Changeset 162 for trunk/MultiChannelUSB
- Timestamp:
- Feb 22, 2012, 11:09:22 PM (13 years ago)
- Location:
- trunk/MultiChannelUSB
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MultiChannelUSB/Paella.v
r161 r162 116 116 wire [4*12-1:0] int_mux_data [N-1:0]; 117 117 118 wire [1:0] amp_flag [ 2*N-1:0];119 wire [11:0] amp_data [ 2*N-1:0];120 121 wire [1:0] amp_mux_flag [ 1:0];122 wire [11:0] amp_mux_data [ 1:0];123 124 wire cnt_good [ N-1:0];118 wire [1:0] amp_flag [3*N-1:0]; 119 wire [11:0] amp_data [3*N-1:0]; 120 121 wire [1:0] amp_mux_flag [2:0]; 122 wire [11:0] amp_mux_data [2:0]; 123 124 wire cnt_good [3:0]; 125 125 wire [15:0] cnt_bits_wire; 126 126 … … 228 228 .lpm_width(14), 229 229 .lpm_widths(2)) amp_mux_unit_1 ( 230 .sel(cfg_bits[ 8][1:0]),230 .sel(cfg_bits[6][1:0]), 231 231 .data({ 232 {amp_flag[4], amp_data[4]},233 232 {amp_flag[2], amp_data[2]}, 233 {amp_flag[1], amp_data[1]}, 234 234 {amp_flag[0], amp_data[0]}}), 235 235 .result({amp_mux_flag[0], amp_mux_data[0]})); … … 240 240 .lpm_width(14), 241 241 .lpm_widths(2)) amp_mux_unit_2 ( 242 .sel(cfg_bits[ 8][5:4]),242 .sel(cfg_bits[6][5:4]), 243 243 .data({ 244 244 {amp_flag[5], amp_data[5]}, 245 {amp_flag[ 3], amp_data[3]},246 {amp_flag[ 1], amp_data[1]}}),245 {amp_flag[4], amp_data[4]}, 246 {amp_flag[3], amp_data[3]}}), 247 247 .result({amp_mux_flag[1], amp_mux_data[1]})); 248 249 lpm_mux #( 250 .lpm_size(3), 251 .lpm_type("LPM_MUX"), 252 .lpm_width(14), 253 .lpm_widths(2)) amp_mux_unit_3 ( 254 .sel(cfg_bits[6][9:8]), 255 .data({ 256 {amp_flag[8], amp_data[8]}, 257 {amp_flag[7], amp_data[7]}, 258 {amp_flag[6], amp_data[6]}}), 259 .result({amp_mux_flag[2], amp_mux_data[2]})); 248 260 249 261 generate … … 329 341 .frame(sys_frame), 330 342 .reset(1'b0), 331 .cfg_data(cfg_bits[ 6][11:0]),343 .cfg_data(cfg_bits[7][11:0]), 332 344 // .cfg_data(cfg_bits[6+2*j][11:0]), 333 345 .inp_data(clp_data[j]), 334 .out_flag(amp_flag[0+ 2*j]),335 .out_data(amp_data[0+ 2*j]));346 .out_flag(amp_flag[0+j]), 347 .out_data(amp_data[0+j])); 336 348 337 349 amplitude #(.width(12)) amplitude_unit_2 ( … … 339 351 .frame(sys_frame), 340 352 .reset(1'b0), 341 .cfg_data(cfg_bits[ 7][11:0]),353 .cfg_data(cfg_bits[8][11:0]), 342 354 // .cfg_data(cfg_bits[7+2*j][11:0]), 343 355 .inp_data(clp_data[j]), 344 .out_flag(amp_flag[1+2*j]), 345 .out_data(amp_data[1+2*j])); 356 .out_flag(amp_flag[3+j]), 357 .out_data(amp_data[3+j])); 358 359 amplitude #(.width(12)) amplitude_unit_3 ( 360 .clock(sys_clock), 361 .frame(sys_frame), 362 .reset(1'b0), 363 .cfg_data(cfg_bits[9][11:0]), 364 // .cfg_data(cfg_bits[7+2*j][11:0]), 365 .inp_data(clp_data[j]), 366 .out_flag(amp_flag[6+j]), 367 .out_data(amp_data[6+j])); 346 368 347 369 end 348 370 endgenerate 349 371 350 histogram32 histogram32_unit (372 histogram32 histogram32_unit_1 ( 351 373 .clock(sys_clock), 352 374 .frame(sys_frame), … … 361 383 .bus_busy(bus_busy[2])); 362 384 363 counter hst_counter_unit (385 counter hst_counter_unit_1 ( 364 386 .clock(sys_clock), 365 387 .frame((sys_frame) & (~amp_mux_flag[0][1])), … … 376 398 .cnt_good(cnt_good[0])); 377 399 400 histogram32 histogram32_unit_2 ( 401 .clock(sys_clock), 402 .frame(sys_frame), 403 .reset(cfg_bits[0][5]), 404 .hst_good((amp_mux_flag[0][0]) & (cnt_good[1]) & (cfg_bits[14][1])), 405 .hst_data(amp_mux_data[0]), 406 .bus_ssel(bus_ssel[3]), 407 .bus_wren(bus_wren), 408 .bus_addr(bus_addr[12:0]), 409 .bus_mosi(bus_mosi), 410 .bus_miso(bus_miso[3]), 411 .bus_busy(bus_busy[3])); 412 413 counter hst_counter_unit_2 ( 414 .clock(sys_clock), 415 .frame((sys_frame) & (~amp_mux_flag[0][1])), 416 // .frame(sys_frame), 417 .reset(cfg_bits[0][8]), 418 .setup(cfg_bits[14][0]), 419 .count(cfg_bits[14][1]), 420 .bus_ssel(bus_ssel[6]), 421 .bus_wren(bus_wren), 422 .bus_addr(bus_addr[1:0]), 423 .bus_mosi(bus_mosi), 424 .bus_miso(bus_miso[6]), 425 .bus_busy(bus_busy[6]), 426 .cnt_good(cnt_good[1])); 427 378 428 histogram16 histogram16_unit ( 379 429 .clock(sys_clock), 380 430 .frame(sys_frame), 381 431 .reset(cfg_bits[0][11]), 382 .hst_good((cnt_good[ 2]) & (~cnt_good[1])),432 .hst_good((cnt_good[3]) & (~cnt_good[2])), 383 433 .hst_data(cnt_bits_wire), 384 434 .bus_ssel(bus_ssel[8]), … … 394 444 // .frame(sys_frame), 395 445 .reset(cfg_bits[0][12]), 396 .setup((sys_frame) & (~cnt_good[ 1])),397 .count((cnt_good[ 2]) & (cfg_bits[16][1])),446 .setup((sys_frame) & (~cnt_good[2])), 447 .count((cnt_good[3]) & (cfg_bits[16][1])), 398 448 .bus_ssel(bus_ssel[9]), 399 449 .bus_wren(bus_wren), … … 402 452 .bus_miso(bus_miso[9]), 403 453 .bus_busy(bus_busy[9]), 404 .cnt_good(cnt_good[ 1]));454 .cnt_good(cnt_good[2])); 405 455 406 456 counter rmt_counter_2 ( 407 457 .clock(sys_clock), 408 .frame((sys_frame) & (~cnt_good[ 1])),458 .frame((sys_frame) & (~cnt_good[2])), 409 459 .reset(cfg_bits[0][13]), 410 460 .setup(cfg_bits[16][0]), … … 416 466 .bus_miso(bus_miso[10]), 417 467 .bus_busy(bus_busy[10]), 418 .cnt_good(cnt_good[ 2]));468 .cnt_good(cnt_good[3])); 419 469 420 470 lpm_counter #( … … 423 473 .lpm_type("LPM_COUNTER"), 424 474 .lpm_width(16)) lpm_counter_component ( 425 .sclr(((sys_frame) & (cnt_good[ 2]) & (~cnt_good[1])) | (cfg_bits[0][11])),426 .clock(sys_clock), 427 .cnt_en((sys_frame) & (amp_mux_flag[1][0]) & (cnt_good[ 1]) & (cnt_good[2]) & (cfg_bits[16][1])),475 .sclr(((sys_frame) & (cnt_good[3]) & (~cnt_good[2])) | (cfg_bits[0][11])), 476 .clock(sys_clock), 477 .cnt_en((sys_frame) & (amp_mux_flag[1][0]) & (cnt_good[2]) & (cnt_good[3]) & (cfg_bits[16][1])), 428 478 .q(cnt_bits_wire)); 429 479 -
trunk/MultiChannelUSB/UserInterface.tcl
r161 r162 248 248 set hstmux(1) 0 249 249 set hstmux(2) 0 250 set hstmux(3) 0 250 251 251 252 trace add variable [myvar chan_val] write [myproc chan_val_update] … … 260 261 $config(6).chan_3_1 select 261 262 263 $config(7).hstmux_1_1 select 264 $config(8).hstmux_2_2 select 265 $config(9).hstmux_3_1 select 266 262 267 for {set i 1} {$i <= 3} {incr i} { 263 $config(7).polar_$i select 264 } 265 266 $config(8).hstmux_1_1 select 267 $config(9).hstmux_2_1 select 268 $config(10).polar_$i select 269 } 268 270 } 269 271 … … 305 307 } 306 308 307 set config(7) [labelframe ${master}.mux_7 -borderwidth 1 -relief sunken -text { Polarity inversion} -font {-weight bold}]308 set config(8) [labelframe ${master}.mux_8 -borderwidth 1 -relief sunken -text {Spectrum histogram } -font {-weight bold}]309 set config(7) [labelframe ${master}.mux_7 -borderwidth 1 -relief sunken -text {Spectrum histogram 1} -font {-weight bold}] 310 set config(8) [labelframe ${master}.mux_8 -borderwidth 1 -relief sunken -text {Spectrum histogram 2} -font {-weight bold}] 309 311 set config(9) [labelframe ${master}.mux_9 -borderwidth 1 -relief sunken -text {Rate histogram} -font {-weight bold}] 312 313 set config(10) [labelframe ${master}.mux_10 -borderwidth 1 -relief sunken -text {Polarity inversion} -font {-weight bold}] 314 310 315 for {set i 1} {$i <= 3} {incr i} { 311 316 set value [expr {$i - 1}] 312 317 313 checkbutton $config(7).polar_$i -text "ADC $i" -variable [myvar polar($i)] 314 grid ${config(7)}.polar_$i 315 316 radiobutton $config(8).hstmux_1_$i -text "ADC $i" -variable [myvar hstmux(1)] -value $value 317 grid ${config(8)}.hstmux_1_$i 318 319 radiobutton $config(9).hstmux_2_$i -text "ADC $i" -variable [myvar hstmux(2)] -value $value 320 grid ${config(9)}.hstmux_2_$i 321 } 322 grid $config(7) -row 3 -column 0 -sticky news -padx 10 -pady 50 323 grid $config(8) -row 3 -column 1 -sticky news -padx 10 -pady 50 324 grid $config(9) -row 3 -column 2 -sticky news -padx 10 -pady 50 318 radiobutton $config(7).hstmux_1_$i -text "ADC $i" -variable [myvar hstmux(1)] -value $value 319 grid ${config(7)}.hstmux_1_$i 320 321 radiobutton $config(8).hstmux_2_$i -text "ADC $i" -variable [myvar hstmux(2)] -value $value 322 grid ${config(8)}.hstmux_2_$i 323 324 radiobutton $config(9).hstmux_3_$i -text "ADC $i" -variable [myvar hstmux(3)] -value $value 325 grid ${config(9)}.hstmux_3_$i 326 327 checkbutton $config(10).polar_$i -text "ADC $i" -variable [myvar polar($i)] 328 grid ${config(10)}.polar_$i 329 } 330 grid $config(7) -row 3 -column 0 -sticky news -padx 10 -pady 30 331 grid $config(8) -row 3 -column 1 -sticky news -padx 10 -pady 30 332 grid $config(9) -row 3 -column 2 -sticky news -padx 10 -pady 30 333 334 grid $config(10) -row 4 -column 0 -sticky news -padx 10 -pady 10 325 335 326 336 grid columnconfigure ${master} 0 -weight 1 … … 332 342 grid rowconfigure ${master} 2 -weight 0 333 343 grid rowconfigure ${master} 3 -weight 0 334 grid rowconfigure ${master} 4 -weight 1 344 grid rowconfigure ${master} 4 -weight 0 345 grid rowconfigure ${master} 5 -weight 1 335 346 336 347 } … … 364 375 my instvar controller hstmux 365 376 366 set value [format {%x%x }$hstmux(2) $hstmux(1)]367 368 $controller usbCmd 0002000 8000400${value}377 set value [format {%x%x%x} $hstmux(3) $hstmux(2) $hstmux(1)] 378 379 $controller usbCmd 0002000600040${value} 369 380 } 370 381 … … 587 598 } 588 599 589 set val_addr [format %02x [expr { 6 + 2 *${number}}]]600 set val_addr [format %02x [expr {7 + ${number}}]] 590 601 591 602 if {$thrs} { … … 793 804 set size 4096 794 805 795 set prefix [format {%x} [expr { $number + 2}]]806 set prefix [format {%x} [expr {2 + ${number}}]] 796 807 797 808 set value [format {%08x} [expr {$size * 2}]] … … 802 813 set yvec_new [usb::integrateBlt [myvar yvec] 0] 803 814 804 set prefix [format {%x} [expr { $number + 5}]]815 set prefix [format {%x} [expr {5 + ${number}}]] 805 816 set command 0001${prefix}000000200000003000400050000 806 817 … … 872 883 my set recs 0 873 884 874 vector create [myvar xvec]( 16384)875 vector create [myvar yvec]( 16384)876 877 # fill one vector for the x axis with 16384points878 [myvar xvec] seq -0.5 16384.5885 vector create [myvar xvec](4096) 886 vector create [myvar yvec](4096) 887 888 # fill one vector for the x axis with 4096 points 889 [myvar xvec] seq -0.5 4095.5 879 890 880 891 my setup … … 930 941 $graph grid configure -hide no 931 942 $graph legend configure -hide yes 932 $graph axis configure x -min 0 -max 16384943 $graph axis configure x -min 0 -max 4096 933 944 934 945 set config [frame ${master}.config -width 170] … … 1054 1065 1055 1066 set number 0 1056 set val_addr [format %02x [expr { 7 + 2 *${number}}]]1067 set val_addr [format %02x [expr {9 + ${number}}]] 1057 1068 1058 1069 if {$thrs} { … … 1255 1266 my instvar cntr cntr_val recs recs_val 1256 1267 1257 set size 163841268 set size 4096 1258 1269 1259 1270 set prefix [format {%x} 8] … … 1311 1322 1312 1323 CntDisplay instproc register {} { 1313 my save_data [join [[myvar yvec] range 0 16383] \n]1324 my save_data [join [[myvar yvec] range 0 4095] \n] 1314 1325 } 1315 1326 … … 1831 1842 1832 1843 set window [frame ${notebook}.hst_0] 1833 $notebook insert end -text "Spectrum histogram " -window $window -fill both1844 $notebook insert end -text "Spectrum histogram 1" -window $window -fill both 1834 1845 ::mca::HstDisplay hst_0 -number 0 -master $window -controller usb 1846 1847 set window [frame ${notebook}.hst_1] 1848 $notebook insert end -text "Spectrum histogram 2" -window $window -fill both 1849 ::mca::HstDisplay hst_1 -number 1 -master $window -controller usb 1835 1850 1836 1851 set window [frame ${notebook}.cnt_0] … … 1852 1867 hst_0 start 1853 1868 1869 hst_1 start 1870 1854 1871 cnt_0 start 1855 1872
Note:
See TracChangeset
for help on using the changeset viewer.