def get_expected_headers_simple_h(): """What headers we expect""" hdr_tp_cmd = get_header( CQCHeader, version=2, tp=CQCType.COMMAND, app_id=0, length=CQCCmdHeader.HDR_LENGTH, ) hdr_cmd_new = get_header( CQCCmdHeader, qubit_id=0, instr=CQC_CMD_NEW, notify=True, action=False, block=True, ) hdr_cmd_h = get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_H, notify=True, action=False, block=True, ) hdr_cmd_release = get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_RELEASE, notify=True, action=False, block=True, ) expected_headers = [ hdr_tp_cmd, hdr_cmd_new, hdr_tp_cmd, hdr_cmd_h, hdr_tp_cmd + hdr_cmd_release, ] return expected_headers
def get_expected_headers_simple_mix(): return [ get_header(CQCHeader, version=2, tp=CQCType.COMMAND, app_id=0, length=CQCCmdHeader.HDR_LENGTH) + get_header(CQCCmdHeader, qubit_id=0, instr=CQC_CMD_NEW, notify=True, action=False, block=True), # BARRIER get_header(CQCHeader, version=2, tp=CQCType.MIX, app_id=0, length=18) + get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=4) + get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_X, notify=True, action=False, block=True, ) + get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=4) + get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_H, notify=True, action=False, block=True, ), # BARRIER get_header(CQCHeader, version=2, tp=CQCType.COMMAND, app_id=0, length=CQCCmdHeader.HDR_LENGTH) + get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_RELEASE, notify=True, action=False, block=True, ) ]
def get_expected_headers_flush(): """What headers we expect.""" hdr_tp_cmd = get_header( CQCHeader, version=2, tp=CQC_TP_COMMAND, app_id=0, length=CQC_CMD_HDR_LENGTH, ) hdr_cmd_new = get_header( CQCCmdHeader, qubit_id=0, instr=CQC_CMD_NEW, notify=True, action=False, block=True, ) hdr_tp_cmd_2 = get_header( CQCHeader, version=2, tp=CQC_TP_COMMAND, app_id=0, length=2 * CQC_CMD_HDR_LENGTH, ) hdr_cmd_h = get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_H, notify=True, action=False, block=True, ) hdr_cmd_x = get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_X, notify=True, action=False, block=True, ) hdr_cmd_release = get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_RELEASE, notify=True, action=False, block=True, ) expected_headers = [ hdr_tp_cmd, hdr_cmd_new, hdr_tp_cmd_2, hdr_cmd_h, hdr_cmd_x, hdr_tp_cmd + hdr_cmd_release ] return expected_headers
def get_expected_headers_mix_nested_if_else(): cqc_header_tp_cmd = get_header(CQCHeader, version=2, tp=CQCType.COMMAND, app_id=0, length=CQCCmdHeader.HDR_LENGTH) hdr_cmd_new = get_header(CQCCmdHeader, qubit_id=0, instr=CQC_CMD_NEW, notify=True, action=False, block=True) return [ cqc_header_tp_cmd + hdr_cmd_new, # BARRIER cqc_header_tp_cmd + hdr_cmd_new, # BARRIER cqc_header_tp_cmd + hdr_cmd_new, # BARRIER get_header(CQCHeader, version=2, tp=CQCType.MIX, app_id=0, length=119) + get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=4) + get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_H, notify=True, action=False, block=True, ) + get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=8) + get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_MEASURE_INPLACE, notify=False, action=False, block=True, ) + get_header(CQCAssignHeader, ref_id=0) + get_header(CQCTypeHeader, tp=CQCType.IF, length=14) + get_header(CQCIfHeader, first_operand=0, operator=CQCLogicalOperator.EQ, type_of_second_operand=CQCIfHeader.TYPE_VALUE, second_operand=1, length=50) + get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=4) + get_header( CQCCmdHeader, qubit_id=2, instr=CQC_CMD_H, notify=True, action=False, block=True, ) + get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=8) + get_header(CQCCmdHeader, qubit_id=2, instr=CQC_CMD_MEASURE_INPLACE, notify=False, action=False, block=True) + get_header(CQCAssignHeader, ref_id=1) + get_header(CQCTypeHeader, tp=CQCType.IF, length=14) + get_header(CQCIfHeader, first_operand=1, operator=CQCLogicalOperator.EQ, type_of_second_operand=CQCIfHeader.TYPE_VALUE, second_operand=0, length=9) + get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=4) + get_header( CQCCmdHeader, qubit_id=3, instr=CQC_CMD_X, notify=True, action=False, block=True, ) + get_header(CQCTypeHeader, tp=CQCType.IF, length=14) + get_header(CQCIfHeader, first_operand=0, operator=CQCLogicalOperator.NEQ, type_of_second_operand=CQCIfHeader.TYPE_VALUE, second_operand=1, length=9) + get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=4) + get_header( CQCCmdHeader, qubit_id=2, instr=CQC_CMD_X, notify=True, action=False, block=True, ), # BARRIER get_header(CQCHeader, version=2, tp=CQCType.COMMAND, app_id=0, length=CQCCmdHeader.HDR_LENGTH) + get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_RELEASE, notify=True, action=False, block=True, ), # BARRIER get_header(CQCHeader, version=2, tp=CQCType.COMMAND, app_id=0, length=CQCCmdHeader.HDR_LENGTH) + get_header( CQCCmdHeader, qubit_id=2, instr=CQC_CMD_RELEASE, notify=True, action=False, block=True, ), # BARRIER get_header(CQCHeader, version=2, tp=CQCType.COMMAND, app_id=0, length=CQCCmdHeader.HDR_LENGTH) + get_header( CQCCmdHeader, qubit_id=3, instr=CQC_CMD_RELEASE, notify=True, action=False, block=True, ) ]
def get_expected_headers_mix_with_factory(): return [ get_header(CQCHeader, version=2, tp=CQCType.COMMAND, app_id=0, length=CQCCmdHeader.HDR_LENGTH) + get_header(CQCCmdHeader, qubit_id=0, instr=CQC_CMD_NEW, notify=True, action=False, block=True), # BARRIER get_header(CQCHeader, version=2, tp=CQCType.MIX, app_id=0, length=29) + get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=4) + get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_X, notify=True, action=False, block=True, ) + get_header(CQCTypeHeader, tp=CQCType.FACTORY, length=6) + get_header(CQCFactoryHeader, num_iter=3) + get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_H, notify=True, action=False, block=True, ) + get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=4) + get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_Y, notify=True, action=False, block=True, ), # BARRIER get_header(CQCHeader, version=2, tp=CQCType.COMMAND, app_id=0, length=CQCCmdHeader.HDR_LENGTH) + get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_RELEASE, notify=True, action=False, block=True, ) ]
def get_expected_headers_bit_flip_code(): cqc_header_tp_cmd = get_header(CQCHeader, version=2, tp=CQCType.COMMAND, app_id=0, length=CQCCmdHeader.HDR_LENGTH) hdr_cmd_new = get_header(CQCCmdHeader, qubit_id=0, instr=CQC_CMD_NEW, notify=True, action=False, block=True) return [ cqc_header_tp_cmd, hdr_cmd_new, cqc_header_tp_cmd, hdr_cmd_new, cqc_header_tp_cmd, hdr_cmd_new, get_header(CQCHeader, version=2, tp=CQCType.MIX, app_id=0, length=95), get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=6), get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_CNOT, notify=True, action=False, block=True, ), get_header(CQCXtraQubitHeader, qubit_id=2), get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=8), get_header( CQCCmdHeader, qubit_id=2, instr=CQC_CMD_MEASURE_INPLACE, notify=False, action=False, block=True, ), get_header(CQCAssignHeader, ref_id=0), get_header(CQCTypeHeader, tp=CQCType.IF, length=14), get_header(CQCIfHeader, first_operand=0, operator=CQCLogicalOperator.EQ, type_of_second_operand=CQCIfHeader.TYPE_VALUE, second_operand=1, length=52), get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=6), get_header(CQCCmdHeader, qubit_id=1, instr=CQC_CMD_CNOT, notify=True, action=False, block=True), get_header(CQCXtraQubitHeader, qubit_id=3), get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=8), get_header(CQCCmdHeader, qubit_id=3, instr=CQC_CMD_MEASURE_INPLACE, notify=False, action=False, block=True), get_header(CQCAssignHeader, ref_id=1), get_header(CQCTypeHeader, tp=CQCType.IF, length=14), get_header(CQCIfHeader, first_operand=1, operator=CQCLogicalOperator.EQ, type_of_second_operand=CQCIfHeader.TYPE_VALUE, second_operand=1, length=9), get_header(CQCTypeHeader, tp=CQCType.COMMAND, length=4), get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_X, notify=True, action=False, block=True, ), get_header(CQCHeader, version=2, tp=CQCType.COMMAND, app_id=0, length=CQCCmdHeader.HDR_LENGTH * 3) + get_header( CQCCmdHeader, qubit_id=1, instr=CQC_CMD_RELEASE, notify=True, action=False, block=True, ) + get_header( CQCCmdHeader, qubit_id=2, instr=CQC_CMD_RELEASE, notify=True, action=False, block=True, ) + get_header( CQCCmdHeader, qubit_id=3, instr=CQC_CMD_RELEASE, notify=True, action=False, block=True, ) ]