Forum Discussion
Altera_Forum
Honored Contributor
12 years ago --- Quote Start --- run a counter enabled only when a peak occurs. so you then save peak0 at count0 into reg[0] then save peak1 at count1 into reg[1] and so on. --- Quote End --- is it like this? reg [26:0] peak_value [0:10]; reg [14:0] peak_location [0:10]; reg [3:0] i; always @ (posedge clk) begin if (data_en) begin if (abs_source_real > peak_value_temp) begin peak_value <= abs_source_real;
peak_location <= Q-3; end Q <= Q + 1; i <= i + 1; end end