hi all,
I found a strange problem in my design: I need to get the result of A*2^K, so I extend "A" by several 0s, like this:
{A,{K{1'b0}}}
K is a defined parameter in the module, it can be 0, 1, 2....
But, I found when I set K as 0, A will still be extended by 1 bit 0, that is, {0{1'b0}} is the same as {1{1'b0}}! Can anyone tell me why and how to solve it?
(I simulate my design by Modelsim 6.5g)
Thanks a lot!
I see the same problem in ModelSim SE 6.2a. I also see a suspicious warning message: "Non-positive replication multiplier '0'"
The Verilog 2001 standard says this, so I think ModelSim is broken:
A replication operation may have a replication constant with a value of zero. This is useful in parameterized code. A replication with a zero replication constant is considered to have a size of zero and is ignored. Such a replication shall appear only within a concatenation in which at least one of the operands of the concatenation has a positive size.