This module sum samples into an accumulator for a powr-of-two number of samples. Input and output bit widths are specified, with the msb of the output aligned with the top of the accumulator. Accumulator precision bits are specified, which are lsbs of the accumulator that participate in the accumulation but are discarded at the end of the cycle. An enable input controls on what clock cycles samples are added, and an output signals that the cycle is complete. The accumulator output may be optionally registered.
Ports | Parameters | Notes | Example
clk | input | The clock input. |
reset | input | Reset input, which clears the accumulator and resets the module's state to the idle state. |
en | input | The enable input. An addition to the accumulator occurs when this signal is high. |
go | input | A pulse on this port initiates an accumulation cycle. It may also be a multi-bit trigger, as this input is routed to a Trigger module. |
in | input | The data input port of w1 bits width. |
out | output | The output port of w2 bits width. |
busy | output | This output indicates that an accumulation cycle is in progress. |
done | output | Asserts a single-clock pulse indicating that an accumulation cycle has completed and data are valid. |
The figure to the right illustrates the meanings of the bit-width parameters.
w1 | The bit width of the input port (default 16). |
w2 | The bit width of the output port (default 16). |
ofl | The number of overflow bits (default 10). The number of accumulation clocks is tied to this parameter: cycles = 2ofl. |
apb | The number of accumulator precision bits (default 5). These bits on the lsb end of the accumulator participate in the addition of samples, but are discarded at the end of the cycle. This is done to preserve precision of the output. |
gb | The number of bits in the go vector, which may be a multi-level trigger. The default is one bit. |
wire [23:0] counter; wire t3, t2, t1, t0; wire [31:0] result; TripStack #(.dw(24), .tw(3), .cw(5)) ts ( .clk(clk), .reset(reset), .next(next), .t(counter), .trigs({t3, t2, t1, t0}), .out(result) );