I’d like to set a parameter based on a parameter which is set when the module is instantiated. I have the following.
1 |
module foo #(WORDS = 8); |
I expected to get an error for redefining P00 but it compiled and ran and displayed the following instead.
1 |
WORDS = 8 |
If I comment the “parameter P00 = 33” assignment, I get a “Identifier P00 has not been declared yet.” error.
It seems that the generate block is being ignored. What is wrong here?
For complex derived parameter assignments you can use functions. For example:
1 |
parameter P01 = FUNC01(WORDS,P00); |
This is also legal: module foo #(parameter WORDS, P00=FUNC00(WORDS));
Reprint: https://stackoverflow.com/questions/17734329/system-verilog-parameters-in-generate-block
近期评论