Changeset 122 for sandbox/MultiChannelUSB
- Timestamp:
- Feb 18, 2011, 12:29:10 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/MultiChannelUSB/cic_filter.v
r121 r122 12 12 ); 13 13 14 localparam widthr = width + 1 3;14 localparam widthr = width + 18; 15 15 16 16 /* … … 20 20 21 21 reg int_wren_reg, int_wren_next; 22 reg int_flag_reg, int_flag_next; 22 23 reg [1:0] int_chan_reg, int_chan_next; 23 24 reg [2:0] int_case_reg, int_case_next; … … 27 28 28 29 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 reg [size*widthr-1:0] int_data_reg [12:0], int_data_next [12:0]; 30 31 31 32 wire [size*widthr-1:0] acc_data_wire [3:0], del_data_wire [1:0]; … … 69 70 70 71 lpm_mux #( 71 .lpm_size( 3),72 .lpm_size(4), 72 73 .lpm_type("LPM_MUX"), 73 74 .lpm_width(10), … … 75 76 .sel(int_chan_next), 76 77 .data({ 78 2'd3, int_lfsr_reg[2*6+3:2*6], int_lfsr_reg[6+3:6], 77 79 2'd2, int_lfsr_reg[2*5+3:2*5], int_lfsr_reg[5+3:5], 78 80 2'd1, int_lfsr_reg[2*4+3:2*4], int_lfsr_reg[4+3:4], … … 85 87 begin 86 88 int_wren_reg <= 1'b1; 89 int_flag_reg <= 1'b0; 87 90 int_chan_reg <= 2'd0; 88 91 int_case_reg <= 3'd0; … … 92 95 acc_data_reg[i] <= {(size*widthr){1'b0}}; 93 96 end 94 for(i = 0; i <= 8; i = i + 1)97 for(i = 0; i <= 12; i = i + 1) 95 98 begin 96 99 int_data_reg[i] <= {(size*widthr){1'b0}}; … … 101 104 begin 102 105 int_wren_reg <= int_wren_next; 106 int_flag_reg <= int_flag_next; 103 107 int_chan_reg <= int_chan_next; 104 108 int_case_reg <= int_case_next; … … 108 112 acc_data_reg[i] <= acc_data_next[i]; 109 113 end 110 for(i = 0; i <= 8; i = i + 1)114 for(i = 0; i <= 12; i = i + 1) 111 115 begin 112 116 int_data_reg[i] <= int_data_next[i]; … … 119 123 begin 120 124 int_wren_next = int_wren_reg; 125 int_flag_next = int_flag_reg; 121 126 int_chan_next = int_chan_reg; 122 127 int_case_next = int_case_reg; … … 126 131 acc_data_next[i] = acc_data_reg[i]; 127 132 end 128 for(i = 0; i <= 8; i = i + 1)133 for(i = 0; i <= 12; i = i + 1) 129 134 begin 130 135 int_data_next[i] = int_data_reg[i]; … … 142 147 acc_data_next[i] = {(size*widthr){1'b0}}; 143 148 end 144 for(i = 0; i <= 8; i = i + 1)149 for(i = 0; i <= 12; i = i + 1) 145 150 begin 146 151 int_data_next[i] = {(size*widthr){1'b0}}; … … 155 160 begin 156 161 int_wren_next = 1'b0; 162 int_flag_next = 1'b0; 157 163 int_chan_next = 2'd0; 158 164 int_lfsr_next = 16'h7650; … … 162 168 2: // frame 163 169 begin 170 int_flag_next = 1'b0; 164 171 if (frame) 165 172 begin … … 179 186 int_case_next = 3'd3; 180 187 end 181 188 if (int_flag_reg) // register 4th sum 189 begin 190 // register 4th sum 191 int_data_next[9] = acc_data_wire[1]; 192 int_data_next[10] = acc_data_wire[2]; 193 int_data_next[11] = acc_data_wire[3]; 194 end 182 195 end 183 196 3: // 1st sum … … 204 217 begin 205 218 int_addr_next = {4'd2, int_lfsr_reg[3:0]}; 219 220 // set read addr for 4th pipeline 221 int_chan_next = 2'd3; 206 222 207 223 // prepare registers for 3rd sum … … 222 238 5: // 3rd sum 223 239 begin 224 int_wren_next = 1'b0; 240 int_flag_next = 1'b1; 241 242 int_addr_next = {4'd3, int_lfsr_reg[4:1]}; 225 243 226 244 // set read addr for 1st pipeline 227 245 int_chan_next = 2'd0; 246 247 // prepare registers for 4th sum 248 acc_data_next[0] = int_data_reg[8]; 249 acc_data_next[1] = int_data_reg[9]; 250 acc_data_next[2] = int_data_reg[10]; 251 acc_data_next[3] = int_data_reg[11]; 228 252 229 253 // register 3rd sum … … 231 255 int_data_next[7] = acc_data_wire[2]; 232 256 int_data_next[8] = acc_data_wire[3]; 257 258 // register 4th output 259 int_data_next[12] = int_data_reg[11]; 233 260 234 261 int_case_next = 3'd2; … … 241 268 end 242 269 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 assign out_data = int_data_reg[5]; 271 assign out_data2 = int_data_reg[8]; 272 assign out_data3 = int_data_reg[12]; 246 273 247 274 endmodule
Note:
See TracChangeset
for help on using the changeset viewer.