Пример #1
0
    def test_all(self):
        file_name = 'Test_CC_test_all.scpi.txt'
        test_path = Path('test_output') / file_name
        os.makedirs('test_output', exist_ok=True)

        transport = FileTransport(str(test_path))
        cc = CC('cc', transport, ccio_slots_driving_vsm=[5])

        cc.reset()
        cc.clear_status()
        cc.set_status_questionable_frequency_enable(0x7FFF)

        cc.dio0_out_delay(0)
        cc.dio0_out_delay(31)
        cc.dio8_out_delay(0)
        cc.dio8_out_delay(31)

        cc.vsm_channel_delay0(0)
        cc.vsm_channel_delay0(1)
        cc.vsm_channel_delay0(127)
        cc.vsm_channel_delay31(0)
        cc.vsm_channel_delay31(127)

        cc.vsm_rise_delay0(0)
        cc.vsm_rise_delay0(48)
        cc.vsm_rise_delay31(0)
        cc.vsm_rise_delay31(48)
        cc.vsm_fall_delay0(0)
        cc.vsm_fall_delay0(48)
        cc.vsm_fall_delay31(0)
        cc.vsm_fall_delay31(48)

        cc.debug_marker_in(0, cc.UHFQA_TRIG)
        cc.debug_marker_in(0, cc.UHFQA_CW[0])

        cc.debug_marker_out(0, cc.UHFQA_TRIG)
        cc.debug_marker_out(8, cc.HDAWG_TRIG)

        prog = '    stop\n'
        cc.sequence_program_assemble(prog)

        tmp_file = tempfile.NamedTemporaryFile(mode='w', delete=False)
        tmp_file.write(prog)
        tmp_file.close()  # to allow access to file
        # FIXME: disabled because it requires input data, which we do not support yet
        #cc.eqasm_program(tmp_file.name)
        os.unlink(tmp_file.name)

        cc.start()
        cc.stop()

        transport.close()  # to allow access to file

        # check results
        test_output = test_path.read_text()
        golden_path = Path(
            pq.__path__[0]
        ) / 'tests/instrument_drivers/physical_instruments/QuTech/golden' / file_name
        golden = golden_path.read_text()
        self.assertEqual(test_output, golden)
Пример #2
0
                f'DIO calibration condition = 0x{cc.debug_get_ccio_reg(cc_slot_uhfqa0, SYS_ST_QUES_DIOCAL_COND):x} (0=OK)'
            )
            log.info(f'DIO read index = {dio_rd_index}')
            log.info(
                f'DIO margin = {cc.debug_get_ccio_reg(cc_slot_uhfqa0, SYS_ST_OPER_DIO_MARGIN)}'
            )
            if dio_rd_index < 0:
                cc.debug_marker_in(
                    cc_slot_uhfqa0,
                    cc.UHFQA_DV)  # watch DV to check upstream period/frequency
                raise RuntimeError(
                    "DIO calibration failed. FIXME: try setting UHF clock to internal"
                )

            if 1:  # disable to allow scope measurements
                cc.stop()
                uhfqa0.stop()
                cc.get_operation_complete(
                )  # ensure all commands have finished

if 1:  # test of Distributed Shared Memory
    if 1:
        log.debug('run UHFQA codeword generator')

        # build a programs that outputs the sequence once, each entry triggered by CC
        #cw_list = [3, 2, 1, 0]
        cw_list = [7, 6, 5, 4]
        cw_array = np.array(cw_list, dtype=int).flatten()
        uhfqa0.awg_sequence_test_pattern(dio_out_vect=cw_array * 2 +
                                         1)  # shift codeword, add Data Valid
Пример #3
0
cc = CC('cc', IPTransport(ip))
cc.reset()
cc.clear_status()
cc.status_preset()

for i in range(num_iter):
    if 1:
#        prog =  'loop:    seq_out         0x00000000,10\n'
        prog =  'loop:    seq_out         0x00000000,2\n'
        # 1: no ILLEGAL_INSTR_RT
        # 2: ~50%
        # 10: mostly
        prog += '         jmp            @loop\n'
    else:
        length = randint(100,10000)
        print(f'generating program of length {length}')
        prog = ''
        for line in range(length):
            prog += '    seq_out         0x00000000,301\n'
        prog += 'stop\n'

    cc.sequence_program_assemble(prog)

    for run in range(num_run_per_iter):
        print(f'starting CC iter={i}, run={run}')
        cc.start()
        cc.stop()
        err_cnt = cc.get_system_error_count()
        for j in range(err_cnt):
            print(cc.get_error())