Event rate counter

 
 
Verified

This component contains RTL Verilog code for a rate counter designed to measure the rate of an event. The rate counter can be used for measuring error rates, data rates or any other synchronous event. Rate counters are mostly important for system monitoring and testing, allowing system tuning and validation. The implementation of the Rate counter is based on a time counter and an event counter. The period of the time counter is typically set to 1 second so the number of events counted in the event counter during this period is actually the frequency of the event. The most efficient way to utilize the rate counter is by instantiating one time counter and multiple event counters.

Block diagram

Event rate counter block diagram

 

Features

  • Event rate counting, optional for multiple events.
  • Parameterized time counter width.
  • Parameterized event counter width.
  • Overflow indication.
  • Constructed of two modules, where the event counter may be instantiated multiple times.
  • Time counter period signal, enabling configuration for different frequencies.

 

Deliverables

  • verified RTL code
  • Access to detailed design documentation
  • 1 year support and customization service.

parameters table

Parameter

Valid values

description

WIDTH

Any

Width of the event counter.

TIMEWIDTH

Any

Width of the time counter.

Time counter Interface table

Signal name

Direction/width

description

clk

Input

Clock signal.

Resetb

Input

Reset signal.

Rate_counter_period

Input [TIMEWIDTH-1:0]

Constant or configuration register value indicating the number of clocks for a predefined time period (typically one second).

Rate_time_expired

Output

Indicating the the time counter has expired.

Event counter Interface table

Signal name

Direction/width

description

clk

Input

Clock signal.

Resetb

Input

Reset signal.

Rate_event_cntr_val

Output [WIDTH-1:0]

Event counter result, updated each time the time counter is expired.

Rate_event_cntr_overflow

Output

Overflow indication, when this bit is set, the event counter value is not valid.

Rate_event_increment

Input

Event input, should be connected to the event for counting.

Functionality

The rate counter allows the measurement of the rate of events occurring in the design for debug, validation and optimization purposes. The rate counter has two counters, one for measuring a predefined time period, and the other for measuring the number of events occurring during that time. In case the time counter, counts a period of 1 second, the resulting event counter, is actually the rate of events.

Overflow case

The overflow signal serves as an indication that the event counter has overrun. Typically, in order to reduce the amount of logic used for the event counter, the number of bits used is low, accommodating the expected number of events during the time period. For example, for measuring an error rate, the expected result is very low, so a smaller counter, capable of measuring up to 5% is enough and in case there are more errors, an overflow indication would be sufficient to signal a very high error rate.

Reset

The design can be reset either synchronously or asynchronously, depending on the overall reset policy of the instantiating design.

Test Items

the below table summarizes the test items that were checked

Item name

Description

Event rate

Measure with different rates of events

Counter size

Change event counter size to produce overflow.

Overflow

Check overflow event.