absolute path for a memory file

M

mel

Guest
Hi pips!

I'm currently using a serial fprom model with a reference to a memory
file. Looks something like this:


module memory_access();
parameter initfile="../../../../m25p20/memory.txt";

...
...

...

$readmemh(initfile, mem_array);

endmodule


When I run a simulation test, this works out just fine. However, if
the sfprom model is used
by a larger module and I run a simulation at a different directory
location, it will produce a warning stating that the memory.txt file
can not be open for reading. To fix this problem, I modified it to
use an absolute path rather than a relative path. I used,

parameter initfile = "$asic_home/m25p20/memory.txt";

My problem is: the "$" sign is a keyword, and the compiler treats
anything after it as a system task. Is there any other way to define
the absolute path for the $readmemh()
system task?

tnx.. =)
 
"mel" <emmanuel.rigor@gmail.com> writes:

Hi pips!

I'm currently using a serial fprom model with a reference to a memory
file. Looks something like this:


module memory_access();
parameter initfile="../../../../m25p20/memory.txt";

..
..

..

$readmemh(initfile, mem_array);

endmodule


When I run a simulation test, this works out just fine. However, if
the sfprom model is used
by a larger module and I run a simulation at a different directory
location, it will produce a warning stating that the memory.txt file
can not be open for reading. To fix this problem, I modified it to
use an absolute path rather than a relative path. I used,

parameter initfile = "$asic_home/m25p20/memory.txt";

My problem is: the "$" sign is a keyword, and the compiler treats
anything after it as a system task. Is there any other way to define
the absolute path for the $readmemh()
system task?
You can enter the full path:

defparam
initfile = "/the/full/path/to/asic/home/m25p20/memory.txt";

memory_access
memory_access_instance();


or you can make a preprocessor variable to hold the path:

defparam
initfile = {`ASIC_HOME,"m25p20/memory.txt"};

memory_access
memory_access_instance();

Then you can specify the ASIC_HOME when you launch your simulator. How
you do that is OS/vendor-dependent, but using VCS under UNIX/Linux you
would do:

vcs +define+ASIC_HOME=\"/the/full/path/to/asic/home/\"


Petter
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
 
I don't believe you can do it that way...
You can create link to the file in your simulation directory and then
use:
parameter initfile = "memory.txt";
 

Welcome to EDABoard.com

Sponsor

Back
Top