Daniel wrote:
[snip]
>
> well, can i use an initial inside my memory module? or only inside the testbanch?
> if only inside the TB, its a bit problematic. as the RAM configuration sits as a register inside the memory module and cannot be seen from the TB
> TB access: addresses,data,clk,en. thats it
Inside your synthesizable code you can place simulation-only
code if you use the synthesis translate_on/off pragmas:
// synthesis translate_off
initial begin
#1000 force ram[3] [4] [1] = 1'b0;
end
// synthesis translate_on
Some synthesizers will not complain even if you don't use the pragmas,
or you'll just get a warning that the force statement was ignored for
synthesis.
If you want to do this from the test bench, then you need to use the
hierarchical naming like:
// synthesis translate_off
initial begin
#1000 force uut.ram_instance.ram[3] [4] [1] = 1'b0;
end
// synthesis translate_on
Where in this case your synthesizable code is instantiated as "uut"
in the testbench and the RAM was one level down in a module instantiated
as "ram_instance."
Note that placing code for simulation inside your synthesizable code
will not work for post-synthesis timing simulation. That's because
the code is not translated during synthesis and thus doesn't end up
in the post synthesis simulation timing model. Also hierarchical
access from the test bench to the RAM bit gets tricky for post synthesis
translation because the name or path may change depending on synthesis
settings.
If you find that this works for individual bits (have you tried it yet?)
then I suppose you could make a memory-like structure in your test
bench that loads a list of bit locations and values from a file and
then use a loop to apply a force command for each entry in the file.
--
Gabor