| |
Counter
Library: |
Memory |
Introduced: |
2.3.0 |
Appearance: |
|
Behavior
This register holds a single value, whose value is emitted on the output
Q. Each time the clock input (diagrammed with a triangle on the
component's south edge) triggers according to its Trigger attribute,
the value in the register may update based on
the two inputs on the component's west edge: The upper input is called
load and the lower is called count, and they are
interpreted as follows.
load | count | trigger action |
0 or z | 0 |
The register remains unchanged. |
0 or z | 1 or z |
The register increments. |
1 | 0 |
The register loads the value found at the
D input. |
1 | 1 or z |
The register decrements. |
The range of the register's counting can be configured using the Maximum
Before Reset attribute. When the register reaches this value, the next
increment wraps the register back to 0; and if the register is at 0,
then a decrement will wrap the register around back to its maximum value.
In addition to the output Q, the component also includes a
single-bit output carry. This is 1 whenever the register is at its
maximum and the load and count inputs indicate that the
component should increment on the next step - or when the register is at 0
and the load and count inputs indicate to decrement at
the next step.
The clear input resets the register's value to 0 (all
zeroes) asynchronously; that is, as long as the clr input
is 1, the value is pinned to 0, regardless of the clock input.
Pins
- East edge, labeled Q (output, bit width matches Data Bits attribute)
- Outputs the value currently stored by the register.
- East edge, lower pin (output, bit width 1)
- Carry: When load and count indicate to increment,
this output is 1 whenever the register is at its maximum. When load
and count indicate to decrement, this output is 1 whenever the
register is at 0. At all other times, this output is 0.
- West edge, top pin (input, bit width 1)
- Load: When this is 1 while the count input is 0, the register
will load the value found at the data input at the next clock
trigger - or, if the count input happens to be 1, the register's
value will decrement.
- West edge, middle pin labeled D
(input, bit with matches Data Bits attribute)
- Data: When the clock triggers while load is 1
and count is 0, the register's value changes to the value found at
this input.
- West edge, lower pin labeled ct (input, bit width 1)
- Count: When this is 1 or unconnected, the value in the register increments
whenever the clock input is triggered - or it decrements if the load
input happens to also be 1.
- South edge, indicated with a triangle (input, bit width 1)
- Clock: At the instant that this is triggered as specified by the Trigger
attribute, the register updates as indicated by the load and
count inputs.
- South edge, labeled 0 (input, bit width 1)
- Clear: When 0 or undefined, this input has no effect.
As long as it is 1, the register's value is asynchronously pinned to 0. This
occurs asynchronously - that is, without regard to the current clock input
value. As long as this is 1, the other inputs have no effect.
Attributes
- Data Bits
- The bit width of the value emitted by the component.
- Maximum Before Reset
- The starting value used for the pseudorandom sequence. If this is 0
(the default), then the starting value is based on the time that the current
simulation began.
- Trigger
- Configures how the clock input is interpreted. The value
rising edge
indicates that the register should update its value at the instant when the
clock rises from 0 to 1. The falling edge value indicates that it should
update at the instant the clock falls from 1 to 0.
- Label
- The text within the label associated with the component.
- Label Font
- The font with which to render the label.
Poke Tool Behavior
Clicking the register brings keyboard focus to the register
(indicated by a red rectangle), and typing hexadecimal digits will
change the value stored in the register.
Text Tool Behavior
Allows the label associated with the component to be edited.
Back to Library Reference
|