nitypes.waveform.DigitalState
- class nitypes.waveform.DigitalState
Bases:
enum.IntEnumAn IntEnum of the different digital states that a digital signal can represent.
You can use
DigitalStatein place of anint:>>> DigitalState.FORCE_OFF <DigitalState.FORCE_OFF: 2> >>> DigitalState.FORCE_OFF == 2 True
Use
from_char()andto_char()to convert between states and characters:>>> DigitalState.from_char("Z") <DigitalState.FORCE_OFF: 2> >>> DigitalState.to_char(2) 'Z'
Use
test()to compare actual vs. expected states, returning True on failure.>>> DigitalState.test(DigitalState.FORCE_DOWN, DigitalState.COMPARE_LOW) False >>> DigitalState.test(DigitalState.FORCE_UP, DigitalState.COMPARE_LOW) True
- FORCE_DOWN = 0
Force logic low (
0). Drive to the low voltage level (VIL).
- FORCE_UP = 1
Force logic high (
1). Drive to the high voltage level (VIH).
- FORCE_OFF = 2
Force logic high impedance (
Z). Turn the driver off.
- COMPARE_LOW = 3
Compare logic low (edge) (
L). Compare for a voltage level lower than the low voltage threshold (VOL).
- COMPARE_HIGH = 4
Compare logic high (edge) (
H). Compare for a voltage level higher than the high voltage threshold (VOH).
- COMPARE_UNKNOWN = 5
Compare logic unknown (
X). Don’t compare.
- COMPARE_OFF = 6
Compare logic high impedance (edge) (
T). Compare for a voltage level between the low voltage threshold (VOL) and the high voltage threshold (VOH).
- COMPARE_VALID = 7
Compare logic valid level (edge) (
V). Compare for a voltage level either lower than the low voltage threshold (VOL) or higher than the high voltage threshold (VOH).
- classmethod from_char(char: str) DigitalState
Look up the digital state for the corresponding character.
- Parameters:
char (str)
- Return type:
- classmethod to_char(state: DigitalState, errors: str = 'strict') str
Get a character representing the digital state.
- Parameters:
state (DigitalState) – The digital state.
errors (str) –
Specifies how to handle errors.
”strict”: raise
KeyError”replace”: return “?”
- Returns:
A character representing the digital state.
- Return type:
- static test(state1: DigitalState, state2: DigitalState) bool
Test two digital states and return True if the test failed.
- Parameters:
state1 (DigitalState)
state2 (DigitalState)
- Return type: