Article View: comp.lang.verilog
Article #47Re: parameters
From: Sean P. O'Donohue
Date: Tue, 14 Apr 1992 06:20
Date: Tue, 14 Apr 1992 06:20
62 lines
2347 bytes
2347 bytes
In article <1992Apr3.222032.11639@jericho.uunet.uu.net> gord@jericho.uunet.uu.net (Gord Wait) writes:
>In article <1992Mar30.211350.14338@ncsu.edu> hdeshma@eos03a-16pa.eos.ncsu.edu (HARSHAVARDHAN DESHMANE) writes:
>>
>>although the parameter declaration is intuitive to use,
>>can the same things be done by declaring the parameters
>>to integers?
>>In what way is a 'parameter' different from an integer? Sorry
>>if this sounds silly, but I am unclear about the real reason
>>for the declaration.
>>
>>harsh
>>________________________________________________________________________________
>>Harshavardhan Deshmane * no fancy stuff*
>>ECE Dept, North Carolina State University
>>________________________________________________________________________________
>
>For one thing, parameters can be altered when you instantiate a model.
>For example:
>
> module testparams;
> parameter p1 = 5;
> parameter p2 = 8;
>
> initial
> begin
> $write("p1 is %d, p2 is %d\n", p1, p2);
> end
> endmodule
>
>
>Now when you use it you can change the values of P1 and P2 like this:
>
> module junk;
>
> item1 testparams;
> item2 #(1, 2) testparams;
> item3 #(9,10) testparamsl
>
> endmodule
>
>In the above example item1 will print out the original values of 5 and
>8, item2 will print out values of 1 and 2, and item three will print
>out values of 9 and 10 for the p1 and p2 parameters. RTFM, page 12-8
>volume 1 of Cadence Verilog 1.6.0.1
>
>Gord
>
>
>--
>Gord Wait SMOS Systems Vancouver Design Centre
>uunet!jericho!gord
>
You can also reference the parameters hierarchacly
module junk;
defparam junk.item4.p1=123; //this replaces p1 in
//instance item4
testparams item1; //NOTE:
testparams #(1, 2) item2; //paramters appear after
testparams #(9,10) item3; //module name and before
testparams #(9,10) item4; //instance names.
endmodule //(This was an error in Gord's
//example)
Technical Details
Message-ID:
<1992Apr14.062015.12378@Cadence.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!Cadence.COM!odonohueReferences:
<1992Apr3.222032.11639@jericho.uunet.uu.net>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.verilog Path: arc1-ca.pugleaf.net!sparky!uunet!Cadence.COM!odonohue From: odonohue@Cadence.COM (Sean P. O'Donohue) Subject: Re: parameters Message-ID: <1992Apr14.062015.12378@Cadence.COM> Organization: Cadence Design Systems, Inc. References: <1992Apr3.222032.11639@jericho.uunet.uu.net> Date: Tue, 14 Apr 1992 06:20:15 GMT Lines: 63