Guest
Hi,
I'm currently trying to have a scalable parameter of alternating bits
in a vector, e.g. 101010101.
The code I use for Modelsim to do this as follows:
parameter width = 10;
parameter alt = { {(width%2){1'b1}}, {(width/2){2'b01}} };
The first term in the concatenation is to add another 1'b1 at the most
significant bit if width is an odd number, e.g.
if width = 5,
alt = 10101
But if width is an even number, {(width%2){1'b1}} should produce zero
replications.
However, it seems that neither Modelsim nor Synplify likes zero
replications, where Modelsim simply adds a 1'b0 whenever a zero
replication is encountered.
Does anyone have any ideas of how to workaround this?
Thanks a lot.
cheers
I'm currently trying to have a scalable parameter of alternating bits
in a vector, e.g. 101010101.
The code I use for Modelsim to do this as follows:
parameter width = 10;
parameter alt = { {(width%2){1'b1}}, {(width/2){2'b01}} };
The first term in the concatenation is to add another 1'b1 at the most
significant bit if width is an odd number, e.g.
if width = 5,
alt = 10101
But if width is an even number, {(width%2){1'b1}} should produce zero
replications.
However, it seems that neither Modelsim nor Synplify likes zero
replications, where Modelsim simply adds a 1'b0 whenever a zero
replication is encountered.
Does anyone have any ideas of how to workaround this?
Thanks a lot.
cheers