aboutsummaryrefslogtreecommitdiffstats
path: root/tests/simple/memory.v
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-02-03 13:01:45 +0100
committerClifford Wolf <clifford@clifford.at>2014-02-03 13:01:45 +0100
commita6750b375301f2c2ebb51a2496cdf2c820b2546b (patch)
treee3a91710abab3a7a89858426b0d17601946d8fec /tests/simple/memory.v
parentde9226a64f96a3731008218727d6b3897c58f593 (diff)
downloadyosys-a6750b375301f2c2ebb51a2496cdf2c820b2546b.tar.gz
yosys-a6750b375301f2c2ebb51a2496cdf2c820b2546b.tar.bz2
yosys-a6750b375301f2c2ebb51a2496cdf2c820b2546b.zip
Added TRANSPARENT parameter to $memrd (and RD_TRANSPARENT to $mem)
Diffstat (limited to 'tests/simple/memory.v')
-rw-r--r--tests/simple/memory.v39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/simple/memory.v b/tests/simple/memory.v
index eaeee01dd..927ee0438 100644
--- a/tests/simple/memory.v
+++ b/tests/simple/memory.v
@@ -75,3 +75,42 @@ assign y4 = mem2[addr][bit];
endmodule
+// ----------------------------------------------------------
+
+module test03(clk, wr_addr, wr_data, wr_enable, rd_addr, rd_data);
+
+input clk, wr_enable;
+input [3:0] wr_addr, wr_data, rd_addr;
+output reg [3:0] rd_data;
+
+reg [3:0] memory [0:15];
+
+always @(posedge clk) begin
+ if (wr_enable)
+ memory[wr_addr] <= wr_data;
+ rd_data <= memory[rd_addr];
+end
+
+endmodule
+
+// ----------------------------------------------------------
+
+module test04(clk, wr_addr, wr_data, wr_enable, rd_addr, rd_data);
+
+input clk, wr_enable;
+input [3:0] wr_addr, wr_data, rd_addr;
+output [3:0] rd_data;
+
+reg rd_addr_buf;
+reg [3:0] memory [0:15];
+
+always @(posedge clk) begin
+ if (wr_enable)
+ memory[wr_addr] <= wr_data;
+ rd_addr_buf <= rd_addr;
+end
+
+assign rd_data = memory[rd_addr_buf];
+
+endmodule
+