Added tests/memfile to 'make test' with an extra testcase
[yosys.git] / tests / memfile / memory.v
1 // A memory initialized with an external file
2
3 module memory (
4 input clk_i,
5 input we_i,
6 input [5:0] addr_i,
7 input [31:0] data_i,
8 output reg [31:0] data_o
9 );
10
11 parameter MEMFILE = "";
12
13 reg [31:0] mem [0:63];
14
15 initial $readmemb(MEMFILE,mem);
16
17 always @(posedge clk_i) begin
18 if (we_i)
19 mem[addr_i] <= data_i;
20 data_o <= mem[addr_i];
21 end
22
23 endmodule