EmbDev.net

Forum: FPGA, VHDL & Verilog How powerful is Verilog at using parameters to specify designs?


von Kevin S. (kvnsmnsn)


Rate this post
useful
not useful
I have a design in mind that would fit in this skeleton:
1
module xyz ( result, leftOp, rightOp);
2
parameter  integer nmBits = 1;
3
localparam integer highBit = nmBits - 1;
4
output             result;
5
input [ highBit:0] leftOp;
6
input [ highBit:0] rightOp;
7
8
// ...
9
10
endmodule
The way (xyz) is designed, this module would work differently for 
different values of (nmBits), but in a way that can be precisely 
defined. In fact, I'm seriously thinking of writing a Java program that 
takes (nmBits) as an input and produces a parameterless verion of (xyz) 
for that version of (nmBits). So I'm wondering, is it a true statement 
that, if one can write such a Java program to produce the equivalent 
(parameterless) Verilog code for any given set of parameters, one can 
also write Verilog code with parameters to do the same thing?

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.