Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Why {0{1'b0}} in verilog doesn't work?

Status
Not open for further replies.

machael

Member level 2
Joined
Nov 4, 2004
Messages
44
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
457
verilog replication

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!
 

replication in verilog

Instead of using {A,{K{1'b0}}} you can write A<<K;
 

replication verilog

ModelSim 6.5g ???

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.
 

non-positive replication multiplier

thanks nand_gate, it works!

echo47,
my modelsim is 5.7g, sorry for my typo! :(
so it is clear that this is a modelsim's bug. Thank you for your verification and citation!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top