Andry Andry - 4 months ago 14
C++ Question

What is the best way to check whether a signal is a valid one in SystemC?

I am having a little problem in a SystemC simulation because in one component I did forget to check for signals integrity and my simulation breaks because of this. Basically I do not handle situations when my signals are like

"XXXXX..."
or
"ZZZZ..."
!

How to check that a signal is a valid one? Meaning not
"ZZZZ..."
, not
"XXXX..."
but a valid one like
"000110..."
?
Thankyou

A little detail



Someone pointed out that maybe here I am asking about checking whether a signal is a number or not. Ok, let's say that if the signal is valid it is a number of course. But I experienced in some debugging sessions that
"XXX..."
signals are sometimes treated like -1 or negative numbers in general... So that is why I did not ask about how to check whether a signal is a number or not...

Answer

sc_logic.is_01()?

bool is_01() const;

from 7.9.2.2 at page 259 of the IEEE Std 1666-2011.