Accumulator Module
Description
The Accumulator module (hs_npu_accumulator
) performs an accumulation operation, adding a bias to each input data value and outputting the result. It accepts a bias value and enables accumulation based on a valid input signal. The accumulated result is output along with a signal indicating validity.
The OUTPUT_DATA_WIDTH
parameter defines the width of the input and output data, allowing flexibility for various data formats.
I/O Table
Input Table
Input Name | Direction | Type | Description |
---|---|---|---|
clk |
Input | logic |
Clock signal for synchronization. |
rst_n |
Input | logic |
Reset signal (active low) to initialize the module. |
input_data |
Input | logic[OUTPUT_DATA_WIDTH-1:0] |
Data to be accumulated with the bias value. |
valid_i |
Input | logic |
Valid signal indicating input_data is ready. |
bias_in |
Input | logic[OUTPUT_DATA_WIDTH-1:0] |
Bias value to add to input_data . |
bias_en |
Input | logic |
Enable signal for updating the stored bias. |
Output Table
Output Name | Direction | Type | Description |
---|---|---|---|
result |
Output | logic[OUTPUT_DATA_WIDTH-1:0] |
Accumulated result after adding input_data and the stored bias. |
valid_o |
Output | logic |
Signal indicating the result is valid. |
Module Behavior and Data Flow
-
Bias Handling: The accumulator holds a bias value, which can be updated whenever the
bias_en
signal is asserted. Whenbias_en
is active, the bias is set to the value onbias_in
; otherwise, it retains its previous value. -
Accumulation Process: When
valid_i
is asserted, the module adds the stored bias to the incominginput_data
and outputs the result throughresult
, withvalid_o
set high to indicate a valid output. Ifvalid_i
is deasserted,result
outputs zero andvalid_o
is low, indicating no valid accumulation result.
Diagram
The diagram is trivial.
The bias value is floped, only registered when bias_en
is set.
When valid_i
is set:
Else:
Related Files
File Name | Type |
---|---|
hs_npu_accumulator | Top Module |