problem of memory initialization

Status
Not open for further replies.

sevid

Member level 2
Joined
May 20, 2006
Messages
53
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,711
hi,everyone

i simulate my design with an off-chip memory with these steps below:

1.if my memory is defined as following:
module memory(...);
...
reg [31:0] mem [07:00];
...

2.then i initialize it in my testbench:
$readmemh("mem0.in", memory0.mem);

3. and my "mem0.in" :
@00 0C012340
@01 13057A21
@02 02000002
@03 11222335
@04 52578847
@05 1565A005
@06 50003847
@07 15A00705

but i find that my memory is not initialized, what's wrong ?
plz help me!

thanks in advance !

sevid
 

hi sevid

you can try initialize mem array to 'h0 before use $readmemh. just use "for" loop in initial block.

hope it can give you some help
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…