aboutsummaryrefslogtreecommitdiffstats
path: root/tests/memlib/memlib_multilut.v
diff options
context:
space:
mode:
authorKrystalDelusion <krystinedawn@yosyshq.com>2022-07-07 11:10:33 +1200
committerKrystalDelusion <krystinedawn@yosyshq.com>2023-02-21 05:23:15 +1300
commit7f033d3c1f4604d303da237fbc7a38ee503416ad (patch)
treeab936013736da16465f74fe771dd08f5fbf261d6 /tests/memlib/memlib_multilut.v
parentaf1b9c9e070dd5873871c73c5762fbefd345a8c9 (diff)
downloadyosys-7f033d3c1f4604d303da237fbc7a38ee503416ad.tar.gz
yosys-7f033d3c1f4604d303da237fbc7a38ee503416ad.tar.bz2
yosys-7f033d3c1f4604d303da237fbc7a38ee503416ad.zip
More tests in memlib/generate.py
Covers most of the todo list, at least functionally. Some minor issues with not always using hardware features.
Diffstat (limited to 'tests/memlib/memlib_multilut.v')
-rw-r--r--tests/memlib/memlib_multilut.v45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/memlib/memlib_multilut.v b/tests/memlib/memlib_multilut.v
new file mode 100644
index 000000000..a623d41fd
--- /dev/null
+++ b/tests/memlib/memlib_multilut.v
@@ -0,0 +1,45 @@
+module LUT_MULTI(
+ input [3:0] PORT_R0_ADDR,
+ input [3:0] PORT_R1_ADDR,
+ input [3:0] PORT_R2_ADDR,
+ input [3:0] PORT_R3_ADDR,
+ input [3:0] PORT_R4_ADDR,
+ input [3:0] PORT_R5_ADDR,
+ input [3:0] PORT_R6_ADDR,
+ input [3:0] PORT_RW_ADDR,
+ input PORT_RW_CLK,
+ input PORT_RW_WR_EN,
+ input [1:0] PORT_RW_WR_DATA,
+ output [1:0] PORT_R0_RD_DATA,
+ output [1:0] PORT_R1_RD_DATA,
+ output [1:0] PORT_R2_RD_DATA,
+ output [1:0] PORT_R3_RD_DATA,
+ output [1:0] PORT_R4_RD_DATA,
+ output [1:0] PORT_R5_RD_DATA,
+ output [1:0] PORT_R6_RD_DATA,
+ output [1:0] PORT_RW_RD_DATA
+);
+
+parameter INIT = 0;
+parameter OPTION_PORTS = "UNDEFINED";
+
+reg [1:0] mem [0:15];
+integer i;
+initial
+ for (i = 0; i < 16; i += 1)
+ mem[i] = INIT[i*4+:4];
+
+assign PORT_R0_RD_DATA = mem[PORT_R0_ADDR];
+assign PORT_R1_RD_DATA = mem[PORT_R1_ADDR];
+assign PORT_R2_RD_DATA = mem[PORT_R2_ADDR];
+assign PORT_R3_RD_DATA = mem[PORT_R3_ADDR];
+assign PORT_R4_RD_DATA = mem[PORT_R4_ADDR];
+assign PORT_R5_RD_DATA = mem[PORT_R5_ADDR];
+assign PORT_R6_RD_DATA = mem[PORT_R6_ADDR];
+assign PORT_RW_RD_DATA = mem[PORT_RW_ADDR];
+
+always @(posedge PORT_RW_CLK)
+ if (PORT_RW_WR_EN)
+ mem[PORT_RW_ADDR] <= PORT_RW_WR_DATA;
+
+endmodule