diff options
author | Eddie Hung <eddie@fpgeh.com> | 2020-01-27 10:34:10 -0800 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2020-01-27 10:34:10 -0800 |
commit | f443695a38fbdd8c2ca38cab45ca964a173dc158 (patch) | |
tree | 4ac13e4fe8ee5e71f963c4230f9f26f32901c2ba /tests/arch/common/lutram.v | |
parent | d730bba6d2847515795c32d3a753320b8b48bee0 (diff) | |
parent | da6abc014987ef562a577dc374bcb03aad9256cd (diff) | |
download | yosys-f443695a38fbdd8c2ca38cab45ca964a173dc158.tar.gz yosys-f443695a38fbdd8c2ca38cab45ca964a173dc158.tar.bz2 yosys-f443695a38fbdd8c2ca38cab45ca964a173dc158.zip |
Merge remote-tracking branch 'origin/master' into eddie/verific_help
Diffstat (limited to 'tests/arch/common/lutram.v')
-rw-r--r-- | tests/arch/common/lutram.v | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/arch/common/lutram.v b/tests/arch/common/lutram.v new file mode 100644 index 000000000..9534b7619 --- /dev/null +++ b/tests/arch/common/lutram.v @@ -0,0 +1,42 @@ +module lutram_1w1r +#(parameter D_WIDTH=8, A_WIDTH=6) +( + input [D_WIDTH-1:0] data_a, + input [A_WIDTH:1] addr_a, + input we_a, clk, + output reg [D_WIDTH-1:0] q_a +); + // Declare the RAM variable + reg [D_WIDTH-1:0] ram[(2**A_WIDTH)-1:0]; + + // Port A + always @ (posedge clk) + begin + if (we_a) + ram[addr_a] <= data_a; + q_a <= ram[addr_a]; + end +endmodule + + +module lutram_1w3r +#(parameter D_WIDTH=8, A_WIDTH=5) +( + input [D_WIDTH-1:0] data_a, data_b, data_c, + input [A_WIDTH:1] addr_a, addr_b, addr_c, + input we_a, clk, + output reg [D_WIDTH-1:0] q_a, q_b, q_c +); + // Declare the RAM variable + reg [D_WIDTH-1:0] ram[(2**A_WIDTH)-1:0]; + + // Port A + always @ (posedge clk) + begin + if (we_a) + ram[addr_a] <= data_a; + q_a <= ram[addr_a]; + q_b <= ram[addr_b]; + q_c <= ram[addr_c]; + end +endmodule |