simuhw.counter package
Module contents
- class simuhw.counter.Counter(width: int)
Bases:
DeviceThe super class for all counters.
- __init__(width: int) None
Creates a counter.
- Parameters:
width – The data word width in bits.
- property port_co: OutputPort
The carry output port.
- property port_q: OutputPort
The count output port.
- reset() None
Resets the states.
- property width: int
The data word width in bits.
- class simuhw.counter.SynchronousCounter(width: int, *, neg_edged: bool)
Bases:
CounterThe super class for all synchronous counters.
- __init__(width: int, *, neg_edged: bool) None
Creates a synchronous counter.
- Parameters:
width – The data word width in bits.
neg_edged – True if negative-edged, False otherwise.
- property negative_edged: bool
True if negative-edged, False otherwise.
- reset() None
Resets the states.
- class simuhw.counter.SynchronousBinaryCounter(width: int, *, neg_edged: bool)
Bases:
SynchronousCounterThe super class for all synchronous binary counters.
- __init__(width: int, *, neg_edged: bool) None
Creates a synchronous binary counter.
- Parameters:
width – The data word width in bits.
neg_edged – True if negative-edged, False otherwise.
- class simuhw.counter.SynchronousBinaryCounter74161(width: int)
Bases:
SynchronousBinaryCounterA synchronous binary counter 74161 with arbitrary bits.
This device behaves like the logic IC 74161 with no timing delay and with arbitrary counter bits.
Truth Table:
+-----------------------------------+-----------+-----------------------+ | Inputs | Outputs | | +-----+-----+-----+-----+-----+-----+-----+-----+ Function | | clr |load | d | enp | ent | ck | q | co | | +-----+-----+-----+-----+-----+-----+-----+-----+-----------------------+ | L | X | X | X | X | X | L | L | Resets count to 0. | | H | L | H/L | X | X | Rise| H/L | L | Presets count with d. | | H | H | X | X | L | Rise| H/L | H/L | No change. | | H | H | X | L | X | Rise| H/L | H/L | No change. | | H | H | X | H | H | Rise| H/L | H/L | Counts up. | | H | X | X | X | X | Fall| H/L | H/L | No change. | +-----+-----+-----+-----+-----+-----+-----+-----+-----------------------+
- __init__(width: int) None
Creates a synchronous binary counter 74161 with arbitrary bits.
- Parameters:
width – The data word width in bits.
- reset() None
Resets the states.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds. None when starting to make the device work.
- Returns:
A tuple of the list of the input ports that are to be watched receive a data word, and the next resuming time in seconds. The next resuming time can be None if resumable anytime.
- class simuhw.counter.SynchronousBinaryCounter74163(width: int)
Bases:
SynchronousBinaryCounterA synchronous binary counter 74163 with arbitrary bits.
This device behaves like the logic IC 74163 with no timing delay and with arbitrary counter bits.
Truth Table:
+-----------------------------------+-----------+-----------------------+ | Inputs | Outputs | | +-----+-----+-----+-----+-----+-----+-----+-----+ Function | | clr |load | d | enp | ent | ck | q | co | | +-----+-----+-----+-----+-----+-----+-----+-----+-----------------------+ | L | X | X | X | X | Rise| L | L | Resets count to 0. | | H | L | H/L | X | X | Rise| H/L | L | Presets count with d. | | H | H | X | X | L | Rise| H/L | H/L | No change. | | H | H | X | L | X | Rise| H/L | H/L | No change. | | H | H | X | H | H | Rise| H/L | H/L | Counts up. | | H | X | X | X | X | Fall| H/L | H/L | No change. | +-----+-----+-----+-----+-----+-----+-----+-----+-----------------------+
- __init__(width: int) None
Creates a synchronous binary counter 74163 with arbitrary bits.
- Parameters:
width – The data word width in bits.
- reset() None
Resets the states.
- work(time: float | None) tuple[list[InputPort], float | None]
Makes the device work.
- Parameters:
time – The current time in seconds. None when starting to make the device work.
- Returns:
A tuple of the list of the input ports that are to be watched receive a data word, and the next resuming time in seconds. The next resuming time can be None if resumable anytime.