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.

Question about particular HDL code

Status
Not open for further replies.

rickyice

Junior Member level 2
Joined
Jun 7, 2006
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,428
if(a>5)
b=1;
else
b=0;


now, if (input)a=x,and then b=???
 

hdl questions

Here, b will get "0" as the if condition fails here. Generally in the case of failing "if" .... else will get executed."else" doesn't look for any condition..failing of "if" is enough for "else" to get the execution.
 

Re: hdl questions

polukir is right,
thank you
 

Re: hdl questions

Why dont you simulate and check in waveform.
 

hdl questions

i think it depend on simulation tools
 

Re: hdl questions

i did it
 

Re: hdl questions

If this is for a non-synthesizable code, then it's going to have a value of 0. but if this is a synthesizable code then after synthesis it's still 'X'.
 

Re: hdl questions

it's definitely 0
 

Re: hdl questions

hi,

f(a>5)
b=1;
else
b=0;

if a is greater than 5, b wiil be equal to 1...................
if a is less than or equal to 5 or others(like x,z...), b will be equal to zero
 

Re: hdl questions

It is not a matter of synthesis or simulation.....

In Synthesis it will take a MUX and a comparator....so it will show X if u simulate synthesized netlist with
input 'X'.

But in rtl code it should give output '0'.

Praveen.
 

hdl questions

stevepre is correct. Put it in another way: if you're answering your final test, write down 'b = 1' if you're facing real problem in your design, particularly for PL simulation, you will get 'x'.
 

hdl questions

Hi,
it's definitely 0 because if statement will see only condition is satisfied or not , and X will be treated as condition is not satisfied so b will be always 0.
 

Re: hdl questions

yups it wil b zero!!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top