Skip to content

Commit

Permalink
fast feedback test
Browse files Browse the repository at this point in the history
  • Loading branch information
imranashraf committed Sep 25, 2017
1 parent ba71c46 commit 588d107
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
13 changes: 13 additions & 0 deletions tests/hardware_config_cc_light.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,19 @@
"cc_light_codeword": 26,
"cc_light_opcode": 2
},
"cprepz q1": {
"duration": 40,
"latency": 0,
"qubits": ["q1"],
"matrix": [ [0.0,1.0], [1.0,0.0], [1.0,0.0], [0.0,0.0] ],
"disable_optimization": false,
"type": "mw",
"cc_light_instr_type": "single_qubit_gate",
"cc_light_instr": "cprepz",
"cc_light_codeword": 27,
"cc_light_opcode": 2,
"cc_light_cond" : 1
},
"measx q0": {
"duration": 40,
"latency": 0,
Expand Down
31 changes: 30 additions & 1 deletion tests/test_cc_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_smis_with_custom_gates(self):

# populate the second kernel using both custom and default gates
k = ql.Kernel('aKernel', platform)
k.gate('prepz', 0) # this line is equivalent to the previous
k.gate('prepz', 0)
k.gate('x', 0)
k.y(1)
k.z(5)
Expand Down Expand Up @@ -403,6 +403,35 @@ def test_edge_illegal(self):
except:
pass

# fast feedback test
# @unittest.expectedFailure
# @unittest.skip
def test_fast_feedback(self):
# You can specify a config location, here we use a default config
config_fn = os.path.join(curdir, 'hardware_config_cc_light.json')
platform = ql.Platform('seven_qubits_chip', config_fn)
sweep_points = [1, 2]
num_circuits = 1
num_qubits = platform.get_qubit_number()
p = ql.Program('aProgram', num_qubits, platform)
p.set_sweep_points(sweep_points, num_circuits)

# populate kernel using default gates
k = ql.Kernel('aKernel', platform)
k.prepz(0)
k.gate('cprepz', 1)
k.measure(0)
k.measure(1)

# add the kernel to the program
p.add_kernel(k)

# compile the program
p.compile(optimize=False, verbose=True)

QISA_fn = os.path.join(output_dir, p.name+'.qisa')
assemble(QISA_fn)


if __name__ == '__main__':
unittest.main()

0 comments on commit 588d107

Please sign in to comment.