Changeset 181
- Timestamp:
- Jan 15, 2014, 4:51:59 PM (11 years ago)
- Location:
- trunk/3DEES
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/3DEES/Paella.v
r180 r181 290 290 .frame(sys_frame), 291 291 .reset(1'b0), 292 .del_data({6'd0, 6'd32, 6'd32, 6'd32}),293 //.del_data({6'd0, cfg_bits[35+6*j][5:0], cfg_bits[33+6*j][5:0], cfg_bits[31+6*j][5:0]}),292 // .del_data({6'd0, 6'd32, 6'd32, 6'd32}), 293 .del_data({6'd0, cfg_bits[35+6*j][5:0], cfg_bits[33+6*j][5:0], cfg_bits[31+6*j][5:0]}), 294 294 .amp_data({6'd0, 6'd20, 6'd20, 6'd20}), 295 .tau_data({16'd0, 16'd19835, 16'd19835, 16'd19835}),295 // .tau_data({16'd0, 16'd19835, 16'd19835, 16'd19835}), 296 296 // exp(-32/1000)*1024*20 297 //.tau_data({16'd0, cfg_bits[33+6*j], cfg_bits[32+6*j], cfg_bits[30+6*j]}),297 .tau_data({16'd0, cfg_bits[33+6*j], cfg_bits[32+6*j], cfg_bits[30+6*j]}), 298 298 .inp_data({ 299 299 19'd0, cic_data[j*3+2][18:0], cic_data[j*3+1][18:0], cic_data[j*3+0][18:0]}), … … 322 322 .frame(sys_frame), 323 323 .reset(1'b0), 324 .min_data(13'd20), 324 // .min_data(13'd20), 325 .min_data(cfg_bits[10+j][12:0]), 325 326 .max_data(13'd4095), 326 327 .inp_data(clp_data[j]), … … 335 336 .frame(sys_frame), 336 337 .reset(1'b0), 337 .cfg_data({12'd20, 12'd20, 338 12'd20, 12'd20, 12'd20, 12'd20, 12'd2000, 12'd20, 339 12'd20, 12'd2000, 12'd2000, 12'd20, 12'd1000, 12'd1000}), 338 // .cfg_data({12'd20, 12'd20, 339 // 12'd20, 12'd20, 12'd20, 12'd20, 12'd2000, 12'd20, 340 // 12'd20, 12'd2000, 12'd2000, 12'd20, 12'd1000, 12'd1000}), 341 .cfg_data({cfg_bits[29][11:0], cfg_bits[28][11:0], 342 cfg_bits[27][11:0], cfg_bits[26][11:0], cfg_bits[25][11:0], cfg_bits[24][11:0], 343 cfg_bits[23][11:0], cfg_bits[22][11:0], cfg_bits[21][11:0], cfg_bits[20][11:0], 344 cfg_bits[19][11:0], cfg_bits[18][11:0], cfg_bits[17][11:0], cfg_bits[16][11:0]}), 340 345 .inp_data({amp_data[5][11:0], amp_data[4][11:0], amp_data[0][11:0], 341 346 amp_data[0][11:0], amp_data[1][11:0], amp_data[0][11:0]}), -
trunk/3DEES/UserInterface.tcl
r180 r181 32 32 variable adcCodes 33 33 array set adcCodes { 34 1 {ADC 1} 35 2 {ADC 2} 36 3 {ADC 3} 37 4 {ADC 4} 38 5 {ADC 5} 39 6 {ADC 6} 40 } 41 34 1 {S1_F} 35 2 {S1_S} 36 3 {S2} 37 4 {D1} 38 5 {D2} 39 6 {D3} 40 } 41 42 # ------------------------------------------------------------------------- 43 44 variable cfgCodes 45 array set cfgCodes { 46 {1_0} 0 47 {1_1} 6 48 {2_0} 1 49 {2_1} 7 50 {3_0} 2 51 {3_1} 8 52 {3_2} 9 53 {3_3} 10 54 {4_0} 3 55 {4_1} 11 56 {4_2} 12 57 {4_3} 13 58 {5_0} 4 59 {5_1} 14 60 {5_2} 15 61 {5_3} 16 62 {6_0} 5 63 {6_1} 17 64 {6_2} 18 65 {6_3} 19 66 } 67 # ------------------------------------------------------------------------- 68 69 variable cfgThrs 70 array set cfgThrs { 71 0 20 72 6 2000 73 1 20 74 7 2000 75 2 20 76 8 200 77 9 2000 78 10 3000 79 3 20 80 11 200 81 12 2000 82 13 3000 83 4 20 84 14 200 85 15 2000 86 16 3000 87 5 20 88 17 200 89 18 2000 90 19 3000 91 } 92 93 42 94 # ------------------------------------------------------------------------- 43 95 … … 253 305 CfgDisplay instproc start {} { 254 306 variable adcCodes 255 my instvar config 307 variable cfgThrs 308 309 foreach {ch id} [array get adcCodes] { 310 my set delay($ch) 32 311 my set decay($ch) 1000 312 } 313 314 foreach {i value} [array get cfgThrs] { 315 my set thrs($i) $value 316 } 256 317 257 318 trace add variable [myvar decay] write [myproc decay_update] 258 319 trace add variable [myvar delay] write [myproc delay_update] 259 320 trace add variable [myvar thrs] write [myproc thrs_update] 260 261 foreach {ch id} [array get adcCodes] { 262 ${config(clip)}.delay_${ch} set 32 263 ${config(clip)}.decay_${ch} set 1000 264 } 265 266 for {set i 0} {$i <= 3} {incr i} { 267 ${config(thrs)}.thrs_${i} set 100 268 } 269 270 for {set i 4} {$i <= 19} {incr i} { 271 ${config(bins)}.thrs_${i} set 100 272 } 321 322 my delay_update 323 my thrs_update 273 324 } 274 325 … … 277 328 CfgDisplay instproc setup {} { 278 329 variable adcCodes 330 variable cfgCodes 279 331 my instvar number master 280 332 my instvar config … … 294 346 295 347 foreach {ch id} [array get adcCodes {[1-2]}] { 296 label ${config(thrs)}.chan_${ch} -text "${ ch} "348 label ${config(thrs)}.chan_${ch} -text "${id} " 297 349 grid ${config(thrs)}.chan_${ch} -row ${ch} -column 0 -sticky ew -padx 5 -pady 7 298 350 foreach {num} [list 0 1] { 299 351 set column [expr {$num + 1}] 300 set value [expr {2 * ($ch - 1) + $num}]301 puts "${ num} ${ch} ${value}"352 set value $cfgCodes(${ch}_${num}) 353 puts "${ch} ${num} ${value}" 302 354 spinbox ${config(thrs)}.thrs_${value} -from 0 -to 4095 \ 303 355 -increment 10 -width 10 -textvariable [myvar thrs($value)] \ … … 319 371 320 372 foreach {ch id} [array get adcCodes {[3-6]}] { 321 label ${config(bins)}.chan_${ch} -text "${ ch} "373 label ${config(bins)}.chan_${ch} -text "${id} " 322 374 grid ${config(bins)}.chan_${ch} -row ${ch} -column 0 -sticky ew -padx 5 -pady 7 323 375 foreach {num} [list 0 1 2 3] { 324 376 set column [expr {$num + 1}] 325 set value [expr {4 * ($ch - 2) + $num}]326 puts "${ num} ${ch} ${value}"377 set value $cfgCodes(${ch}_${num}) 378 puts "${ch} ${num} ${value}" 327 379 spinbox ${config(bins)}.thrs_${value} -from 0 -to 4095 \ 328 380 -increment 10 -width 10 -textvariable [myvar thrs($value)] \ … … 344 396 345 397 foreach {ch id} [array get adcCodes] { 346 label ${config(clip)}.chan_${ch} -text "${ ch} "398 label ${config(clip)}.chan_${ch} -text "${id} " 347 399 grid ${config(clip)}.chan_${ch} -row ${ch} -column 0 -sticky ew -padx 5 -pady 7 348 400 spinbox ${config(clip)}.delay_${ch} -from 0 -to 62 \ … … 381 433 set a $delay($i).0 382 434 set b $decay($i).0 383 set value [expr int(exp(-${a}/${b})*1024* 17)]435 set value [expr int(exp(-${a}/${b})*1024*20)] 384 436 append command [format {000200%02x0004%04x} [expr {30 + 2 * (${i} - 1)}] $value] 385 437 } … … 492 544 incr column 493 545 } 494 foreach {ch dummy} $adcList {495 label $config($osc).chan_${ch} -text "${ ch} "546 foreach {ch id} $adcList { 547 label $config($osc).chan_${ch} -text "${id} " 496 548 grid $config($osc).chan_${ch} -row ${ch} -column 0 -sticky ew 497 549 foreach {code input} $inpList { -
trunk/3DEES/classifier.v
r180 r181 12 12 ); 13 13 14 reg int_case_reg, int_case_next;15 14 reg out_flag_reg, out_flag_next; 16 15 reg [5:0] out_data_reg, out_data_next; 16 reg [5:0] inp_flag_reg, inp_flag_next; 17 17 reg [width-1:0] inp_data_reg [5:0], inp_data_next [5:0]; 18 18 reg [15:0] int_pipe_reg [19:0], int_pipe_next [19:0]; 19 19 reg [1:0] int_data_reg [3:0], int_data_next [3:0]; 20 reg [4:0] int_temp_reg [1:0], int_temp_next [1:0]; 20 21 21 22 wire [width-1:0] inp_data_wire [5:0]; … … 60 61 if (reset) 61 62 begin 63 inp_flag_reg <= {(6){1'b0}}; 62 64 out_data_reg <= {(6){1'b0}}; 63 65 out_flag_reg <= 1'b0; … … 74 76 int_data_reg[i] <= {(2){1'b0}}; 75 77 end 78 for (i = 0; i < 2; i = i + 1) 79 begin 80 int_temp_reg[i] <= {(5){1'b0}}; 81 end 76 82 end 77 83 else 78 84 begin 85 inp_flag_reg <= inp_flag_next; 79 86 out_data_reg <= out_data_next; 80 87 out_flag_reg <= out_flag_next; … … 90 97 begin 91 98 int_data_reg[i] <= int_data_next[i]; 99 end 100 for (i = 0; i < 2; i = i + 1) 101 begin 102 int_temp_reg[i] <= int_temp_next[i]; 92 103 end 93 104 end … … 96 107 always @* 97 108 begin 109 inp_flag_next = inp_flag_reg; 98 110 out_data_next = out_data_reg; 99 111 out_flag_next = out_flag_reg; … … 110 122 int_data_next[i] = int_data_reg[i]; 111 123 end 124 for (i = 0; i < 2; i = i + 1) 125 begin 126 int_temp_next[i] = int_temp_reg[i]; 127 end 112 128 113 129 if (frame) 114 130 begin 131 inp_flag_next = inp_flag; 115 132 for (i = 0; i < 6; i = i + 1) 116 133 begin 117 inp_data_next[i] = inp_ flag[i] ? inp_data_wire[i] : {(width){1'b0}};134 inp_data_next[i] = inp_data_wire[i]; 118 135 end 119 136 … … 125 142 int_pipe_next[i] = {(16){1'b0}}; 126 143 end 144 int_temp_next[0] = {(5){1'b0}}; 145 int_temp_next[1] = {(5){1'b0}}; 127 146 out_data_next = {(6){1'b0}}; 128 147 end … … 134 153 for (i = 2; i < 8; i = i + 1) 135 154 begin 136 int_pipe_next[i] = {int_pipe_reg[i][14:0], inp_flag [i-2]};155 int_pipe_next[i] = {int_pipe_reg[i][14:0], inp_flag_reg[i-2]}; 137 156 end 138 157 for (i = 8; i < 20; i = i + 1) … … 151 170 endcase 152 171 end 153 154 case ({int_pipe_wire[1], int_pipe_wire[0][3]^int_pipe_wire[0][2]}) 172 173 int_temp_next[0] = {int_pipe_wire[1], int_pipe_wire[0][3]^int_pipe_wire[0][2]}; 174 int_temp_next[1] = {1'b0, int_pipe_wire[0]}; 175 176 case (int_temp_reg[0][4:0]) 155 177 5'b00011: out_data_next[3:0] = {2'd0, int_data_next[0]}; 156 178 5'b00111: out_data_next[3:0] = {2'd1, int_data_next[1]}; … … 160 182 endcase 161 183 162 case (int_ pipe_wire[0])184 case (int_temp_reg[1][3:0]) 163 185 // S1_F, electron 164 4'b0 001: out_data_next[5:4] = 2'd0;186 4'b0100: out_data_next[5:4] = 2'd0; 165 187 166 188 // S1_F, proton … … 168 190 169 191 // S1_S, electron 170 4'b 0010: out_data_next[5:4] = 2'd2;192 4'b1000: out_data_next[5:4] = 2'd2; 171 193 172 194 // S1_S, proton … … 179 201 end 180 202 181 // assign out_data = {2'd0, int_data_reg[1]}; 182 // assign out_data = {2'd0, int_pipe_wire[7:4]}; 203 // assign out_data = {1'd0, int_pipe_wire[1+2][2:0], int_data_reg[1]}; 204 // assign out_data = {1'd0, int_comp_wire[0], int_temp_reg[1][3:0]}; 205 // assign out_data = {1'd0, int_temp_reg[0][4:0]}; 183 206 assign out_data = out_data_reg; 184 207 assign out_flag = out_flag_reg;
Note:
See TracChangeset
for help on using the changeset viewer.