Skip to content

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

NameDirectionValue typeNotes
clockinputintVisible when trigger == 1
outoutputint

Parameters

NameLabelTypeDefaultUnitsDescription
initial_valuen₀int0Initial count value (the count starts here at t=0).
triggerTriggerenum (Every time step / External clock / Internal clock)0What causes the count to increment.
frequencyf (Hz)double1Internal-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).

Released under the MIT License.