Submodule of the PMU to handle event counters. This module contains generic adders with reset and simple control logic to ease interface with other modules.\\
\\
New values for the counters is provided through regs\_i and output of the counters is provided through regs\_o.\\
This modules is meant to be instantiated by the interface agnostic PMU (PMU\_raw.sv). Only one instance of this module is required. The application-specific interface shall take care of the write enable of this module.
%This module is meant to be a blackbox inside the chisel code. It belongs to the Drac class in the \emph{rocket.scala} file. We can have as many instances of this module as cores are instantiated in the SoC. Currently only single core operation has been tested.
The module contains two reset signals. One synchronous active high reset enabled by software called softrst\_i, the other is the global reset, called rstn\_i it is asynchronous and active low.\\
\\
Any reset when active shall clear any internal register and set them to 0. Interruptions shall become inactive while the unit is in reset.
When a write is performed to any of the counter values fo the PMU regs\_o shall show the most up to date value of the counters, rather than the internally registered value of the counters. Otherwise the value of the counter may oscillate between the last value and new one.
The module uses generate loops to parametrically implement the amount of counters required. The output of the adders is stored in slv\_reg. the adder takes the last value of the counter (slv\_reg[n]) and adds one to it if the unit is enabled and the event n is active. Events and counters share the same index, meaning that event[0] will map to slv\_reg[0].\\
\\
The outputs of the adders are stored in slv\_reg. If counters need to be updated externally the write enable signal (we\_i) will be high. When we\_i is high the input regs\_i will be bypassed to regs\_o ignoring the current value of the counters, also each slv\_reg will be updated with regs\_i rather than the ouput of the adders.\\
\\
\subsection{Packages and structures}
No packages and structures are used in this module.