Counter Blocks

Keep track of what happens.

Explore counter components and their configuration. Review triggers, values, and reset behavior in the reference before use.

Counter Block Models


UpDownCounter

UpDownCount

File: general_blocks/Counters/updown_counter.sim
Description
The model implements an up/down counter with reset capability.
The value of the counter is set to the value of the reset_value parameter
when a simulator is started an each time the reset input is enabled.
The incr and decr inputs increment and decrement the value of the counter by 1,
respectively. Enabling the test input causes the value of the counter to be placed
on the out port.
Ports

Input Ports

  • incr     Data Type: TRIGGER
  • reset   Data Type: TRIGGER
  • test     Data Type: TRIGGER
  • decr    Data Type: TRIGGER

Output Ports

  • out     Data Type:INTEGER

Parameters

  • reset_value = 0  Data Type: INTEGER

UpDownCounterChangeValue

File: general_blocks/Counters/updown_counter_changev.sim
Description
The model implements an up/down counter with a counter variable change option.
The value of the counter is set to the value of the inital_value parameter
when a simulator is started and each time the newval input is enabled.
The incr and decr inputs increment and decrement the value of the counter by 1,
respectively. Enabling the test input causes the value of the counter to be placed
on the out port.
Ports

Input Ports

  • incr     Data Type: TRIGGER
  • newval   Data Type: TRIGGER
  • test     Data Type: TRIGGER
  • decr    Data Type: TRIGGER

Output Ports

  • out     Data Type:INTEGER

Parameters

  • initial_value = 0  Data Type: INTEGER

SimpleCounter

SimpleCounter

File: general_blocks/Counters/simple_counter.sim
Description
The model inplements a simple up counter with no reset capability.
The value of the counter is initially set to the value of the initialparameter.
Each time the in port is enabled the counter will be incremented by 1 and the
new value of the counter will be placed on the port out.
Ports

Input Ports

  • in              Data Type: TRIGGER

Output Ports

  • out Data Type: INTEGER

Parameters

  • initial = 0 Data Type: INTEGER

Int_Accumulator

IntAccum

File: general_blocks/Counters/int_accumulator.sim
Description
The model sums all input values which have been received since the last time
the reset port was enabled. When trigger is enabled then the value of the
accumulator is put on the port out. The value of accumulator is the most recent value
enabled on the reset port plus the sum of all values which have come into the in port
since the last time the reset port was enabled.
Ports

Input Ports

  • in          Data Type: INTEGER
  • reset     Data Type: INTEGER
  • trigger Data Type:TRIGGER

Output Ports

  • out         Data Type: INTEGER

Parameters

  • initial_value = 0   Data Type: INTEGER

Counter

File: general_blocks/Counters/counter.sim
Description
The model implements a counter with reset capability. The value of the counter is set to
the value of the reset_value parameters when a simulation is started and each time a reset
signal is received. The in port increments the value of the counter by 1. Triggering the test port
will cause the value of the counter to be placed on the out port.
Ports

Input Ports

  • in         Data Type: INTEGER
  • reset    Data Type: INTEGER
  • test      Data Type: TRIGGER

Output Ports

  • out      Data Type: INTEGER

Parameters

  • reset_value = 0   Data Type: INTEGER

CircularCounter

CirCounter

File: general_blocks/Counters/circular_counter.sim

Description
The model is a counter which counts by 1 from the initial parameter value
to the final parameter value. The counter wraps around to the initial value
when the out reaches the final value.
Ports

Input Ports

  • in     Data Type: TRIGGER

Output Ports

  • out    Data Type: INTEGER

Parameters

  • initial= 0     Data Type: INTEGER
  • final            Data Type: INTEGER

Accumulator

Accum

File: general_blocks/Counters/accumulator.sim

Description
The model accumulates the input values on the port in . Each time a new input arives,
is added to the current value of the accumulator which is the sum of the initial value
of the accumulator and all the input values that have been received since the last reset
value. Each reset value causes the current value of the accumulator to be replaced by
the value on reset. The current value of the accumulator can be placed on out by
triggering the input trigger.

Ports

Input Ports

  • in         Data Type: REAL
  • reset    Data Type: REAL
  • trigger Data Type: TRIGGER

Output Ports

  • out Data Type: REAL

Parameters

  • initial_value= 0  Data Type: REAL

GlobalCount

GlobalCount

File: general_blocks/Counters/GlobalCounter.sim
Description
This model maintains three global variables that can be
used to keep and display global status information.
Counter increment/decrement is signaled via alarms.
The model generates a DisplayStream for display of the count status.
Ports

Input Ports

  • (none)

Output Ports

  • (none)

Parameters

  • CounterName     Data Type: CHARACTER (Counter1, Counter2 or Counter3)
  • CounterType     Data Type: CHARACTER (Increment or Decrement)
  • AlarmName       Data Type: CHARACTER
  • DisplayStream   Data Type: CHARACTER

This page is an editorial rewrite of source documentation. Historical status, availability, and platform notes are not independently verified for a current release. Technical examples are reference material, not a live simulator.