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.

X propagation on input when else is not there

Status
Not open for further replies.

stanford

Full Member level 2
Joined
Feb 16, 2014
Messages
132
Helped
4
Reputation
8
Reaction score
6
Trophy points
1,298
Activity points
2,223
When if (condition == X), it will go to the else statement. What happens if the else statement is not defined?
 

I am not too familiar with this, but as far as I know, it would infer an element of memory (FF) in order to hold the previous state.
 

I am not too familiar with this, but as far as I know, it would infer an element of memory (FF) in order to hold the previous state.

Meaning X will not be propagated to the output
 

What happens if the else statement is not defined?
It can happen than an else part is not defined. In such a case, when the 'if' condition is not met, then the signals just stay at their previous value.


But wait, do you mean X as a logic logic level such as 1, 0, Z?

If so then you are thinking on the wrong lines.
If you see in your sim something going to X, then stop there and analyze the source of the X and fix it. You don't write RTL code to work with X.
 

It can happen than an else part is not defined. In such a case, when the 'if' condition is not met, then the signals just stay at their previous value.


But wait, do you mean X as a logic logic level such as 1, 0, Z?

If so then you are thinking on the wrong lines.
If you see in your sim something going to X, then stop there and analyze the source of the X and fix it. You don't write RTL code to work with X.

No.... I mean what would you see in simulation? will the output hold the value even though the input is X? If the input is X, it would evaluate to 'else' but if there is no else, what happens.
 

Perhaps you have not understood the explanation, the fact is that in HDL languages terminology, in general the term X is used to represent an undeterminate value, instead of a variable as you have supposed done. Therefore, a X (unknown value) will be propagated toward the output.
 

I mean what would you see in simulation? will the output hold the value even though the input is X?
Yes if the input to a flop is X, it will be passed to its output.
But you shouldn't be thinking what to do in RTL so as to handle X values.....as in #1.

The 1st place wherever you see X in a sim, just stop and find out from where the X first first occurs.
Most common reason for X is multi-driver problem, when a signal is driven from more than 1 sources. You should find such a place in your RTL and fix it.
 

Perhaps you have not understood the explanation, the fact is that in HDL languages terminology, in general the term X is used to represent an undeterminate value, instead of a variable as you have supposed done. Therefore, a X (unknown value) will be propagated toward the output.

This is incorrect for an HDL. An X in the expression of an if statement is treated the same as 0/false. When there is no else branch, nothing gets executed.

Some tools have implemented an X-propagation feature that evaluate both branches when the condition is X, and check if a variable would have been set differently, then sets it to X. However, this can be a very expensive computation, supporting only limited situations.
 
When if (condition == X), it will go to the else statement. What happens if the else statement is not defined?

I understand that you are focused on x-propagation analysis. In general, if you do not have an else, there will be latch that will infer. X should propagate when latch is open in real implementation.
However, it is always advisable to use ternary operator for conditional statements to make your code more x-propagation friendly. Hope this helps.

Thanks,
Abhishek
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top