Article View: comp.lang.verilog
Article #75Re: readmem
From: Richard Eversole; x6239
Date: Mon, 31 Aug 1992 13:35
Date: Mon, 31 Aug 1992 13:35
54 lines
2226 bytes
2226 bytes
In article <ovs5imk@fido.asd.sgi.com>, williams@agomoda.asd.sgi.com (Eric Williams) writes:
|> In <4006@rbiffm.informatik.uni-frankfurt.de> justin@rbiffm.informatik.uni-frankfurt.de (Justin Strohschneider) writes:
|>
|> >For the simulation of a computer architecture it is necessary for me to
|> >define a RAM as a module and to have several incarnations of this RAM with
|> >different contents.
|> >The $readmem system task can be used to fill a memory array with data.
|> >The problem I have is to realize different filenames in the $readmem task.
|> >I would be very glad if anybody could give me some information concerning
|> >this problem.
|>
|> Two ways you could do this. The first method simply does the readmemh from
|> the module that instantiates the memories. It sounds like you're trying to
|> put the readmem in the module that contains the memory. In this case try
|> method 2 which passes this filename into the module as an input.
|>
|> -Eric Williams
Another alternative (and prefered over second option shown by Eric is
to use the parameter construct. There are two ways to use this:
override with defparam and module parameter value assignment.
Both are shown in the following simple example. Note I only use
a $display but it could be $readmemh or whatever.
module test;
wire A;
memmod #("FILEA") U1(A); // Parameter Value Assignment
defparam U2.FOO = "BAR";
memmod U2(A);
endmodule
module memmod(A);
input A;
parameter FOO = "";
initial
$display("%s",FOO);
endmodule
--
=====================================================================
eversole@cadence.com
Live long and prosper !
Technical Details
Message-ID:
<1992Aug31.133512.22582@Cadence.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!Cadence.COM!acae037!eversoleReferences:
<4006@rbiffm.informatik.uni-frankfurt.de> <ovs5imk@fido.asd.sgi.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.verilog Path: arc1-ca.pugleaf.net!sparky!uunet!Cadence.COM!acae037!eversole From: eversole@acae037.cadence.com (Richard Eversole; x6239) Subject: Re: readmem Message-ID: <1992Aug31.133512.22582@Cadence.COM> Sender: usenet@Cadence.COM (Usenet News) Nntp-Posting-Host: acae037 Reply-To: eversole@acae037.cadence.com (Richard Eversole; x6239) Organization: Cadence Design Systems, Inc. References: <4006@rbiffm.informatik.uni-frankfurt.de> <ovs5imk@fido.asd.sgi.com> Date: Mon, 31 Aug 1992 13:35:12 GMT Lines: 55