- Timestamp:
- Jan 15, 2014, 1:30:27 AM (11 years ago)
- Location:
- trunk/3DEES
- Files:
-
- 1 added
- 4 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/3DEES/Paella.qsf
r179 r180 97 97 set_location_assignment PIN_56 -to USB_PB[2] 98 98 set_location_assignment PIN_57 -to USB_PB[3] 99 set_location_assignment PIN_78 -to PWM[0]100 set_location_assignment PIN_80 -to PWM[1]101 set_location_assignment PIN_81 -to PWM[2]102 set_location_assignment PIN_82 -to PWM[3]103 set_location_assignment PIN_114 -to SPI_SEL[0]104 set_location_assignment PIN_117 -to ADC_RST105 set_location_assignment PIN_118 -to SPI_CLK106 set_location_assignment PIN_119 -to SPI_SDO107 set_location_assignment PIN_120 -to SPI_SEL[1]108 99 set_location_assignment PIN_137 -to "ADC_D[0](n)" 109 100 set_location_assignment PIN_139 -to ADC_D[0] … … 191 182 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to USB_SLWR 192 183 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to USB_IFCLK 193 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to PWM[0]194 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to PWM[1]195 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to PWM[2]196 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to PWM[3]197 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SPI_SEL[0]198 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to ADC_RST199 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SPI_CLK200 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SPI_SDO201 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SPI_SEL[1]202 184 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to RAM_ADDR[0] 203 185 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to RAM_ADDR[1] … … 242 224 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to RAM_DQB[6] 243 225 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to RAM_DQB[7] 244 set_instance_assignment -name AUTO_OPEN_DRAIN_PINS ON -to PWM[0]245 set_instance_assignment -name AUTO_OPEN_DRAIN_PINS ON -to PWM[1]246 set_instance_assignment -name AUTO_OPEN_DRAIN_PINS ON -to PWM[2]247 set_instance_assignment -name AUTO_OPEN_DRAIN_PINS ON -to PWM[3]248 226 249 227 set_global_assignment -name MISC_FILE "D:/altera/MultiChannelUSB/Paella.dpf" … … 254 232 set_global_assignment -name VERILOG_FILE control.v 255 233 set_global_assignment -name VERILOG_FILE analyser.v 234 set_global_assignment -name VERILOG_FILE classifier.v 256 235 set_global_assignment -name VERILOG_FILE amplitude.v 257 236 set_global_assignment -name VERILOG_FILE deconv.v … … 261 240 set_global_assignment -name VERILOG_FILE counter.v 262 241 set_global_assignment -name VERILOG_FILE histogram32.v 263 set_global_assignment -name VERILOG_FILE histogram16.v264 242 set_global_assignment -name VERILOG_FILE trigger.v 265 243 set_global_assignment -name VERILOG_FILE oscilloscope.v 266 244 set_global_assignment -name VERILOG_FILE configuration.v 267 245 set_global_assignment -name VERILOG_FILE usb_fifo.v 268 set_global_assignment -name VERILOG_FILE i2c_fifo.v269 set_global_assignment -name VERILOG_FILE spi_fifo.v270 246 set_global_assignment -name VERILOG_FILE test.v 271 247 set_global_assignment -name MIF_FILE test.mif … … 274 250 set_global_assignment -name VERILOG_FILE new_filter.v 275 251 set_global_assignment -name VERILOG_FILE clip.v 276 set_global_assignment -name VERILOG_FILE pwm.v277 252 set_global_assignment -name MISC_FILE "D:/altera/3DEES-6ch/Paella.dpf" 278 253 set_global_assignment -name FMAX_REQUIREMENT "100 MHz" -section_id "100 MHz Clock" 279 254 set_instance_assignment -name CLOCK_SETTINGS "100 MHz Clock" -to CLK_100MHz 255 set_global_assignment -name MISC_FILE "D:/altera/3DEES/Paella.dpf" 280 256 set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top -
trunk/3DEES/Paella.v
r178 r180 7 7 input wire ADC_FCO, 8 8 input wire [5:0] ADC_D, 9 10 output wire [3:0] PWM,11 12 output wire [1:0] SPI_SEL,13 output wire SPI_SDO,14 output wire SPI_CLK,15 output wire ADC_RST,16 9 17 10 output wire USB_SLRD, … … 43 36 assign RAM_ADDR = 20'h00000; 44 37 */ 45 assign ADC_RST = 1'b0;46 38 47 39 assign RAM_CLK = sys_clock; … … 101 93 wire [12:0] amp_data [3*N-1:0]; 102 94 95 wire cls_flag; 96 wire [5:0] cls_data; 97 103 98 wire [1:0] amp_mux_flag [2:0]; 104 99 wire [11:0] amp_mux_data [2:0]; … … 125 120 wire i2c_reset; 126 121 127 assign tmp_data = 12' h000;122 assign tmp_data = 12'd0; 128 123 assign sys_clock = CLK_100MHz; 129 124 /* … … 167 162 wire cfg_reset; 168 163 169 wire [ 12:0] bus_ssel;164 wire [2:0] bus_ssel; 170 165 wire bus_wren; 171 166 wire [31:0] bus_addr; 172 167 wire [15:0] bus_mosi; 173 wire [15:0] bus_miso [ 10:0];174 wire [ 12:0] bus_busy;168 wire [15:0] bus_miso [2:0]; 169 wire [2:0] bus_busy; 175 170 176 171 wire [15:0] mrg_bus_miso; 177 172 wire mrg_bus_busy; 178 173 179 wire [ 11*16-1:0] int_bus_miso;174 wire [3*16-1:0] int_bus_miso; 180 175 181 176 genvar j; … … 203 198 begin : MUX_DATA 204 199 assign int_mux_data[j] = { 205 {4'd0, amp_flag[j][0], 7'd0}, 200 {6'd0, cls_data}, 201 {4'd0, cls_flag, 7'd0}, 202 // {4'd0, amp_flag[j][0], 7'd0}, 206 203 amp_data[j][11:0], 207 clp_data[j][11:0], 208 sys_data[j]}; 204 clp_data[j][11:0] 205 // sys_data[j] 206 }; 209 207 end 210 208 endgenerate … … 288 286 begin : DECONV_CHAIN 289 287 290 clip #(.shift(2 2), .width(19), .widthr(12)) clip_unit (288 clip #(.shift(21), .width(19), .widthr(13)) clip_unit ( 291 289 .clock(sys_clock), 292 290 .frame(sys_frame), 293 291 .reset(1'b0), 294 292 .del_data({6'd0, 6'd32, 6'd32, 6'd32}), 295 // .del_data({6'd0, cfg_bits[3 7+6*j][5:0], cfg_bits[35+6*j][5:0], cfg_bits[33+6*j][5:0]}),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]}), 296 294 .amp_data({6'd0, 6'd20, 6'd20, 6'd20}), 297 295 .tau_data({16'd0, 16'd19835, 16'd19835, 16'd19835}), 298 296 // exp(-32/1000)*1024*20 299 // .tau_data({16'd0, cfg_bits[3 6+6*j], cfg_bits[34+6*j], cfg_bits[32+6*j]}),297 // .tau_data({16'd0, cfg_bits[33+6*j], cfg_bits[32+6*j], cfg_bits[30+6*j]}), 300 298 .inp_data({ 301 299 19'd0, cic_data[j*3+2][18:0], cic_data[j*3+1][18:0], cic_data[j*3+0][18:0]}), … … 324 322 .frame(sys_frame), 325 323 .reset(1'b0), 326 .min_data( {1'b0, cfg_bits[7][11:0]}),324 .min_data(13'd20), 327 325 .max_data(13'd4095), 328 // .cfg_data(cfg_bits[6+2*j][11:0]),329 326 .inp_data(clp_data[j]), 330 327 .out_flag(amp_flag[j]), … … 333 330 endgenerate 334 331 332 // {D3, D2, D1, S2, S1_S, S1_F} 333 classifier #(.width(12)) classifier_unit ( 334 .clock(sys_clock), 335 .frame(sys_frame), 336 .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}), 340 .inp_data({amp_data[5][11:0], amp_data[4][11:0], amp_data[0][11:0], 341 amp_data[0][11:0], amp_data[1][11:0], amp_data[0][11:0]}), 342 .inp_flag({amp_flag[5][0], amp_flag[4][0], amp_flag[0][0], 343 amp_flag[0][0], amp_flag[1][0], amp_flag[0][0]}), 344 .out_flag(cls_flag), 345 .out_data(cls_data)); 346 335 347 histogram32 histogram32_unit ( 336 348 .clock(sys_clock), 337 349 .frame(sys_frame), 338 350 .reset(cfg_bits[0][5]), 339 .hst_good( (amp_flag[0][1]) & (cnt_good[0]) & (cfg_bits[13][1])),340 .hst_data( amp_data[0]),351 .hst_good(cls_flag & cfg_bits[6][0]), 352 .hst_data(cls_data), 341 353 .bus_ssel(bus_ssel[2]), 342 354 .bus_wren(bus_wren), 343 .bus_addr(bus_addr[ 12:0]),355 .bus_addr(bus_addr[6:0]), 344 356 .bus_mosi(bus_mosi), 345 357 .bus_miso(bus_miso[2]), 346 358 .bus_busy(bus_busy[2])); 347 359 348 counter hst_counter_unit ( 349 .clock(sys_clock), 350 .frame((sys_frame) & (~amp_flag[0][1])), 351 // .frame(sys_frame), 352 .reset(cfg_bits[0][8]), 353 .setup(cfg_bits[13][0]), 354 .count(cfg_bits[13][1]), 355 .bus_ssel(bus_ssel[5]), 356 .bus_wren(bus_wren), 357 .bus_addr(bus_addr[1:0]), 358 .bus_mosi(bus_mosi), 359 .bus_miso(bus_miso[5]), 360 .bus_busy(bus_busy[5]), 361 .cnt_good(cnt_good[0])); 362 363 364 i2c_fifo i2c_unit( 365 .clock(sys_clock), 366 .reset(i2c_reset), 367 /* 368 normal connection 369 .i2c_sda(I2C_SDA), 370 .i2c_scl(I2C_SCL), 371 372 following is a cross wire connection for EPT 373 */ 374 .i2c_sda(I2C_SCL), 375 .i2c_scl(I2C_SDA), 376 377 .bus_ssel(bus_ssel[11]), 378 .bus_wren(bus_wren), 379 .bus_mosi(bus_mosi), 380 .bus_busy(bus_busy[11])); 381 382 spi_fifo spi_unit( 383 .clock(sys_clock), 384 .reset(1'b0), 385 .spi_sel(SPI_SEL), 386 .spi_sdo(SPI_SDO), 387 .spi_clk(SPI_CLK), 388 389 .bus_ssel(bus_ssel[12]), 390 .bus_wren(bus_wren), 391 .bus_mosi(bus_mosi), 392 .bus_busy(bus_busy[12])); 393 394 pwm pwm_unit( 395 .clock(sys_clock), 396 .cfg_data({cfg_bits[31], cfg_bits[30], cfg_bits[29]}), 397 .out_data(PWM)); 398 399 generate 400 for (j = 0; j < 11; j = j + 1) 360 361 generate 362 for (j = 0; j < 3; j = j + 1) 401 363 begin : BUS_OUTPUT 402 364 assign int_bus_miso[j*16+15:j*16] = bus_miso[j]; … … 405 367 406 368 lpm_mux #( 407 .lpm_size( 11),369 .lpm_size(3), 408 370 .lpm_type("LPM_MUX"), 409 371 .lpm_width(16), 410 .lpm_widths( 4)) bus_miso_mux_unit (411 .sel(bus_addr[ 31:28]),372 .lpm_widths(2)) bus_miso_mux_unit ( 373 .sel(bus_addr[29:28]), 412 374 .data(int_bus_miso), 413 375 .result(mrg_bus_miso)); 414 376 415 377 lpm_mux #( 416 .lpm_size( 13),378 .lpm_size(3), 417 379 .lpm_type("LPM_MUX"), 418 380 .lpm_width(1), 419 .lpm_widths( 4)) bus_busy_mux_unit (420 .sel(bus_addr[ 31:28]),381 .lpm_widths(2)) bus_busy_mux_unit ( 382 .sel(bus_addr[29:28]), 421 383 .data(bus_busy), 422 384 .result(mrg_bus_busy)); 423 385 424 386 lpm_decode #( 425 .lpm_decodes( 13),387 .lpm_decodes(3), 426 388 .lpm_type("LPM_DECODE"), 427 .lpm_width( 4)) lpm_decode_unit (428 .data(bus_addr[ 31:28]),389 .lpm_width(2)) lpm_decode_unit ( 390 .data(bus_addr[29:28]), 429 391 .eq(bus_ssel)); 430 392 -
trunk/3DEES/UserInterface.tcl
r143 r180 38 38 5 {ADC 5} 39 39 6 {ADC 6} 40 7 {ADC 7}41 8 {ADC 8}42 9 {ADC 9}43 10 {ADC 10}44 11 {ADC 11}45 12 {ADC 12}46 40 } 47 41 … … 114 108 # ------------------------------------------------------------------------- 115 109 110 UsbController instproc init {} { 111 112 my set ignore false 113 114 next 115 } 116 117 # ------------------------------------------------------------------------- 118 116 119 UsbController instproc usbConnect {} { 117 my instvar handle 120 my instvar handle ignore 118 121 119 122 puts usbConnect … … 123 126 unset handle 124 127 } 125 if {1} { 126 while {[catch {usb::connect 0x09FB 0x6001 1 1 0} result]} { 127 set answer [tk_messageBox -icon error -type retrycancel \ 128 -message {Cannot access USB device} -detail $result] 129 # puts $result 130 if {[string equal $answer cancel]} exit 131 } 132 133 set handle $result 134 135 } 128 if {!$ignore} { 129 while {[catch {usb::connect 0x09FB 0x6001 1 1 0} result]} { 130 set answer [tk_messageBox -icon error -type abortretryignore \ 131 -message {Cannot access USB device} -detail $result] 132 if {[string equal $answer abort]} exit 133 if {[string equal $answer ignore]} { 134 set ignore true 135 return 136 } 137 } 138 139 set handle $result 140 141 } 136 142 } 137 143 … … 139 145 140 146 UsbController instproc usbHandle {} { 141 my instvar handle 147 my instvar handle ignore 142 148 143 149 if {[my exists handle]} { 144 150 return $handle 145 } else {151 } elseif {!$ignore} { 146 152 my usbConnect 147 153 } … … 223 229 # ------------------------------------------------------------------------- 224 230 225 Class SpiDisplay -parameter {231 Class CfgDisplay -parameter { 226 232 {master} 227 233 {controller} … … 230 236 # ------------------------------------------------------------------------- 231 237 232 SpiDisplay instproc init {} {238 CfgDisplay instproc init {} { 233 239 234 240 my setup … … 239 245 # ------------------------------------------------------------------------- 240 246 241 SpiDisplay instproc destroy {} {247 CfgDisplay instproc destroy {} { 242 248 next 243 249 } … … 245 251 # ------------------------------------------------------------------------- 246 252 247 SpiDisplay instproc start {} { 253 CfgDisplay instproc start {} { 254 variable adcCodes 248 255 my instvar config 249 256 250 trace add variable [myvar dac1] write [myproc dac1_update] 251 trace add variable [myvar dac2] write [myproc dac2_update] 252 253 ${config(1)}.dac1 set 0 254 ${config(1)}.dac2 set 0 255 } 256 257 # ------------------------------------------------------------------------- 258 259 SpiDisplay instproc setup {} { 257 trace add variable [myvar decay] write [myproc decay_update] 258 trace add variable [myvar delay] write [myproc delay_update] 259 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 } 273 } 274 275 # ------------------------------------------------------------------------- 276 277 CfgDisplay instproc setup {} { 278 variable adcCodes 260 279 my instvar number master 261 280 my instvar config 262 281 263 set config(1) [labelframe ${master}.cfg1 -borderwidth 1 -relief sunken -text {DAC}] 264 265 frame ${config(1)}.limits 266 label ${config(1)}.limits.min -text {2.5V} 267 label ${config(1)}.limits.max -text {0.0V} 268 269 scale ${config(1)}.dac1 -orient vertical -from 4095 -to 0 -tickinterval 0 -variable [myvar dac1] 270 scale ${config(1)}.dac2 -orient vertical -from 4095 -to 0 -tickinterval 0 -variable [myvar dac2] 271 272 pack ${config(1)}.limits.min -anchor n -side top -pady 10 273 pack ${config(1)}.limits.max -anchor s -side bottom -pady 9 274 275 grid ${config(1)}.dac1 ${config(1)}.dac2 ${config(1)}.limits -sticky ns -pady 7 276 277 278 set config(2) [labelframe ${master}.cfg2 -borderwidth 1 -relief sunken -text {ADC}] 279 280 frame ${config(2)}.spc1 -width 130 -height 10 281 frame ${config(2)}.spc2 -width 130 -height 10 282 frame ${config(2)}.spc3 -width 130 -height 10 283 284 button ${config(2)}.reset -text {Reset} -command [myproc adc_reset] 285 button ${config(2)}.pattern -text {Test pattern} -command [myproc adc_pattern] 286 button ${config(2)}.ramp -text {Test ramp} -command [myproc adc_ramp] 287 button ${config(2)}.100mV -text {Test 100 mV} -command [myproc adc_100mV] 288 button ${config(2)}.150mV -text {Test 150 mV} -command [myproc adc_150mV] 289 button ${config(2)}.fltr0 -text {Filter 14MHz} -command [myproc adc_fltr0] 290 button ${config(2)}.fltr1 -text {Filter 10MHz} -command [myproc adc_fltr1] 291 button ${config(2)}.fltr2 -text {Filter 7.5MHz} -command [myproc adc_fltr2] 292 293 grid ${config(2)}.spc1 294 grid ${config(2)}.reset -sticky ew -pady 3 -padx 5 295 grid ${config(2)}.spc2 296 grid ${config(2)}.pattern -sticky ew -pady 3 -padx 5 297 grid ${config(2)}.ramp -sticky ew -pady 3 -padx 5 298 grid ${config(2)}.100mV -sticky ew -pady 3 -padx 5 299 grid ${config(2)}.150mV -sticky ew -pady 3 -padx 5 300 grid ${config(2)}.spc3 301 grid ${config(2)}.fltr0 -sticky ew -pady 3 -padx 5 302 grid ${config(2)}.fltr1 -sticky ew -pady 3 -padx 5 303 grid ${config(2)}.fltr2 -sticky ew -pady 3 -padx 5 304 305 grid ${config(1)} -row 1 -column 1 -sticky ns 306 grid ${config(2)} -row 1 -column 2 -sticky ns 307 308 grid columnconfigure ${master} 0 -weight 1 309 grid columnconfigure ${master} 1 -weight 1 310 grid columnconfigure ${master} 2 -weight 1 311 grid columnconfigure ${master} 3 -weight 1 312 313 grid rowconfigure ${master} 0 -weight 0 314 grid rowconfigure ${master} 1 -weight 1 315 grid rowconfigure ${master} 2 -weight 0 316 317 grid rowconfigure ${config(1)} 0 -weight 1 318 } 319 320 # ------------------------------------------------------------------------- 321 322 SpiDisplay instproc dac1_update args { 323 my instvar controller dac1 324 325 set value [format {3%03x} $dac1] 326 327 set prefix [format {%x} 12] 282 set thrs [frame ${master}.thrs] 283 set bins [frame ${master}.bins] 284 set clip [frame ${master}.clip] 285 286 set config(thrs) [labelframe ${thrs}.frame -borderwidth 1 -relief sunken -text {Thresholds}] 287 288 set column 0 289 foreach {input} [list "ADC" "noise thrs" "e/p thrs"] { 290 label ${config(thrs)}.label_${column} -text "${input}" 291 grid ${config(thrs)}.label_${column} -row 0 -column ${column} -sticky ew -padx 5 -pady 7 292 incr column 293 } 294 295 foreach {ch id} [array get adcCodes {[1-2]}] { 296 label ${config(thrs)}.chan_${ch} -text "${ch} " 297 grid ${config(thrs)}.chan_${ch} -row ${ch} -column 0 -sticky ew -padx 5 -pady 7 298 foreach {num} [list 0 1] { 299 set column [expr {$num + 1}] 300 set value [expr {2 * ($ch - 1) + $num}] 301 puts "${num} ${ch} ${value}" 302 spinbox ${config(thrs)}.thrs_${value} -from 0 -to 4095 \ 303 -increment 10 -width 10 -textvariable [myvar thrs($value)] \ 304 -validate all -vcmd {::mca::validate 4095 4 %P} 305 grid ${config(thrs)}.thrs_${value} -row ${ch} -column ${column} -sticky w -padx 5 -pady 7 306 } 307 } 308 309 grid $config(thrs) -row 0 -column 0 -sticky news -padx 10 310 311 set config(bins) [labelframe ${bins}.frame -borderwidth 1 -relief sunken -text {Thresholds}] 312 313 set column 0 314 foreach {input} [list "ADC" "thrs 1" "thrs 2" "thrs 3" "thrs 4"] { 315 label ${config(bins)}.label_${column} -text "${input}" 316 grid ${config(bins)}.label_${column} -row 0 -column ${column} -sticky ew -padx 5 -pady 7 317 incr column 318 } 319 320 foreach {ch id} [array get adcCodes {[3-6]}] { 321 label ${config(bins)}.chan_${ch} -text "${ch} " 322 grid ${config(bins)}.chan_${ch} -row ${ch} -column 0 -sticky ew -padx 5 -pady 7 323 foreach {num} [list 0 1 2 3] { 324 set column [expr {$num + 1}] 325 set value [expr {4 * ($ch - 2) + $num}] 326 puts "${num} ${ch} ${value}" 327 spinbox ${config(bins)}.thrs_${value} -from 0 -to 4095 \ 328 -increment 10 -width 10 -textvariable [myvar thrs($value)] \ 329 -validate all -vcmd {::mca::validate 4095 4 %P} 330 grid ${config(bins)}.thrs_${value} -row ${ch} -column ${column} -sticky w -padx 5 -pady 7 331 } 332 } 333 334 grid $config(bins) -row 0 -column 0 -sticky news -padx 10 335 336 set config(clip) [labelframe ${clip}.frame -borderwidth 1 -relief sunken -text {Signal clipping}] 337 338 set column 0 339 foreach {input} [list "ADC" "delay" "decay"] { 340 label ${config(clip)}.label_${column} -text "${input}" 341 grid ${config(clip)}.label_${column} -row 0 -column ${column} -sticky ew -padx 5 -pady 7 342 incr column 343 } 344 345 foreach {ch id} [array get adcCodes] { 346 label ${config(clip)}.chan_${ch} -text "${ch} " 347 grid ${config(clip)}.chan_${ch} -row ${ch} -column 0 -sticky ew -padx 5 -pady 7 348 spinbox ${config(clip)}.delay_${ch} -from 0 -to 62 \ 349 -increment 2 -width 10 -textvariable [myvar delay($ch)] \ 350 -validate all -vcmd {::mca::validate 63 5 %P} 351 grid ${config(clip)}.delay_${ch} -row ${ch} -column 1 -sticky w -padx 5 -pady 7 352 spinbox ${config(clip)}.decay_${ch} -from 0 -to 65535 \ 353 -increment 10 -width 10 -textvariable [myvar decay($ch)] \ 354 -validate all -vcmd {::mca::validate 65535 5 %P} 355 grid ${config(clip)}.decay_${ch} -row ${ch} -column 2 -sticky w -padx 5 -pady 7 356 } 357 358 grid $config(clip) -row 0 -column 0 -sticky news -padx 10 359 360 grid ${thrs} -row 0 -column 2 -sticky news 361 grid ${bins} -row 0 -column 1 -sticky news 362 grid ${clip} -row 0 -column 0 -sticky news 363 364 grid columnconfigure ${master} 0 -weight 1 365 grid columnconfigure ${master} 1 -weight 1 366 grid columnconfigure ${master} 2 -weight 1 367 grid rowconfigure ${master} 0 -weight 1 368 369 grid rowconfigure ${thrs} 0 -weight 0 370 grid rowconfigure ${bins} 0 -weight 0 371 grid rowconfigure ${clip} 0 -weight 0 372 } 373 374 # ------------------------------------------------------------------------- 375 376 CfgDisplay instproc decay_update args { 377 my instvar controller decay delay 328 378 329 379 set command {} 330 append command 0001${prefix}00000020000000402[string range $value 0 1] 331 append command 0001${prefix}000000200000004[string range $value 2 3]00 380 for {set i 1} {$i <= 6} {incr i} { 381 set a $delay($i).0 382 set b $decay($i).0 383 set value [expr int(exp(-${a}/${b})*1024*17)] 384 append command [format {000200%02x0004%04x} [expr {30 + 2 * (${i} - 1)}] $value] 385 } 332 386 333 387 $controller usbCmd $command … … 336 390 # ------------------------------------------------------------------------- 337 391 338 SpiDisplay instproc dac2_update args { 339 my instvar controller dac2 340 341 set value [format {b%03x} $dac1] 342 343 set prefix [format {%x} 12] 392 CfgDisplay instproc delay_update args { 393 my instvar controller delay 344 394 345 395 set command {} 346 append command 0001${prefix}00000020000000402[string range $value 0 1] 347 append command 0001${prefix}000000200000004[string range $value 2 3]00 396 for {set i 1} {$i <= 6} {incr i} { 397 append command [format {000200%02x0004%04x} [expr {31 + 2 * (${i} - 1)}] $delay($i)] 398 } 348 399 349 400 $controller usbCmd $command 350 } 351 352 # ------------------------------------------------------------------------- 353 354 SpiDisplay instproc adc_reset args { 355 my instvar controller 356 357 set prefix [format {%x} 12]358 401 402 my decay_update 403 } 404 405 # ------------------------------------------------------------------------- 406 407 CfgDisplay instproc thrs_update args { 408 my instvar controller thrs 409 359 410 set command {} 360 361 set value {000001} 362 append command 0001${prefix}00000020000000401[string range $value 0 1] 363 append command 0001${prefix}000000200000004[string range $value 2 5] 364 365 set value {040008} 366 append command 0001${prefix}00000020000000401[string range $value 0 1] 367 append command 0001${prefix}000000200000004[string range $value 2 5] 368 369 $controller usbCmd $command 370 } 371 372 # ------------------------------------------------------------------------- 373 374 SpiDisplay instproc adc_pattern args { 375 my instvar controller 376 377 set value {022000} 378 379 set prefix [format {%x} 12] 380 381 set command {} 382 append command 0001${prefix}00000020000000401[string range $value 0 1] 383 append command 0001${prefix}000000200000004[string range $value 2 5] 384 385 $controller usbCmd $command 386 } 387 388 # ------------------------------------------------------------------------- 389 390 SpiDisplay instproc adc_ramp args { 391 my instvar controller 392 393 set value {02E000} 394 395 set prefix [format {%x} 12] 396 397 set command {} 398 append command 0001${prefix}00000020000000401[string range $value 0 1] 399 append command 0001${prefix}000000200000004[string range $value 2 5] 400 401 $controller usbCmd $command 402 } 403 404 # ------------------------------------------------------------------------- 405 406 SpiDisplay instproc adc_100mV args { 407 my instvar controller 408 409 set value {070080} 410 411 set prefix [format {%x} 12] 412 413 set command {} 414 append command 0001${prefix}00000020000000401[string range $value 0 1] 415 append command 0001${prefix}000000200000004[string range $value 2 5] 416 417 $controller usbCmd $command 418 } 419 420 # ------------------------------------------------------------------------- 421 422 SpiDisplay instproc adc_150mV args { 423 my instvar controller 424 425 set value {070180} 426 427 set prefix [format {%x} 12] 428 429 set command {} 430 append command 0001${prefix}00000020000000401[string range $value 0 1] 431 append command 0001${prefix}000000200000004[string range $value 2 5] 432 433 $controller usbCmd $command 434 } 435 436 # ------------------------------------------------------------------------- 437 438 SpiDisplay instproc adc_fltr0 args { 439 my instvar controller 440 441 set value {070000} 442 443 set prefix [format {%x} 12] 444 445 set command {} 446 append command 0001${prefix}00000020000000401[string range $value 0 1] 447 append command 0001${prefix}000000200000004[string range $value 2 5] 448 449 $controller usbCmd $command 450 } 451 452 # ------------------------------------------------------------------------- 453 454 SpiDisplay instproc adc_fltr1 args { 455 my instvar controller 456 457 set value {070004} 458 459 set prefix [format {%x} 12] 460 461 set command {} 462 append command 0001${prefix}00000020000000401[string range $value 0 1] 463 append command 0001${prefix}000000200000004[string range $value 2 5] 464 465 $controller usbCmd $command 466 } 467 468 # ------------------------------------------------------------------------- 469 470 SpiDisplay instproc adc_fltr2 args { 471 my instvar controller 472 473 set value {070008} 474 475 set prefix [format {%x} 12] 476 477 set command {} 478 append command 0001${prefix}00000020000000401[string range $value 0 1] 479 append command 0001${prefix}000000200000004[string range $value 2 5] 411 for {set i 0} {$i <= 19} {incr i} { 412 append command [format {000200%02x0004%04x} [expr {10 + ${i}}] $thrs($i)] 413 } 480 414 481 415 $controller usbCmd $command … … 549 483 set key [frame ${master}.key] 550 484 set inv [frame ${master}.inv] 551 485 552 486 foreach {osc title} $oscList { 553 487 set config($osc) [labelframe ${mux}.$osc -borderwidth 1 -relief sunken -text $title] … … 580 514 label $config(key).f -text "f - filtered signal" 581 515 grid $config(key).f -row 0 -column 1 -sticky news 582 516 583 517 label $config(key).d -text "d - deconvoluted signal" 584 518 grid $config(key).d -row 0 -column 2 -sticky news 585 519 586 520 label $config(key).c -text "c - clipped signal" 587 521 grid $config(key).c -row 0 -column 3 -sticky news … … 589 523 grid $config(key) -row 0 -column 0 -sticky news -padx 10 590 524 591 525 592 526 set config(inv) [labelframe ${inv}.frame -borderwidth 1 -relief sunken -text {polarity inversion}] 593 527 label $config(inv).chan_label -text "channel " … … 620 554 grid columnconfigure $config(key) 3 -weight 1 621 555 622 556 623 557 grid columnconfigure ${mux} 0 -weight 1 624 558 grid columnconfigure ${mux} 1 -weight 1 … … 627 561 grid columnconfigure ${mux} 4 -weight 1 628 562 grid columnconfigure ${mux} 5 -weight 1 629 630 631 } 632 563 } 633 564 634 565 # ------------------------------------------------------------------------ … … 648 579 MuxDisplay instproc polar_update args { 649 580 my instvar controller polar 650 581 651 582 set value {0b} 652 for {set i 12} {$i >= 1} {incr i -1} {653 append value $polar($i) 583 for {set i 6} {$i >= 1} {incr i -1} { 584 append value $polar($i) 654 585 } 655 586 … … 673 604 my set data {} 674 605 675 vector create [myvar xvec]( 4096)676 vector create [myvar yvec]( 4096)677 678 # fill one vector for the x axis with 4096points679 [myvar xvec] seq -0.5 4095.5606 vector create [myvar xvec](64) 607 vector create [myvar yvec](64) 608 609 # fill one vector for the x axis with 64 points 610 [myvar xvec] seq -0.5 63.5 680 611 681 612 my setup … … 696 627 697 628 trace add variable [myvar data] write [myproc data_update] 698 trace add variable [myvar cntr_val] write [myproc cntr_val_update]699 trace add variable [myvar rate_val] write [myproc rate_val_update]700 629 701 630 trace add variable [myvar axis] write [myproc axis_update] 702 trace add variable [myvar thrs] write [myproc thrs_update]703 trace add variable [myvar thrs_val] write [myproc thrs_update]704 trace add variable [myvar base] write [myproc base_update]705 trace add variable [myvar base_typ] write [myproc base_typ_update]706 trace add variable [myvar base_val] write [myproc base_val_update]707 631 708 632 ${config}.axis_check select 709 633 710 ${config}.thrs_check select711 ${config}.thrs_field set 25712 713 ${config}.base_auto select714 ${config}.base_field set 20715 ${config}.base_check select716 717 set cntr_tmp 1200000000718 my set cntr_val $cntr_tmp719 my set cntr_bak $cntr_tmp720 my set cntr_old $cntr_tmp721 634 my set yvec_bak 0.0 722 635 my set yvec_old 0.0 723 724 my set rate_val(inst) 0.0725 my set rate_val(mean) 0.0726 727 # my cntr_reset728 636 } 729 637 … … 741 649 $graph grid configure -hide no 742 650 $graph legend configure -hide yes 743 $graph axis configure x -min 0 -max 4096651 $graph axis configure x -min 0 -max 64 744 652 745 653 set config [frame ${master}.config -width 170] … … 748 656 749 657 frame ${config}.spc1 -width 170 -height 30 750 751 frame ${config}.rate_frame -borderwidth 0 -width 170752 legendLabel ${config}.rate_frame 0 inst {Inst. rate, 1/s}753 legendLabel ${config}.rate_frame 1 mean {Avg. rate, 1/s}754 755 frame ${config}.spc2 -width 170 -height 30756 658 757 659 frame ${config}.chan_frame -borderwidth 0 -width 170 … … 759 661 legendLabel ${config}.chan_frame 1 axisx {Bin number} 760 662 761 frame ${config}.spc3 -width 170 -height 30 762 763 frame ${config}.cntr_frame -borderwidth 0 -width 170 764 765 label ${config}.cntr_frame.h -width 3 -anchor w -text {h} 766 entry ${config}.cntr_frame.h_field -width 3 -textvariable [myvar cntr_h] \ 767 -validate all -vcmd {::mca::validate 999 3 %P} 768 label ${config}.cntr_frame.m -width 3 -anchor w -text {m} 769 entry ${config}.cntr_frame.m_field -width 3 -textvariable [myvar cntr_m] \ 770 -validate all -vcmd {::mca::validate 59 2 %P} 771 label ${config}.cntr_frame.s -width 3 -anchor w -text {s} 772 entry ${config}.cntr_frame.s_field -width 6 -textvariable [myvar cntr_s] \ 773 -validate all -vcmd {::mca::doublevalidate 59.999 %P} 774 775 grid ${config}.cntr_frame.h_field ${config}.cntr_frame.h \ 776 ${config}.cntr_frame.m_field ${config}.cntr_frame.m ${config}.cntr_frame.s_field ${config}.cntr_frame.s 777 778 frame ${config}.spc4 -width 170 -height 10 663 frame ${config}.spc2 -width 170 -height 30 779 664 780 665 button ${config}.start -text Start \ … … 783 668 -bg red -activebackground red -command [myproc cntr_reset] 784 669 785 frame ${config}.spc5 -width 170 -height 30 786 787 checkbutton ${config}.thrs_check -text threshold -variable [myvar thrs] 788 spinbox ${config}.thrs_field -from 1 -to 4095 \ 789 -increment 5 -width 10 -textvariable [myvar thrs_val] \ 790 -validate all -vcmd {::mca::validate 4095 4 %P} 791 792 frame ${config}.spc6 -width 170 -height 30 793 794 checkbutton ${config}.base_check -text baseline -variable [myvar base] 795 radiobutton ${config}.base_auto -text automatic -variable [myvar base_typ] -value 1 796 radiobutton ${config}.base_const -text constant -variable [myvar base_typ] -value 0 797 spinbox ${config}.base_field -from 1 -to 4095 \ 798 -increment 5 -width 10 -textvariable [myvar base_val] \ 799 -validate all -vcmd {::mca::validate 4095 4 %P} 800 801 frame ${config}.spc7 -width 170 -height 30 670 frame ${config}.spc3 -width 170 -height 30 802 671 803 672 button ${config}.register -text Register \ … … 806 675 grid ${config}.axis_check -sticky w 807 676 grid ${config}.spc1 808 grid ${config}. rate_frame -sticky ew -padx 5677 grid ${config}.chan_frame -sticky ew -padx 5 809 678 grid ${config}.spc2 810 grid ${config}.chan_frame -sticky ew -padx 5811 grid ${config}.spc3812 grid ${config}.cntr_frame -sticky ew -padx 5813 grid ${config}.spc4814 679 grid ${config}.start -sticky ew -pady 3 -padx 5 815 680 grid ${config}.reset -sticky ew -pady 3 -padx 5 816 grid ${config}.spc5 817 grid ${config}.thrs_check -sticky w 818 grid ${config}.thrs_field -sticky ew -pady 1 -padx 5 819 grid ${config}.spc6 820 grid ${config}.base_check -sticky w 821 grid ${config}.base_auto -sticky w 822 grid ${config}.base_const -sticky w 823 grid ${config}.base_field -sticky ew -pady 1 -padx 5 824 grid ${config}.spc7 681 grid ${config}.spc3 825 682 grid ${config}.register -sticky ew -pady 3 -padx 5 826 683 … … 832 689 grid columnconfigure ${master} 1 -weight 0 -minsize 80 833 690 834 grid columnconfigure ${config}.rate_frame 1 -weight 1835 691 grid columnconfigure ${config}.chan_frame 1 -weight 1 836 692 … … 886 742 # ------------------------------------------------------------------------- 887 743 888 HstDisplay instproc thrs_update args {889 my instvar controller config number thrs thrs_val890 891 if {[string equal $thrs_val {}]} {892 set thrs_val 0893 }894 895 set val_addr [format %02x [expr {6 + 2 * ${number}}]]896 897 if {$thrs} {898 ${config}.thrs_field configure -state normal899 set value [format %03x $thrs_val]900 } else {901 ${config}.thrs_field configure -state disabled902 set value 000903 }904 905 $controller usbCmd 000200${val_addr}00040${value}906 }907 908 # -------------------------------------------------------------------------909 910 HstDisplay instproc base_update args {911 my instvar controller config number base base_typ912 913 set val_addr [format %02x [expr {7 + 2 * ${number}}]]914 915 if {$base} {916 ${config}.base_auto configure -state normal917 ${config}.base_const configure -state normal918 my base_typ_update919 } else {920 ${config}.base_auto configure -state disabled921 ${config}.base_const configure -state disabled922 ${config}.base_field configure -state disabled923 $controller usbCmd 000200${val_addr}0004${base_typ}000924 }925 }926 927 # -------------------------------------------------------------------------928 929 HstDisplay instproc base_typ_update args {930 my instvar config base_typ931 932 switch -- $base_typ {933 1 {934 ${config}.base_field configure -state disabled935 }936 0 {937 ${config}.base_field configure -state normal938 }939 }940 941 my base_val_update942 }943 944 # -------------------------------------------------------------------------945 946 HstDisplay instproc base_val_update args {947 my instvar controller number base_typ base_val948 949 if {[string equal $base_val {}]} {950 set base_val 0951 }952 953 set val_addr [format %02x [expr {7 + 2 * ${number}}]]954 set value [format %03x $base_val]955 956 $controller usbCmd 000200${val_addr}0004${base_typ}${value}957 }958 959 # -------------------------------------------------------------------------960 961 HstDisplay instproc rate_val_update {name key op} {962 my instvar config rate_val963 964 ${config}.rate_frame.${key}_value configure -text [format {%.2e} $rate_val(${key})]965 }966 967 # -------------------------------------------------------------------------968 969 HstDisplay instproc cntr_val_update args {970 my instvar cntr_val cntr_h cntr_m cntr_s971 972 set cntr_tmp [expr {${cntr_val}/20000}]973 set cntr_h [expr {${cntr_tmp}/3600000}]974 set cntr_m [expr {${cntr_tmp}%3600000/60000}]975 set cntr_s [expr {${cntr_tmp}%3600000%60000/1000.0}]976 }977 978 # -------------------------------------------------------------------------979 980 HstDisplay instproc cntr_setup {} {981 my instvar controller number cntr_val982 983 set word0 [format %08x [expr {${cntr_val} & 0xFFFFFFFF}]]984 set word1 [format %08x [expr {${cntr_val} >> 32}]]985 986 set prefix [format %x [expr {5 + ${number}}]]987 988 set command {}989 append command 0001${prefix}000000200000004[string range $word0 4 7]990 append command 0001${prefix}000000200010004[string range $word0 0 3]991 append command 0001${prefix}000000200020004[string range $word1 4 7]992 append command 0001${prefix}000000200030004[string range $word1 0 3]993 994 # send counter value995 $controller usbCmd $command996 997 # load counter value998 # set val_addr [format %02x [expr {12 + ${number}}]]999 # $controller usbCmd 000200${val_addr}00040001000200${val_addr}000400001000 }1001 1002 # -------------------------------------------------------------------------1003 1004 744 HstDisplay instproc cntr_reset {} { 1005 my instvar controller number after_handle 1006 my instvar cntr_val cntr_bak cntr_old yvec_bak yvec_old 745 my instvar controller number 1007 746 1008 747 my cntr_stop … … 1011 750 $controller usbCmd 000200000004${value}0002000000040000 1012 751 1013 set cntr_val $cntr_bak1014 my cntr_setup1015 1016 set cntr_old $cntr_bak1017 set yvec_bak 0.01018 set yvec_old 0.01019 1020 752 my acquire 1021 1022 my cntr_ready1023 }1024 1025 # -------------------------------------------------------------------------1026 1027 HstDisplay instproc cntr_ready {} {1028 my instvar config cntr_val cntr_bak1029 1030 set cntr_val $cntr_bak1031 1032 ${config}.start configure -text Start -command [myproc cntr_start]1033 ${config}.reset configure -state active1034 1035 ${config}.cntr_frame.h_field configure -state normal1036 ${config}.cntr_frame.m_field configure -state normal1037 ${config}.cntr_frame.s_field configure -state normal1038 753 } 1039 754 … … 1041 756 1042 757 HstDisplay instproc cntr_start {} { 1043 my instvar config1044 my instvar cntr_h cntr_m cntr_s1045 my instvar cntr_val cntr_bak cntr_old yvec_bak yvec_old1046 1047 set h $cntr_h1048 set m $cntr_m1049 set s $cntr_s1050 1051 if {[string equal $h {}]} {1052 set h 01053 }1054 if {[string equal $m {}]} {1055 set m 01056 }1057 if {[string equal $s {}]} {1058 set s 01059 }1060 1061 set cntr_tmp [expr {${h}*3600000 + ${m}*60000 + ${s}*1000}]1062 set cntr_tmp [expr {entier(20000 * ${cntr_tmp})}]1063 1064 if {$cntr_tmp > 0} {1065 ${config}.cntr_frame.h_field configure -state disabled1066 ${config}.cntr_frame.m_field configure -state disabled1067 ${config}.cntr_frame.s_field configure -state disabled1068 1069 set cntr_val $cntr_tmp1070 set cntr_bak $cntr_tmp1071 set cntr_old $cntr_tmp1072 set yvec_bak [usb::integrateBlt [myvar yvec] 0]1073 set yvec_old $yvec_bak1074 1075 my cntr_setup1076 1077 my cntr_resume1078 }1079 }1080 1081 # -------------------------------------------------------------------------1082 1083 HstDisplay instproc cntr_pause {} {1084 my instvar config1085 1086 my cntr_stop1087 1088 ${config}.start configure -text Resume -command [myproc cntr_resume]1089 # ${config}.reset configure -state active1090 1091 }1092 1093 # -------------------------------------------------------------------------1094 1095 HstDisplay instproc cntr_resume {} {1096 758 my instvar controller config number auto 1097 759 1098 set val_addr [format %02x [expr { 13+ ${number}}]]1099 1100 ${config}.start configure -text Pause -command [myproc cntr_pause]760 set val_addr [format %02x [expr {6 + ${number}}]] 761 762 ${config}.start configure -text Stop -command [myproc cntr_stop] 1101 763 # ${config}.reset configure -state disabled 1102 764 1103 $controller usbCmd 000200${val_addr}0004000 2765 $controller usbCmd 000200${val_addr}00040001 1104 766 1105 767 set auto 1 … … 1113 775 my instvar controller config number auto 1114 776 1115 set val_addr [format %02x [expr {13 + ${number}}]] 777 set val_addr [format %02x [expr {6 + ${number}}]] 778 779 ${config}.start configure -text Start -command [myproc cntr_start] 1116 780 1117 781 $controller usbCmd 000200${val_addr}00040000 1118 782 1119 783 set auto 0 784 785 my acquire 1120 786 } 1121 787 … … 1134 800 my acquire 1135 801 1136 if {$cntr_val == 0} { 1137 my cntr_stop 1138 my cntr_ready 1139 } elseif {$auto} { 802 if {$auto} { 1140 803 after 1000 [myproc acquire_loop] 1141 804 } … … 1146 809 HstDisplay instproc acquire {} { 1147 810 my instvar controller config number 1148 my instvar cntr_val cntr_bak cntr_old yvec_bak yvec_old rate_val 1149 1150 set size 4096 811 812 set size 64 1151 813 1152 814 set prefix [format {%x} [expr {$number + 2}]] … … 1157 819 1158 820 $controller usbCmdReadRaw $command [expr {$size * 4}] [myvar data] 1159 set yvec_new [usb::integrateBlt [myvar yvec]]1160 1161 set prefix [format {%x} [expr {$number + 5}]]1162 set command 0001${prefix}0000002000000030004000500001163 1164 $controller usbCmdReadHex $command 8 1 [myvar cntr_val]1165 set cntr_new $cntr_val1166 1167 if {$cntr_new < $cntr_old} {1168 set rate_val(inst) [expr {($yvec_new - $yvec_old)*20000000/($cntr_old - $cntr_new)}]1169 set rate_val(mean) [expr {($yvec_new - $yvec_bak)*20000000/($cntr_bak - $cntr_new)}]1170 set yvec_old $yvec_new1171 set cntr_old $cntr_new1172 }1173 821 } 1174 822 … … 1209 857 1210 858 HstDisplay instproc register {} { 1211 my save_data [join [[myvar yvec] range 0 4095] \n]1212 } 1213 1214 # ------------------------------------------------------------------------- 1215 1216 Class CntDisplay -parameter {859 my save_data [join [[myvar yvec] range 0 63] \n] 860 } 861 862 # ------------------------------------------------------------------------- 863 864 Class OscDisplay -parameter { 1217 865 {master} 1218 866 {controller} … … 1221 869 # ------------------------------------------------------------------------- 1222 870 1223 CntDisplay instproc init {} { 1224 1225 my set data {} 1226 my set cntr 0 1227 my set recs 0 1228 1229 vector create [myvar xvec](16384) 1230 vector create [myvar yvec](16384) 1231 1232 # fill one vector for the x axis with 16384 points 1233 [myvar xvec] seq -0.5 16384.5 871 OscDisplay instproc init {} { 872 my instvar sequence data xvec yvec 873 874 set data {} 875 876 set sequence 0 877 878 # set xvec [vector create #auto(262144)] 879 # set xvec [vector create #auto(10000)] 880 set xvec [vector create #auto(60000)] 881 882 for {set i 1} {$i <= 9} {incr i} { 883 # dict set yvec $i [vector create #auto(262144)] 884 # dict set yvec $i [vector create #auto(10000)] 885 dict set yvec $i [vector create #auto(60000)] 886 } 887 888 # fill one vector for the x axis 889 # $xvec seq 0 262143 890 # $xvec seq 0 10000 891 $xvec seq 0 60000 1234 892 1235 893 my setup … … 1240 898 # ------------------------------------------------------------------------- 1241 899 1242 CntDisplay instproc destroy {} {900 OscDisplay instproc destroy {} { 1243 901 next 1244 902 } … … 1246 904 # ------------------------------------------------------------------------- 1247 905 1248 CntDisplay instproc start {} {906 OscDisplay instproc start {} { 1249 907 my instvar config 908 my instvar recs_val directory 909 910 set directory $::env(HOME) 911 set recs_val 100 912 913 trace add variable [myvar chan] write [myproc chan_update] 1250 914 1251 915 trace add variable [myvar data] write [myproc data_update] 1252 916 1253 trace add variable [myvar thrs_val] write [myproc thrs_val_update]1254 1255 trace add variable [myvar cntr] write [myproc cntr_update]1256 trace add variable [myvar recs] write [myproc recs_update]1257 1258 trace add variable [myvar axis] write [myproc axis_update]1259 1260 ${config}.axis_check select1261 1262 my set thrs_val 1001263 1264 my set cntr_val 1001265 my set cntr_bak 1001266 my set recs_val 1001267 my set recs_bak 100 1268 1269 # my cntr_reset 1270 } 1271 1272 # ------------------------------------------------------------------------- 1273 1274 CntDisplay instproc setup {} {917 trace add variable [myvar auto] write [myproc auto_update] 918 919 trace add variable [myvar thrs] write [myproc thrs_update 0] 920 trace add variable [myvar thrs_val] write [myproc thrs_update 0] 921 922 trace add variable [myvar recs_val] write [myproc recs_val_update] 923 924 trace add variable [myvar last] write [myproc last_update] 925 926 for {set i 1} {$i <= 6} {incr i} { 927 ${config}.chan_frame.chan${i}_check select 928 ${config}.chan_frame.chan${i}_value configure -text 0.0 929 } 930 ${config}.chan_frame.axisx_value configure -text 0.0 931 932 ${config}.thrs_check select 933 ${config}.thrs_field set 100 934 } 935 936 # ------------------------------------------------------------------------- 937 938 OscDisplay instproc setup {} { 1275 939 my instvar master 1276 940 my instvar xvec yvec graph 1277 941 my instvar config 1278 my instvar cntr_ms1279 942 1280 943 # create a graph widget and show a grid … … 1283 946 $graph grid configure -hide no 1284 947 $graph legend configure -hide yes 1285 $graph axis configure x -min 0 -max 16384 1286 1287 set config [frame ${master}.config -width 170] 1288 1289 checkbutton ${config}.axis_check -text {log scale} -variable [myvar axis] 1290 1291 frame ${config}.spc1 -width 170 -height 30 1292 1293 frame ${config}.chan_frame -borderwidth 0 -width 170 1294 legendLabel ${config}.chan_frame 0 mean {Mean value} 1295 legendLabel ${config}.chan_frame 1 entr {Total entries} 1296 legendLabel ${config}.chan_frame 2 empty {} 1297 legendLabel ${config}.chan_frame 3 axisy {Bin entries} 1298 legendLabel ${config}.chan_frame 4 axisx {Bin number} 1299 1300 frame ${config}.spc3 -width 170 -height 30 1301 1302 label ${config}.thrs -text {amplitude threshold} 1303 spinbox ${config}.thrs_field -from 1 -to 4095 \ 1304 -increment 5 -width 10 -textvariable [myvar thrs_val] \ 1305 -validate all -vcmd {::mca::validate 4095 4 %P} 1306 1307 frame ${config}.spc4 -width 170 -height 30 1308 1309 label ${config}.cntr -text {time of exposure (s)} 1310 spinbox ${config}.cntr_field -from 0 -to 9999 \ 1311 -increment 10 -width 10 -textvariable [myvar cntr_val] \ 1312 -validate all -vcmd {::mca::validate 9999 4 %P} 1313 1314 frame ${config}.spc5 -width 170 -height 10 1315 1316 label ${config}.recs -text {number of exposures} 1317 spinbox ${config}.recs_field -from 0 -to 99999 \ 1318 -increment 10 -width 10 -textvariable [myvar recs_val] \ 1319 -validate all -vcmd {::mca::validate 99999 5 %P} 1320 1321 frame ${config}.spc6 -width 170 -height 10 1322 1323 button ${config}.start -text {Start} \ 1324 -bg yellow -activebackground yellow -command [myproc recs_start] 1325 1326 button ${config}.reset -text Reset \ 1327 -bg red -activebackground red -command [myproc cntr_reset] 1328 1329 frame ${config}.spc7 -width 170 -height 30 1330 1331 button ${config}.register -text Register \ 1332 -bg lightblue -activebackground lightblue -command [myproc register] 1333 1334 grid ${config}.axis_check -sticky w 1335 grid ${config}.spc1 1336 grid ${config}.chan_frame -sticky ew -padx 5 1337 grid ${config}.spc3 1338 grid ${config}.thrs -sticky w -pady 1 -padx 3 1339 grid ${config}.thrs_field -sticky ew -pady 1 -padx 5 1340 grid ${config}.spc4 1341 grid ${config}.cntr -sticky w -pady 1 -padx 3 1342 grid ${config}.cntr_field -sticky ew -pady 1 -padx 5 1343 grid ${config}.spc5 1344 grid ${config}.recs -sticky w -pady 1 -padx 3 1345 grid ${config}.recs_field -sticky ew -pady 1 -padx 5 1346 grid ${config}.spc6 1347 grid ${config}.start -sticky ew -pady 3 -padx 5 1348 grid ${config}.reset -sticky ew -pady 3 -padx 5 1349 grid ${config}.spc7 1350 grid ${config}.register -sticky ew -pady 3 -padx 5 1351 1352 grid ${graph} -row 0 -column 0 -sticky news 1353 grid ${config} -row 0 -column 1 1354 1355 grid rowconfigure ${master} 0 -weight 1 1356 grid columnconfigure ${master} 0 -weight 1 1357 grid columnconfigure ${master} 1 -weight 0 -minsize 80 1358 1359 grid columnconfigure ${config}.chan_frame 1 -weight 1 1360 1361 # enable zooming 1362 Blt_ZoomStack $graph 1363 1364 my crosshairs $graph 1365 1366 #bind .graph <Motion> {%W crosshairs configure -position @%x,%y} 1367 1368 # create one element with data for the x and y axis, no dots 1369 $graph element create Spectrum1 -color blue -linewidth 2 -symbol none -smooth step -xdata [myvar xvec] -ydata [myvar yvec] 1370 } 1371 1372 # ------------------------------------------------------------------------- 1373 1374 CntDisplay instproc coor_update {W x y} { 1375 my instvar config graph 1376 1377 $W crosshairs configure -position @${x},${y} 1378 1379 set index [$W axis invtransform x $x] 1380 set index [::tcl::mathfunc::round $index] 1381 catch { 1382 ${config}.chan_frame.axisy_value configure -text [[myvar yvec] index $index] 1383 ${config}.chan_frame.axisx_value configure -text ${index}.0 1384 } 1385 } 1386 # ------------------------------------------------------------------------- 1387 1388 CntDisplay instproc crosshairs {graph} { 1389 set method [myproc coor_update] 1390 bind $graph <Motion> [list [self] coor_update %W %x %y] 1391 bind $graph <Leave> { 1392 %W crosshairs off 1393 } 1394 bind $graph <Enter> { 1395 %W crosshairs on 1396 } 1397 } 1398 1399 # ------------------------------------------------------------------------- 1400 1401 CntDisplay instproc thrs_val_update args { 1402 my instvar controller config thrs_val 1403 1404 if {[string equal $thrs_val {}]} { 1405 set thrs_val 0 1406 } 1407 1408 set val_addr [format %02x 12] 1409 1410 ${config}.thrs_field configure -state normal 1411 set value [format %03x $thrs_val] 1412 1413 $controller usbCmd 000200${val_addr}00040${value} 1414 } 1415 1416 # ------------------------------------------------------------------------- 1417 1418 CntDisplay instproc cntr_update args { 1419 my instvar cntr cntr_val 1420 set cntr_val [expr {${cntr}/20000000}] 1421 1422 } 1423 1424 # ------------------------------------------------------------------------- 1425 1426 CntDisplay instproc recs_update args { 1427 my instvar recs recs_val 1428 set recs_val [expr {${recs}*1}] 1429 } 1430 1431 # ------------------------------------------------------------------------- 1432 1433 CntDisplay instproc cntr_setup {} { 1434 my instvar controller cntr_val 1435 1436 set cntr_tmp [expr {${cntr_val} * 20000000}] 1437 set word0 [format {%08x} [expr {${cntr_tmp} & 0xFFFFFFFF}]] 1438 set word1 [format {%08x} [expr {${cntr_tmp} >> 32}]] 1439 1440 set prefix [format {%x} 9] 1441 1442 set command {} 1443 append command 0001${prefix}000000200000004[string range $word0 4 7] 1444 append command 0001${prefix}000000200010004[string range $word0 0 3] 1445 append command 0001${prefix}000000200020004[string range $word1 4 7] 1446 append command 0001${prefix}000000200030004[string range $word1 0 3] 1447 1448 # send counter value 1449 $controller usbCmd $command 1450 } 1451 1452 # ------------------------------------------------------------------------- 1453 1454 CntDisplay instproc recs_setup {} { 1455 my instvar controller recs_val 1456 1457 set word0 [format {%08x} [expr {${recs_val} & 0xFFFFFFFF}]] 1458 set word1 [format {%08x} [expr {${recs_val} >> 32}]] 1459 1460 set prefix [format {%x} 10] 1461 1462 set command {} 1463 append command 0001${prefix}000000200000004[string range $word0 4 7] 1464 append command 0001${prefix}000000200010004[string range $word0 0 3] 1465 append command 0001${prefix}000000200020004[string range $word1 4 7] 1466 append command 0001${prefix}000000200030004[string range $word1 0 3] 1467 1468 # send counter value 1469 $controller usbCmd $command 1470 } 1471 1472 # ------------------------------------------------------------------------- 1473 1474 CntDisplay instproc cntr_reset {} { 1475 my instvar controller after_handle 1476 my instvar cntr_val cntr_bak recs_val recs_bak 1477 1478 my cntr_stop 1479 1480 set value [format {%04x} [expr {1 << 11}]] 1481 $controller usbCmd 000200000004${value}0002000000040000 1482 1483 my recs_stop 1484 } 1485 1486 # ------------------------------------------------------------------------- 1487 1488 CntDisplay instproc cntr_ready {} { 1489 my instvar config cntr_val cntr_bak recs_val recs_bak 1490 1491 set cntr_val $cntr_bak 1492 set recs_val $recs_bak 1493 1494 ${config}.start configure -text Start -command [myproc recs_start] 1495 ${config}.reset configure -state active 1496 1497 ${config}.start configure -state active 1498 ${config}.cntr_field configure -state normal 1499 ${config}.recs_field configure -state normal 1500 } 1501 1502 # ------------------------------------------------------------------------- 1503 1504 CntDisplay instproc recs_start {} { 1505 my instvar controller config auto 1506 my instvar cntr_val cntr_bak recs_val recs_bak 1507 1508 if {$cntr_val > 0 && $recs_val > 0} { 1509 ${config}.start configure -text {Stop} -command [myproc recs_stop] 1510 ${config}.cntr_field configure -state disabled 1511 ${config}.recs_field configure -state disabled 1512 1513 set cntr_bak $cntr_val 1514 set recs_bak $recs_val 1515 1516 my cntr_setup 1517 my recs_setup 1518 1519 set val_addr [format {%02x} 16] 1520 1521 $controller usbCmd 000200${val_addr}00040002 1522 1523 set auto 1 1524 1525 after 100 [myproc acquire_loop] 1526 } 1527 } 1528 1529 # ------------------------------------------------------------------------- 1530 1531 CntDisplay instproc recs_stop {} { 1532 my instvar cntr_val cntr_bak recs_val recs_bak 1533 1534 my cntr_stop 1535 1536 set cntr_val $cntr_bak 1537 my cntr_setup 1538 1539 set recs_val $recs_bak 1540 my recs_setup 1541 1542 my acquire 1543 1544 my cntr_ready 1545 } 1546 1547 # ------------------------------------------------------------------------- 1548 1549 CntDisplay instproc cntr_stop {} { 1550 my instvar controller config auto 1551 1552 set val_addr [format {%02x} 16] 1553 1554 $controller usbCmd 000200${val_addr}00040000 1555 1556 set auto 0 1557 } 1558 1559 # ------------------------------------------------------------------------- 1560 1561 CntDisplay instproc acquire_loop {} { 1562 my instvar recs_val auto 1563 1564 my acquire 1565 1566 if {$recs_val == 0} { 1567 my cntr_stop 1568 my cntr_ready 1569 } elseif {$auto} { 1570 after 1000 [myproc acquire_loop] 1571 } 1572 } 1573 1574 # ------------------------------------------------------------------------- 1575 1576 CntDisplay instproc data_update args { 1577 my instvar config data 1578 usb::convertBlt $data 2 [myvar yvec] 1579 1580 ${config}.chan_frame.mean_value configure \ 1581 -text [format {%.2e} [usb::integrateBlt [myvar yvec] 1]] 1582 ${config}.chan_frame.entr_value configure \ 1583 -text [usb::integrateBlt [myvar yvec] 0] 1584 1585 } 1586 1587 # ------------------------------------------------------------------------- 1588 1589 CntDisplay instproc axis_update args { 1590 my instvar axis graph 1591 if {$axis} { 1592 $graph axis configure y -min 1 -max 1E5 -logscale yes 1593 } else { 1594 $graph axis configure y -min {} -max {} -logscale no 1595 } 1596 } 1597 1598 # ------------------------------------------------------------------------- 1599 1600 CntDisplay instproc acquire {} { 1601 my instvar controller config 1602 my instvar cntr cntr_val recs recs_val 1603 1604 set size 16384 1605 1606 set prefix [format {%x} 8] 1607 1608 set value [format {%08x} $size] 1609 1610 set command 0001${prefix}000000200000001[string range $value 0 3]0003[string range $value 4 7]00050000 1611 1612 $controller usbCmdReadRaw $command [expr {$size * 2}] [myvar data] 1613 1614 set prefix [format {%x} 9] 1615 set command 0001${prefix}000000200000003000400050000 1616 1617 $controller usbCmdReadHex $command 8 1 [myvar cntr] 1618 1619 set prefix [format {%x} 10] 1620 set command 0001${prefix}000000200000003000400050000 1621 1622 $controller usbCmdReadHex $command 8 1 [myvar recs] 1623 } 1624 1625 # ------------------------------------------------------------------------- 1626 1627 CntDisplay instproc save_data {data} { 1628 1629 set types { 1630 {{Data Files} {.dat} } 1631 {{All Files} * } 1632 } 1633 1634 set stamp [clock format [clock seconds] -format %Y%m%d_%H%M%S] 1635 set fname counts_${stamp}.dat 1636 1637 set fname [tk_getSaveFile -filetypes $types -initialfile $fname] 1638 if {[string equal $fname {}]} { 1639 return 1640 } 1641 1642 set x [catch { 1643 set fid [open $fname w+] 1644 puts $fid $data 1645 close $fid 1646 }] 1647 1648 if { $x || ![file exists $fname] || ![file isfile $fname] || ![file readable $fname] } { 1649 tk_messageBox -icon error \ 1650 -message "An error occurred while writing to \"$fname\"" 1651 } else { 1652 tk_messageBox -icon info \ 1653 -message "File \"$fname\" written successfully" 1654 } 1655 } 1656 1657 # ------------------------------------------------------------------------- 1658 1659 CntDisplay instproc register {} { 1660 my save_data [join [[myvar yvec] range 0 16383] \n] 1661 } 1662 1663 # ------------------------------------------------------------------------- 1664 1665 Class OscDisplay -parameter { 1666 {master} 1667 {controller} 1668 } 1669 1670 # ------------------------------------------------------------------------- 1671 1672 OscDisplay instproc init {} { 1673 my instvar sequence data xvec yvec 1674 1675 set data {} 1676 1677 set sequence 0 1678 1679 # set xvec [vector create #auto(262144)] 1680 set xvec [vector create #auto(10000)] 1681 1682 for {set i 1} {$i <= 9} {incr i} { 1683 # dict set yvec $i [vector create #auto(262144)] 1684 dict set yvec $i [vector create #auto(10000)] 1685 } 1686 1687 # fill one vector for the x axis 1688 # $xvec seq 0 262143 1689 $xvec seq 0 10000 1690 1691 my setup 1692 1693 next 1694 } 1695 1696 # ------------------------------------------------------------------------- 1697 1698 OscDisplay instproc destroy {} { 1699 next 1700 } 1701 1702 # ------------------------------------------------------------------------- 1703 1704 OscDisplay instproc start {} { 1705 my instvar config 1706 my instvar recs_val directory 1707 1708 set directory $::env(HOMEPATH) 1709 set recs_val 100 1710 1711 trace add variable [myvar chan] write [myproc chan_update] 1712 1713 trace add variable [myvar data] write [myproc data_update] 1714 1715 trace add variable [myvar auto] write [myproc auto_update] 1716 1717 trace add variable [myvar thrs] write [myproc thrs_update 0] 1718 trace add variable [myvar thrs_val] write [myproc thrs_update 0] 1719 1720 trace add variable [myvar recs_val] write [myproc recs_val_update] 1721 1722 trace add variable [myvar last] write [myproc last_update] 1723 1724 ${config}.chan_frame.chan1_check select 1725 ${config}.chan_frame.chan2_check select 1726 ${config}.chan_frame.chan3_check select 1727 ${config}.chan_frame.chan4_check select 1728 ${config}.chan_frame.chan5_check select 1729 ${config}.chan_frame.chan6_check select 1730 1731 ${config}.thrs_check select 1732 ${config}.thrs_field set 100 1733 } 1734 1735 # ------------------------------------------------------------------------- 1736 1737 OscDisplay instproc setup {} { 1738 my instvar master 1739 my instvar xvec yvec graph 1740 my instvar config 1741 1742 # create a graph widget and show a grid 1743 set graph [graph ${master}.graph -height 250 -leftmargin 80] 1744 $graph crosshairs configure -hide no -linewidth 1 -color darkblue -dashes {2 2} 1745 $graph grid configure -hide no 1746 $graph legend configure -hide yes 1747 $graph axis configure x -min 0 -max 10000 948 $graph axis configure x -min 0 -max 60000 1748 949 $graph axis configure y -min 0 -max 4100 1749 950 … … 1791 992 -bg yellow -activebackground yellow 1792 993 1793 frame ${config}.spc6 -width 170 -height 10994 frame ${config}.spc6 -width 170 -height 30 1794 995 1795 996 button ${config}.recover -text {Read file} \ … … 1920 1121 if {$thrs} { 1921 1122 ${config}.thrs_field configure -state normal 1922 set value [format %03x$thrs_val]1123 set value [format {%03x} $thrs_val] 1923 1124 } else { 1924 1125 ${config}.thrs_field configure -state disabled … … 1979 1180 1980 1181 # set size 262144 1981 set size 10000 1182 # set size 10000 1183 set size 60000 1982 1184 1983 1185 set value [format {%08x} [expr {$size * 4}]] 1984 1186 1985 1187 set command 00011000000200000001[string range $value 0 3]0003[string range $value 4 7]00050000 1986 1188 1987 1189 $controller usbCmdReadRaw $command [expr {$size * 8}] [myvar data] 1988 1190 … … 2071 1273 } 2072 1274 2073 set stamp [clock format [clock seconds] -format %Y%m%d_%H%M%S]1275 set stamp [clock format [clock seconds] -format {%Y%m%d_%H%M%S}] 2074 1276 set fname oscillogram_${stamp}.dat 2075 1277 … … 2078 1280 return 2079 1281 } 2080 1282 2081 1283 if {[catch {my save_data $fname} result]} { 2082 1284 tk_messageBox -icon error \ … … 2115 1317 ${config}.register configure -state disabled 2116 1318 ${config}.recover configure -state disabled 2117 1319 2118 1320 set recs_bak $recs_val 2119 1321 … … 2140 1342 return 2141 1343 } 2142 1344 2143 1345 my sequence_stop 2144 1346 } … … 2150 1352 2151 1353 set sequence 0 2152 1354 2153 1355 set recs_val $recs_bak 2154 1356 … … 2164 1366 namespace export MuxDisplay 2165 1367 namespace export HstDisplay 2166 namespace export C ntDisplay1368 namespace export CfgDisplay 2167 1369 namespace export OscDisplay 2168 1370 } … … 2176 1378 2177 1379 ::mca::UsbController usb 2178 usb usbCmd 000000002179 2180 set window [frame ${notebook}.spi]2181 $notebook insert end -text "DAC & ADC control" -window $window -fill both2182 ::mca::SpiDisplay spi -master $window -controller usb2183 1380 2184 1381 set window [frame ${notebook}.mux] … … 2186 1383 ::mca::MuxDisplay mux -master $window -controller usb 2187 1384 1385 set window [frame ${notebook}.cfg] 1386 $notebook insert end -text "Configuration" -window $window -fill both 1387 ::mca::CfgDisplay cfg -master $window -controller usb 1388 1389 set window [frame ${notebook}.hst] 1390 $notebook insert end -text "Histogram" -window $window -fill both 1391 ::mca::HstDisplay hst -number 0 -master $window -controller usb 1392 2188 1393 set window [frame ${notebook}.ept] 2189 1394 $notebook insert end -text "Oscilloscope" -window $window -fill both … … 2192 1397 update 2193 1398 2194 spistart1399 cfg start 2195 1400 2196 1401 mux start 2197 1402 1403 hst start 1404 2198 1405 osc start 2199 2200 spi adc_reset -
trunk/3DEES/amplitude.v
r178 r180 19 19 reg [width-1:0] inp_data_reg [1:0], inp_data_next [1:0]; 20 20 21 wire 21 wire [1:0] int_comp_wire; 22 22 reg int_comp_reg, int_comp_next; 23 23 24 24 reg [5:0] int_cntr_reg, int_cntr_next; 25 25 26 assign int_comp_wire = (inp_data_reg[1] < inp_data); 26 assign int_comp_wire[0] = (inp_data_reg[1] < inp_data); 27 assign int_comp_wire[1] = (inp_data_reg[1] < max_data); 27 28 28 29 always @(posedge clock) … … 73 74 inp_data_next[0] = inp_data; 74 75 inp_data_next[1] = inp_data_reg[0]; 75 int_comp_next = int_comp_wire ;76 int_comp_next = int_comp_wire[0]; 76 77 out_data_next = {(width){1'b0}}; 77 78 out_flag_next = 1'b0; 78 79 // minimum 79 if ((~int_comp_reg) & (int_comp_wire ) & int_cntr_reg[5])80 if ((~int_comp_reg) & (int_comp_wire[0]) & int_cntr_reg[5]) 80 81 begin 81 82 int_mini_next = inp_data_reg[0]; … … 83 84 end 84 85 // maximum after minimum 85 else if ((int_comp_reg) & (~int_comp_wire ) & (int_flag_reg))86 else if ((int_comp_reg) & (~int_comp_wire[0]) & (int_flag_reg)) 86 87 begin 87 88 out_data_next = inp_data_reg[0] - int_mini_reg; 88 int_flag_next = 1'b0;89 // int_flag_next = 1'b0; 89 90 int_case_next = 1'b1; 90 91 end … … 102 103 int_cntr_next = 6'b0; 103 104 // out_flag_next = 1'b1; 104 out_flag_next = (inp_data_reg[1] < max_data); 105 out_flag_next = int_comp_wire[1]; 106 int_flag_next = ~int_comp_wire[1]; 105 107 end 106 108 int_case_next = 1'b0; -
trunk/3DEES/histogram32.v
r107 r180 4 4 5 5 input wire hst_good, 6 input wire [ 11:0] hst_data,6 input wire [5:0] hst_data, 7 7 8 8 input wire bus_ssel, bus_wren, 9 input wire [ 12:0] bus_addr,9 input wire [6:0] bus_addr, 10 10 input wire [15:0] bus_mosi, 11 11 … … 17 17 reg [3:0] int_case_reg, int_case_next; 18 18 reg int_wren_reg, int_wren_next; 19 reg [ 11:0] int_addr_reg, int_addr_next;19 reg [5:0] int_addr_reg, int_addr_next; 20 20 reg [31:0] int_data_reg, int_data_next; 21 21 22 reg [ 12:0] bus_addr_reg, bus_addr_next;22 reg [6:0] bus_addr_reg, bus_addr_next; 23 23 reg [15:0] bus_miso_reg, bus_miso_next; 24 24 … … 38 38 .intended_device_family("Cyclone III"), 39 39 .lpm_type("altsyncram"), 40 .numwords_a( 4096),41 .numwords_b( 8192),40 .numwords_a(64), 41 .numwords_b(128), 42 42 .operation_mode("BIDIR_DUAL_PORT"), 43 43 .outdata_aclr_a("NONE"), … … 49 49 .read_during_write_mode_port_a("NEW_DATA_NO_NBE_READ"), 50 50 .read_during_write_mode_port_b("NEW_DATA_NO_NBE_READ"), 51 .widthad_a( 12),52 .widthad_b( 13),51 .widthad_a(6), 52 .widthad_b(7), 53 53 .width_a(32), 54 54 .width_b(16), … … 86 86 begin 87 87 int_wren_reg <= 1'b1; 88 int_addr_reg <= 12'd0;88 int_addr_reg <= 6'd0; 89 89 int_data_reg <= 32'd0; 90 90 int_case_reg <= 4'b0; 91 bus_addr_reg <= 13'd0;91 bus_addr_reg <= 7'd0; 92 92 bus_miso_reg <= 16'd0; 93 93 bus_wren_reg <= 1'b0; … … 139 139 begin 140 140 // write zeros 141 int_addr_next = int_addr_reg + 12'd1;141 int_addr_next = int_addr_reg + 6'd1; 142 142 if (&int_addr_reg) 143 143 begin … … 187 187 begin 188 188 int_wren_next = 1'b0; 189 int_addr_next = 12'd0;189 int_addr_next = 6'd0; 190 190 int_data_next = 32'd0; 191 191 int_case_next = 4'd0;
Note:
See TracChangeset
for help on using the changeset viewer.