Forum Discussion
Altera_Forum
Honored Contributor
12 years agoHow to find largest value and its position in memory array?
As attachment... the memory array contains continuous input at every positive edge clock... these inputs are the outputs from the Altera FFT core... then i need to find the peak and its location... p...
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