Changeset 121 for sandbox/MultiChannelUSB
- Timestamp:
- Feb 16, 2011, 9:50:21 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/MultiChannelUSB/cic_filter.v
r119 r121 26 26 wire [9:0] int_addr_wire; 27 27 28 reg [size*widthr-1:0] acc_data_reg [2:0], acc_data_next [2:0]; 29 reg [size*widthr-1:0] int_data_reg [5:0], int_data_next [5:0]; 30 31 wire [size*widthr-1:0] acc_data_wire [2:0], del_data_wire [1:0]; 32 33 wire [size*widthr-1:0] add_data_wire, sub_data_wire; 34 28 reg [size*widthr-1:0] acc_data_reg [3:0], acc_data_next [3:0]; 29 reg [size*widthr-1:0] int_data_reg [8:0], int_data_next [8:0]; 30 31 wire [size*widthr-1:0] acc_data_wire [3:0], del_data_wire [1:0]; 35 32 36 33 integer i; … … 44 41 // -2*del_data_1 + del_data_2 + inp_data + result 45 42 46 lpm_add_sub #( 47 .lpm_direction("ADD"), 48 .lpm_hint("ONE_INPUT_IS_CONSTANT=NO,CIN_USED=NO"), 49 .lpm_representation("SIGNED"), 50 .lpm_type("LPM_ADD_SUB"), 51 .lpm_width(widthr)) add_unit_1 ( 52 .dataa(acc_data_reg[0][j*widthr+widthr-1:j*widthr]), 53 .datab(del_data_wire[1][j*widthr+widthr-1:j*widthr]), 54 .result(add_data_wire[j*widthr+widthr-1:j*widthr])); 55 56 lpm_add_sub #( 57 .lpm_direction("SUB"), 58 .lpm_hint("ONE_INPUT_IS_CONSTANT=NO,CIN_USED=NO"), 59 .lpm_representation("SIGNED"), 60 .lpm_type("LPM_ADD_SUB"), 61 .lpm_width(widthr)) sub_unit_1 ( 62 .dataa(acc_data_reg[1][j*widthr+widthr-1:j*widthr]), 63 .datab({del_data_wire[0][j*widthr+widthr-1],del_data_wire[0][j*widthr+widthr-3:j*widthr], 1'b0}), 64 .result(sub_data_wire[j*widthr+widthr-1:j*widthr])); 65 66 lpm_add_sub #( 67 .lpm_direction("ADD"), 68 .lpm_hint("ONE_INPUT_IS_CONSTANT=NO,CIN_USED=NO"), 69 .lpm_representation("SIGNED"), 70 .lpm_type("LPM_ADD_SUB"), 71 .lpm_width(widthr)) acc_unit_1 ( 72 .dataa(add_data_wire[j*widthr+widthr-1:j*widthr]), 73 .datab(sub_data_wire[j*widthr+widthr-1:j*widthr]), 74 .result(acc_data_wire[1][j*widthr+widthr-1:j*widthr])); 75 76 lpm_add_sub #( 77 .lpm_direction("ADD"), 78 .lpm_hint("ONE_INPUT_IS_CONSTANT=NO,CIN_USED=NO"), 79 .lpm_representation("SIGNED"), 80 .lpm_type("LPM_ADD_SUB"), 81 .lpm_width(widthr)) acc_unit_2 ( 82 .dataa(acc_data_reg[1][j*widthr+widthr-1:j*widthr]), 83 .datab(acc_data_reg[2][j*widthr+widthr-1:j*widthr]), 84 .result(acc_data_wire[2][j*widthr+widthr-1:j*widthr])); 43 assign acc_data_wire[1][j*widthr+widthr-1:j*widthr] = 44 acc_data_reg[0][j*widthr+widthr-1:j*widthr] 45 + del_data_wire[1][j*widthr+widthr-1:j*widthr] 46 - {del_data_wire[0][j*widthr+widthr-1],del_data_wire[0][j*widthr+widthr-3:j*widthr], 1'b0}; 47 48 assign acc_data_wire[2][j*widthr+widthr-1:j*widthr] = 49 acc_data_reg[1][j*widthr+widthr-1:j*widthr] 50 + acc_data_reg[2][j*widthr+widthr-1:j*widthr]; 51 52 assign acc_data_wire[3][j*widthr+widthr-1:j*widthr] = 53 acc_data_reg[2][j*widthr+widthr-1:j*widthr] 54 + acc_data_reg[3][j*widthr+widthr-1:j*widthr]; 85 55 86 56 end … … 118 88 int_case_reg <= 3'd0; 119 89 int_addr_reg <= 8'd0; 120 for(i = 0; i <= 2; i = i + 1)90 for(i = 0; i <= 3; i = i + 1) 121 91 begin 122 92 acc_data_reg[i] <= {(size*widthr){1'b0}}; 123 93 end 124 for(i = 0; i <= 5; i = i + 1)94 for(i = 0; i <= 8; i = i + 1) 125 95 begin 126 96 int_data_reg[i] <= {(size*widthr){1'b0}}; … … 134 104 int_case_reg <= int_case_next; 135 105 int_addr_reg <= int_addr_next; 136 for(i = 0; i <= 2; i = i + 1)106 for(i = 0; i <= 3; i = i + 1) 137 107 begin 138 108 acc_data_reg[i] <= acc_data_next[i]; 139 109 end 140 for(i = 0; i <= 5; i = i + 1)110 for(i = 0; i <= 8; i = i + 1) 141 111 begin 142 112 int_data_reg[i] <= int_data_next[i]; … … 152 122 int_case_next = int_case_reg; 153 123 int_addr_next = int_addr_reg; 154 for(i = 0; i <= 2; i = i + 1)124 for(i = 0; i <= 3; i = i + 1) 155 125 begin 156 126 acc_data_next[i] = acc_data_reg[i]; 157 127 end 158 for(i = 0; i <= 5; i = i + 1)128 for(i = 0; i <= 8; i = i + 1) 159 129 begin 160 130 int_data_next[i] = int_data_reg[i]; … … 168 138 int_wren_next = 1'b1; 169 139 int_addr_next = 8'd0; 170 for(i = 0; i <= 2; i = i + 1)140 for(i = 0; i <= 3; i = i + 1) 171 141 begin 172 142 acc_data_next[i] = {(size*widthr){1'b0}}; 173 143 end 174 for(i = 0; i <= 5; i = i + 1)144 for(i = 0; i <= 8; i = i + 1) 175 145 begin 176 146 int_data_next[i] = {(size*widthr){1'b0}}; … … 205 175 acc_data_next[1] = int_data_reg[0]; 206 176 acc_data_next[2] = int_data_reg[1]; 177 acc_data_next[3] = int_data_reg[2]; 207 178 208 179 int_case_next = 3'd3; … … 218 189 219 190 // prepare registers for 2nd sum 220 acc_data_next[0] = int_data_reg[1]; 221 acc_data_next[1] = int_data_reg[2]; 222 acc_data_next[2] = int_data_reg[3]; 191 acc_data_next[0] = int_data_reg[2]; 192 acc_data_next[1] = int_data_reg[3]; 193 acc_data_next[2] = int_data_reg[4]; 194 acc_data_next[3] = int_data_reg[5]; 223 195 224 196 // register 1st sum 225 197 int_data_next[0] = acc_data_wire[1]; 226 198 int_data_next[1] = acc_data_wire[2]; 199 int_data_next[2] = acc_data_wire[3]; 227 200 228 201 int_case_next = 3'd4; … … 233 206 234 207 // prepare registers for 3rd sum 235 acc_data_next[0] = int_data_reg[3]; 236 acc_data_next[1] = int_data_reg[4]; 237 acc_data_next[2] = int_data_reg[5]; 208 acc_data_next[0] = int_data_reg[5]; 209 acc_data_next[1] = int_data_reg[6]; 210 acc_data_next[2] = int_data_reg[7]; 211 acc_data_next[3] = int_data_reg[8]; 238 212 239 213 // register 2nd sum 240 int_data_next[2] = acc_data_wire[1]; 241 int_data_next[3] = acc_data_wire[2]; 214 int_data_next[3] = acc_data_wire[1]; 215 int_data_next[4] = acc_data_wire[2]; 216 int_data_next[5] = acc_data_wire[3]; 242 217 243 218 int_lfsr_next = {int_lfsr_reg[14:0], int_lfsr_reg[2] ~^ int_lfsr_reg[3]}; … … 253 228 254 229 // register 3rd sum 255 int_data_next[4] = acc_data_wire[1]; 256 int_data_next[5] = acc_data_wire[2]; 230 int_data_next[6] = acc_data_wire[1]; 231 int_data_next[7] = acc_data_wire[2]; 232 int_data_next[8] = acc_data_wire[3]; 257 233 258 234 int_case_next = 3'd2; … … 265 241 end 266 242 267 assign out_data = int_data_reg[ 1];268 assign out_data2 = int_data_reg[ 3];269 assign out_data3 = int_data_reg[ 5];243 assign out_data = int_data_reg[2]; 244 assign out_data2 = int_data_reg[5]; 245 assign out_data3 = int_data_reg[8]; 270 246 271 247 endmodule
Note:
See TracChangeset
for help on using the changeset viewer.