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.

Verilog problem: default case to set signal xxxx

Status
Not open for further replies.

davyzhu

Advanced Member level 1
Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
Hi all,

I always found people like to add default branch like below:
Code:
case(branch)
  ... ...
  [all the possible branch]
  ... ...
default: signal = 8'bx;

And my friend told me it's for simulation cause. When branch not hit all the possible case, the branch must have something like xxxx. So we set signal to xxxx to let xxxx pass go on and help us to find the bug.

If I set default: signal = 0; the xxxx problem will be hidden and hard to find the bug.

But as we know, there is no xxxx signal in real digital world. So is there any better method to solve the problem?

Best regards,
Davy
 

No problem, the simulator and synthesizer are both happy with X. During simulation, X means "unknown state", and helps you catch bugs. During synthesis, X means "don't care", and is absorbed during logic optimization. Go ahead and use X, it is very helpful.

In my projects, I set various data buses to X during idle states. ModelSim displays X in red color. That greatly clarifies the data pipelines, helping me to visualize the data flow and catch bugs such as reading data at the wrong time.
 

    davyzhu

    Points: 2
    Helpful Answer Positive Rating
it depends on the systhesis tool. in some case, the systhesis tool think "x" as "dont care". x is useful for tracing.
 

I'm seeking a clarification here!

Is it SOMETIMES or ALWAYS that synthesis tools treat "X" as don't cares?

-B
 

Hi echo47,

Nice to meet you again!

You said "In my projects, I set various data buses to X during idle states. ModelSim displays X in red color."

Do you mean just set data buses to X and make control bus dedicated logic 0/1, is it right?

Best regards,
Davy
 

in fact, you can't hit all the possible. for instance, 2-bit case varible, you may think 00 01 10 11 is all the possible. but have you thought about 2'bZ0 or 2'b1Z.
 

Hi davyzhu. Yes, my control signals are always 0 or 1 and never X. Similar to reading and writing an ordinary SRAM, the address and data buses are sometimes "don't care", but the read and write enables must always be valid.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top