diff --git a/pytket/phir/api.py b/pytket/phir/api.py new file mode 100644 index 0000000..65b513b --- /dev/null +++ b/pytket/phir/api.py @@ -0,0 +1,22 @@ +from pytket.circuit import Circuit + +from .sharding.sharder import Sharder + + +def pytket_to_phir( + circuit: Circuit, +) -> str: + """Converts a pytket circuit into its PHIR representation + + :param circuit: Circuit object to be converted + """ + + # TODO: Process circuit according to desired machine architecture + + sharder = Sharder(circuit) + shards = sharder.shard() # noqa: F841 + + # TODO: Pass shards[] into placement, routing, etc + # TODO: Convert to PHIR JSON spec and return + + return "{ phir json, someday }" diff --git a/pytket/phir/main.py b/pytket/phir/main.py deleted file mode 100644 index a8d37c1..0000000 --- a/pytket/phir/main.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -NOTE: Just a placeholder to allow convenient testing of the flows -""" - -from pytket.circuit import Circuit -from pytket.qasm.qasm import circuit_from_qasm - -from .sharding.sharder import Sharder - -# Load a qasm circuit and parse -# ,=""=, -# c , _,{ -# /\ @ ) __ -# / ^~~^\ <=.,__/ '}= -# (_/ ,, ,,) \_ _>_/~ -# ~\_(/-\)'-,_,_,_,-'(_)-(_) -circuit: Circuit = circuit_from_qasm("tests/data/qasm/baby.qasm") - -# https://cqcl.github.io/tket/pytket/api/circuit_class.html - -# Just a little debugging fun -print("Input circuit:") -print(circuit) -print() - -sharding_output = Sharder(circuit).shard() - -print("Sharding output:") -print(sharding_output)