Skip to content

From squin

squin_to_stim

squin_to_stim(
    mt: Method, insert_ticks: bool = False
) -> ir.Method

Lower a squin kernel to the STIM dialect.

Parameters:

Name Type Description Default
mt Method

The squin kernel to lower.

required
insert_ticks bool

If True, insert a TICK after every gate, reset, measurement, and noise operation so the emitted circuit preserves the authored execution-order layering when rendered as a diagram. Timing-only, so record/detector indexing is unaffected.

False

Returns:

Type Description
Method

A new method lowered to the STIM main dialect group.

Source code in .venv/lib/python3.14/site-packages/bloqade/stim/upstream/from_squin.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
def squin_to_stim(mt: ir.Method, insert_ticks: bool = False) -> ir.Method:
    """Lower a squin kernel to the STIM dialect.

    Args:
        mt: The squin kernel to lower.
        insert_ticks: If True, insert a ``TICK`` after every gate, reset,
            measurement, and noise operation so the emitted circuit preserves
            the authored execution-order layering when rendered as a diagram.
            Timing-only, so record/detector indexing is unaffected.

    Returns:
        A new method lowered to the STIM main dialect group.
    """
    new_mt = mt.similar()
    SquinToStimPass(mt.dialects, no_raise=False, insert_ticks=insert_ticks)(new_mt)
    return new_mt.similar(dialects=main)