C
Chih-Hsu Yen
Guest
Hello,
If one memory "reg [9:0] stack[127:0]" is used, then how to write an
easy reading and synthesizable code to initialize this memory? I want the
code like the followings, but it seems that the task can not have memory
declaration inside it.
always@ ( posedge clk )
begin
if ( reset )
begin
initial_fifo( stack);
end
end
task initial_fifo;
output [9:0] stack[127:0];
begin
stack[0]<= 10'd0;
stack[1]<=10'd1;
stack[2]<=10'd2;
.
.
.
stack[127]<=10'd127;
end
endtask
If one memory "reg [9:0] stack[127:0]" is used, then how to write an
easy reading and synthesizable code to initialize this memory? I want the
code like the followings, but it seems that the task can not have memory
declaration inside it.
always@ ( posedge clk )
begin
if ( reset )
begin
initial_fifo( stack);
end
end
task initial_fifo;
output [9:0] stack[127:0];
begin
stack[0]<= 10'd0;
stack[1]<=10'd1;
stack[2]<=10'd2;
.
.
.
stack[127]<=10'd127;
end
endtask