readmemh.v
来自「一些自己编写的verilog代码」· Verilog 代码 · 共 25 行
V
25 行
// Illustrates how to initialize a memory array from data
// stored as hexadecimal values in a data file
//
// Simulate this file directly to see the results
//
// Note: The data file must reside in the same directory
// as the .v file for the module
module readmemh_demo;
// Declare memory array that is twelve words of 32-bits each
reg [31:0] Mem [0:11];
// Fill the memory with values taken from a data file
initial $readmemh("data.txt",Mem);
// Display the contents of memory
integer k;
initial begin
$display("Contents of Mem after reading data file:");
for (k=0; k<12; k=k+1) $display("%d:%h",k,Mem[k]);
end
endmodule
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?