Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
254 additions
and
5 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
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
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,9 @@ | ||
import magma as m | ||
|
||
|
||
def BitOrBits(width): | ||
if width is None: | ||
return m.Bit | ||
if not isinstance(width, int): | ||
raise ValueError(f"Expected width to be None or int, got {width}") | ||
return m.Bits(width) |
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,7 @@ | ||
import magma as m | ||
|
||
|
||
def DeclareAnd(width): | ||
T = m.util.BitOrBits(width) | ||
return m.DeclareCircuit(f'And{width}', "I0", m.In(T), "I1", m.In(T), | ||
"O", m.Out(T)) |
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,32 @@ | ||
{"top":"global.test_assign_operator2_3_coreir", | ||
"namespaces":{ | ||
"global":{ | ||
"modules":{ | ||
"And3":{ | ||
"type":["Record",[ | ||
["I0",["Array",3,"BitIn"]], | ||
["I1",["Array",3,"BitIn"]], | ||
["O",["Array",3,"Bit"]] | ||
]] | ||
}, | ||
"test_assign_operator2_3_coreir":{ | ||
"type":["Record",[ | ||
["a",["Array",3,"BitIn"]], | ||
["b",["Array",3,"BitIn"]], | ||
["c",["Array",3,"Bit"]] | ||
]], | ||
"instances":{ | ||
"inst0":{ | ||
"modref":"global.And3" | ||
} | ||
}, | ||
"connections":[ | ||
["inst0.O","inst0.I0"], | ||
["self.a","inst0.I1"], | ||
["self.c","self.b"] | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
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,6 @@ | ||
module test_assign_operator2_3_verilog (input [2:0] a, input [2:0] b, output [2:0] c); | ||
wire [2:0] inst0_O; | ||
And3 inst0 (.I0(inst0_O), .I1(a), .O(inst0_O)); | ||
assign c = b; | ||
endmodule | ||
|
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,32 @@ | ||
{"top":"global.test_assign_operator2_None_coreir", | ||
"namespaces":{ | ||
"global":{ | ||
"modules":{ | ||
"AndNone":{ | ||
"type":["Record",[ | ||
["I0","BitIn"], | ||
["I1","BitIn"], | ||
["O","Bit"] | ||
]] | ||
}, | ||
"test_assign_operator2_None_coreir":{ | ||
"type":["Record",[ | ||
["a","BitIn"], | ||
["b","BitIn"], | ||
["c","Bit"] | ||
]], | ||
"instances":{ | ||
"inst0":{ | ||
"modref":"global.AndNone" | ||
} | ||
}, | ||
"connections":[ | ||
["inst0.O","inst0.I0"], | ||
["self.a","inst0.I1"], | ||
["self.c","self.b"] | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
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,6 @@ | ||
module test_assign_operator2_None_verilog (input a, input b, output c); | ||
wire inst0_O; | ||
AndNone inst0 (.I0(inst0_O), .I1(a), .O(inst0_O)); | ||
assign c = b; | ||
endmodule | ||
|
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,32 @@ | ||
{"top":"global.test_assign_operator_3_coreir", | ||
"namespaces":{ | ||
"global":{ | ||
"modules":{ | ||
"And3":{ | ||
"type":["Record",[ | ||
["I0",["Array",3,"BitIn"]], | ||
["I1",["Array",3,"BitIn"]], | ||
["O",["Array",3,"Bit"]] | ||
]] | ||
}, | ||
"test_assign_operator_3_coreir":{ | ||
"type":["Record",[ | ||
["a",["Array",3,"BitIn"]], | ||
["b",["Array",3,"BitIn"]], | ||
["c",["Array",3,"Bit"]] | ||
]], | ||
"instances":{ | ||
"inst0":{ | ||
"modref":"global.And3" | ||
} | ||
}, | ||
"connections":[ | ||
["self.a","inst0.I0"], | ||
["self.b","inst0.I1"], | ||
["self.c","inst0.O"] | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
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,6 @@ | ||
module test_assign_operator_3_verilog (input [2:0] a, input [2:0] b, output [2:0] c); | ||
wire [2:0] inst0_O; | ||
And3 inst0 (.I0(a), .I1(b), .O(inst0_O)); | ||
assign c = inst0_O; | ||
endmodule | ||
|
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,32 @@ | ||
{"top":"global.test_assign_operator_None_coreir", | ||
"namespaces":{ | ||
"global":{ | ||
"modules":{ | ||
"AndNone":{ | ||
"type":["Record",[ | ||
["I0","BitIn"], | ||
["I1","BitIn"], | ||
["O","Bit"] | ||
]] | ||
}, | ||
"test_assign_operator_None_coreir":{ | ||
"type":["Record",[ | ||
["a","BitIn"], | ||
["b","BitIn"], | ||
["c","Bit"] | ||
]], | ||
"instances":{ | ||
"inst0":{ | ||
"modref":"global.AndNone" | ||
} | ||
}, | ||
"connections":[ | ||
["self.a","inst0.I0"], | ||
["self.b","inst0.I1"], | ||
["self.c","inst0.O"] | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
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,6 @@ | ||
module test_assign_operator_None_verilog (input a, input b, output c); | ||
wire inst0_O; | ||
AndNone inst0 (.I0(a), .I1(b), .O(inst0_O)); | ||
assign c = inst0_O; | ||
endmodule | ||
|
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