Skip to content
4 changes: 2 additions & 2 deletions examples/advanced/link_layer/example_link_layer_ck.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def meta(self) -> ProgramMeta:
name="client_program",
csockets=[self.PEER],
epr_sockets=[self.PEER],
max_qubits=1,
max_qubits=2,
)

def run(
Expand Down Expand Up @@ -67,7 +67,7 @@ def meta(self) -> ProgramMeta:
name="server_program",
csockets=[self.PEER],
epr_sockets=[self.PEER],
max_qubits=1,
max_qubits=2,
)

def run(
Expand Down
4 changes: 2 additions & 2 deletions examples/advanced/link_layer/example_link_layer_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def meta(self) -> ProgramMeta:
name="client_program",
csockets=[self.PEER],
epr_sockets=[self.PEER],
max_qubits=1,
max_qubits=2,
)

def run(
Expand Down Expand Up @@ -54,7 +54,7 @@ def meta(self) -> ProgramMeta:
name="server_program",
csockets=[self.PEER],
epr_sockets=[self.PEER],
max_qubits=1,
max_qubits=2,
)

def run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def meta(self) -> ProgramMeta:
name="client_program",
csockets=[self.PEER],
epr_sockets=[self.PEER],
max_qubits=1,
max_qubits=2,
)

def run(
Expand Down Expand Up @@ -147,7 +147,7 @@ def meta(self) -> ProgramMeta:
name="server_program",
csockets=[self.PEER],
epr_sockets=[self.PEER],
max_qubits=1,
max_qubits=2,
)

def run(
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/single_node/example_single_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def meta(self) -> ProgramMeta:
name="client_program",
csockets=[],
epr_sockets=[],
max_qubits=1,
max_qubits=2,
)

def run(
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorial/1_Basics/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def meta(self) -> ProgramMeta:
name="tutorial_program",
csockets=[self.PEER_NAME],
epr_sockets=[self.PEER_NAME],
max_qubits=1,
max_qubits=2,
)

def run(self, context: ProgramContext):
Expand Down Expand Up @@ -65,7 +65,7 @@ def meta(self) -> ProgramMeta:
name="tutorial_program",
csockets=[self.PEER_NAME],
epr_sockets=[self.PEER_NAME],
max_qubits=1,
max_qubits=2,
)

def run(self, context: ProgramContext):
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorial/2.1_NetQASM-language/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def meta(self) -> ProgramMeta:
name="tutorial_program",
csockets=[self.PEER_NAME],
epr_sockets=[self.PEER_NAME],
max_qubits=1,
max_qubits=2,
)

def run(self, context: ProgramContext):
Expand Down Expand Up @@ -43,7 +43,7 @@ def meta(self) -> ProgramMeta:
name="tutorial_program",
csockets=[self.PEER_NAME],
epr_sockets=[self.PEER_NAME],
max_qubits=1,
max_qubits=2,
)

def run(self, context: ProgramContext):
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorial/2.2_Future-objects/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def meta(self) -> ProgramMeta:
name="tutorial_program",
csockets=[self.PEER_NAME],
epr_sockets=[self.PEER_NAME],
max_qubits=1,
max_qubits=2,
)

def run(self, context: ProgramContext):
Expand Down Expand Up @@ -55,7 +55,7 @@ def meta(self) -> ProgramMeta:
name="tutorial_program",
csockets=[self.PEER_NAME],
epr_sockets=[self.PEER_NAME],
max_qubits=1,
max_qubits=2,
)

def run(self, context: ProgramContext):
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorial/4.3_multi-node/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def meta(self) -> ProgramMeta:
name="tutorial_program",
csockets=[self.PEER],
epr_sockets=[self.PEER],
max_qubits=1,
max_qubits=2,
)

def run(self, context: ProgramContext):
Expand Down Expand Up @@ -96,7 +96,7 @@ def meta(self) -> ProgramMeta:
name="tutorial_program",
csockets=[self.PEER],
epr_sockets=[self.PEER],
max_qubits=1,
max_qubits=2,
)

def run(self, context: ProgramContext):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ install_requires =
netsquid >=1.1.8, <2.0
netsquid-magic >= 16.0.0, <17.0.0
bitarray >=2.8.0, <3.0.0
netqasm >=1.0.0, <=2.0.0
netqasm >=2.2.1
pytest >=7.1, <8.0

[options.extras_require]
Expand Down
2 changes: 2 additions & 0 deletions squidasm/nqasm/executor/nv.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
INSTR_ROT_X,
INSTR_ROT_Y,
INSTR_ROT_Z,
INSTR_SWAP,
)
from netsquid.nodes.node import Node as NetSquidNode

Expand All @@ -27,6 +28,7 @@
nv.RotZInstruction: INSTR_ROT_Z,
nv.ControlledRotXInstruction: INSTR_CXDIR,
nv.ControlledRotYInstruction: INSTR_CYDIR,
nv.MovInstruction: INSTR_SWAP,
}


Expand Down
1 change: 1 addition & 0 deletions squidasm/sim/network/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ def __init__(
PhysicalInstruction(ns_instructions.INSTR_ROT_Z, duration=2),
PhysicalInstruction(ns_instructions.INSTR_CXDIR, duration=5),
PhysicalInstruction(ns_instructions.INSTR_CYDIR, duration=5),
PhysicalInstruction(ns_instructions.INSTR_SWAP, duration=5),
]

super().__init__(
Expand Down
17 changes: 13 additions & 4 deletions squidasm/sim/stack/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def execute_subroutine(
self, subroutine: Subroutine
) -> Generator[EventExpression, None, None]:
"""Execute a NetQASM subroutine on this processor."""
self._logger.info(f"Executing subroutine {subroutine}")
app_id = subroutine.app_id
assert app_id in self.app_memories
app_mem = self.app_memories[app_id]
Expand Down Expand Up @@ -230,6 +231,10 @@ def _interpret_instruction(
pass
elif isinstance(instr, core.SingleQubitInstruction):
return self._interpret_single_qubit_instr(app_id, instr)
elif isinstance(instr, vanilla.MovInstruction) or isinstance(
instr, nv.MovInstruction
):
return self._interpret_mov(app_id, instr)
elif isinstance(instr, core.TwoQubitInstruction):
return self._interpret_two_qubit_instr(app_id, instr)
elif isinstance(instr, core.RotationInstruction):
Expand Down Expand Up @@ -288,6 +293,12 @@ def _interpret_set(self, app_id: int, instr: core.SetInstruction) -> None:
self._logger.debug(f"Set register {instr.reg} to {instr.imm}")
self.app_memories[app_id].set_reg_value(instr.reg, instr.imm.value)

def _interpret_mov(self, app_id: int, instr: vanilla.MovInstruction) -> None:
self._logger.debug(f"Moving value from {instr.reg1} to {instr.reg0}")
app_mem = self.app_memories[app_id]
val = app_mem.get_reg_value(instr.reg1)
app_mem.set_reg_value(instr.reg0, val)

def _interpret_qalloc(self, app_id: int, instr: core.QAllocInstruction) -> None:
app_mem = self.app_memories[app_id]

Expand Down Expand Up @@ -543,8 +554,7 @@ def _interpret_create_epr(
result_array_addr,
)
self._send_netstack_msg(msg)
# result = yield from self._receive_netstack_msg()
# self._logger.debug(f"result from netstack: {result}")
yield from self._receive_netstack_msg()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this commented out before?


def _interpret_recv_epr(self, app_id: int, instr: core.RecvEPRInstruction) -> None:
app_mem = self.app_memories[app_id]
Expand Down Expand Up @@ -572,8 +582,7 @@ def _interpret_recv_epr(self, app_id: int, instr: core.RecvEPRInstruction) -> No
result_array_addr,
)
self._send_netstack_msg(msg)
# result = yield from self._receive_netstack_msg()
# self._logger.debug(f"result from netstack: {result}")
yield from self._receive_netstack_msg()

def _interpret_wait_all(
self, app_id: int, instr: core.WaitAllInstruction
Expand Down
4 changes: 2 additions & 2 deletions tests/system_tests/test_classical_communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def meta(self) -> ProgramMeta:
name="test_program",
csockets=list(self.per_peer_messages.keys()),
epr_sockets=[],
max_qubits=1,
max_qubits=2,
)

def run(self, context: ProgramContext):
Expand Down Expand Up @@ -65,7 +65,7 @@ def meta(self) -> ProgramMeta:
name="test_program",
csockets=list(self.per_peer_expect_num_messages.keys()),
epr_sockets=[],
max_qubits=1,
max_qubits=2,
)

def run(self, context: ProgramContext):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_qnodeos.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test():
bytes(
InitNewAppMessage(
app_id=app_id,
max_qubits=1,
max_qubits=2,
)
),
)
Expand Down
Loading