From 4e24b86bda2db8ff09ce4a19301f6e7fb2ebaf10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rist=C3=A8?= Date: Wed, 12 Sep 2018 11:40:20 -0400 Subject: [PATCH] Fix majoritymask --- QGL/BasicSequences/Feedback.py | 12 ++++++------ QGL/TdmInstructions.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/QGL/BasicSequences/Feedback.py b/QGL/BasicSequences/Feedback.py index b7833556..7cd52ae4 100644 --- a/QGL/BasicSequences/Feedback.py +++ b/QGL/BasicSequences/Feedback.py @@ -124,8 +124,8 @@ def BitFlip3(data_qs, ancilla_qs, theta=None, phi=None, nrounds=1, meas_delay=1e raise Exception("Wrong number of qubits") seqs = [ DecodeSetRounds(1,0,nrounds), - Invalidate(addr=10, mask=2*nrounds), - Invalidate(addr=11, mask=0x1)] + Invalidate(10, 2*nrounds), + Invalidate(11, 1)] # encode single-qubit state into 3 qubits if theta and phi: @@ -153,7 +153,7 @@ def BitFlip3(data_qs, ancilla_qs, theta=None, phi=None, nrounds=1, meas_delay=1e if docals: seqs += create_cal_seqs(qubits, calRepeats) - metafile = compile_to_hardware(seqs, 'BitFlip/BitFlip') + metafile = compile_to_hardware(seqs, 'BitFlip/BitFlip', tdm_seq = True) return metafile def MajorityVoteN(qubits, nrounds, prep=[], meas_delay=1e-6, docals=False, calRepeats=2): @@ -173,8 +173,8 @@ def MajorityVoteN(qubits, nrounds, prep=[], meas_delay=1e-6, docals=False, calRe """ nqubits = len(qubits) seqs = [MajorityMask(nrounds*nqubits), - Invalidate(addr=10, mask=nrounds*nqubits), - Invalidate(addr=11, mask=1)] + Invalidate(10, nrounds*nqubits), + Invalidate(11, 1)] if prep: seqs += [reduce(operator.mul, [X(q) for n,q in enumerate(qubits) if prep[n]])] for n in range(nrounds): @@ -187,5 +187,5 @@ def MajorityVoteN(qubits, nrounds, prep=[], meas_delay=1e-6, docals=False, calRe if docals: seqs += create_cal_seqs(qubits, calRepeats) - metafile = compile_to_hardware(seqs, 'MajorityVote/MajorityVote') + metafile = compile_to_hardware(seqs, 'MajorityVote/MajorityVote', tdm_seq = True) return metafile diff --git a/QGL/TdmInstructions.py b/QGL/TdmInstructions.py index 945743c9..bd6ae9fc 100644 --- a/QGL/TdmInstructions.py +++ b/QGL/TdmInstructions.py @@ -40,8 +40,8 @@ def __ne__(self, other): def MajorityVote(in_addr, out_addr, nmeas): # alternatively, append the loadcmpvram instruction when compiling (see STOREMEAS) return [LoadCmpVramInstruction('LOADCMPVRAM', 1, in_addr, 2**nmeas-1, True), CustomInstruction('MAJORITY', in_addr, out_addr)] -def MajorityMask(in_addr, out_addr, value): - return [WriteAddrInstruction('INVALIDATE', None, 1, in_addr, 0x0, True), WriteAddrInstruction('WRITEADDR', None, 0, in_addr, value, True), LoadCmpVramInstruction('LOADCMPVRAM', 1, in_addr, 0xffff, True), CustomInstruction('MAJORITYMASK', in_addr, out_addr)] +def MajorityMask(value): + return [WriteAddrInstruction('INVALIDATE', None, 1, 0, 0x0, True), WriteAddrInstruction('WRITEADDR', None, 0, 0, value, True), LoadCmpVramInstruction('LOADCMPVRAM', 1, 0, 0xffff, True), CustomInstruction('MAJORITYMASK', 0, 1)] def Decode(in_addr, out_addr, nmeas): return [LoadCmpVramInstruction('LOADCMPVRAM', 1, in_addr, 2**nmeas-1, True), CustomInstruction('TSM', in_addr, out_addr)]