Changeset 72 for trunk/MultiChannelUSB/analyser.v
- Timestamp:
- Nov 25, 2009, 11:02:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MultiChannelUSB/analyser.v
r50 r72 5 5 input wire [1:0] uwt_flag, 6 6 input wire [11:0] uwt_data, 7 input wire [11:0] threshold,8 7 output wire peak_ready, 9 8 output wire [11:0] peak … … 14 13 reg peak_ready_reg, peak_ready_next; 15 14 reg [11:0] peak_reg, peak_next; 16 reg [15:0] buffer [15:0];17 wire [15:0] sample;18 wire [11:0] baseline;19 15 20 integer i;21 22 assign sample = {4'd0, uwt_data};23 assign baseline = buffer[15][15:4];24 25 16 always @(posedge clk) 26 17 begin … … 31 22 peak_ready_reg <= 1'b0; 32 23 peak_reg <= 12'd0; 33 34 for(i = 0; i <= 15; i = i + 1)35 begin36 buffer[i] <= 12'd0;37 end38 24 end 39 25 else … … 42 28 counter_reg <= counter_next; 43 29 peak_ready_reg <= peak_ready_next; 44 peak_reg <= peak_next; 45 46 if (data_ready & uwt_flag[1]) 47 begin 48 for(i = 0; i < 15; i = i + 1) 49 begin 50 buffer[i+1] <= buffer[i] + sample; 51 end 52 buffer[0] <= sample; 53 end 30 peak_reg <= peak_next; 54 31 end 55 32 end … … 92 69 if (data_ready & uwt_flag[0]) 93 70 begin 94 peak_next = (uwt_data > baseline) ? (uwt_data - baseline) : 12'd0;95 peak_ready_next = (peak_next > threshold);71 peak_next = uwt_data; 72 peak_ready_next = 1'b1; 96 73 end 97 74 else
Note:
See TracChangeset
for help on using the changeset viewer.