-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only reading/writing to ref memories don't need to be turned into an …
…interface memory (#2200)
- Loading branch information
1 parent
efffa92
commit f53de4f
Showing
3 changed files
with
68 additions
and
1 deletion.
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,31 @@ | ||
import "primitives/memories/comb.futil"; | ||
component main(@go go: 1, @clk clk: 1, @reset reset: 1) -> (@done done: 1) { | ||
cells { | ||
@external mem_0 = comb_mem_d1(32, 4, 2); | ||
read_only_instance = read_only(); | ||
} | ||
wires {} | ||
control { | ||
seq { | ||
invoke read_only_instance[ref_mem_0 = mem_0]()(); | ||
} | ||
} | ||
} | ||
component read_only(@go go: 1, @clk clk: 1, @reset reset: 1) -> (@done done: 1) { | ||
cells { | ||
ref ref_mem_0 = comb_mem_d1(32, 4, 2); | ||
} | ||
wires { | ||
group read_data { | ||
ref_mem_0.write_en = 1'd1; | ||
ref_mem_0.write_data = 32'd3; | ||
ref_mem_0.addr0 = 2'd0; | ||
read_data[done] = ref_mem_0.done; | ||
} | ||
} | ||
control { | ||
seq { | ||
read_data; | ||
} | ||
} | ||
} |
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,36 @@ | ||
// -p papercut | ||
|
||
import "primitives/memories/comb.futil"; | ||
|
||
component main(@go go: 1, @clk clk: 1, @reset reset: 1) -> (@done done: 1) { | ||
cells { | ||
@external mem_0 = comb_mem_d1(32, 4, 2); | ||
read_only_instance = read_only(); | ||
} | ||
wires { | ||
} | ||
control { | ||
seq { | ||
invoke read_only_instance[ref_mem_0 = mem_0]()(); | ||
} | ||
} | ||
} | ||
|
||
component read_only(@go go: 1, @clk clk: 1, @reset reset: 1) -> (@done done: 1) { | ||
cells { | ||
ref ref_mem_0 = comb_mem_d1(32, 4, 2); | ||
} | ||
wires { | ||
group read_data { | ||
ref_mem_0.write_en = 1'b1; | ||
ref_mem_0.write_data = 32'd3; | ||
ref_mem_0.addr0 = 2'b0; | ||
read_data[done] = ref_mem_0.done; | ||
} | ||
} | ||
control { | ||
seq { | ||
read_data; | ||
} | ||
} | ||
} |