mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-01 07:40:42 +00:00
added tests/memories
This commit is contained in:
parent
ab4b26679f
commit
5d9127418b
5 changed files with 133 additions and 0 deletions
26
tests/memories/simple_sram_byte_en.v
Normal file
26
tests/memories/simple_sram_byte_en.v
Normal file
|
@ -0,0 +1,26 @@
|
|||
// expect-wr-ports 1
|
||||
// expect-rd-ports 1
|
||||
|
||||
module generic_sram_byte_en #(
|
||||
parameter DATA_WIDTH = 32,
|
||||
parameter ADDRESS_WIDTH = 4
|
||||
) (
|
||||
input i_clk,
|
||||
input [DATA_WIDTH-1:0] i_write_data,
|
||||
input i_write_enable,
|
||||
input [ADDRESS_WIDTH-1:0] i_address,
|
||||
input [DATA_WIDTH/8-1:0] i_byte_enable,
|
||||
output reg [DATA_WIDTH-1:0] o_read_data
|
||||
);
|
||||
|
||||
reg [DATA_WIDTH-1:0] mem [0:2**ADDRESS_WIDTH-1];
|
||||
integer i;
|
||||
|
||||
always @(posedge i_clk) begin
|
||||
for (i=0;i<DATA_WIDTH/8;i=i+1)
|
||||
if (i_write_enable && i_byte_enable[i])
|
||||
mem[i_address][i*8 +: 8] <= i_write_data[i*8 +: 8];
|
||||
o_read_data <= mem[i_address];
|
||||
end
|
||||
|
||||
endmodule
|
Loading…
Add table
Add a link
Reference in a new issue