Changeset 72 for trunk/MultiChannelUSB/adc_fifo.v
- Timestamp:
- Nov 25, 2009, 11:02:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MultiChannelUSB/adc_fifo.v
r64 r72 3 3 input wire adc_clk, 4 4 input wire [11:0] adc_data, 5 input wire polarity,6 5 7 6 input wire clk, 8 9 output wire ready, 10 output wire [11:0] raw_data, 11 output wire [13:0] uwt_data 7 output wire data_ready, 8 output wire [11:0] data 12 9 ); 13 10 14 wire [31:0] uwt_d1, uwt_a1, uwt_peak1; 15 wire [31:0] uwt_d2, uwt_a2, uwt_peak2; 16 wire [31:0] uwt_d3, uwt_a3, uwt_peak3; 17 wire [1:0] uwt_flag1, uwt_flag2, uwt_flag3; 18 19 wire [11:0] int_raw_q; 20 wire [13:0] int_uwt_q; 21 22 reg [11:0] int_raw_data; 23 reg [13:0] int_uwt_data; 24 25 wire [1:0] wrfull; 11 wire [11:0] int_q; 12 reg [11:0] int_data; 26 13 27 reg state; 28 reg int_rdreq, int_ready; 29 wire int_rdempty; 30 31 wire [11:0] int_adc_data; 32 assign int_adc_data = (polarity) ? (12'hfff - adc_data) : (adc_data); 33 34 uwt_bior31 #(.L(1)) uwt_1_unit ( 35 .clk(adc_clk), 36 .x({20'h00000, int_adc_data}), 37 .d(uwt_d1), 38 .a(uwt_a1), 39 .peak(uwt_peak1), 40 .flag(uwt_flag1)); 41 42 uwt_bior31 #(.L(2)) uwt_2_unit ( 43 .clk(adc_clk), 44 .x(uwt_a1), 45 .d(uwt_d2), 46 .a(uwt_a2), 47 .peak(uwt_peak2), 48 .flag(uwt_flag2)); 49 50 uwt_bior31 #(.L(3)) uwt_3_unit ( 51 .clk(adc_clk), 52 .x(uwt_a2), 53 .d(uwt_d3), 54 .a(uwt_a3), 55 .peak(uwt_peak3), 56 .flag(uwt_flag3)); 14 reg state, int_rdreq, int_data_ready; 15 wire int_wrfull, int_rdempty; 57 16 58 17 dcfifo #( … … 67 26 .overflow_checking("ON"), 68 27 .underflow_checking("ON"), 69 .use_eab("O N"),70 .write_aclr_synch("OFF")) fifo_ raw(28 .use_eab("OFF"), 29 .write_aclr_synch("OFF")) fifo_unit ( 71 30 .aclr(1'b0), 72 .data( int_adc_data),31 .data(adc_data), 73 32 .rdclk(clk), 74 33 .rdreq((~int_rdempty) & int_rdreq), 75 34 .wrclk(adc_clk), 76 .wrreq(~ wrfull[0]),77 .q(int_ raw_q),35 .wrreq(~int_wrfull), 36 .q(int_q), 78 37 .rdempty(int_rdempty), 79 .wrfull(wrfull[0]), 80 .rdfull(), 81 .rdusedw(), 82 .wrempty(), 83 .wrusedw()); 84 85 dcfifo #( 86 .intended_device_family("Cyclone III"), 87 .lpm_numwords(16), 88 .lpm_showahead("ON"), 89 .lpm_type("dcfifo"), 90 .lpm_width(14), 91 .lpm_widthu(4), 92 .rdsync_delaypipe(4), 93 .wrsync_delaypipe(4), 94 .overflow_checking("ON"), 95 .underflow_checking("ON"), 96 .use_eab("ON"), 97 .write_aclr_synch("OFF")) fifo_uwt ( 98 .aclr(1'b0), 99 .data({uwt_flag3, uwt_peak3[11:0]}), 100 .rdclk(clk), 101 .rdreq((~int_rdempty) & int_rdreq), 102 .wrclk(adc_clk), 103 .wrreq(~wrfull[1]), 104 .q(int_uwt_q), 105 .rdempty(), 106 .wrfull(wrfull[1]), 38 .wrfull(int_wrfull), 107 39 .rdfull(), 108 40 .rdusedw(), … … 116 48 begin 117 49 int_rdreq <= 1'b1; 118 int_ ready <= 1'b0;50 int_data_ready <= 1'b0; 119 51 state <= 1'b1; 120 52 end … … 124 56 if (~int_rdempty) 125 57 begin 126 int_raw_data <= int_raw_q; 127 int_uwt_data <= int_uwt_q; 58 int_data <= int_q; 128 59 int_rdreq <= 1'b0; 129 int_ ready <= 1'b1;60 int_data_ready <= 1'b1; 130 61 state <= 1'b0; 131 62 end … … 135 66 begin 136 67 int_rdreq <= 1'b1; 137 int_ ready <= 1'b0;68 int_data_ready <= 1'b0; 138 69 state <= 1'b1; 139 70 end … … 141 72 end 142 73 143 assign ready = int_ready; 144 assign raw_data = int_raw_data; 145 assign uwt_data = int_uwt_data; 74 assign data_ready = int_data_ready; 75 assign data = int_data; 146 76 147 77 endmodule
Note:
See TracChangeset
for help on using the changeset viewer.