-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dialects: (stim) add qubit attribute and qubit coordinate attribute (#…
…3114) Add a base attribute to the stim dialect - StimAttr which is StimPrintable so that all implementing attributes must implement print_stim. Add two initial attributes - QubitAttr to indicate qubits, and QubitCoordAttr which provides a pair of a coordinate of a physical qubit to a QubitAttr --------- Co-authored-by: Emilien Bauer <papychacal@gmail.com> Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
- Loading branch information
1 parent
d9da45c
commit 34d3d11
Showing
5 changed files
with
173 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// RUN: XDSL_ROUNDTRIP | ||
|
||
"test.op"() { | ||
qubit = !stim.qubit<0>, | ||
qubitcoord = #stim.qubit_coord<(0,0), !stim.qubit<0>> | ||
} : () -> () | ||
|
||
%qubit0 = "test.op"() : () -> (!stim.qubit<0>) | ||
|
||
// CHECK: builtin.module { | ||
// CHECK-NEXT: "test.op"() {"qubit" = !stim.qubit<0>, "qubitcoord" = #stim.qubit_coord<(0, 0), !stim.qubit<0>>} : () -> () | ||
// CHECK-NEXT: %qubit0 = "test.op"() : () -> !stim.qubit<0> | ||
// CHECK-NEXT: } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
from xdsl.ir import Dialect | ||
|
||
from .ops import StimCircuitOp | ||
from .ops import QubitAttr, QubitMappingAttr, StimCircuitOp | ||
|
||
Stim = Dialect( | ||
"stim", | ||
[ | ||
StimCircuitOp, | ||
], | ||
[ | ||
QubitAttr, | ||
QubitMappingAttr, | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters