mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-04 09:07:42 +00:00
Added a test for the Memory Content File inclusion using $readmemb
Signed-off-by: Rodrigo Alejandro Melo <rodrigomelo9@gmail.com>
This commit is contained in:
parent
b4c30cfc8d
commit
43396fae2c
3 changed files with 63 additions and 0 deletions
23
tests/memfile/memory.v
Normal file
23
tests/memfile/memory.v
Normal file
|
@ -0,0 +1,23 @@
|
|||
// A memory initialized with an external file
|
||||
|
||||
module memory (
|
||||
input clk_i,
|
||||
input we_i,
|
||||
input [5:0] addr_i,
|
||||
input [31:0] data_i,
|
||||
output reg [31:0] data_o
|
||||
);
|
||||
|
||||
parameter MEMFILE = "";
|
||||
|
||||
reg [31:0] mem [0:63];
|
||||
|
||||
initial $readmemb(MEMFILE,mem);
|
||||
|
||||
always @(posedge clk_i) begin
|
||||
if (we_i)
|
||||
mem[addr_i] <= data_i;
|
||||
data_o <= mem[addr_i];
|
||||
end
|
||||
|
||||
endmodule
|
Loading…
Add table
Add a link
Reference in a new issue