electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Verilog problem: default case to set signal xxxx


Post new topic  Reply to topic    EDAboard.com Forum Index -> ASIC Design Methodologies & Tools (Digital) -> Verilog problem: default case to set signal xxxx
Author Message
davyzhu



Joined: 23 May 2004
Posts: 521
Helped: 3
Location: oriental


Post24 Nov 2006 16:48   

Verilog problem: default case to set signal xxxx


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
Back to top
echo47



Joined: 07 Apr 2002
Posts: 4206
Helped: 566


Post25 Nov 2006 10:27   

Verilog problem: default case to set signal xxxx


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.
Back to top
darylz



Joined: 24 Mar 2005
Posts: 132
Helped: 4


Post26 Nov 2006 7:41   

Verilog problem: default case to set signal xxxx


it depends on the systhesis tool. in some case, the systhesis tool think "x" as "dont care". x is useful for tracing.
Back to top
blanket



Joined: 14 Jan 2003
Posts: 30
Helped: 1


Post26 Nov 2006 17:51   

Re: Verilog problem: default case to set signal xxxx


I'm seeking a clarification here!

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

-B
Back to top
davyzhu



Joined: 23 May 2004
Posts: 521
Helped: 3
Location: oriental


Post27 Nov 2006 3:22   

Verilog problem: default case to set signal xxxx


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
Back to top
aslijia



Joined: 03 Nov 2006
Posts: 51
Helped: 1


Post27 Nov 2006 3:45   

Verilog problem: default case to set signal xxxx


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.
Back to top
Google
AdSense
Google Adsense




Post27 Nov 2006 3:45   

Ads




Back to top
echo47



Joined: 07 Apr 2002
Posts: 4206
Helped: 566


Post27 Nov 2006 4:30   

Re: Verilog problem: default case to set signal xxxx


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.
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> ASIC Design Methodologies & Tools (Digital) -> Verilog problem: default case to set signal xxxx
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Qn on synthesis of "default" branch in case statem (2)
Optimization while Set case analysis (3)
default value of wire in verilog = 0 (3)
difference between default generic and default technology (3)
if vs case verilog (3)
if vs case verilog (5)
default binding problem in gate-level simulation (7)
case statement(verilog) (3)
REG case statement in verilog (2)
Verilog case and if else (1)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS