Changeset 184 for trunk/3DEES
- Timestamp:
- Jan 27, 2014, 3:49:22 PM (11 years ago)
- Location:
- trunk/3DEES
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/3DEES/Paella.v
r183 r184 94 94 95 95 wire cls_flag; 96 wire [ 5:0] cls_data;96 wire [6:0] cls_data; 97 97 98 98 wire [1:0] amp_mux_flag [2:0]; … … 200 200 assign int_mux_data[j] = { 201 201 // {4'd0, cls_flag, 7'd0}, 202 { 6'd0, cls_data},202 {5'd0, cls_data}, 203 203 {4'd0, amp_flag[j][0], 7'd0}, 204 204 amp_data[j][11:0], … … 292 292 .reset(1'b0), 293 293 // .del_data({6'd0, 6'd32, 6'd32, 6'd32}), 294 .del_data({6'd0, cfg_bits[3 5+6*j][5:0], cfg_bits[33+6*j][5:0], cfg_bits[31+6*j][5:0]}),294 .del_data({6'd0, cfg_bits[39+6*j][5:0], cfg_bits[37+6*j][5:0], cfg_bits[35+6*j][5:0]}), 295 295 .amp_data({6'd0, 6'd20, 6'd20, 6'd20}), 296 296 // .tau_data({16'd0, 16'd19835, 16'd19835, 16'd19835}), 297 297 // exp(-32/1000)*1024*20 298 .tau_data({16'd0, cfg_bits[3 4+6*j], cfg_bits[32+6*j], cfg_bits[30+6*j]}),298 .tau_data({16'd0, cfg_bits[38+6*j], cfg_bits[36+6*j], cfg_bits[34+6*j]}), 299 299 .inp_data({ 300 300 19'd0, cic_data[j*3+2][18:0], cic_data[j*3+1][18:0], cic_data[j*3+0][18:0]}), … … 340 340 // 12'd20, 12'd20, 12'd20, 12'd20, 12'd2000, 12'd20, 341 341 // 12'd20, 12'd2000, 12'd2000, 12'd20, 12'd1000, 12'd1000}), 342 .cfg_data({cfg_bits[29][11:0], cfg_bits[28][11:0], 342 .cfg_data({cfg_bits[33][11:0], cfg_bits[32][11:0], 343 cfg_bits[31][11:0], cfg_bits[30][11:0], cfg_bits[29][11:0], cfg_bits[28][11:0], 343 344 cfg_bits[27][11:0], cfg_bits[26][11:0], cfg_bits[25][11:0], cfg_bits[24][11:0], 344 345 cfg_bits[23][11:0], cfg_bits[22][11:0], cfg_bits[21][11:0], cfg_bits[20][11:0], … … 356 357 .reset(cfg_bits[0][5]), 357 358 .hst_good(cls_flag & cfg_bits[6][0]), 358 .hst_data(cls_data ),359 .hst_data(cls_data[5:0]), 359 360 .bus_ssel(bus_ssel[2]), 360 361 .bus_wren(bus_wren), -
trunk/3DEES/UserInterface.tcl
r183 r184 46 46 {1_0} 0 47 47 {1_1} 6 48 {1_2} 7 49 {1_3} 8 48 50 {2_0} 1 49 {2_1} 7 51 {2_1} 9 52 {2_2} 10 53 {2_3} 11 50 54 {3_0} 2 51 {3_1} 852 {3_2} 953 {3_3} 1 055 {3_1} 12 56 {3_2} 13 57 {3_3} 14 54 58 {4_0} 3 55 {4_1} 1 156 {4_2} 1 257 {4_3} 1 359 {4_1} 15 60 {4_2} 16 61 {4_3} 17 58 62 {5_0} 4 59 {5_1} 1 460 {5_2} 1 561 {5_3} 1663 {5_1} 18 64 {5_2} 19 65 {5_3} 20 62 66 {6_0} 5 63 {6_1} 1764 {6_2} 1865 {6_3} 1967 {6_1} 21 68 {6_2} 22 69 {6_3} 23 66 70 } 67 71 # ------------------------------------------------------------------------- … … 69 73 variable cfgThrs 70 74 array set cfgThrs { 71 0 8 72 6 50 73 1 8 74 7 50 75 2 10 76 8 31 77 9 52 78 10 79 79 3 60 80 11 135 81 12 171 82 13 233 83 4 249 84 14 348 85 15 495 86 16 693 87 5 505 88 17 606 89 18 707 90 19 808 75 0 8 76 6 150 77 7 200 78 8 3000 79 1 8 80 9 150 81 10 200 82 11 3000 83 2 10 84 12 31 85 13 52 86 14 79 87 3 60 88 15 135 89 16 171 90 17 233 91 4 249 92 18 348 93 19 495 94 20 693 95 5 505 96 21 606 97 22 707 98 23 808 91 99 } 92 100 … … 334 342 335 343 set thrs [frame ${master}.thrs] 336 set bins [frame ${master}.bins]337 344 set clip [frame ${master}.clip] 338 345 … … 340 347 341 348 set column 0 342 foreach {input} [list "ADC" " noise thrs" "e/p thrs"] {349 foreach {input} [list "ADC" "thrs 1" "thrs 2" "thrs 3" "thrs 4"] { 343 350 label ${config(thrs)}.label_${column} -text "${input}" 344 351 grid ${config(thrs)}.label_${column} -row 0 -column ${column} -sticky ew -padx 5 -pady 7 … … 346 353 } 347 354 348 foreach {ch id} [array get adcCodes {[1-2]}] {355 foreach {ch id} [array get adcCodes] { 349 356 label ${config(thrs)}.chan_${ch} -text "${id} " 350 357 grid ${config(thrs)}.chan_${ch} -row ${ch} -column 0 -sticky ew -padx 5 -pady 7 351 foreach {num} [list 0 1 ] {358 foreach {num} [list 0 1 2 3] { 352 359 set column [expr {$num + 1}] 353 360 set value $cfgCodes(${ch}_${num}) … … 360 367 361 368 grid $config(thrs) -row 0 -column 0 -sticky news -padx 10 362 363 set config(bins) [labelframe ${bins}.frame -borderwidth 1 -relief sunken -text {Thresholds}]364 365 set column 0366 foreach {input} [list "ADC" "thrs 1" "thrs 2" "thrs 3" "thrs 4"] {367 label ${config(bins)}.label_${column} -text "${input}"368 grid ${config(bins)}.label_${column} -row 0 -column ${column} -sticky ew -padx 5 -pady 7369 incr column370 }371 372 foreach {ch id} [array get adcCodes {[3-6]}] {373 label ${config(bins)}.chan_${ch} -text "${id} "374 grid ${config(bins)}.chan_${ch} -row ${ch} -column 0 -sticky ew -padx 5 -pady 7375 foreach {num} [list 0 1 2 3] {376 set column [expr {$num + 1}]377 set value $cfgCodes(${ch}_${num})378 spinbox ${config(bins)}.thrs_${value} -from 0 -to 4095 \379 -increment 10 -width 10 -textvariable [myvar thrs($value)] \380 -validate all -vcmd {::mca::validate 4095 4 %P}381 grid ${config(bins)}.thrs_${value} -row ${ch} -column ${column} -sticky w -padx 5 -pady 7382 }383 }384 385 grid $config(bins) -row 0 -column 0 -sticky news -padx 10386 369 387 370 set config(clip) [labelframe ${clip}.frame -borderwidth 1 -relief sunken -text {Signal clipping}] … … 409 392 grid $config(clip) -row 0 -column 0 -sticky news -padx 10 410 393 411 grid ${thrs} -row 0 -column 2 -sticky news 412 grid ${bins} -row 0 -column 1 -sticky news 394 grid ${thrs} -row 0 -column 1 -sticky news 413 395 grid ${clip} -row 0 -column 0 -sticky news 414 396 415 397 grid columnconfigure ${master} 0 -weight 1 416 398 grid columnconfigure ${master} 1 -weight 1 417 grid columnconfigure ${master} 2 -weight 1418 399 grid rowconfigure ${master} 0 -weight 1 419 400 420 401 grid rowconfigure ${thrs} 0 -weight 0 421 grid rowconfigure ${bins} 0 -weight 0422 402 grid rowconfigure ${clip} 0 -weight 0 423 403 } … … 433 413 set b $decay($i).0 434 414 set value [expr int(exp(-${a}/${b})*1024*20)] 435 append command [format {000200%02x0004%04x} [expr {3 0+ 2 * (${i} - 1)}] $value]415 append command [format {000200%02x0004%04x} [expr {34 + 2 * (${i} - 1)}] $value] 436 416 } 437 417 … … 446 426 set command {} 447 427 for {set i 1} {$i <= 6} {incr i} { 448 append command [format {000200%02x0004%04x} [expr {3 1+ 2 * (${i} - 1)}] $delay($i)]428 append command [format {000200%02x0004%04x} [expr {35 + 2 * (${i} - 1)}] $delay($i)] 449 429 } 450 430 … … 460 440 461 441 set command {} 462 for {set i 0} {$i <= 19} {incr i} {442 for {set i 0} {$i <= 23} {incr i} { 463 443 append command [format {000200%02x0004%04x} [expr {10 + ${i}}] $thrs($i)] 464 444 } -
trunk/3DEES/classifier.v
r183 r184 5 5 ( 6 6 input wire clock, frame, reset, 7 input wire [1 4*width-1:0] cfg_data,7 input wire [18*width-1:0] cfg_data, 8 8 input wire [6*width-1:0] inp_data, // {D3, D2, D1, S2, S1_S, S1_F} 9 9 input wire [5:0] inp_flag, 10 output wire [ 5:0] out_data,10 output wire [6:0] out_data, 11 11 output wire out_flag 12 12 ); 13 13 14 14 reg out_flag_reg [2:0], out_flag_next [2:0]; 15 reg [ 5:0] out_data_reg [2:0], out_data_next [2:0];15 reg [6:0] out_data_reg [2:0], out_data_next [2:0]; 16 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]; … … 22 22 wire [width-1:0] inp_data_wire [5:0]; 23 23 wire [3:0] int_pipe_wire [5:0]; 24 wire [1 3:0] int_comp_wire;24 wire [15:0] int_comp_wire; 25 25 26 26 integer i; … … 35 35 36 36 generate 37 assign int_comp_wire[0] = (inp_data_reg[0] > cfg_data[width-1:0]); 38 assign int_comp_wire[1] = (inp_data_reg[1] > cfg_data[2*width-1:width]); 37 assign int_comp_wire[0] = inp_flag_reg[0] & (inp_data_reg[0] < cfg_data[width-1:0]); 38 assign int_comp_wire[1] = inp_flag_reg[0] & (inp_data_reg[0] > cfg_data[2*width-1:1*width]) & (inp_data_reg[0] < cfg_data[3*width-1:2*width]); 39 40 assign int_comp_wire[2] = inp_flag_reg[1] & (inp_data_reg[1] < cfg_data[4*width-1:3*width]); 41 assign int_comp_wire[3] = inp_flag_reg[1] & (inp_data_reg[1] > cfg_data[5*width-1:4*width]) & (inp_data_reg[1] < cfg_data[6*width-1:5*width]); 42 39 43 for (j = 0; j < 4; j = j + 1) 40 44 begin : CLASSIFIER_COMPARTORS 41 assign int_comp_wire[j*3+0+ 2] = (inp_data_reg[j+2] > cfg_data[(j*3+0+2)*width+width-1:(j*3+0+2)*width]);42 assign int_comp_wire[j*3+1+ 2] = (inp_data_reg[j+2] > cfg_data[(j*3+1+2)*width+width-1:(j*3+1+2)*width]);43 assign int_comp_wire[j*3+2+ 2] = (inp_data_reg[j+2] > cfg_data[(j*3+2+2)*width+width-1:(j*3+2+2)*width]);45 assign int_comp_wire[j*3+0+4] = (inp_data_reg[j+2] > cfg_data[(j*3+0+6)*width+width-1:(j*3+0+6)*width]); 46 assign int_comp_wire[j*3+1+4] = (inp_data_reg[j+2] > cfg_data[(j*3+1+6)*width+width-1:(j*3+1+6)*width]); 47 assign int_comp_wire[j*3+2+4] = (inp_data_reg[j+2] > cfg_data[(j*3+2+6)*width+width-1:(j*3+2+6)*width]); 44 48 end 45 49 endgenerate … … 168 172 out_flag_next[2] = out_flag_reg[1] & (out_data_reg[1] > out_data_reg[0]); 169 173 170 int_pipe_next[0] = {int_pipe_reg[0][14:0], int_comp_wire[0]}; 171 int_pipe_next[1] = {int_pipe_reg[1][14:0], int_comp_wire[1]}; 172 for (i = 2; i < 8; i = i + 1) 174 for (i = 0; i < 4; i = i + 1) 175 begin 176 int_pipe_next[i] = {int_pipe_reg[i][14:0], int_comp_wire[i]}; 177 end 178 for (i = 4; i < 8; i = i + 1) 173 179 begin 174 180 int_pipe_next[i] = {int_pipe_reg[i][14:0], inp_flag_reg[i-2]}; … … 176 182 for (i = 8; i < 20; i = i + 1) 177 183 begin 178 int_pipe_next[i] = {int_pipe_reg[i][14:0], int_comp_wire[i- 6]};184 int_pipe_next[i] = {int_pipe_reg[i][14:0], int_comp_wire[i-4]}; 179 185 end 180 186 … … 182 188 begin 183 189 case (int_pipe_wire[i+2][2:0]) 184 3'b000: int_data_next[i] = 2' d0;185 3'b001: int_data_next[i] = 2' d1;186 3'b011: int_data_next[i] = 2' d2;187 3'b111: int_data_next[i] = 2' d3;190 3'b000: int_data_next[i] = 2'b00; 191 3'b001: int_data_next[i] = 2'b01; 192 3'b011: int_data_next[i] = 2'b10; 193 3'b111: int_data_next[i] = 2'b11; 188 194 default: int_data_next[i] = 2'd0; 189 195 endcase 190 196 end 191 197 192 int_temp_next[0] = {int_pipe_wire[1], int_pipe_wire[0][3]^int_pipe_wire[0][2]};198 int_temp_next[0] = {int_pipe_wire[1], ^int_pipe_wire[0]}; 193 199 int_temp_next[1] = {1'b0, int_pipe_wire[0]}; 194 200 195 201 case (int_temp_reg[0][4:0]) 196 5'b00011: out_data_next[0][3:0] = {2' d0, int_data_next[0]};197 5'b00111: out_data_next[0][3:0] = {2' d1, int_data_next[1]};198 5'b01111: out_data_next[0][3:0] = {2' d2, int_data_next[2]};199 5'b11111: out_data_next[0][3:0] = {2' d3, int_data_next[3]};202 5'b00011: out_data_next[0][3:0] = {2'b00, int_data_next[0]}; 203 5'b00111: out_data_next[0][3:0] = {2'b01, int_data_next[1]}; 204 5'b01111: out_data_next[0][3:0] = {2'b10, int_data_next[2]}; 205 5'b11111: out_data_next[0][3:0] = {2'b11, int_data_next[3]}; 200 206 default: out_flag_next[0] = 1'b0; 201 207 endcase … … 203 209 case (int_temp_reg[1][3:0]) 204 210 // S1_F, electron 205 4'b0 100: out_data_next[0][5:4] = 2'd0;211 4'b0001: out_data_next[0][6:4] = 3'b100; 206 212 207 213 // S1_F, proton 208 4'b0 101: out_data_next[0][5:4] = 2'd1;214 4'b0010: out_data_next[0][6:4] = 3'b101; 209 215 210 216 // S1_S, electron 211 4'b 1000: out_data_next[0][5:4] = 2'd2;217 4'b0100: out_data_next[0][6:4] = 3'b110; 212 218 213 219 // S1_S, proton 214 4'b10 10: out_data_next[0][5:4] = 2'd3;220 4'b1000: out_data_next[0][6:4] = 3'b111; 215 221 216 222 default: out_flag_next[0] = 1'b0;
Note:
See TracChangeset
for help on using the changeset viewer.