mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 00:55:32 +00:00
Fix elaboration of whole memory words used as indices
This commit is contained in:
parent
af457ce8d0
commit
750831e3e0
4 changed files with 56 additions and 1 deletions
4
tests/various/memory_word_as_index.data
Normal file
4
tests/various/memory_word_as_index.data
Normal file
|
@ -0,0 +1,4 @@
|
|||
00 04 08 0c
|
||||
10 14 18 1c
|
||||
20 24 28 2c
|
||||
30 34 38 3c
|
21
tests/various/memory_word_as_index.v
Normal file
21
tests/various/memory_word_as_index.v
Normal file
|
@ -0,0 +1,21 @@
|
|||
`define DATA 64'h492e5c4d7747e032
|
||||
|
||||
`define GATE(n, expr) \
|
||||
module gate``n(sel, out); \
|
||||
input wire [3:0] sel; \
|
||||
output wire out; \
|
||||
reg [63:0] bits; \
|
||||
reg [5:0] ptrs[15:0]; \
|
||||
initial bits = `DATA; \
|
||||
initial $readmemh("memory_word_as_index.data", ptrs); \
|
||||
assign out = expr; \
|
||||
endmodule
|
||||
|
||||
`GATE(1, bits[ptrs[sel]])
|
||||
`GATE(2, bits[ptrs[sel][5:0]])
|
||||
`GATE(3, bits[ptrs[sel]+:1])
|
||||
|
||||
module gold(sel, out);
|
||||
input wire [3:0] sel;
|
||||
output wire out = `DATA >> (sel * 4);
|
||||
endmodule
|
23
tests/various/memory_word_as_index.ys
Normal file
23
tests/various/memory_word_as_index.ys
Normal file
|
@ -0,0 +1,23 @@
|
|||
read_verilog memory_word_as_index.v
|
||||
|
||||
hierarchy
|
||||
proc
|
||||
memory
|
||||
flatten
|
||||
opt -full
|
||||
|
||||
equiv_make gold gate1 equiv
|
||||
equiv_simple
|
||||
equiv_status -assert
|
||||
|
||||
delete equiv
|
||||
|
||||
equiv_make gold gate2 equiv
|
||||
equiv_simple
|
||||
equiv_status -assert
|
||||
|
||||
delete equiv
|
||||
|
||||
equiv_make gold gate3 equiv
|
||||
equiv_simple
|
||||
equiv_status -assert
|
Loading…
Add table
Add a link
Reference in a new issue