Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17268 Discussions

How to develop a Verilog model for a peak detector?

Altera_Forum
Honored Contributor II
6,206 Views

Develop a Verilog model for a peak detector that finds the maximum value in a sequence of 10-bit unsigned integers. A new number arrives 

at the input during a clock cycle when the data_en input is 1. If the new number is greater than the previously stored maximum value, the maximum value is updated with the new number; otherwise, it is unchanged. The stored maximum value is cleared to zero when the reset control input is 1. Both data_en and reset are synchronous control inputs. 

 

Please help, thanks!
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
4,644 Views

Homework? 

module peak_detect( input wire clk, input wire reset, input wire data_en, input wire in, output reg peak ); always @ (posedge clk) if (reset) peak <= 0; else if (data_en && (in > peak)) peak <= in; endmodule 

Cheers, 

Alex
0 Kudos
Altera_Forum
Honored Contributor II
4,644 Views

 

--- Quote Start ---  

Homework? 

module peak_detect( input wire clk, input wire reset, input wire data_en, input wire in, output reg peak ); always @ (posedge clk) if (reset) peak <= 0; else if (data_en && (in > peak)) peak <= in; endmodule 

Cheers, 

Alex 

--- Quote End ---  

 

 

Thanks Alex.... i got it done yesterday... thanks anyway :)
0 Kudos
Altera_Forum
Honored Contributor II
4,644 Views

 

--- Quote Start ---  

Homework? 

module peak_detect( input wire clk, input wire reset, input wire data_en, input wire in, output reg peak ); always @ (posedge clk) if (reset) peak <= 0; else if (data_en && (in > peak)) peak <= in; endmodule 

Cheers, 

Alex 

--- Quote End ---  

 

 

Hey Alex... do you know how to detect several peaks?
0 Kudos
Reply