Appearance
Counter
Integer counter that increments on a configurable trigger (rising edge / falling edge / level). Optional reset port. Useful for event counting and frequency division.
Category: Discrete
Keywords: count, increment, tick, edge, accumulate, tally
Ports
| Name | Direction | Value type | Notes |
|---|---|---|---|
clock | input | int | Visible when trigger == 1 |
out | output | int |
Parameters
| Name | Label | Type | Default | Units | Description |
|---|---|---|---|---|---|
initial_value | n₀ | int | 0 | — | Initial count value (the count starts here at t=0). |
trigger | Trigger | enum (Every time step / External clock / Internal clock) | 0 | — | What causes the count to increment. |
frequency | f (Hz) | double | 1 | — | Internal-clock frequency. The count increments every 1/f seconds. |
Used in samples
Implemented in C++ class SimCompCtlCounter (components/control/CSim_comp_ctl_counter/sim_comp_ctl_counter.h).