URL
https://opencores.org/ocsvn/cic_core_2/cic_core_2/trunk
Show entire file |
Details |
Blame |
View Log
Rev 7 |
Rev 9 |
Line 7... |
Line 7... |
input clk,
|
input clk,
|
input reset_n,
|
input reset_n,
|
input clear,
|
input clear,
|
input wire signed [DATA_WIDTH_INP - 1:0] inp_samp_data,
|
input wire signed [DATA_WIDTH_INP - 1:0] inp_samp_data,
|
input inp_samp_str,
|
input inp_samp_str,
|
output reg signed [DATA_WIDTH_OUT - 1:0] out_samp_data
|
output wire signed [DATA_WIDTH_OUT - 1:0] out_samp_data
|
);
|
);
|
/*********************************************************************************************/
|
/*********************************************************************************************/
|
wire signed [DATA_WIDTH_OUT - 1:0] sum;
|
localparam SUMMER_WIDTH = DATA_WIDTH_INP > DATA_WIDTH_OUT ? DATA_WIDTH_INP : DATA_WIDTH_OUT;
|
assign #4 sum = out_samp_data + inp_samp_data; // delay for 18x18 multiplier of Cyclone V SE is 3.4 ns
|
wire signed [SUMMER_WIDTH - 1:0] sum;
|
|
reg signed [SUMMER_WIDTH - 1:0] acc_reg;
|
|
assign #4 sum = acc_reg + inp_samp_data; // delay for 18x18 multiplier of Cyclone V SE is 3.4 ns
|
always @(posedge clk or negedge reset_n)
|
always @(posedge clk or negedge reset_n)
|
begin
|
begin
|
if (!reset_n) out_samp_data <= '0;
|
if (!reset_n) acc_reg <= '0;
|
else if (clear) out_samp_data <= '0;
|
else if (clear) acc_reg <= '0;
|
else if (inp_samp_str) out_samp_data <= sum;
|
else if (inp_samp_str) acc_reg <= sum;
|
end
|
end
|
|
|
|
assign out_samp_data = acc_reg[SUMMER_WIDTH - 1 -: DATA_WIDTH_OUT];
|
/*********************************************************************************************/
|
/*********************************************************************************************/
|
endmodule
|
endmodule
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.