qat.experimental.conversion.pulse_to_q1.phase module

Phase rewrite strategies for the Pulse-to-Q1 conversion.

PhaseLegalisation canonicalises constant pulse.phase operands into the [0, 2π) range.

PhaseLowering consumes canonical constants and converts radians to degrees, then to NCO phase steps.

Dynamic phase operands are unsupported: Q1 phase instructions only accept an immediate operand, so there is no numeric radians-to-steps runtime conversion for a dynamic value. Q1PulseValidationPass rejects a dynamic pulse.phase_set or pulse.phase_shift operand upstream of both stages.

class PhaseLegalisation

Bases: object

Callable strategy that canonicalises a pulse.phase_set or pulse.phase_shift operand to the [0, 2π) radian range and replaces the op with an equivalent Pulse op carrying the normalised constant.

The stage stays within the Pulse dialect. Constant operand finiteness is enforced upstream by Q1PulseValidationPass, which also rejects a dynamic phase operand before this stage runs.

class PhaseLowering

Bases: object

Callable strategy for the lowering stage.

Lowering is distinct from legalisation. Canonical Pulse constants map to immediate Q1 phase instructions.

Conversion from radians is lossy. Values are quantised into sequencer NCO phase-step space prior to emission.