Changeset 123 for sandbox/MultiChannelUSB/deconv.v
- Timestamp:
- Feb 21, 2011, 12:33:56 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/MultiChannelUSB/deconv.v
r120 r123 2 2 #( 3 3 parameter size = 1, // number of channels 4 parameter width = 24 // bit width of the input data 4 parameter shift = 24, // right shift of the result 5 parameter width = 27, // bit width of the input data 6 parameter widthr = 13 // bit width of the output data 5 7 ) 6 8 ( … … 9 11 input wire [3*size*8-1:0] amp_data, 10 12 input wire [3*size*16-1:0] tau_data, 11 input wire [3*size*6-1:0] cls_data,12 13 input wire [3*size*width-1:0] inp_data, 13 14 output wire [3*size*widthr-1:0] out_data … … 16 17 localparam width1 = width + 1; 17 18 localparam width2 = width + 6 + 1; 18 localparam width r= width + 16 + 3;19 localparam width3 = width + 16 + 3; 19 20 20 21 reg int_wren_reg, int_wren_next; … … 30 31 wire [size*widthr-1:0] out_data_wire; 31 32 32 wire [size*width r-1:0] add_data_wire;33 34 wire [size*width r-1:0] mul_data_wire [1:0];33 wire [size*width3-1:0] add_data_wire; 34 35 wire [size*width3-1:0] mul_data_wire [1:0]; 35 36 36 37 reg [size*width2-1:0] acc_data_reg [3:0], acc_data_next [3:0]; … … 47 48 reg [size*16-1:0] tau_data_reg, tau_data_next; 48 49 wire [size*16-1:0] tau_data_wire [2:0]; 49 50 reg [size*6-1:0] cls_data_reg, cls_data_next;51 wire [size*6-1:0] cls_data_wire [2:0];52 50 53 51 integer i; … … 66 64 assign tau_data_wire[1][j*16+16-1:j*16] = tau_data[(3*j+1)*16+16-1:(3*j+1)*16]; 67 65 assign tau_data_wire[2][j*16+16-1:j*16] = tau_data[(3*j+2)*16+16-1:(3*j+2)*16]; 68 assign cls_data_wire[0][j*6+6-1:j*6] = cls_data[(3*j+0)*6+6-1:(3*j+0)*6];69 assign cls_data_wire[1][j*6+6-1:j*6] = cls_data[(3*j+1)*6+6-1:(3*j+1)*6];70 assign cls_data_wire[2][j*6+6-1:j*6] = cls_data[(3*j+2)*6+6-1:(3*j+2)*6];71 66 72 67 lpm_mux #( … … 119 114 .lpm_widtha(width1), 120 115 .lpm_widthb(17), 121 .lpm_widthp(width r)) mult_unit_1 (116 .lpm_widthp(width3)) mult_unit_1 ( 122 117 .clock(clock), 123 118 .clken(int_wren_reg), 124 119 .dataa(sub_data_wire[j*width1+width1-1:j*width1]), 125 120 .datab({1'b0, tau_data_reg[j*16+16-1:j*16]}), 126 .result(mul_data_wire[0][j*width r+widthr-1:j*widthr]));121 .result(mul_data_wire[0][j*width3+width3-1:j*width3])); 127 122 128 123 lpm_mult #( … … 133 128 .lpm_widtha(width2), 134 129 .lpm_widthb(8), 135 .lpm_widthp(width r)) mult_unit_2 (130 .lpm_widthp(width3)) mult_unit_2 ( 136 131 .clock(clock), 137 132 .clken(int_wren_reg), 138 133 .dataa(acc_data_reg[0][j*width2+width2-1:j*width2]), 139 134 .datab(amp_data_reg[j*8+8-1:j*8]), 140 .result(mul_data_wire[1][j*width r+widthr-1:j*widthr]));135 .result(mul_data_wire[1][j*width3+width3-1:j*width3])); 141 136 142 137 lpm_add_sub #( … … 145 140 .lpm_representation("SIGNED"), 146 141 .lpm_type("LPM_ADD_SUB"), 147 .lpm_width(width r)) add_unit_2 (148 .dataa(mul_data_wire[0][j*width r+widthr-1:j*widthr]),149 .datab(mul_data_wire[1][j*width r+widthr-1:j*widthr]),150 .result(add_data_wire[j*width r+widthr-1:j*widthr]));151 152 153 lpm_ clshift#(154 .lpm_ shifttype("LOGICAL"),155 .lpm_ type("LPM_CLSHIFT"),156 .lpm_ width(widthr),157 .lpm_ widthdist(6)) shift_unit_1 (158 . distance(cls_data_reg[j*6+6-1:j*6]),159 .d irection(1'b1),160 .data (add_data_wire[j*widthr+widthr-1:j*widthr]),142 .lpm_width(width3)) add_unit_2 ( 143 .dataa(mul_data_wire[0][j*width3+width3-1:j*width3]), 144 .datab(mul_data_wire[1][j*width3+width3-1:j*width3]), 145 .result(add_data_wire[j*width3+width3-1:j*width3])); 146 147 148 lpm_add_sub #( 149 .lpm_direction("ADD"), 150 .lpm_hint("ONE_INPUT_IS_CONSTANT=NO,CIN_USED=NO"), 151 .lpm_representation("UNSIGNED"), 152 .lpm_type("LPM_ADD_SUB"), 153 .lpm_width(widthr)) add_unit_3 ( 154 .dataa(add_data_wire[j*width3+shift+widthr-1:j*width3+shift]), 155 .datab({{(widthr-1){1'b0}}, add_data_wire[j*width3+shift-1]}), 161 156 .result(out_data_wire[j*widthr+widthr-1:j*widthr])); 162 157 … … 220 215 amp_data_reg <= 8'd0; 221 216 tau_data_reg <= 16'd0; 222 cls_data_reg <= 6'd0;223 217 for(i = 0; i <= 2; i = i + 1) 224 218 begin … … 240 234 amp_data_reg <= amp_data_next; 241 235 tau_data_reg <= tau_data_next; 242 cls_data_reg <= cls_data_next;243 236 for(i = 0; i <= 2; i = i + 1) 244 237 begin … … 262 255 amp_data_next = amp_data_reg; 263 256 tau_data_next = tau_data_reg; 264 cls_data_next = cls_data_reg;265 257 for(i = 0; i <= 2; i = i + 1) 266 258 begin … … 282 274 amp_data_next = 8'd0; 283 275 tau_data_next = 16'd0; 284 cls_data_next = 6'd0;285 276 for(i = 0; i <= 2; i = i + 1) 286 277 begin … … 327 318 tau_data_next = tau_data_wire[0]; 328 319 amp_data_next = amp_data_wire[0]; 329 cls_data_next = cls_data_wire[0];330 320 331 321 int_case_next = 3'd3; … … 346 336 tau_data_next = tau_data_wire[1]; 347 337 amp_data_next = amp_data_wire[1]; 348 cls_data_next = cls_data_wire[1];349 338 350 339 // register 1st sum … … 364 353 tau_data_next = tau_data_wire[2]; 365 354 amp_data_next = amp_data_wire[2]; 366 cls_data_next = cls_data_wire[2];367 355 368 356 // register 2nd sum
Note:
See TracChangeset
for help on using the changeset viewer.