ELGIP-91 ELGIP-88 - Created major version 3. Removed legacy code for output pulse conditioning and overdrive detection. Reviewed diagnostic registers

This commit is contained in:
gianmarcogirau 2020-04-15 14:21:46 +01:00
commit e2c35c7c44
26 changed files with 7867 additions and 1 deletions

View file

@ -0,0 +1,462 @@
[{
"ip_name": "pulse_generator_3",
"bus": "csr",
"description": "Generate Fire-Requests, based on the absolute position and PD inputs - W&H specific variant",
"addr_hi_bit" : "10",
"addr_lo_bit" : "5",
"sub_blocks": {
"local": {
"instance": "",
"process": "cpp, txt",
"offset": "0x0"
},
"generic_sequencer_15": {
"instance": "channel",
"process": "cpp, txt",
"offset": "0x20"
}
},
"registers": {
"ip_id" : {
"address" : "0",
"width" : "32",
"description" : "Unique ID for this IP block",
"fields": {
"ip_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x13",
"description" : "IP identifier number"
},
"mfr_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0xFF",
"description" : "Manufacturer number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
},
"ip_ver" : {
"address" : "1",
"width" : "32",
"description" : "IP Version",
"fields": {
"minor_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x01",
"description" : "Minor number"
},
"major_number" : {
"type" : "c",
"bit_len" : "8",
"reset" : "0x03",
"description" : "Major number"
},
"reserved" : {
"type" : "rsv",
"bit_len" : "16",
"description" : "Reserved bits"
}
}
},
"pulse_gen_control": {
"address": "2",
"width": "32",
"description": "",
"fields": {
"enable": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Pulse-Generator Enable"
},
"bypass_channel_controller": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "By-Pass Ch-Ctrl (=> Fractional Divider only)"
},
"reserved_0": {
"type": "rsv",
"bit_len": "1",
"description": ""
},
"bypass_delay_equalizer": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Bypass Delay Equalization"
},
"sw_control_dp_dir": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Dual-Phase Direction, when Ch-Ctrl is bypassed"
},
"pd_queue_error_flag": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "PD Queue Overflow Error"
},
"delay_equalizer_error_flag": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "Delay Equalizer Overflow Error"
},
"reserved_1": {
"type": "rsv",
"bit_len": "1",
"description": ""
},
"ch_mask_status": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "ch_mask status"
},
"fire_enable_status": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "fire enable status"
},
"dual_phase_directionality_select_status": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "Dual-Phase Direction status"
},
"wh_apply_corr_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Enable WH wheel correction "
},
"wh_apply_corr_en": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Enable Pixel-Pitch Correction "
},
"tof_comp_enable": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Enable Time-of-Flight Compensation"
},
"tof_sat_flag": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "Asserted when the current encoder velocity value falls outside of the range covered by the ToF compensation LUT. Velocity saturation is therefore applied."
},
"reserved_2": {
"type": "rsv",
"bit_len": "2",
"description": ""
},
"enable_output": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Enable fire-request output"
},
"trigger_abort_fire": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Abort pending request of fire-request issued by Ch-Ctrl"
},
"reset_diag_regs" : {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Reset the local PD and Fire-Request counters"
},
"clr_pd_queue" : {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "Clear PD Queue"
},
"reserved_3" : {
"type": "rsv",
"bit_len": "12",
"description": ""
}
}
},
"pd_offset_dir_0": {
"type": "w",
"address": "3",
"reset": "0x00",
"width": "32",
"description": "PD Offset for DIR-0"
},
"pd_offset_dir_1": {
"type": "w",
"address": "4",
"reset": "0x00",
"width": "32",
"description": "PD Offset for DIR-1"
},
"channel_delay": {
"type": "w",
"address": "5",
"reset": "0x00",
"width": "16",
"description": "Channel Delay (Delay Equalization)"
},
"channel_controller_control": {
"address": "6",
"width": "16",
"description": "",
"fields": {
"start_seq_trigger": {
"type": "w0",
"bit_len": "1",
"reset": "0x0",
"description": "Ch-Ctrl Sequencer Start-Request"
},
"busy": {
"type": "r",
"bit_len": "1",
"reset": "0x0",
"description": "Ch-Ctrl Sequencer Busy"
},
"reserved0": {
"type": "rsv",
"bit_len": "6",
"description": ""
},
"sequencer_start_address": {
"type": "w",
"bit_len": "8",
"reset" : "0x0",
"description": "Ch-Ctrl Sequencer Start-Address"
}
}
},
"fractional_divider_control": {
"address": "7",
"width": "3",
"description": "Fractional Divider Control Register",
"fields": {
"enable": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Fractional Divider Enable"
},
"udp_max_pos": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Clear the encoder jitter for DIR-0"
},
"udp_min_pos": {
"type": "w",
"bit_len": "1",
"reset": "0x0",
"description": "Clear the encoder jitter for DIR-1"
}
}
},
"divider_ratio_int": {
"type": "w",
"address": "11",
"reset": "0x00",
"width": "10",
"description": "Integer part of the Division ratio"
},
"divider_ratio_fraction": {
"type": "w",
"address": "12",
"reset": "0x00",
"width": "24",
"description": "Fractional part of the Division ratio"
},
"subpixel_phase_num": {
"type": "w",
"address": "13",
"reset": "0x01",
"width": "6",
"description": "Number of sub-pixel phases to be generated"
},
"abs_position_max": {
"type": "r",
"address": "15",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Absolute Position Maximum"
},
"abs_position_min": {
"type": "r",
"address": "16",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Absolute Position Minimum"
},
"abs_position": {
"type": "r",
"address": "17",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Current Absolute Position "
},
"pd_counter": {
"type": "r",
"address": "18",
"reset": "0x00",
"width": "16",
"description": "PD counter"
},
"fire_req_counter": {
"type": "r",
"address": "19",
"reset": "0x00",
"width": "24",
"description": "Fire-Request counter"
},
"enc_speed_meas_window": {
"address": "20",
"width": "20",
"type": "w",
"reset": "0x0C350",
"description": "Encoder speed measurement window length [clock cycles @100MHz]"
},
"enc_speed": {
"address": "21",
"width": "20",
"type": "r",
"reset": "0x0",
"subtype": "signed",
"description": "Encoder Velocity: balance between positive and negative encoder steps over the measurement window"
},
"tof_compensation": {
"address": "22",
"width": "32",
"description": "Time-of-Flight Compensation",
"fields": {
"enc_speed_norm": {
"type": "w",
"bit_len": "16",
"reset": "0x0100",
"description": "Encoder Speed Normalization factor: allow to match the encoder-speed range to the address bus width of the ToF Compensation LUT. With the default value (256), an encoder-speed measurement equal to k selects LUT address k)"
},
"tof_lut_comp": {
"type": "r",
"bit_len": "16",
"reset": "0x0",
"description": "Current value of the Time-of-Flight compensation"
}
}
},
"pixel_pitch_corr_stripe_num": {
"type": "w",
"address": "23",
"reset": "0x00",
"width": "24",
"description": "Number of stripes to be considered for pixel pitch correction: corresponds to the number of pixels composing the label, head width included)"
},
"pixel_pitch_pos_err_2_corr": {
"type": "w",
"address": "24",
"reset": "0x00",
"width": "32",
"description": "Static value used by the logic to compute pixel-pitch correction: need to be set to the number of 2^32/stripe_num, where stripe_num is the value programmed in pixel_pitch_corr_stripe_num"
},
"pixel_pitch_skip_corr_thres": {
"type": "w",
"address": "25",
"reset": "0x400000",
"width": "24",
"description": "Alignment error threshold causing a correction to be skipped, expressed in encoder steps (24-bits integer) "
},
"pixel_pitch_loop_filter_corr": {
"address": "26",
"width": "32",
"description": "Loop filter coefficient for pixel-pitch correction",
"fields": {
"delta_error_coeff": {
"type": "w",
"bit_len": "16",
"reset": "0x0100",
"description": "Loop Filter delta-error coefficient"
},
"tot_error_coeff": {
"type": "w",
"bit_len": "16",
"reset": "0x0100",
"description": "Loop Filter tot-error coefficient"
}
}
},
"pixel_pitch_pos_err_curr": {
"type": "r",
"address": "27",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Pixel-pitch misalignment measured on the last rotation [encoder steps], represented as signed, fixed point with 24-bits integer part and 8-bits mantissa"
},
"pixel_pitch_pos_err_max": {
"type": "r",
"address": "28",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Maximum recorded value of pixel-pitch misalignment [encoder steps], represented as signed, fixed point with 24-bits integer part and 8-bits mantissa"
},
"pixel_pitch_pos_err_min": {
"type": "r",
"address": "29",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Minimum recorded value of pixel-pitch misalignment [encoder steps], represented as signed, fixed point with 24-bits integer part and 8-bits mantissa"
},
"pixel_pitch_div_ratio_corr": {
"type": "r",
"address": "30",
"reset": "0x00",
"width": "32",
"subtype": "signed",
"description": "Division-Ratio Correction (32-LSBs)"
},
"pixel_pitch_corr_cnt": {
"type": "r",
"address": "31",
"reset": "0x00",
"width": "16",
"description": "Pixel-pitch corrections count"
},
"channel_controller_seq": {
"type": "w",
"address": "512",
"reset": "0x00",
"width": "32",
"description": "Ch-Ctrl buffer offset (size=256)"
},
"ToF_Comp_LUT": {
"type": "w",
"address": "1024",
"reset": "0x00",
"width": "16",
"description": "The LUT size is 512x16"
}
}
}]

View file

@ -0,0 +1,79 @@
# Simulation macro
.main clear
# Cleanup libraries
foreach lib [list work OSVVM] {
file delete -force -- $lib
vlib $lib
}
set COMP_ONLY 0
set TB_PATH ./../src/test
set SRC_PATH ../src
set COMMON_PATH ../../../common/0/src
set SEQUENCER_PATH ../../../generic_sequencer/16
set OSVVM_PATH ../../../common/0/src/test/OSVVM
set WORKLIB work
vlib ./work
vmap work ./work
if {$COMP_ONLY == 0} {
# Compile the constrained random related packages
vlib OSVVM
vcom -2008 -work OSVVM \
$OSVVM_PATH/RandomBasePkg.vhd \
$OSVVM_PATH/SortListPkg_int.vhd \
$OSVVM_PATH/RandomPkg.vhd \
$OSVVM_PATH/NamePkg.vhd \
$OSVVM_PATH/MessagePkg.vhd \
$OSVVM_PATH/CoveragePkg.vhd
}
# compile the UUTs:
vcom -2008 -work work $COMMON_PATH/common_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/sync_fifo.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/queue_and_delay.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/dpram_sclk.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/altera/generic_seq_ram_16.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_16_pkg.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_16.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/simple_frac_div_3.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_3_pkg.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_3.vhd
# Compile the testbench and the other components supporting the test
if {$COMP_ONLY == 0} {
# Test support packages
vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/avalon_verify_pkg.vhd
# Testbench
vcom -2008 -work $WORKLIB $TB_PATH/ch_ctrl_cfg_tb.vhd
vsim -t ps work.ch_ctrl_cfg_tb
#add wave /ch_ctrl_cfg_tb/*
#add wave ch_ctrl_cfg_tb/iUUT/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_ch_ctrl_cfg.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 1 ms;
}

View file

@ -0,0 +1,79 @@
# Simulation macro Net-Sync testbench
.main clear
# Cleanup libraries
foreach lib [list work OSVVM] {
file delete -force -- $lib
vlib $lib
}
set COMP_ONLY 0
set TB_PATH ./../src/test
set SRC_PATH ../src
set COMMON_PATH ../../../common/0/src
set SEQUENCER_PATH ../../../generic_sequencer/16
set OSVVM_PATH ../../../common/0/src/test/OSVVM
set WORKLIB work
vlib ./work
vmap work ./work
if {$COMP_ONLY == 0} {
# Compile the constrained random related packages
vlib OSVVM
vcom -2008 -work OSVVM \
$OSVVM_PATH/RandomBasePkg.vhd \
$OSVVM_PATH/SortListPkg_int.vhd \
$OSVVM_PATH/RandomPkg.vhd \
$OSVVM_PATH/NamePkg.vhd \
$OSVVM_PATH/MessagePkg.vhd \
$OSVVM_PATH/CoveragePkg.vhd
}
# compile the UUTs:
vcom -2008 -work work $COMMON_PATH/common_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/sync_fifo.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/queue_and_delay.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/dpram_sclk.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/altera/generic_seq_ram_16.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_16_pkg.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_16.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/simple_frac_div_3.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_3_pkg.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_3.vhd
# Compile the testbench and the other components supporting the test
if {$COMP_ONLY == 0} {
# Test support packages
vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/avalon_verify_pkg.vhd
# Testbench
vcom -2008 -work $WORKLIB $TB_PATH/pd_jitter_verify_tb.vhd
vsim -t ps work.pd_jitter_verify_tb
#add wave /pd_jitter_verify_tb/*
#add wave /pd_jitter_verify_tb/iUUT/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_pd_jitter.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 1 ms;
}

View file

@ -0,0 +1,67 @@
# Simulation macro
.main clear
# Cleanup libraries
foreach lib [list work OSVVM] {
file delete -force -- $lib
vlib $lib
}
set COMP_ONLY 0
set TB_PATH ./../src/test
set OSVVM_PATH ../../../common/0/src/test/OSVVM
set COMMON_PATH ../../../common/0/src
set WORKLIB work
vlib ./work
vmap work ./work
if {$COMP_ONLY == 0} {
# Compile the constrained random related packages
vlib OSVVM
vcom -2008 -work OSVVM \
$OSVVM_PATH/RandomBasePkg.vhd \
$OSVVM_PATH/SortListPkg_int.vhd \
$OSVVM_PATH/RandomPkg.vhd \
$OSVVM_PATH/NamePkg.vhd \
$OSVVM_PATH/MessagePkg.vhd \
$OSVVM_PATH/CoveragePkg.vhd
}
# compile the UUTs:
vcom -2008 -work $WORKLIB ../src/simple_frac_div_3.vhd
# Compile the testbench and the other components supporting the test
if {$COMP_ONLY == 0} {
# Test support packages
vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd
# Testbench
vcom -2008 -work $WORKLIB $TB_PATH/simple_frac_div_tb.vhd
vsim -t ps work.simple_frac_div_tb
#add wave /simple_frac_div_tb/*
#add wave /simple_frac_div_tb/iUUT/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_simple_frac_div.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 1 ms;
}

View file

@ -0,0 +1,83 @@
# Simulation macro
.main clear
# Cleanup libraries
foreach lib [list work OSVVM] {
file delete -force -- $lib
vlib $lib
}
set COMP_ONLY 0
set TB_PATH ./../src/test
set SRC_PATH ../src
set COMMON_PATH ../../../common/0/src
set SEQUENCER_PATH ../../../generic_sequencer/16
set FPM_PATH ../../../fire_pulse_manager/2/src
set OSVVM_PATH ../../../common/0/src/test/OSVVM
set WORKLIB work
vlib ./work
vmap work ./work
if {$COMP_ONLY == 0} {
# Compile the constrained random related packages
vlib OSVVM
vcom -2008 -work OSVVM \
$OSVVM_PATH/RandomBasePkg.vhd \
$OSVVM_PATH/SortListPkg_int.vhd \
$OSVVM_PATH/RandomPkg.vhd \
$OSVVM_PATH/NamePkg.vhd \
$OSVVM_PATH/MessagePkg.vhd \
$OSVVM_PATH/CoveragePkg.vhd
}
# compile the UUTs:
vcom -2008 -work work $COMMON_PATH/common_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/altera/sync_fifo.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/queue_and_delay.vhd
#vcom -2008 -work $WORKLIB $COMMON_PATH/dpram_sclk.vhd
vlog -work $WORKLIB $COMMON_PATH/dpram_sclk.v
vcom -2008 -work $WORKLIB $FPM_PATH/simple_enc_vel_detect.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/altera/generic_seq_ram_16.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_16_pkg.vhd
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_16.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/simple_frac_div_3.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_3_pkg.vhd
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_3.vhd
# Compile the testbench and the other components supporting the test
if {$COMP_ONLY == 0} {
# Test support packages
vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd
vcom -2008 -work $WORKLIB $COMMON_PATH/test/avalon_verify_pkg.vhd
# Testbench
vcom -2008 -work $WORKLIB $TB_PATH/tof_comp_tb.vhd
vsim -t ps work.tof_comp_tb
#add wave tof_comp_tb/*
#add wave tof_comp_tb/iUUT/*
#add wave tof_comp_tb/iVEL/*
# remove warnings from standard numeric/arithmetic packages (speed-up simulation)
set StdArithNoWarnings 1
set NumericStdNoWarnings 1
do wave_tof_comp.do
when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;}
run -all
#run 1 ms;
}

View file

@ -0,0 +1,247 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /ch_ctrl_cfg_tb/reset_n
add wave -noupdate /ch_ctrl_cfg_tb/clk
add wave -noupdate /ch_ctrl_cfg_tb/wheel_error
add wave -noupdate /ch_ctrl_cfg_tb/rotation_idx
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_rotat_cnt
add wave -noupdate /ch_ctrl_cfg_tb/wh_pos_err_r
add wave -noupdate /ch_ctrl_cfg_tb/div_ratio_corr_rr
add wave -noupdate /ch_ctrl_cfg_tb/wheel_corr_on
add wave -noupdate /ch_ctrl_cfg_tb/pos_error
add wave -noupdate /ch_ctrl_cfg_tb/pos_error_old
add wave -noupdate /ch_ctrl_cfg_tb/div_ratio_corr_r
add wave -noupdate /ch_ctrl_cfg_tb/div_ratio_r
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio_i
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio_corr
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_loop_filt_tot
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_loop_filt_delta
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_pos_err_old
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_tot_err
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_delta_err
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_loop_err
add wave -noupdate /ch_ctrl_cfg_tb/wh_pos_err_r
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/wh_pos_err_curr
add wave -noupdate /ch_ctrl_cfg_tb/init
add wave -noupdate /ch_ctrl_cfg_tb/pd_in
add wave -noupdate /ch_ctrl_cfg_tb/skip_pd
add wave -noupdate /ch_ctrl_cfg_tb/wheel_pos
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/abs_position
add wave -noupdate /ch_ctrl_cfg_tb/dp_dir
add wave -noupdate /ch_ctrl_cfg_tb/fire_req
add wave -noupdate /ch_ctrl_cfg_tb/filtered_pd
add wave -noupdate /ch_ctrl_cfg_tb/ch_pd
add wave -noupdate /ch_ctrl_cfg_tb/ch_mask
add wave -noupdate /ch_ctrl_cfg_tb/raw_fire_req
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/avs_address
add wave -noupdate /ch_ctrl_cfg_tb/avs_write
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/avs_writedata
add wave -noupdate /ch_ctrl_cfg_tb/avs_read
add wave -noupdate /ch_ctrl_cfg_tb/avs_readdatavalid
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/avs_readdata
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/avs_m
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/avs_s
add wave -noupdate /ch_ctrl_cfg_tb/pd_in_cnt
add wave -noupdate /ch_ctrl_cfg_tb/pd_out_cnt
add wave -noupdate /ch_ctrl_cfg_tb/test_completed
add wave -noupdate /ch_ctrl_cfg_tb/setup
add wave -noupdate /ch_ctrl_cfg_tb/running
add wave -noupdate /ch_ctrl_cfg_tb/passed
add wave -noupdate /ch_ctrl_cfg_tb/failed
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_apply_corr_en
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_error_meas_avail
add wave -noupdate /ch_ctrl_cfg_tb/pos_error
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/wh_pos_err_abs
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/wh_skip_corr_thres
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_skip_corr
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_corr_ready
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_error_meas_started
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/init_wh
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/loc_pd_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_meas_event
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_img_end
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/wh_img_pixel_cnt
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/wh_image_pixel_len
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/first_img_started
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_error_meas_avail
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_corr_ready_v
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/start_pos
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/abs_pos_d
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/basic_pos_error
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/wh_pos_err_abs
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_skip_corr_thres
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/wh_pos_err
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_pos_err_max
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_pos_err_min
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_pos_err_2_corr
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/div_ratio_corr_new
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/pos_error
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio_corr_ext
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio_i
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio_corr
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/clk
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/reset_n
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/init
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/pd_in
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/abs_position
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/dp_dir
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/filtered_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_mask
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/enc_pulse
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/avs_address
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_write
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/avs_writedata
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_read
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_readdatavalid
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/avs_readdata
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/init_de
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/init_qd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/enable
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/loc_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/pd_queue_error
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_start_req
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/pd_pulse
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/filt_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/filt_pd_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_write
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_read
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_busy
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/enable_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_mask_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/bypass_ch_ctrl
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/bypass_delay_equal
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/div_pulse
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/gated_pulse
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/retimed_pulse
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_write_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_read_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_read_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/de_queue_error
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/cnt_dir
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/dp_dir_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_start_req_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/set_first_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/dp_dir_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/pulse_scale_out
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_img_req
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_img_req_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_img
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_img_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_img_dd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/fire_enable
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/img_completed
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/sw_ctrl_dp_dir
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/enable_out
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_start_req_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/add_img_size
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/add_img_size_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/abort_fire
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_write
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_read
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/frac_div_en_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/upd_max_pos
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/upd_min_pos
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/frac_div_en
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/gen_filt_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/upd_max_pos_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/upd_min_pos_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/dir_change
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/first_pd
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/pd_in_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/filt_pd_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/abs_pos_lsb
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_start_req_ii
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/prevent_div_restart
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/rst_jitter
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/rst_diag_regs
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/fire_req
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/mid_cross
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/mid_crossed
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/zero_cross
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/close_to_zero
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/close_to_mid
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/div_pulse_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/spitting_enable
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/spit_pulse
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/seq_bus_valid
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/spit_nco_msb
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/abs_pos_msb_old
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_addr
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_trigger_in
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_addr
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/init_v
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_start_addr
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_address
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_address_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/img_size
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/pixel_cnt
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_vector_out
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/ch_offset
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/ch_delay
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/avs_readdata_i
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/ch_ctrl_writedata
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/ch_ctrl_readdata
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_writedata
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_readdata
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/ch_offset_dir0
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/ch_offset_dir1
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/abs_pos_max
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/abs_pos_min
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/last_pd_pos
add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/fire_req_cnt
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/seq_bus_data
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/spit_nco
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/spit_nco_inc
add wave -noupdate -radix hexadecimal /ch_ctrl_cfg_tb/iUUT/div_ratio
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/div_ratio_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/div_ratio_corr
add wave -noupdate -divider {PD Queue}
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/USE_EXT_TIME
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/QUEUE_SIZE
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/rstN
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/clk
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/init
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/cnt_dir
add wave -noupdate -radix decimal /ch_ctrl_cfg_tb/iUUT/iPD_queue/delay
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/ext_time
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/wave_in
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/wave_out
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/ovf_error
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/toggle_in
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/toggle_out
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/time_elapsed
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/wave_in_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/wave_out_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/pending_trans
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/fifo_rd_en
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/fifo_empty
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/fifo_full
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/cnt_dir_i
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/wave_out_i_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/new_event
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/wave_out_ii
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/shf_enable
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/delay_line
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/local_time_d
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/event_time
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {2135755000 ps} 0} {{Cursor 2} {15451360286 ps} 0}
quietly wave cursor active 2
configure wave -namecolwidth 293
configure wave -valuecolwidth 216
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {17886802338 ps} {19427520930 ps}

View file

@ -0,0 +1,148 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /pd_jitter_verify_tb/reset_n
add wave -noupdate /pd_jitter_verify_tb/clk
add wave -noupdate /pd_jitter_verify_tb/init
add wave -noupdate /pd_jitter_verify_tb/pd_in
add wave -noupdate -radix decimal /pd_jitter_verify_tb/abs_position
add wave -noupdate /pd_jitter_verify_tb/dp_dir
add wave -noupdate /pd_jitter_verify_tb/filtered_pd
add wave -noupdate /pd_jitter_verify_tb/ch_pd
add wave -noupdate /pd_jitter_verify_tb/pd_in_cnt
add wave -noupdate /pd_jitter_verify_tb/pd_out_cnt
add wave -noupdate /pd_jitter_verify_tb/ch_mask
add wave -noupdate -radix hexadecimal /pd_jitter_verify_tb/avs_address
add wave -noupdate /pd_jitter_verify_tb/avs_write
add wave -noupdate -radix hexadecimal /pd_jitter_verify_tb/avs_writedata
add wave -noupdate /pd_jitter_verify_tb/avs_read
add wave -noupdate /pd_jitter_verify_tb/avs_readdatavalid
add wave -noupdate -radix hexadecimal /pd_jitter_verify_tb/avs_readdata
add wave -noupdate /pd_jitter_verify_tb/avs_m
add wave -noupdate /pd_jitter_verify_tb/avs_s
add wave -noupdate /pd_jitter_verify_tb/test_completed
add wave -noupdate /pd_jitter_verify_tb/setup
add wave -noupdate /pd_jitter_verify_tb/running
add wave -noupdate /pd_jitter_verify_tb/error_flag
add wave -noupdate /pd_jitter_verify_tb/passed
add wave -noupdate /pd_jitter_verify_tb/failed
add wave -noupdate /pd_jitter_verify_tb/iUUT/clk
add wave -noupdate /pd_jitter_verify_tb/iUUT/reset_n
add wave -noupdate /pd_jitter_verify_tb/iUUT/init
add wave -noupdate /pd_jitter_verify_tb/iUUT/pd_in
add wave -noupdate -radix decimal /pd_jitter_verify_tb/iUUT/abs_position
add wave -noupdate /pd_jitter_verify_tb/iUUT/dp_dir
add wave -noupdate /pd_jitter_verify_tb/iUUT/gen_filt_pd
add wave -noupdate /pd_jitter_verify_tb/iUUT/filtered_pd
add wave -noupdate /pd_jitter_verify_tb/iUUT/pd_pulse
add wave -noupdate /pd_jitter_verify_tb/iUUT/first_pd
add wave -noupdate /pd_jitter_verify_tb/iUUT/filt_pd
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_pd
add wave -noupdate -radix decimal /pd_jitter_verify_tb/iUUT/last_pd_pos
add wave -noupdate /pd_jitter_verify_tb/iUUT/close_to_zero
add wave -noupdate /pd_jitter_verify_tb/iUUT/close_to_mid
add wave -noupdate /pd_jitter_verify_tb/iUUT/mid_cross
add wave -noupdate /pd_jitter_verify_tb/iUUT/mid_crossed
add wave -noupdate /pd_jitter_verify_tb/iUUT/zero_cross
add wave -noupdate /pd_jitter_verify_tb/iUUT/abs_pos_msb_old
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_mask
add wave -noupdate -radix hexadecimal /pd_jitter_verify_tb/iUUT/avs_address
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_write
add wave -noupdate -radix hexadecimal /pd_jitter_verify_tb/iUUT/avs_writedata
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_read
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_readdatavalid
add wave -noupdate -radix hexadecimal /pd_jitter_verify_tb/iUUT/avs_readdata
add wave -noupdate /pd_jitter_verify_tb/iUUT/init_de
add wave -noupdate /pd_jitter_verify_tb/iUUT/init_qd
add wave -noupdate /pd_jitter_verify_tb/iUUT/enable
add wave -noupdate /pd_jitter_verify_tb/iUUT/loc_pd
add wave -noupdate /pd_jitter_verify_tb/iUUT/pd_queue_error
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_start_req
add wave -noupdate /pd_jitter_verify_tb/iUUT/filt_pd_d
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_write
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_read
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_busy
add wave -noupdate /pd_jitter_verify_tb/iUUT/enable_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_mask_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/bypass_ch_ctrl
add wave -noupdate /pd_jitter_verify_tb/iUUT/bypass_delay_equal
add wave -noupdate /pd_jitter_verify_tb/iUUT/div_pulse
add wave -noupdate /pd_jitter_verify_tb/iUUT/gated_pulse
add wave -noupdate /pd_jitter_verify_tb/iUUT/retimed_pulse
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_write_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_read_d
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_read_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/de_queue_error
add wave -noupdate /pd_jitter_verify_tb/iUUT/cnt_dir
add wave -noupdate /pd_jitter_verify_tb/iUUT/dp_dir_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_start_req_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/set_first_pd
add wave -noupdate /pd_jitter_verify_tb/iUUT/dp_dir_d
add wave -noupdate /pd_jitter_verify_tb/iUUT/pulse_scale_out
add wave -noupdate /pd_jitter_verify_tb/iUUT/start_img_req
add wave -noupdate /pd_jitter_verify_tb/iUUT/start_img_req_d
add wave -noupdate /pd_jitter_verify_tb/iUUT/start_img
add wave -noupdate /pd_jitter_verify_tb/iUUT/start_img_d
add wave -noupdate /pd_jitter_verify_tb/iUUT/start_img_dd
add wave -noupdate /pd_jitter_verify_tb/iUUT/fire_enable
add wave -noupdate /pd_jitter_verify_tb/iUUT/img_completed
add wave -noupdate /pd_jitter_verify_tb/iUUT/sw_ctrl_dp_dir
add wave -noupdate /pd_jitter_verify_tb/iUUT/enable_out
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_start_req_d
add wave -noupdate /pd_jitter_verify_tb/iUUT/add_img_size
add wave -noupdate /pd_jitter_verify_tb/iUUT/add_img_size_d
add wave -noupdate /pd_jitter_verify_tb/iUUT/abort_fire
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_csr_write
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_csr_read
add wave -noupdate /pd_jitter_verify_tb/iUUT/frac_div_en_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/upd_max_pos
add wave -noupdate /pd_jitter_verify_tb/iUUT/upd_min_pos
add wave -noupdate /pd_jitter_verify_tb/iUUT/frac_div_en
add wave -noupdate /pd_jitter_verify_tb/iUUT/upd_max_pos_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/upd_min_pos_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/dir_change
add wave -noupdate /pd_jitter_verify_tb/iUUT/pd_in_d
add wave -noupdate /pd_jitter_verify_tb/iUUT/filt_pd_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/abs_pos_lsb
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_start_req_ii
add wave -noupdate /pd_jitter_verify_tb/iUUT/prevent_div_restart
add wave -noupdate /pd_jitter_verify_tb/iUUT/rst_jitter
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_csr_addr
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_trigger_in
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_addr
add wave -noupdate /pd_jitter_verify_tb/iUUT/init_v
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_start_addr
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_address
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_address_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/img_size
add wave -noupdate /pd_jitter_verify_tb/iUUT/pixel_cnt
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_vector_out
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_offset
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_delay
add wave -noupdate /pd_jitter_verify_tb/iUUT/avs_readdata_i
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_writedata
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_readdata
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_csr_writedata
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_ctrl_csr_readdata
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_offset_dir0
add wave -noupdate /pd_jitter_verify_tb/iUUT/ch_offset_dir1
add wave -noupdate /pd_jitter_verify_tb/iUUT/abs_pos_max
add wave -noupdate /pd_jitter_verify_tb/iUUT/abs_pos_min
add wave -noupdate /pd_jitter_verify_tb/iUUT/div_ratio
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {35005000 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 281
configure wave -valuecolwidth 146
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {85023836 ps} {100488220 ps}

View file

@ -0,0 +1,77 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /simple_frac_div_tb/reset_n
add wave -noupdate /simple_frac_div_tb/clk
add wave -noupdate /simple_frac_div_tb/enable
add wave -noupdate /simple_frac_div_tb/dir
add wave -noupdate -radix hexadecimal /simple_frac_div_tb/offset
add wave -noupdate -radix hexadecimal /simple_frac_div_tb/ratio
add wave -noupdate -radix decimal /simple_frac_div_tb/abs_pos
add wave -noupdate /simple_frac_div_tb/fire
add wave -noupdate -radix unsigned /simple_frac_div_tb/fire_cnt
add wave -noupdate /simple_frac_div_tb/div_ratio
add wave -noupdate /simple_frac_div_tb/pixel_offset
add wave -noupdate /simple_frac_div_tb/ideal_fire
add wave -noupdate /simple_frac_div_tb/firing_error
add wave -noupdate /simple_frac_div_tb/pos
add wave -noupdate /simple_frac_div_tb/test_completed
add wave -noupdate /simple_frac_div_tb/configuring
add wave -noupdate /simple_frac_div_tb/running
add wave -noupdate /simple_frac_div_tb/passed
add wave -noupdate /simple_frac_div_tb/failed
add wave -noupdate /simple_frac_div_tb/pTB_CTRL/delta_pos
add wave -noupdate /simple_frac_div_tb/pTB_CTRL/init_pos
add wave -noupdate /simple_frac_div_tb/pTB_CTRL/dir_m
add wave -noupdate /simple_frac_div_tb/pTB_CTRL/tot_steps
add wave -noupdate /simple_frac_div_tb/pTB_CTRL/result
add wave -noupdate /simple_frac_div_tb/pTB_CTRL/test_idx
add wave -noupdate /simple_frac_div_tb/iUUT/clk
add wave -noupdate /simple_frac_div_tb/iUUT/enable
add wave -noupdate /simple_frac_div_tb/iUUT/upd_max_pos
add wave -noupdate /simple_frac_div_tb/iUUT/upd_min_pos
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/abs_pos_max
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/abs_pos_min
add wave -noupdate /simple_frac_div_tb/iUUT/dir
add wave -noupdate -radix hexadecimal /simple_frac_div_tb/iUUT/offset
add wave -noupdate -radix hexadecimal /simple_frac_div_tb/iUUT/ratio
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/abs_pos
add wave -noupdate /simple_frac_div_tb/iUUT/fire
add wave -noupdate -radix unsigned /simple_frac_div_tb/iUUT/fire_cnt
add wave -noupdate /simple_frac_div_tb/iUUT/enable_d
add wave -noupdate /simple_frac_div_tb/iUUT/start
add wave -noupdate /simple_frac_div_tb/iUUT/inc_pos
add wave -noupdate /simple_frac_div_tb/iUUT/dec_pos
add wave -noupdate /simple_frac_div_tb/iUUT/new_max
add wave -noupdate /simple_frac_div_tb/iUUT/new_min
add wave -noupdate /simple_frac_div_tb/iUUT/delta_wrap
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/pos_diff
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/pos_max
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/pos_min
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/dist_pos
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/dist_neg
add wave -noupdate /simple_frac_div_tb/iUUT/update
add wave -noupdate -radix unsigned /simple_frac_div_tb/iUUT/fire_cnt_i
add wave -noupdate /simple_frac_div_tb/iUUT/zeros
add wave -noupdate -radix unsigned /simple_frac_div_tb/iUUT/delta_pos
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/pos_diff
add wave -noupdate -radix unsigned /simple_frac_div_tb/iUUT/abs_pos_d
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/ideal_fire
add wave -noupdate -radix decimal /simple_frac_div_tb/iUUT/firing_error
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {212441 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 266
configure wave -valuecolwidth 182
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {3225966927 ps} {3226491215 ps}

View file

@ -0,0 +1,270 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /tof_comp_tb/reset_n
add wave -noupdate /tof_comp_tb/clk
add wave -noupdate /tof_comp_tb/init
add wave -noupdate /tof_comp_tb/pd_in
add wave -noupdate -radix decimal /tof_comp_tb/abs_position
add wave -noupdate /tof_comp_tb/dp_dir
add wave -noupdate /tof_comp_tb/fire_req
add wave -noupdate /tof_comp_tb/filtered_pd
add wave -noupdate /tof_comp_tb/ch_pd
add wave -noupdate /tof_comp_tb/ch_mask
add wave -noupdate /tof_comp_tb/raw_fire_req
add wave -noupdate /tof_comp_tb/avs_address
add wave -noupdate /tof_comp_tb/avs_write
add wave -noupdate /tof_comp_tb/avs_writedata
add wave -noupdate /tof_comp_tb/avs_read
add wave -noupdate /tof_comp_tb/avs_readdatavalid
add wave -noupdate /tof_comp_tb/avs_readdata
add wave -noupdate /tof_comp_tb/avs_m
add wave -noupdate /tof_comp_tb/avs_s
add wave -noupdate /tof_comp_tb/step_pos
add wave -noupdate /tof_comp_tb/step_neg
add wave -noupdate -radix decimal /tof_comp_tb/vel_meas
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_addr
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_comp
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/ch_delay
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/ch_delay_i
add wave -noupdate /tof_comp_tb/end_of_stimuli
add wave -noupdate /tof_comp_tb/test_completed
add wave -noupdate /tof_comp_tb/setup
add wave -noupdate /tof_comp_tb/running
add wave -noupdate /tof_comp_tb/passed
add wave -noupdate /tof_comp_tb/failed
add wave -noupdate /tof_comp_tb/vel_meas_cnt
add wave -noupdate /tof_comp_tb/vel_upd_flag
add wave -noupdate /tof_comp_tb/iUUT/clk
add wave -noupdate /tof_comp_tb/iUUT/reset_n
add wave -noupdate /tof_comp_tb/iUUT/init
add wave -noupdate /tof_comp_tb/iUUT/pd_in
add wave -noupdate -radix decimal /tof_comp_tb/iUUT/abs_position
add wave -noupdate /tof_comp_tb/fire_cnt
add wave -noupdate /tof_comp_tb/raw_fire_cnt
add wave -noupdate /tof_comp_tb/iUUT/dp_dir
add wave -noupdate -radix decimal /tof_comp_tb/iUUT/enc_vel
add wave -noupdate -radix hexadecimal /tof_comp_tb/iUUT/norm_enc_vel
add wave -noupdate /tof_comp_tb/iUUT/fire_req
add wave -noupdate /tof_comp_tb/iUUT/tof_comp_enable
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_wr_addr
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_addr
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/ch_delay
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/ch_delay_i
add wave -noupdate /tof_comp_tb/iUUT/tof_saturation
add wave -noupdate /tof_comp_tb/iUUT/tof_sat_flag
add wave -noupdate /tof_comp_tb/iUUT/gated_pulse
add wave -noupdate /tof_comp_tb/iUUT/retimed_pulse
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/enc_speed_norm_coeff
add wave -noupdate -radix hexadecimal /tof_comp_tb/iUUT/tof_lut_wr_data
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_wr_q
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_comp
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_comp_i
add wave -noupdate -radix decimal /tof_comp_tb/iVEL/vel_meas
add wave -noupdate /tof_comp_tb/iVEL/sampling_pulse
add wave -noupdate /tof_comp_tb/iUUT/filtered_pd
add wave -noupdate /tof_comp_tb/iUUT/ch_pd
add wave -noupdate /tof_comp_tb/iUUT/ch_mask
add wave -noupdate /tof_comp_tb/iUUT/raw_fire_req
add wave -noupdate /tof_comp_tb/iUUT/enc_pulse
add wave -noupdate /tof_comp_tb/iUUT/avs_address
add wave -noupdate /tof_comp_tb/iUUT/avs_write
add wave -noupdate /tof_comp_tb/iUUT/avs_writedata
add wave -noupdate /tof_comp_tb/iUUT/avs_read
add wave -noupdate /tof_comp_tb/iUUT/avs_readdatavalid
add wave -noupdate /tof_comp_tb/iUUT/avs_readdata
add wave -noupdate /tof_comp_tb/iUUT/init_de
add wave -noupdate /tof_comp_tb/iUUT/init_qd
add wave -noupdate /tof_comp_tb/iUUT/enable
add wave -noupdate /tof_comp_tb/iUUT/loc_pd
add wave -noupdate /tof_comp_tb/iUUT/pd_queue_error
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_start_req
add wave -noupdate /tof_comp_tb/iUUT/pd_pulse
add wave -noupdate /tof_comp_tb/iUUT/filt_pd
add wave -noupdate /tof_comp_tb/iUUT/filt_pd_d
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_write
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_read
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_busy
add wave -noupdate /tof_comp_tb/iUUT/enable_i
add wave -noupdate /tof_comp_tb/iUUT/ch_mask_i
add wave -noupdate /tof_comp_tb/iUUT/bypass_ch_ctrl
add wave -noupdate /tof_comp_tb/iUUT/bypass_delay_equal
add wave -noupdate /tof_comp_tb/iUUT/div_pulse
add wave -noupdate /tof_comp_tb/iUUT/gated_pulse
add wave -noupdate /tof_comp_tb/iUUT/retimed_pulse
add wave -noupdate /tof_comp_tb/iUUT/avs_write_i
add wave -noupdate /tof_comp_tb/iUUT/avs_read_d
add wave -noupdate /tof_comp_tb/iUUT/avs_read_i
add wave -noupdate /tof_comp_tb/iUUT/de_queue_error
add wave -noupdate /tof_comp_tb/iUUT/cnt_dir
add wave -noupdate /tof_comp_tb/iUUT/dp_dir_i
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_start_req_i
add wave -noupdate /tof_comp_tb/iUUT/set_first_pd
add wave -noupdate /tof_comp_tb/iUUT/dp_dir_d
add wave -noupdate /tof_comp_tb/iUUT/pulse_scale_out
add wave -noupdate /tof_comp_tb/iUUT/start_img_req
add wave -noupdate /tof_comp_tb/iUUT/start_img_req_d
add wave -noupdate /tof_comp_tb/iUUT/start_img
add wave -noupdate /tof_comp_tb/iUUT/start_img_d
add wave -noupdate /tof_comp_tb/iUUT/start_img_dd
add wave -noupdate /tof_comp_tb/iUUT/fire_enable
add wave -noupdate /tof_comp_tb/iUUT/img_completed
add wave -noupdate /tof_comp_tb/iUUT/sw_ctrl_dp_dir
add wave -noupdate /tof_comp_tb/iUUT/enable_out
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_start_req_d
add wave -noupdate /tof_comp_tb/iUUT/add_img_size
add wave -noupdate /tof_comp_tb/iUUT/add_img_size_d
add wave -noupdate /tof_comp_tb/iUUT/abort_fire
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_csr_write
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_csr_read
add wave -noupdate /tof_comp_tb/iUUT/frac_div_en_i
add wave -noupdate /tof_comp_tb/iUUT/upd_max_pos
add wave -noupdate /tof_comp_tb/iUUT/upd_min_pos
add wave -noupdate /tof_comp_tb/iUUT/frac_div_en
add wave -noupdate /tof_comp_tb/iUUT/gen_filt_pd
add wave -noupdate /tof_comp_tb/iUUT/upd_max_pos_i
add wave -noupdate /tof_comp_tb/iUUT/upd_min_pos_i
add wave -noupdate /tof_comp_tb/iUUT/dir_change
add wave -noupdate /tof_comp_tb/iUUT/first_pd
add wave -noupdate /tof_comp_tb/iUUT/pd_in_d
add wave -noupdate /tof_comp_tb/iUUT/filt_pd_i
add wave -noupdate /tof_comp_tb/iUUT/abs_pos_lsb
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_start_req_ii
add wave -noupdate /tof_comp_tb/iUUT/prevent_div_restart
add wave -noupdate /tof_comp_tb/iUUT/rst_jitter
add wave -noupdate /tof_comp_tb/iUUT/rst_diag_regs
add wave -noupdate /tof_comp_tb/iUUT/fire_req
add wave -noupdate /tof_comp_tb/iUUT/mid_cross
add wave -noupdate /tof_comp_tb/iUUT/mid_crossed
add wave -noupdate /tof_comp_tb/iUUT/zero_cross
add wave -noupdate /tof_comp_tb/iUUT/close_to_zero
add wave -noupdate /tof_comp_tb/iUUT/close_to_mid
add wave -noupdate /tof_comp_tb/iUUT/div_pulse_i
add wave -noupdate /tof_comp_tb/iUUT/spitting_enable
add wave -noupdate /tof_comp_tb/iUUT/spit_pulse
add wave -noupdate /tof_comp_tb/iUUT/seq_bus_valid
add wave -noupdate /tof_comp_tb/iUUT/spit_nco_msb
add wave -noupdate /tof_comp_tb/iUUT/wh_apply_corr_en
add wave -noupdate /tof_comp_tb/iUUT/wh_error_meas_avail
add wave -noupdate /tof_comp_tb/iUUT/wh_corr_ready
add wave -noupdate /tof_comp_tb/iUUT/wh_error_meas_started
add wave -noupdate /tof_comp_tb/iUUT/init_wh
add wave -noupdate /tof_comp_tb/iUUT/loc_pd_d
add wave -noupdate /tof_comp_tb/iUUT/wh_meas_event
add wave -noupdate /tof_comp_tb/iUUT/tof_lut_wr_en
add wave -noupdate /tof_comp_tb/iUUT/tof_comp_enable
add wave -noupdate /tof_comp_tb/iUUT/abs_pos_msb_old
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_csr_addr
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_trigger_in
add wave -noupdate /tof_comp_tb/iUUT/wh_corr_ready_v
add wave -noupdate /tof_comp_tb/iUUT/avs_addr
add wave -noupdate /tof_comp_tb/iUUT/init_v
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_start_addr
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_address
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_wr_addr
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_addr
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_comp
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_comp_i
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/ch_delay
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/ch_delay_i
add wave -noupdate /tof_comp_tb/iUUT/tof_saturation
add wave -noupdate /tof_comp_tb/iUUT/tof_sat_flag
add wave -noupdate /tof_comp_tb/iUUT/avs_address_i
add wave -noupdate /tof_comp_tb/iUUT/enc_vel_i
add wave -noupdate /tof_comp_tb/iUUT/wh_rotat_cnt
add wave -noupdate /tof_comp_tb/iUUT/basic_pos_error
add wave -noupdate /tof_comp_tb/iUUT/wh_loop_filt_tot
add wave -noupdate /tof_comp_tb/iUUT/wh_loop_filt_delta
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/enc_speed_norm_coeff
add wave -noupdate -radix hexadecimal /tof_comp_tb/iUUT/tof_lut_wr_data
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/tof_lut_wr_q
add wave -noupdate /tof_comp_tb/iUUT/img_size
add wave -noupdate /tof_comp_tb/iUUT/pixel_cnt
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_vector_out
add wave -noupdate /tof_comp_tb/iUUT/wh_pos_err
add wave -noupdate /tof_comp_tb/iUUT/wh_pos_err_max
add wave -noupdate /tof_comp_tb/iUUT/wh_pos_err_old
add wave -noupdate /tof_comp_tb/iUUT/wh_tot_err
add wave -noupdate /tof_comp_tb/iUUT/wh_delta_err
add wave -noupdate /tof_comp_tb/iUUT/norm_enc_vel
add wave -noupdate /tof_comp_tb/iUUT/ch_offset
add wave -noupdate -radix decimal /tof_comp_tb/iVEL/vel_meas
add wave -noupdate /tof_comp_tb/iUUT/avs_readdata_i
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_writedata
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_readdata
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_csr_writedata
add wave -noupdate /tof_comp_tb/iUUT/ch_ctrl_csr_readdata
add wave -noupdate /tof_comp_tb/iUUT/ch_offset_dir0
add wave -noupdate /tof_comp_tb/iUUT/ch_offset_dir1
add wave -noupdate /tof_comp_tb/iUUT/abs_pos_max
add wave -noupdate /tof_comp_tb/iUUT/abs_pos_min
add wave -noupdate /tof_comp_tb/iUUT/last_pd_pos
add wave -noupdate /tof_comp_tb/iUUT/fire_req_cnt
add wave -noupdate /tof_comp_tb/iUUT/seq_bus_data
add wave -noupdate /tof_comp_tb/iUUT/spit_nco
add wave -noupdate /tof_comp_tb/iUUT/spit_nco_inc
add wave -noupdate /tof_comp_tb/iUUT/start_pos
add wave -noupdate /tof_comp_tb/iUUT/abs_pos_d
add wave -noupdate /tof_comp_tb/iUUT/wh_pos_err_2_corr
add wave -noupdate /tof_comp_tb/iUUT/div_ratio
add wave -noupdate /tof_comp_tb/iUUT/div_ratio_i
add wave -noupdate /tof_comp_tb/iUUT/div_ratio_corr
add wave -noupdate /tof_comp_tb/iUUT/div_ratio_corr_new
add wave -noupdate /tof_comp_tb/iUUT/pos_error
add wave -noupdate /tof_comp_tb/iUUT/wh_loop_err
add wave -noupdate /tof_comp_tb/iUUT/div_ratio_corr_ext
add wave -noupdate /tof_comp_tb/iVEL/clk
add wave -noupdate /tof_comp_tb/iVEL/init
add wave -noupdate /tof_comp_tb/iVEL/step_pos
add wave -noupdate /tof_comp_tb/iVEL/step_neg
add wave -noupdate /tof_comp_tb/iVEL/init_i
add wave -noupdate /tof_comp_tb/iVEL/sampling_pulse
add wave -noupdate /tof_comp_tb/iVEL/sampling_per_cnt
add wave -noupdate /tof_comp_tb/iVEL/vel_meas_i
add wave -noupdate /tof_comp_tb/iVEL/vel_meas_sat_pos
add wave -noupdate /tof_comp_tb/iVEL/vel_meas_sat_neg
add wave -noupdate -divider {Delay Equalizer}
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/rstN
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/clk
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/init
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/cnt_dir
add wave -noupdate -radix decimal /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/delay
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/ext_time
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/wave_in
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/wave_out
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/ovf_error
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/toggle_in
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/toggle_out
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/time_elapsed
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/wave_in_d
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/wave_out_i
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/pending_trans
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/fifo_rd_en
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/fifo_empty
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/fifo_full
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/cnt_dir_i
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/wave_out_i_d
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/new_event
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/wave_out_ii
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/shf_enable
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/delay_line
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/int_time
add wave -noupdate /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/local_time_d
add wave -noupdate -radix unsigned /tof_comp_tb/iUUT/gPULSE_DELAY_EQUAL/iDE/event_time
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {10895000 ps} 0} {{Cursor 2} {121098274 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 394
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {0 ps} {220244480 ps}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,65 @@
-------------------------------------------------------------------------------
-- Title : pulse_generator_3_pkg
-- Project : SMB/Encoder Simulation board
-------------------------------------------------------------------------------
-- File : pulse_generator_3_pkg.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2018-08-22
-- Last update: 2020-04-15
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Package defining common constants for the pulse generator
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package pulse_generator_3_pkg is
constant CSR_IP_ID_ADDR : std_logic_vector(4 downto 0) := 5x"00";
constant CSR_IP_VER_ADDR : std_logic_vector(4 downto 0) := 5x"01";
constant PULSE_GEN_CTRL_REG : std_logic_vector(4 downto 0) := 5x"02";
constant CH_OFFSET_D0_REG : std_logic_vector(4 downto 0) := 5x"03";
constant CH_OFFSET_D1_REG : std_logic_vector(4 downto 0) := 5x"04";
constant CH_DELAY_REG : std_logic_vector(4 downto 0) := 5x"05";
constant CH_CTRL_CTRL_REG : std_logic_vector(4 downto 0) := 5x"06";
constant FRAC_DIV_CTRL_REG : std_logic_vector(4 downto 0) := 5x"07";
constant PULSE_WIDTH_REG : std_logic_vector(4 downto 0) := 5x"08";
constant UNUSED_0 : std_logic_vector(4 downto 0) := 5x"09";
constant UNUSED_1 : std_logic_vector(4 downto 0) := 5x"0A";
constant DIV_RATIO_INT : std_logic_vector(4 downto 0) := 5x"0B";
constant DIV_RATIO_FRAC : std_logic_vector(4 downto 0) := 5x"0C";
constant SUBPIXEL_PHASE_REG : std_logic_vector(4 downto 0) := 5x"0D";
constant UNUSED_2 : std_logic_vector(4 downto 0) := 5x"0E";
constant POS_MAX_REG : std_logic_vector(4 downto 0) := 5x"0F";
constant POS_MIN_REG : std_logic_vector(4 downto 0) := 5x"10";
constant ABS_POS_STAT : std_logic_vector(4 downto 0) := 5x"11";
constant PD_CNT_REG : std_logic_vector(4 downto 0) := 5x"12";
constant FIRE_REQ_CNT_REG : std_logic_vector(4 downto 0) := 5x"13";
constant ENC_SPEED_MEAS_W_REG : std_logic_vector(4 downto 0) := 5x"14";
constant ENC_SPEED_REG : std_logic_vector(4 downto 0) := 5x"15";
constant TOF_COMPENSATION_REG : std_logic_vector(4 downto 0) := 5x"16";
constant WH_PIXEL_NUM : std_logic_vector(4 downto 0) := 5x"17";
constant WH_POS_ERR_2_CORR_REG : std_logic_vector(4 downto 0) := 5x"18";
constant WH_SKIP_CORR_THRES_REG : std_logic_vector(4 downto 0) := 5x"19";
constant WH_LOOP_FILT_COEFF : std_logic_vector(4 downto 0) := 5x"1A";
constant WH_POS_ERR_CURR_REG : std_logic_vector(4 downto 0) := 5x"1B";
constant WH_POS_ERR_MAX_REG : std_logic_vector(4 downto 0) := 5x"1C";
constant WH_POS_ERR_MIN_REG : std_logic_vector(4 downto 0) := 5x"1D";
constant WH_DIV_RATIO_CORR_REG : std_logic_vector(4 downto 0) := 5x"1E";
constant WH_CORR_CNT_REG : std_logic_vector(4 downto 0) := 5x"1F";
constant SEQ_CSR_OFFSET : std_logic_vector(10 downto 0) := 11x"20";
constant SEQ_RAM_OFFSET : std_logic_vector(10 downto 0) := 11x"200";
constant TOF_COMP_LUT_OFFSET : std_logic_vector(10 downto 0) := 11x"400";
constant TOF_COMP_LUT_DEPTH : natural := 512;
constant TOF_COMP_LUT_WIDTH : natural := 16;
end package pulse_generator_3_pkg;

View file

@ -0,0 +1,166 @@
-------------------------------------------------------------------------------
-- Title : simple_frac_div_3
-- Project : EMB-1
-------------------------------------------------------------------------------
-- File : simple_frac_div_3.vhd
-- Author : Gianmarco Girau
-- Company : Global Inkjet Systems
-- Created : 2017-12-04
-- Last update: 2019-12-02
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Simple Fractional Divider: this version of the fractional divider identifies
-- the optimal encoder position to generate a fire-pulse, but it does not
-- identy the optimal fire time. Therefore the resulting resolution is equal to
-- +/-1/2 encoder pulse.
-- The identification of the optimal absolute position for the fire request
-- employs an iterative algorithm which checks, for every increment of the
-- absolute position, in the intended direction, whether the position error at
-- the current position is lower than the error at the next position. If the
-- result of the check is positive, the fire request will be issued at the
-- current absolute position, otherwise the check is repeated at the next step.
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity simple_frac_div_3 is
port(
clk : in std_logic;
enable : in std_logic;
upd_max_pos : in std_logic;
upd_min_pos : in std_logic;
abs_pos_max : out std_logic_vector(31 downto 0);
abs_pos_min : out std_logic_vector(31 downto 0);
dir : in std_logic;
offset : in std_logic_vector(33 downto 0);
ratio : in std_logic_vector(33 downto 0);
abs_pos : in std_logic_vector(31 downto 0);
enc_pulse : out std_logic;
fire : out std_logic;
fire_cnt : out std_logic_vector(31 downto 0));
end entity simple_frac_div_3;
architecture rtl of simple_frac_div_3 is
signal enable_d, start : std_logic;
signal update, fire_gen : std_logic;
signal inc_pos, dec_pos : std_logic;
signal new_max, new_min : std_logic;
signal delta_wrap, start_d : std_logic;
signal check_first : std_logic;
signal check_others : std_logic;
signal firing_error_comp : std_logic;
signal firing_error_is_0 : std_logic;
signal firing_error_is_1 : std_logic;
--
signal zeros, delta_pos : std_logic_vector(15 downto 0);
signal fire_cnt_i : std_logic_vector(31 downto 0);
signal pos_diff : std_logic_vector(31 downto 0);
signal pos_max, pos_min : std_logic_vector(31 downto 0);
signal dist_pos, dist_neg : std_logic_vector(31 downto 0);
signal abs_pos_d : std_logic_vector(31 downto 0);
signal ideal_fire : std_logic_vector(49 downto 0);
signal firing_error : std_logic_vector(49 downto 0);
begin
zeros <= (others => '0');
-----------------------------------------------------------------------------
-- Min/Max Absolute Position Tracking (and jitter rejection)
-----------------------------------------------------------------------------
pPOS_TRACK : process(clk)
begin
if(clk = '1' and clk'event) then
abs_pos_d <= abs_pos;
if(new_max = '1' or upd_max_pos = '1') then
pos_max <= abs_pos;
end if;
if(new_min = '1' or upd_min_pos = '1') then
pos_min <= abs_pos;
end if;
-- enc_pulse output replaces the enc_out from the EMS, because the EMS
-- does not support encoder jitter tracking anymore.
-- Note: because of the absolute position, enc_pulse is redundant and
-- used only for diagnostic purpose.
enc_pulse <= (new_max and not dir) or (new_min and dir);
end if;
end process pPOS_TRACK;
pos_diff <= std_logic_vector(signed(abs_pos) - signed(abs_pos_d));
dist_pos <= std_logic_vector(signed(abs_pos)-signed(pos_max));
dist_neg <= std_logic_vector(signed(pos_min)-signed(abs_pos));
inc_pos <= '1' when pos_diff(31) = '0' and pos_diff(2 downto 0) = "001" else '0';
dec_pos <= '1' when pos_diff(31) = '1' and pos_diff(2 downto 0) = "111" else '0';
new_max <= '1' when inc_pos = '1' and dir = '0' and dist_pos(31) = '0' and unsigned(dist_pos(3 downto 0)) /= 0 else '0';
new_min <= '1' when dec_pos = '1' and dir = '1' and dist_neg(31) = '0' and unsigned(dist_neg(3 downto 0)) /= 0 else '0';
abs_pos_min <= pos_min;
abs_pos_max <= pos_max;
-----------------------------------------------------------------------------
-- Fractional Divider Logic
-----------------------------------------------------------------------------
pFD_REGs : process(clk)
begin
if(clk = '1' and clk'event) then
enable_d <= enable;
start_d <= start;
if(enable = '0') then
delta_pos <= (others => '0');
elsif(delta_wrap = '1') then
-- Decrement delta_pos of 64
delta_pos <= (6 => '1', others => '0');
elsif(new_min = '1' or new_max = '1') then
delta_pos <= std_logic_vector(unsigned(delta_pos)+1);
end if;
if(unsigned(delta_pos) = 127 and update = '1') then
delta_wrap <= '1';
else
delta_wrap <= '0';
end if;
-- ideal_fire: represents the ideal fire position (normalized 2**RATIO_FRACT_W)
if(start = '1') then
ideal_fire <= zeros & offset;
elsif(fire_gen = '1') then
ideal_fire <= std_logic_vector(unsigned(ideal_fire)+unsigned(ratio));
elsif(delta_wrap = '1') then
-- Decrement delta_pos of 64 (normalized 2**RATIO_FRACT_W)
--ideal_fire <= std_logic_vector(unsigned(ideal_fire)- X"3F000000");
ideal_fire <= ideal_fire(ideal_fire'left downto 36) & std_logic_vector(unsigned(ideal_fire(35 downto 24))- 12X"03F") & ideal_fire(23 downto 0);
end if;
firing_error <= std_logic_vector(unsigned(ideal_fire(ideal_fire'left downto 24)) - unsigned(delta_pos)) & X"000000";
update <= enable and (start_d or new_min or new_max);
check_first <= enable and start_d;
check_others <= enable and (new_min or new_max);
fire <= fire_gen;
if(enable = '0') then
fire_cnt_i <= (others => '0');
elsif(fire_gen = '1') then
fire_cnt_i <= std_logic_vector(unsigned(fire_cnt_i)+1);
end if;
end if;
end process pFD_REGs;
-- firing_error_comp is asserted when firing_error(firing_error'left downto 24) is
-- either 0 or 1:
firing_error_comp <= '1' when unsigned(firing_error(firing_error'left downto 25)) = 0 else '0';
firing_error_is_0 <= firing_error_comp and (not firing_error(24));
firing_error_is_1 <= firing_error_comp and firing_error(24);
fire_gen <= '1' when (check_first = '1' and firing_error_is_0 = '1') or (check_others = '1' and firing_error_is_1 = '1') else '0';
start <= enable and not enable_d;
fire_cnt <= fire_cnt_i;
end architecture rtl;

View file

@ -0,0 +1,256 @@
30000000
1000000F
C0000003
C0000004
30000001
30000000
20000001
C0000008
30006424
30006400
81000032
23000001
30000000
C000000E
C000000F
30000011
30000010
23000001
C0000013
30006434
30006410
81000032
23000001
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000

View file

@ -0,0 +1,256 @@
30000000
1000000F
C0000003
C0000004
30000001
30000000
20000001
C0000008
30006424
30006400
81000032
23000001
30000000
C000000E
C000000F
30000011
30000010
23000001
C0000013
30006434
30006410
81000032
23000001
C0000013
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000

View file

@ -0,0 +1,256 @@
30000000
1000000F
C0000003
C0000004
30000000
30000000
20000001
C0000008
30006424
30006400
81000032
23000001
30000000
C000000E
C000000F
30000010
30000010
23000001
C0000013
30006434
30006410
81000032
23000001
C0000013
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000

View file

@ -0,0 +1,863 @@
-------------------------------------------------------------------------------
-- Title : ch_ctrl_cfg_tb
-- Project : Pulse-Generator
-------------------------------------------------------------------------------
-- File : ch_ctrl_cfg_tb.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2019-05-17
-- Last update: 2020-04-15
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Allows to verify Pulse-Generator with customs Ch-Ctrl configurations
-------------------------------------------------------------------------------
library std;
use std.textio.all;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_textio.all;
use ieee.math_real.all;
use work.log_pkg.all;
use work.avalon_verify_pkg.all;
use work.pulse_generator_3_pkg.all;
entity ch_ctrl_cfg_tb is
-- ..
end entity ch_ctrl_cfg_tb;
architecture behav of ch_ctrl_cfg_tb is
constant CLK_PERIOD : time := 10 ns;
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
constant seq_config_file : string := "./../src/test/ch_ctrl_cfg2.cfg";
type cfg_data_t is array (natural range <>) of std_logic_vector(31 downto 0);
constant SEQ_SIZE : natural := 256;
subtype seq_cfg_data_t is cfg_data_t(0 to SEQ_SIZE-1);
-- Total number of wheel rotations to simulate
constant TOTAL_ROTATIONS : natural := 100;
-- DIV_RATIO: head-pitch/ encoder-global-resolution
constant DIV_RATIO : real := 4.23;
-- Nominal image size, in pixel
constant IMG_LEN : natural := 100;
-- Nominal Distance between PDs, in encoder pulses, which corresponds to the
-- wheel circumference
constant WHEEL_CIRCUM : real := real(IMG_LEN)*DIV_RATIO;
-- number of Rotations before stopping the simulation
-- constant SIM_ROTATIONS : natural := TOTAL_ROTATIONS;
constant SIM_ROTATIONS : natural := 90;
constant APPLY_CORR_EN : boolean := true;
constant APPLY_EMUL_CORR : boolean := false;
constant SKIP_PD_EN : boolean := true;
constant PD_OFFSET : natural := 10;
constant HALF_RNG_CROSS : std_logic_vector(31 downto 0) := X"7FFFFFFF";
constant FULL_RNG_CROSS : std_logic_vector(31 downto 0) := X"FFFFFFFF";
--constant INIT_ABS_POS : std_logic_vector(31 downto 0) := std_logic_vector(signed(HALF_RNG_CROSS)-50 -PD_OFFSET);
--constant INIT_ABS_POS : std_logic_vector(31 downto 0) := std_logic_vector(signed(HALF_RNG_CROSS)-421 -PD_OFFSET);
constant INIT_ABS_POS : std_logic_vector(31 downto 0) := std_logic_vector(signed(FULL_RNG_CROSS)-421 -PD_OFFSET);
--constant INIT_ABS_POS : std_logic_vector(31 downto 0) := (others => '0');
-- Correction Loop Filter constants
constant LOOP_FILT_DELTA : real := 1.0;
constant LOOP_FILT_TOT : real := 1.0;
type wheel_error_t is array (0 to TOTAL_ROTATIONS-1) of integer;
/*
signal wheel_error : wheel_error_t := (
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
2, 2, 3, 3, 4, 4, 5, 5, 4, 4,
3, 3, 2, 2, 1, 1, 0, 0, -1, -1,
-2, -2, -3, -3, -4, -4, -5, -5, -4, -4,
-3, -3, -2, -2, -1, -1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 1, 1,
1, 1, 0, 0, -1, -1, -1, -1, 0, 0, others => 0);
*/
/*
signal wheel_error : wheel_error_t := (
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
2, 2, 3, 3, 4, 4, 5, 5, 4, 4,
3, 3, 2, 2, 1, 1, 0, 0, -1, -1,
-2, -2, -3, -3, -4, -4, -5, -5, -4, -4,
-3, -3, -2, -2, -1, -1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 1, 1,
1, 1, 0, 0, -1, -1, -1, -1, 0, 0, -40, 0, 0, +80, others => 0);
*/
/*
signal wheel_error : wheel_error_t := (
0, 0, 0, 0, 0, -1, -1, -1, -1, -1,
-2, -2, -3, -3, -4, -4, -5, -5, -4, -4,
-3, -3, -2, -2, -1, -1, 0, 0, 1, 1,
2, 2, 3, 3, 4, 4, 5, 5, 4, 4,
3, 3, 2, 2, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 1, 1,
1, 1, 0, 0, -1, -1, -1, -1, 0, 0, -40, 0, 0, +80, others => 0);
*/
/*
signal wheel_error : wheel_error_t := (
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
2, 2, 3, 3, 4, 4, 5, 5, 4, 4,
3, 3, 2, 2, 1, 1, 0, 0, -1, -1,
-2, -2, -3, -3, -4, -4, -5, -5, -4, -4,
-3, -3, -2, -2, -1, -1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 1, 1,
1, 1, 0, 0, -1, -1, -1, -1, 0, 0, -40, 0, 0, +80, others => +40);
*/
signal wheel_error : wheel_error_t := (
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
2, 2, 3, 3, 4, 4, 5, 5, 4, 4,
3, 3, 2, 2, 1, 1, 0, 0, -1, -1,
-2, -2, -3, -3, -4, -4, -5, -5, -4, -4,
-3, -3, -2, -2, -1, -1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 1, 1,
1, 1, 0, 0, -1, -1, -1, -1, 0, 0, -40, -40, -40, others => +40);
-----------------------------------------------------------------------------
-- Signal declarations
-----------------------------------------------------------------------------
signal reset_n : std_logic := '0';
signal clk : std_logic := '0';
signal init : std_logic;
signal pd_in : std_logic;
signal abs_position : std_logic_vector(31 downto 0);
signal dp_dir : std_logic;
signal fire_req : std_logic;
signal fire_req_vec : std_logic_vector(31 downto 0);
signal filtered_pd : std_logic;
signal ch_pd : std_logic;
signal ch_mask : std_logic;
signal raw_fire_req : std_logic;
signal avs_address : std_logic_vector(10 downto 0);
signal avs_write : std_logic;
signal avs_writedata : std_logic_vector(31 downto 0);
signal avs_read : std_logic;
signal avs_readdatavalid : std_logic;
signal avs_readdata : std_logic_vector(31 downto 0);
--
signal avs_m : mm_m_rec_t;
signal avs_s : mm_s_rec_t;
--
signal pd_in_cnt : integer;
signal pd_out_cnt : integer;
--
signal end_of_stimuli : boolean;
signal test_completed : boolean;
signal setup : boolean;
signal running : boolean;
signal passed : boolean;
signal failed : boolean;
shared variable error_flag : boolean;
signal wheel_pos : integer;
signal pos_error : real;
signal pos_error_old : real;
signal rotation_idx : natural;
signal div_ratio_corr_r : real;
signal div_ratio_corr_rr : real;
signal div_ratio_r : real;
signal wh_pos_err_r : real;
signal wheel_corr_on : std_logic;
signal skip_pd : std_logic;
-----------------------------------------------------------------------------
-- TB Functions / Procedures
-----------------------------------------------------------------------------
procedure wait_latency(
signal clk : in std_logic;
cycles : in natural) is
begin
for i in 1 to cycles loop
wait until clk = '1' and clk'event;
end loop; -- i
end procedure wait_latency;
procedure read_cfg_file(
fname : in string;
num_data : in natural;
read_data : out cfg_data_t) is
file f_id : text;
variable status : file_open_status;
variable InLine : line;
variable word : std_logic_vector(31 downto 0);
begin
file_open(status, f_id, fname, read_mode);
if(status /= open_ok) then
log("ERROR: Failed to open file " & fname & ".", VLOW);
error_flag := true;
else
READ_LOOP: for idx in 0 to num_data-1 loop
readline(f_id, InLine);
hread(InLine, word);
read_data(idx) := word;
end loop; -- READ_LOOP
file_close(f_id);
end if;
end procedure read_cfg_file;
-- load ch-ctrl sequencer configuration
procedure load_seq_cfg(
fname : in string;
signal seq_s_rec : in mm_s_rec_t;
signal seq_m_rec : out mm_m_rec_t) is
variable seq_data : seq_cfg_data_t;
variable offset : natural;
variable addr : std_logic_vector(31 downto 0);
begin
read_cfg_file(fname, SEQ_SIZE, seq_data);
log("Configuring Ch-Ctrl RAM ...", VMEDIUM);
offset :=512;
for n in 0 to SEQ_SIZE-1 loop
addr := std_logic_vector(to_unsigned(offset+n,32));
--log("Ch-Ctrl Cfg: Addr = " & to_string(n) & ", data = 0x" & to_hstring(seq_data(n)) & ".", VMEDIUM);
mm_32b_write(addr, seq_data(n), seq_s_rec, seq_m_rec);
end loop; -- n
end procedure load_seq_cfg;
procedure set_div_ratio(
div_ratio : real;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
variable ratio_int : integer;
variable ratio_slv : std_logic_vector(33 downto 0);
begin
-- set the division ratio
ratio_int := integer(div_ratio*real(2**24));
ratio_slv := std_logic_vector(to_unsigned(ratio_int, 34));
-- Set the integer part of the div-ratio
data(31 downto 10) := (others => '0');
data( 9 downto 0) := ratio_slv(33 downto 24);
addr := std_logic_vector(resize(unsigned(DIV_RATIO_INT), 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Set the fractional part of the div-ratio
data(31 downto 24) := (others => '0');
data(23 downto 0) := ratio_slv(23 downto 0);
addr := std_logic_vector(resize(unsigned(DIV_RATIO_FRAC), 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
end procedure set_div_ratio;
procedure enable_wheel_corr(
enable : std_logic;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
-- Read the current value of the cotrl register
addr := std_logic_vector(resize(unsigned(PULSE_GEN_CTRL_REG), 32));
mm_32b_read(addr, data, mm_s_rec, mm_m_rec);
data(11) := enable;
-- Write back the updated value
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
if(enable = '0') then
log("Wheel Correction Disabled:", VMEDIUM);
else
log("Wheel Correction Enabled:", VMEDIUM);
end if;
end procedure enable_wheel_corr;
procedure apply_pg_cfg(
div_ratio : real;
offset_dir0 : integer;
offset_dir1 : integer;
delay : integer;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
variable ratio_int : integer;
variable ratio_slv : std_logic_vector(33 downto 0);
begin
log_separator_line(VMEDIUM);
log("Configuring Pulse-Generator registers ...", VMEDIUM);
log_separator_line(VMEDIUM);
log("Div-Ratio = " & to_string(div_ratio), VMEDIUM);
-- Disable/Re-enable first the whole pulse_generator
addr := std_logic_vector(resize(unsigned(PULSE_GEN_CTRL_REG), 32));
data := (others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
data := (0 => '1', 16 => '1', others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Disable the Channel Controller sequencer
addr := std_logic_vector(resize(unsigned(CH_CTRL_CTRL_REG), 32));
data := (others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Set the division ratio
set_div_ratio(div_ratio, mm_s_rec, mm_m_rec);
-- Disable/Enable the fractional divider
addr := std_logic_vector(resize(unsigned(FRAC_DIV_CTRL_REG), 32));
data := (others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
data := (0 => '1', others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Configure the rest of the pulse_generator:
-- Configure the Channel Offset (Both DIR_0 and DIR_1):
-- DIR_0
addr := std_logic_vector(resize(unsigned(CH_OFFSET_D0_REG),32));
data := std_logic_vector(to_unsigned(offset_dir0, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- DIR_1
addr := std_logic_vector(resize(unsigned(CH_OFFSET_D1_REG), 32));
data := std_logic_vector(to_unsigned(offset_dir1, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Configure the Channel Delay:
addr := std_logic_vector(resize(unsigned(CH_DELAY_REG), 32));
data := std_logic_vector(to_unsigned(delay, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- enable the ch-ctrl sequencer
addr := std_logic_vector(to_unsigned(32+3, 32));
data := (0 => '1', others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- issue a start_req to the ch-ctrl sequencer
addr := std_logic_vector(resize(unsigned(CH_CTRL_CTRL_REG), 32));
data := (0 => '1', others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Specify the image-length for wheel correction
addr := std_logic_vector(resize(unsigned(WH_PIXEL_NUM), 32));
data := std_logic_vector(to_unsigned(IMG_LEN, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Compute the constant for W&H Correction
addr := std_logic_vector(resize(unsigned(WH_POS_ERR_2_CORR_REG), 32));
data := std_logic_vector(to_unsigned(integer(round((1.0/real(IMG_LEN))*(2.0**32))), 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- set the threshold for skipping correctiion to 256
addr := std_logic_vector(resize(unsigned(WH_SKIP_CORR_THRES_REG), 32));
data := std_logic_vector(to_unsigned((256), 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- enable the pulse-generator + Enable W&H Correction
addr := std_logic_vector(resize(unsigned(PULSE_GEN_CTRL_REG), 32));
data := (0 => '1', 11 => '1', 16 => '1', others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
log("Wheel Correction Enabled:", VMEDIUM);
log_separator_line(VMEDIUM);
end procedure apply_pg_cfg;
-----------------------------------------------------------------------------
-- End declarative part
-----------------------------------------------------------------------------
begin -- architecture behav
clk <= not clk after 0.5*CLK_PERIOD;
-----------------------------------------------------------------------------
-- UUT
-----------------------------------------------------------------------------
iUUT: entity work.pulse_generator_3
generic map (
PULSE_DELAY_EQUAL_EN => true,
PIXEL_PITCH_CORR_EN => true)
port map (
clk => clk,
reset_n => reset_n,
init => init,
pd_in => pd_in,
abs_position => abs_position,
dp_dir => dp_dir,
fire_req_vec => fire_req_vec,
filtered_pd => filtered_pd,
ch_pd => ch_pd,
ch_mask => ch_mask,
raw_fire_req => raw_fire_req,
avs_address => avs_address,
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdatavalid => avs_readdatavalid,
avs_readdata => avs_readdata);
fire_req <= fire_req_vec(0);
pGET_WH_ERR : process
alias wh_pos_err is <<signal iUUT.wh_pos_err_curr : std_logic_vector(31 downto 0)>>;
alias wh_corr_meas_ready is <<signal iUUT.wh_corr_ready_v : std_logic_vector(5 downto 0)>>;
alias div_ratio_corr is <<signal iUUT.div_ratio_corr : std_logic_vector(33 downto 0)>>;
variable pos_error : real;
variable div_ratio_corr_r : real;
begin
if(SKIP_PD_EN = false) then
wh_pos_err_r <= real(to_integer(signed(wh_pos_err)))/256.0;
wait until clk = '1' and clk'event;
else
wh_pos_err_r <= 0.0;
div_ratio_corr_rr <= 0.0;
-- wait until the first PD;
wait until rising_edge(ch_pd);
-- measur the error, then apply correction
while end_of_stimuli = false loop
wait until rising_edge(wh_corr_meas_ready(2));
wait until clk = '0' and clk'event;
pos_error := real(to_integer(signed(wh_pos_err)))/256.0;
wh_pos_err_r <= pos_error;
log("Rotation #" & to_string(rotation_idx) & ": pos_error = " & to_string(pos_error) & ".", VMEDIUM);
wait_latency(clk, 10);
div_ratio_corr_r := real(to_integer(signed(div_ratio_corr)))/(2.0**24);
div_ratio_corr_rr <= div_ratio_corr_r;
log("Division Ratio Correction =" & to_string(div_ratio_corr_r) & ".", VMEDIUM);
end loop;
wait until running = false;
if(abs(pos_error) > DIV_RATIO) then
error_flag := true;
log("ERROR: simulation ended with a misalignment error bigger than 1 pixel.", VLOW);
end if;
end if;
end process pGET_WH_ERR;
-----------------------------------------------------------------------------
-- Avalon interface
-----------------------------------------------------------------------------
clk_clk <= clk;
reset_reset_n <= reset_n;
avs_s.mm_readdata <= avs_readdata;
avs_s.mm_readdatavalid <= avs_readdatavalid;
avs_s.mm_waitrequest <= '0';
avs_s.use_readvalid <= true;
avs_address <= avs_m.mm_address(avs_address'range);
avs_write <= avs_m.mm_write;
avs_writedata <= avs_m.mm_writedata;
avs_read <= avs_m.mm_read;
pCNT_CH_PD : process(reset_n, clk)
begin
if(reset_n = '0') then
pd_out_cnt <= 0;
elsif(clk = '1' and clk'event) then
if(ch_pd = '1') then
pd_out_cnt <= pd_out_cnt + 1;
end if;
end if;
end process pCNT_CH_PD;
-----------------------------------------------------------------------------
-- Testbench Logic
-----------------------------------------------------------------------------
pSTIMULI : process
begin
end_of_stimuli <= false;
pd_in <= '0';
pd_in_cnt <= 0;
--
abs_position <= INIT_ABS_POS;
wheel_pos <= 0;
-- wait until init is deasserted
wait until falling_edge(init);
wait for 1 us;
-- send the initial PD event
wait until clk = '1' and clk'event;
log("Issueing Initial PD ...", VLOW);
pd_in <= '1';
pd_in_cnt <= pd_in_cnt + 1;
wait until clk = '1' and clk'event;
pd_in <= '0';
while pd_in_cnt < TOTAL_ROTATIONS loop
wait_latency(clk, 50);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
if((wheel_pos + 1) = integer(WHEEL_CIRCUM+real(wheel_error(pd_in_cnt))+0.5)) then
-- it's time to issue a new PD
if(skip_pd = '0') then
pd_in <= '1';
else
log("Skipped PD (PD count = " & to_string(pd_in_cnt) & ").", VLOW);
end if;
pd_in_cnt <= pd_in_cnt + 1;
wheel_pos <= 0;
wait until clk = '1' and clk'event;
pd_in <= '0';
else
wheel_pos <= wheel_pos + 1;
end if;
end loop;
-- completed
end_of_stimuli <= true;
wait;
end process pSTIMULI;
pSKIP_PD : process
begin
if(pd_in_cnt = 47 or pd_in_cnt = 6 or pd_in_cnt = 49 or
pd_in_cnt = 43 or pd_in_cnt = 48 or pd_in_cnt = 55 or
pd_in_cnt = 62 or pd_in_cnt = 71 or pd_in_cnt = 72) then
if(SKIP_PD_EN = true) then
skip_pd <= '1';
end if;
else
skip_pd <= '0';
end if;
wait until clk = '1' and clk'event;
end process pSKIP_PD;
-----------------------------------------------------------------------------
-- Measure Error, Apply external correction
-----------------------------------------------------------------------------
pMEAS_CORR : process
variable measure_started : boolean;
variable pos_error_avail : boolean;
variable start_pos : integer;
alias div_ratio_corr is <<signal iUUT.div_ratio_corr : std_logic_vector(33 downto 0)>>;
alias div_ratio_i is <<signal iUUT.div_ratio_i : std_logic_vector(33 downto 0)>>;
procedure apply_correction(pos_error: in real) is
variable div_ratio_new : real;
variable div_ratio_man : real;
variable div_ratio_vec : std_logic_vector(33 downto 0);
variable tot_error : real;
variable delta_error : real;
begin
-- compute the total and the delta loop error
tot_error := pos_error;
delta_error := pos_error-pos_error_old;
-- Compute the correction through a 2nd order loop filter
div_ratio_new := div_ratio_r + (delta_error*LOOP_FILT_DELTA+tot_error*LOOP_FILT_TOT)*(1.0/real(IMG_LEN));
div_ratio_r <= div_ratio_new;
div_ratio_corr_r <= div_ratio_new - DIV_RATIO;
div_ratio_vec(33 downto 24) := std_logic_vector(to_unsigned(integer(floor(div_ratio_new)),10));
div_ratio_man := (div_ratio_new - floor(div_ratio_new))*(2.0**24);
div_ratio_vec(23 downto 0) := std_logic_vector(to_unsigned(integer(floor(div_ratio_man)),24));
-- force the correction into the UUT:
if(APPLY_EMUL_CORR = true) then
div_ratio_i <= force div_ratio_vec;
end if;
-- save the correction value
log("Division Ratio Correction =" & to_string(div_ratio_new-DIV_RATIO) & ".", VMEDIUM);
end procedure apply_correction;
-- The correction is computed emulating fixed-point numbers
-- (pos_err-to-correction is represented with a 32 bits mantissa)
procedure apply_correction_int(pos_error: in real) is
variable div_ratio_new : real;
variable div_ratio_man : real;
variable div_ratio_vec : std_logic_vector(33 downto 0);
variable pos_err_to_corr : integer := integer(round((1.0/real(IMG_LEN))*(2.0**32)));
variable tot_error : real;
variable delta_error : real;
begin
-- compute the total and the delta loop error
tot_error := pos_error;
delta_error := pos_error-pos_error_old;
if(APPLY_EMUL_CORR = true) then
-- Compute the correction through a 2nd order loop filter
div_ratio_new := div_ratio_r + (delta_error*LOOP_FILT_DELTA+tot_error*LOOP_FILT_TOT)*real(pos_err_to_corr)/(2.0**32);
div_ratio_corr_r <= div_ratio_new - DIV_RATIO;
div_ratio_r <= div_ratio_new;
div_ratio_vec(33 downto 24) := std_logic_vector(to_unsigned(integer(floor(div_ratio_new)),10));
div_ratio_man := (div_ratio_new - floor(div_ratio_new))*(2.0**24);
div_ratio_vec(23 downto 0) := std_logic_vector(to_unsigned(integer(floor(div_ratio_man)),24));
else
div_ratio_new := real(to_integer(unsigned(div_ratio_i(33 downto 24)))) + real(to_integer(unsigned(div_ratio_i(23 downto 0))))/(2.0**24);
div_ratio_corr_r <= div_ratio_new - DIV_RATIO;
div_ratio_r <= div_ratio_new;
end if;
--log("tot_error = " & to_string(tot_error) & ", delta_error = " & to_string(delta_error), VMEDIUM);
--log("tot_error-norm = " & to_string(256.0*tot_error) & ", delta_error-norm = " & to_string(256.0*delta_error), VMEDIUM);
-- force the correction into the UUT:
if(APPLY_EMUL_CORR = true) then
div_ratio_i <= force div_ratio_vec;
end if;
-- save the correction value
log("Division Ratio Correction =" & to_string(div_ratio_new-DIV_RATIO) & ".", VMEDIUM);
end procedure apply_correction_int;
begin
pos_error <= 0.0;
pos_error_old <= 0.0;
rotation_idx <= 0;
div_ratio_corr_r <= 0.0;
div_ratio_r <= DIV_RATIO;
measure_started := false;
pos_error_avail := false;
-- wait until the first PD;
wait until rising_edge(ch_pd);
-- measur the error, then apply correction
while end_of_stimuli = false loop
if SKIP_PD_EN = false then
wait until rising_edge(ch_pd) or falling_edge(ch_mask);
if(rising_edge(ch_pd) and falling_edge(ch_mask)) then
pos_error_old <= pos_error;
pos_error <= -DIV_RATIO;
pos_error_avail := true;
rotation_idx <= rotation_idx + 1;
elsif(rising_edge(ch_pd)) then
if(measure_started = false) then
start_pos := to_integer(signed(abs_position));
measure_started := true;
else
pos_error_old <= pos_error;
pos_error <= real(to_integer(signed(abs_position)) - start_pos) - DIV_RATIO;
rotation_idx <= rotation_idx + 1;
measure_started := false;
pos_error_avail := true;
end if;
elsif(falling_edge(ch_mask)) then
if(measure_started = false) then
start_pos := to_integer(signed(abs_position));
measure_started := true;
else
pos_error_old <= pos_error;
pos_error <= -(real(to_integer(signed(abs_position)) - start_pos)) - DIV_RATIO;
rotation_idx <= rotation_idx + 1;
measure_started := false;
pos_error_avail := true;
end if;
end if;
if(pos_error_avail = true) then
-- Do not remove this wait statement: it makes sures previous signal
-- assignment are executed before computing the corrections
wait until clk = '0' and clk'event;
log("Rotation #" & to_string(rotation_idx) & ": pos_error = " & to_string(pos_error) & ".", VMEDIUM);
if(APPLY_CORR_EN = true) then
--apply_correction(pos_error);
apply_correction_int(pos_error);
end if;
pos_error_avail := false;
end if;
else
-- When PD are skipped, do not try to measure the position error in the
-- testbench
wait until rising_edge(ch_pd);
rotation_idx <= rotation_idx + 1;
wait_latency(clk, 20);
end if;
end loop;
end process pMEAS_CORR;
-----------------------------------------------------------------------------
-- Testbench Main
-----------------------------------------------------------------------------
pTB_CTRL : process
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
-- Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
--set_log_verbosity(VHIGH);
-- initilialize the Avalon master-bus
mm_m_init(avs_m);
log_header("Ch-Ctrl Config verification:", VLOW);
setup <= false;
running <= false;
passed <= false;
error_flag := false;
init <= '0';
wheel_corr_on <= '0';
-- Reset
reset_n <= '0';
wait for 100 ns;
wait until clk = '1' and clk'event;
reset_n <= '1';
---------------------------------------------------------------------------
-- Pulse-Generator Configuration
---------------------------------------------------------------------------
wait for 200 ns;
-- Configure Ch-Ctrl RAM
load_seq_cfg(seq_config_file, avs_s, avs_m);
apply_pg_cfg(
div_ratio => DIV_RATIO,
offset_dir0 => PD_OFFSET,
offset_dir1 => 0,
delay => 0,
mm_s_rec => avs_s, mm_m_rec => avs_m);
wheel_corr_on <= '1';
---------------------------------------------------------------------------
-- Movement Simulation
---------------------------------------------------------------------------
log("Forward Movement:", VLOW);
log_separator_line(VLOW);
wait for 200 ns;
wait until clk = '1' and clk'event;
init <= '1';
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
init <= '0';
wait for 200 ns;
running <= true;
wait until clk = '1' and clk'event;
-- Disable Wheel Correction after a while
if(SIM_ROTATIONS >= 50) then
-- disable wheel corrections
wait until rotation_idx = 30;
wait for 200 ns;
enable_wheel_corr(enable => '0', mm_s_rec => avs_s, mm_m_rec => avs_m);
wheel_corr_on <= '0';
-- re-enable wheel corrections
wait until rotation_idx = 40;
wait for 200 ns;
enable_wheel_corr(enable => '1', mm_s_rec => avs_s, mm_m_rec => avs_m);
wheel_corr_on <= '1';
end if;
wait until (end_of_stimuli = true) or (pd_in_cnt = SIM_ROTATIONS + 1);
running <= false;
passed <= true after 100 ns;
wait;
end process pTB_CTRL;
failed <= error_flag after 100 ns;
pREPORT_RESULT : process
begin
wait until failed = true or passed = true;
wait for 1 us;
log_separator_line(VLOW);
if(failed = true) then
log("FAILURE: test completed with errors.", VLOW);
elsif(passed = true) then
log("SUCCESS: test successfully completed.", VLOW);
end if;
log_separator_line(VLOW);
test_completed <= true;
end process pREPORT_RESULT;
end architecture behav;

View file

@ -0,0 +1,266 @@
##/////////////////////////////////////////////////////////////////////////////
## Title : wheel_correction_analysis
##/////////////////////////////////////////////////////////////////////////////
## File : wheel_correction_analysis.py
## Author : Gianmarco Girau
## Company : GIS
## Target : HMB Console
## Dependency : none
##/////////////////////////////////////////////////////////////////////////////
## Description: Analyze misalignment error from wheel corrections
##/////////////////////////////////////////////////////////////////////////////
## Last update: 2019-05-30
##/////////////////////////////////////////////////////////////////////////////
## Revisions :
## Date Version Author Description
## 2019-05-30 01.00.0a gmg Created
##/////////////////////////////////////////////////////////////////////////////
from bokeh.plotting import figure, output_file, show
from bokeh.layouts import gridplot
from functools import reduce
# log_from_console = 1 => analyze logs from SMB/HMB Console
# log_from_console = 0 => analyze logs from SMB DebugView++
log_from_console = 0
enc_res = 1.41667*1.0e-6
pd_num = []
pd_time = []
pd_pos = []
##/////////////////////////////////////////////////////////////////////////////
## Get data from the log file
##/////////////////////////////////////////////////////////////////////////////
def get_pd_data(data_filename):
global log_from_console
pd_num = []
pd_time = []
pd_pos = []
f_log = open((data_filename), 'r')
if log_from_console == 1:
for line in f_log:
target = '<Detected-PD>'
idx = line.find(target)
if idx != -1:
tmp = line[idx + len(target):].split('#')
clist = tmp[1].split(',')
pd_num.append(int(clist[0]))
# print('PD Event = {:d}'.format(pd_num[-1]))
target = 'Time = '
idx = line.find(target)
clist = line[idx + len(target):].split(None)
pd_time.append(float(clist[0][0:-1]))
target = 'abs_pos = '
idx = line.find(target)
clist = line[idx + len(target):].split(None)
pd_pos.append(float(clist[0][0:-1]))
else:
for line in f_log:
target = 'addToHistory Added Product Detect FIFO entry: entryId: '
idx = line.find(target)
if idx != -1:
clist = line[idx + len(target):].split(None)
pd_num.append(int(clist[0]))
# print('PD Event = {:d}'.format(pd_num[-1]))
target = 'coarseTime: '
idx = line.find(target)
clist = line[idx + len(target):].split(None)
coarse_time = float(clist[0])
target = 'fineTime: '
idx = line.find(target)
clist = line[idx + len(target):].split(None)
fine_time = float(clist[0])
pd_time.append(float(coarse_time)+float(fine_time)*1.0e-8)
target = ' position: '
idx = line.find(target)
clist = line[idx + len(target):].split(None)
pd_pos.append(float(clist[0]))
f_log.closed
return [pd_num, pd_time, pd_pos]
def save_raw_data(pd_num, pd_time, pd_pos, outfile):
f_data = open(outfile, 'w')
f_data.write("PD event, Time, Position" + '\n')
for idx in range(0, len(pd_num)):
f_data.write("{0:d}, {1:f}, {2:f}".format(pd_num[idx], pd_time[idx], pd_pos[idx]) + '\n')
f_data.close
def avg(lst):
return reduce(lambda a, b: a + b, lst) / len(lst)
def plot_pd_dat(pd_num, pd_time, pd_pos, outfile, flexo_label=''):
# output to static HTML file
output_file((outfile) + '.html')
plot_w = 500
plot_h = 500
toolset = "pan,box_zoom,reset,save"
delta_pd = []
N = len(pd_num)
for idx in range(1, N):
delta_pd.append(pd_pos[idx] - pd_pos[idx - 1])
pd_avg = avg(delta_pd)
print("PD average distance = {:f} [encoder pulses]".format(pd_avg))
pd_var = []
pd_var.append(0.0)
for idx in range(1, N):
pd_var.append(delta_pd[idx-1]-pd_avg)
data_range = max(delta_pd)-min(delta_pd)
if data_range == 0.0:
data_range = 1.0
plot_range = [min(delta_pd)-data_range, max(delta_pd)+data_range]
# PD variation on a cycle-by-cycle basis
pd_cbc = []
pd_cbc.append(0.0)
for idx in range(1, N):
pd_cbc.append(pd_var[idx]-pd_var[idx-1])
print("Maximum variation on a cycle basis = {0}".format(max(pd_cbc)))
print("Minimum variation on a cycle basis = {0}".format(min(pd_cbc)))
# Compute the average linear encoder speed over a Flexo wheel rotation
enc_speed = []
enc_speed.append(0.0)
enc_speed.append(0.0)
for idx in range(1, N):
enc_speed.append(enc_res*delta_pd[idx-1]/(pd_time[idx]-pd_time[idx-1]))
# create a new plot
this_legend = 'Min = {0:f}'.format(min(delta_pd)) + '\n' + 'Max = {0:f}'.format(max(delta_pd))
s1 = figure(width=plot_w, plot_height=plot_h, title='PD distance [encoder pulses]', x_axis_label='PD Event',
y_axis_label='PD distance [encoder pulses]', tools=toolset,y_range=plot_range)
s1.circle(pd_num[1:], delta_pd, size=5, color="navy", alpha=0.5, legend=this_legend)
data_range = max(pd_var)-min(pd_var)
if data_range == 0.0:
data_range = 1.0
plot_range = [min(pd_var)-data_range, max(pd_var)+data_range]
this_legend = 'Min = {0:f}'.format(min(pd_var[1:N])) + '\n' + 'Max = {0:f}'.format(max(pd_var[1:N]))
s2 = figure(width=plot_w, height=plot_h, x_range=s1.x_range, y_range=plot_range, title='PD variation from average',
x_axis_label='PD Event', y_axis_label='PD Variation from average[Encoder Steps]',
tools=toolset)
s2.triangle(pd_num[1:], pd_var[1:N], size=10, color="olive", alpha=0.5, legend=this_legend)
data_range = max(pd_cbc)-min(pd_cbc)
if data_range == 0.0:
data_range = 1.0
plot_range = [min(pd_cbc)-data_range, max(pd_cbc)+data_range]
this_legend = 'Min = {0:f}'.format(min(pd_cbc[1:N])) + '\n' + 'Max = {0:f}'.format(max(pd_cbc[1:N]))
s3 = figure(width=plot_w, height=plot_h, x_range=s1.x_range, y_range=plot_range,
title='PD distance variation from the previous rotation',
x_axis_label='PD Event', y_axis_label='PD Variation [Encoder Steps]',
tools=toolset)
s3.circle(pd_num[1:], pd_cbc[1:N], size=10, color="firebrick", alpha=0.5,legend=this_legend)
data_range = max(enc_speed) - min(enc_speed)
if data_range == 0.0:
data_range = 1.0
plot_range = [min(enc_speed) - data_range, max(enc_speed) + data_range]
s4 = figure(width=plot_w, height=plot_h, x_range=s1.x_range, y_range=plot_range, title='Average linear encoder speed over a Flexo wheel rotation',
x_axis_label='PD Event', y_axis_label='Encoder Velocity',
tools=toolset)
s4.triangle(pd_num[1:], enc_speed[2:N+1], size=10, color="navy", alpha=0.5)
p = gridplot([[s1], [s2], [s3], [s4]])
#p = gridplot([[s1]])
# show the results
show(p)
##/////////////////////////////////////////////////////////////////////////////
## Plot-data
##/////////////////////////////////////////////////////////////////////////////
#1
#data_set = 'data-set'
data_set = './MiRAFLEX-tests-2019-09-13/2019-09-13_10mmin_direct_no_pd_maschine'
data_file = "{0}.txt".format(data_set)
csv_file = "{0}.csv".format(data_set)
[pd_num, pd_time, pd_pos] = get_pd_data(data_file)
save_raw_data(pd_num, pd_time, pd_pos, csv_file)
plot_pd_dat(pd_num, pd_time, pd_pos, data_set)
#2
data_set = './MiRAFLEX-tests-2019-09-13/2019-09-13_10mmin_no_pd_mschine'
data_file = "{0}.txt".format(data_set)
csv_file = "{0}.csv".format(data_set)
[pd_num, pd_time, pd_pos] = get_pd_data(data_file)
save_raw_data(pd_num, pd_time, pd_pos, csv_file)
plot_pd_dat(pd_num, pd_time, pd_pos, data_set)
#3
data_set = './MiRAFLEX-tests-2019-09-13/2019-09-13_15mmin_ramp_no_pd_maschine'
data_file = "{0}.txt".format(data_set)
csv_file = "{0}.csv".format(data_set)
[pd_num, pd_time, pd_pos] = get_pd_data(data_file)
save_raw_data(pd_num, pd_time, pd_pos, csv_file)
plot_pd_dat(pd_num, pd_time, pd_pos, data_set)
#4
data_set = './MiRAFLEX-tests-2019-09-13/2019-09-13_20mmin_direct_no_pd_maschine'
data_file = "{0}.txt".format(data_set)
csv_file = "{0}.csv".format(data_set)
[pd_num, pd_time, pd_pos] = get_pd_data(data_file)
save_raw_data(pd_num, pd_time, pd_pos, csv_file)
plot_pd_dat(pd_num, pd_time, pd_pos, data_set)
#5
data_set = './MiRAFLEX-tests-2019-09-13/2019-09-13_20mmin_direct_no_pd_maschine_02'
data_file = "{0}.txt".format(data_set)
csv_file = "{0}.csv".format(data_set)
[pd_num, pd_time, pd_pos] = get_pd_data(data_file)
save_raw_data(pd_num, pd_time, pd_pos, csv_file)
plot_pd_dat(pd_num, pd_time, pd_pos, data_set)
#6
data_set = './MiRAFLEX-tests-2019-09-13/2019-09-13_30mmin_ramp_no_pd_maschine'
data_file = "{0}.txt".format(data_set)
csv_file = "{0}.csv".format(data_set)
[pd_num, pd_time, pd_pos] = get_pd_data(data_file)
save_raw_data(pd_num, pd_time, pd_pos, csv_file)
plot_pd_dat(pd_num, pd_time, pd_pos, data_set)
#7
data_set = './MiRAFLEX-tests-2019-09-13/2019-09-13_30mmin_ramp_no_pd_maschine_02'
data_file = "{0}.txt".format(data_set)
csv_file = "{0}.csv".format(data_set)
[pd_num, pd_time, pd_pos] = get_pd_data(data_file)
save_raw_data(pd_num, pd_time, pd_pos, csv_file)
plot_pd_dat(pd_num, pd_time, pd_pos, data_set)

View file

@ -0,0 +1,76 @@
# HMB log file
< 2019_07_30_h09:39:37 > Loading Configuration file ./config/default.cfg
< 2019_07_30_h09:39:37 > Encoder Resolution = 20.0000000000
< 2019_07_30_h09:39:37 > Print-Head Resolution type = dpi
< 2019_07_30_h09:39:37 > Print-Head Resolution = 1200.0000000000
< 2019_07_30_h09:39:37 > Encoder Source = 0
< 2019_07_30_h09:39:37 > Internal Encoder Frequency = 5000.0000000000
< 2019_07_30_h09:39:37 > Encoder Phase = 1
< 2019_07_30_h09:39:37 > Encoder Edge = 2
< 2019_07_30_h09:39:37 > Encoder Directionality = 0
< 2019_07_30_h09:39:37 > PD Source = 3
< 2019_07_30_h09:39:37 > PD Edge = 0
< 2019_07_30_h09:39:37 > Print-Mode = Continuous
< 2019_07_30_h09:39:37 > PD-Type = None
< 2019_07_30_h09:39:37 > Image Length = 0.0000000000 pixel
< 2019_07_30_h09:39:37 > Gap Length = 0.0000000000 pixel
< 2019_07_30_h09:39:37 > Print-Head Width = 0.0000000000 pixel
< 2019_07_30_h09:39:37 > Forward-Pass Pre-Print Buffer Length = 0.0000000000 pixel
< 2019_07_30_h09:39:37 > Swathe Length = 0.0000000000 pixel
< 2019_07_30_h09:39:37 > Reverse-Pass Offset = 0.0000000000 pixel
< 2019_07_30_h09:39:37 > Pre-Print Additional Movement = 0.0000000000 mm
< 2019_07_30_h09:39:37 > Daisy-Chain Enable = 1
< 2019_07_30_h09:39:37 > Daisy-Chain Position = 1
< 2019_07_30_h09:39:37 > Daisy-Chain Length = 1
< 2019_07_30_h09:39:37 > Configuration file loaded.
< 2019_07_30_h09:39:37 > Make sure to be connected to the EMB Server and press the button 'Apply' to configure the EMB
< 2019_07_30_h09:39:37 > Starting Remote-Server on port 6124
< 2019_07_30_h09:39:46 > ERROR: Unable to connect to the EMB-server on IP address 192.168.79.139
< 2019_07_30_h09:40:21 > Opened connection to IP 192.168.79.139, Port 6121
< 2019_07_30_h09:40:21 > show server.version
< 2019_07_30_h09:40:21 > hmb_remote_server version 1.10016.0.5356
< 2019_07_30_h09:40:21 > show fpm_ctrl.fw_info
< 2019_07_30_h09:40:21 > GIS-HMB Board - Firmware version is F003
< 2019_07_30_h09:40:23 > set diag.pd_watchdog_enable 0 0.1
< 2019_07_30_h09:40:23 > set diag.polling 7 200
< 2019_07_30_h09:42:49 > show print.force_all_zeros
< 2019_07_30_h09:42:49 > 0
< 2019_07_30_h09:43:05 > set pg.wh_wheel_corr 1 4827
< 2019_07_30_h09:43:05 > W&H - Wheel Correction Enabled
< 2019_07_30_h09:43:30 > <Detected-PD> Event-Number #1, Time = 500.092 s, Positition = 101.540000 mm (abs_pos = 20308)
< 2019_07_30_h09:43:37 > <Wheel-Correction> - Rotation Count = 1, Position Error = -2.000, Division-Ratio Correction = -0.00331500
< 2019_07_30_h09:43:37 > <Detected-PD> Event-Number #2, Time = 506.773 s, Positition = 198.080000 mm (abs_pos = 39616)
< 2019_07_30_h09:43:44 > <Wheel-Correction> - Rotation Count = 2, Position Error = 1.000, Division-Ratio Correction = -0.00000000
< 2019_07_30_h09:43:44 > <Detected-PD> Event-Number #3, Time = 513.464 s, Positition = 294.620000 mm (abs_pos = 58924)
< 2019_07_30_h09:43:46 > <Detected-PD> Event-Number #4, Time = 515.962 s, Positition = 391.160000 mm (abs_pos = 78232)
< 2019_07_30_h09:43:47 > <Wheel-Correction> - Rotation Count = 3, Position Error = 2.000, Division-Ratio Correction = 0.00248600
< 2019_07_30_h09:43:49 > <Wheel-Correction> - Rotation Count = 4, Position Error = -1.000, Division-Ratio Correction = -0.00082900
< 2019_07_30_h09:43:49 > <Detected-PD> Event-Number #5, Time = 518.668 s, Positition = 487.700000 mm (abs_pos = 97540)
< 2019_07_30_h09:43:51 > <Detected-PD> Event-Number #6, Time = 520.496 s, Positition = 584.240000 mm (abs_pos = 116848)
< 2019_07_30_h09:43:51 > <Wheel-Correction> - Rotation Count = 5, Position Error = 0.000, Division-Ratio Correction = -0.00000000
< 2019_07_30_h09:43:52 > <Detected-PD> Event-Number #7, Time = 522.121 s, Positition = 680.780000 mm (abs_pos = 136156)
< 2019_07_30_h09:43:53 > <Wheel-Correction> - Rotation Count = 6, Position Error = 0.000, Division-Ratio Correction = -0.00000000
< 2019_07_30_h09:43:54 > <Detected-PD> Event-Number #8, Time = 523.475 s, Positition = 777.320000 mm (abs_pos = 155464)
< 2019_07_30_h09:43:54 > <Wheel-Correction> - Rotation Count = 7, Position Error = 0.000, Division-Ratio Correction = -0.00000000
< 2019_07_30_h09:44:12 > <Detected-PD> Event-Number #9, Time = 542.085 s, Positition = 872.320000 mm (abs_pos = 174464)
< 2019_07_30_h09:44:14 > <Wheel-Correction> - Rotation Count = 8, Position Error = -1.000, Division-Ratio Correction = -0.51046200
< 2019_07_30_h09:44:15 > <Detected-PD> Event-Number #10, Time = 544.155 s, Positition = 967.320000 mm (abs_pos = 193464)
< 2019_07_30_h09:44:15 > <Wheel-Correction> - Rotation Count = 9, Position Error = -1.000, Division-Ratio Correction = -0.25688900
< 2019_07_30_h09:44:17 > <Wheel-Correction> - Rotation Count = 10, Position Error = 2.000, Division-Ratio Correction = -0.25274600
< 2019_07_30_h09:44:17 > <Detected-PD> Event-Number #11, Time = 546.342 s, Positition = 1062.320000 mm (abs_pos = 212464)
< 2019_07_30_h09:44:19 > <Detected-PD> Event-Number #12, Time = 548.990 s, Positition = 1157.320000 mm (abs_pos = 231464)
< 2019_07_30_h09:44:20 > <Wheel-Correction> - Rotation Count = 11, Position Error = -1.000, Division-Ratio Correction = -0.25606000
< 2019_07_30_h09:44:22 > <Detected-PD> Event-Number #13, Time = 551.806 s, Positition = 1252.320000 mm (abs_pos = 250464)
< 2019_07_30_h09:44:22 > <Wheel-Correction> - Rotation Count = 12, Position Error = 0.000, Division-Ratio Correction = -0.25523200
< 2019_07_30_h09:44:24 > <Detected-PD> Event-Number #14, Time = 553.494 s, Positition = 1347.320000 mm (abs_pos = 269464)
< 2019_07_30_h09:44:24 > <Wheel-Correction> - Rotation Count = 13, Position Error = 0.000, Division-Ratio Correction = -0.25523200
< 2019_07_30_h09:44:25 > <Wheel-Correction> - Rotation Count = 14, Position Error = 0.000, Division-Ratio Correction = -0.25523200
< 2019_07_30_h09:44:25 > <Detected-PD> Event-Number #15, Time = 554.990 s, Positition = 1442.320000 mm (abs_pos = 288464)
< 2019_07_30_h09:59:11 > set diag.polling 0 200
< 2019_07_30_h09:59:11 > set server.disconnect
< 2019_07_30_h09:59:11 > Closed connection to 192.168.79.139
< 2019_07_30_h09:59:11 > <Wheel-Correction> - Rotation Count = -1, Position Error = 0.000, Division-Ratio Correction = -1.00000000
< 2019_07_30_h09:59:43 > Closing EMB Console ...

View file

@ -0,0 +1,181 @@
##/////////////////////////////////////////////////////////////////////////////
## Title : wheel_correction_analysis
##/////////////////////////////////////////////////////////////////////////////
## File : wheel_correction_analysis.py
## Author : Gianmarco Girau
## Company : GIS
## Target : HMB Console
## Dependency : none
##/////////////////////////////////////////////////////////////////////////////
## Description: Analyze misalignment error from wheel corrections
##/////////////////////////////////////////////////////////////////////////////
## Last update: 2019-05-30
##/////////////////////////////////////////////////////////////////////////////
## Revisions :
## Date Version Author Description
## 2019-05-30 01.00.0a gmg Created
##/////////////////////////////////////////////////////////////////////////////
from bokeh.plotting import figure, output_file, show
from bokeh.layouts import gridplot
rotation_idx = []
pos_err = []
pitch_corr = []
pd_num = []
pd_time = []
pd_pos = []
log_file_name = './hmb_log2.txt'
data_file_name = './pitch_corr.csv'
pd_file_name = './pd_log.csv'
plot_file_name_1 = './pitch_corr_1.html'
plot_file_name_2 = './pitch_corr_2.html'
plot_file_name_3 = './delta_pd.html'
##/////////////////////////////////////////////////////////////////////////////
## Get data from the log file
##/////////////////////////////////////////////////////////////////////////////
f_log = open(log_file_name, 'r')
for line in f_log:
target = '<Wheel-Correction> - '
idx =line.find(target)
if idx != -1:
target = 'Rotation Count = '
idx = line.find(target)
clist = line[idx+len(target):].split(None)
rotation_idx.append(int(clist[0][0:-1]))
target = 'Position Error = '
idx = line.find(target)
clist = line[idx + len(target):].split(None)
pos_err.append(float(clist[0][0:-1]))
target = 'Division-Ratio Correction = '
idx = line.find(target)
clist = line[idx + len(target):].split(None)
pitch_corr.append(float(clist[0][0:-1]))
#print("Rotation Idx = {0:d}, Position-Error = {1:f}, Pixel-Pitch-Correction = {2:f}".format(rotation_idx[-1], pos_err[-1], pitch_corr[-1]))
f_log.closed
f_log = open(log_file_name, 'r')
for line in f_log:
target = '<Detected-PD>'
idx =line.find(target)
if idx != -1:
tmp = line[idx + len(target):].split('#')
clist = tmp[1].split(',')
pd_num.append(int(clist[0]))
#print('PD Event = {:d}'.format(pd_num[-1]))
target = 'Time = '
idx = line.find(target)
clist = line[idx + len(target):].split(None)
pd_time.append(float(clist[0][0:-1]))
target = 'abs_pos = '
idx = line.find(target)
clist = line[idx + len(target):].split(None)
pd_pos.append(float(clist[0][0:-1]))
f_log.closed
# Save data on a separate CSV file
f_data = open(data_file_name, 'w')
f_data.write("Rotation index, Position Error, Pixel-Pitch Correction" + '\n')
for idx in range(0,len(rotation_idx)):
f_data.write("{0:d}, {1:f}, {2:f}".format(rotation_idx[idx], pos_err[idx], pitch_corr[idx]) + '\n')
f_data.close
f_data = open(pd_file_name, 'w')
f_data.write("PD event, Time, Position" + '\n')
for idx in range(0,len(pd_num)):
f_data.write("{0:d}, {1:f}, {2:f}".format(pd_num[idx], pd_time[idx], pd_pos[idx]) + '\n')
f_data.close
##/////////////////////////////////////////////////////////////////////////////
## Plot-data
##/////////////////////////////////////////////////////////////////////////////
# output to static HTML file
output_file(plot_file_name_1)
plot_w = 500
plot_h = 500
toolset="pan,box_zoom,reset,save"
# create a new plot
s1 = figure(width=plot_w, plot_height=plot_h, title='Position Error', x_axis_label='Flexo Wheel Rotation', y_axis_label='Position Error [Encoder Steps]', tools=toolset)
s1.circle(rotation_idx, pos_err, size=5, color="navy", alpha=0.5)
s2 = figure(width=plot_w, height=plot_h, x_range=s1.x_range, y_range=s1.y_range, title='Pixel-Pitch Correction', x_axis_label='Flexo Wheel Rotation', y_axis_label='Pixel-Pitch Correction [Encoder Steps]', tools=toolset)
s2.triangle(rotation_idx, pitch_corr, size=10, color="olive", alpha=0.5)
#p = gridplot([[s1], [s2]], toolbar_location=None)
p = gridplot([[s1], [s2]])
# show the results
show(p)
# Create a second plot in um
# output to static HTML file
output_file(plot_file_name_2)
enc_res = 5
head_reas = 21.167
pos_err_um = [x*enc_res for x in pos_err]
pitch_corr_um = [x*enc_res for x in pitch_corr]
plot_w = 500
plot_h = 500
toolset="pan,box_zoom,reset,save"
# create a new plot
s1 = figure(width=plot_w, plot_height=plot_h, title='Position Error', x_axis_label='Flexo Wheel Rotation', y_axis_label='Position Error [um]', tools=toolset)
s1.circle(rotation_idx, pos_err_um, size=5, color="navy", alpha=0.5)
s2 = figure(width=plot_w, height=plot_h, x_range=s1.x_range, y_range=s1.y_range, title='Pixel-Pitch Correction', x_axis_label='Flexo Wheel Rotation', y_axis_label='Pixel-Pitch Correction [um]', tools=toolset)
s2.triangle(rotation_idx, pitch_corr_um, size=10, color="olive", alpha=0.5)
#p = gridplot([[s1], [s2]], toolbar_location=None)
p = gridplot([[s1], [s2]])
# show the results
show(p)
# output to static HTML file
output_file(plot_file_name_3)
plot_w = 500
plot_h = 500
toolset="pan,box_zoom,reset,save"
delta_pd = []
N = len(pd_num)
for idx in range(1,N):
delta_pd.append(pd_pos[idx] - pd_pos[idx-1])
# create a new plot
s1 = figure(width=plot_w, plot_height=plot_h, title='PD distance [encoder pulses]', x_axis_label='PD Event', y_axis_label='PD distance [encoder pulses]', tools=toolset)
s1.circle(pd_num[1:], delta_pd, size=5, color="navy", alpha=0.5)
#p = gridplot([[s1], [s2]], toolbar_location=None)
p = gridplot([[s1]])
# show the results
show(p)

View file

@ -0,0 +1,594 @@
-------------------------------------------------------------------------------
-- Title : pd_jitter_verify_tb
-- Project : EMB/SMB
-------------------------------------------------------------------------------
-- File : pd_jitter_verify_tb.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2018-09-11
-- Last update: 2020-04-15
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Verify the PD jitter mechanism on the Pulse-Generator
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.math_real.all;
use work.log_pkg.all;
use work.avalon_verify_pkg.all;
use work.pulse_generator_3_pkg.all;
entity pd_jitter_verify_tb is
-- ..
end entity pd_jitter_verify_tb;
architecture behav of pd_jitter_verify_tb is
constant CLK_PERIOD : time := 10 ns;
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
-----------------------------------------------------------------------------
-- TB Functions / Procedures
-----------------------------------------------------------------------------
procedure wait_latency(
signal clk : in std_logic;
cycles : in natural) is
begin
for i in 1 to cycles loop
wait until clk = '1' and clk'event;
end loop; -- i
end procedure wait_latency;
-----------------------------------------------------------------------------
-- Signal declarations
-----------------------------------------------------------------------------
signal reset_n : std_logic := '0';
signal clk : std_logic := '0';
signal init : std_logic;
signal pd_in : std_logic;
signal abs_position : std_logic_vector(31 downto 0);
signal dp_dir : std_logic;
signal fire_req : std_logic;
signal fire_req_vec : std_logic_vector(31 downto 0);
signal filtered_pd : std_logic;
signal ch_pd : std_logic;
signal ch_mask : std_logic;
signal raw_fire_req : std_logic;
signal avs_address : std_logic_vector(10 downto 0);
signal avs_write : std_logic;
signal avs_writedata : std_logic_vector(31 downto 0);
signal avs_read : std_logic;
signal avs_readdatavalid : std_logic;
signal avs_readdata : std_logic_vector(31 downto 0);
--
signal avs_m : mm_m_rec_t;
signal avs_s : mm_s_rec_t;
--
signal pd_in_cnt : integer;
signal pd_out_cnt : integer;
--
signal test_completed : boolean;
signal setup : boolean;
signal running : boolean;
signal error_flag : boolean;
signal passed : boolean;
signal failed : boolean;
begin -- architecture behav
clk <= not clk after 0.5*CLK_PERIOD;
-----------------------------------------------------------------------------
-- UUT
-----------------------------------------------------------------------------
iUUT: entity work.pulse_generator_3
generic map (
pulse_delay_equal_en => true)
port map (
clk => clk,
reset_n => reset_n,
init => init,
pd_in => pd_in,
abs_position => abs_position,
dp_dir => dp_dir,
fire_req_vec => fire_req_vec,
filtered_pd => filtered_pd,
ch_pd => ch_pd,
ch_mask => ch_mask,
raw_fire_req => raw_fire_req,
avs_address => avs_address,
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdatavalid => avs_readdatavalid,
avs_readdata => avs_readdata);
fire_req <= fire_req_vec(0);
-----------------------------------------------------------------------------
-- Avalon interface
-----------------------------------------------------------------------------
clk_clk <= clk;
reset_reset_n <= reset_n;
avs_s.mm_readdata <= avs_readdata;
avs_s.mm_readdatavalid <= avs_readdatavalid;
avs_s.mm_waitrequest <= '0';
avs_s.use_readvalid <= true;
avs_address <= avs_m.mm_address(avs_address'range);
avs_write <= avs_m.mm_write;
avs_writedata <= avs_m.mm_writedata;
avs_read <= avs_m.mm_read;
pCNT_CH_PD : process(reset_n, clk)
begin
if(reset_n = '0') then
pd_out_cnt <= 0;
elsif(clk = '1' and clk'event) then
if(ch_pd = '1') then
pd_out_cnt <= pd_out_cnt + 1;
end if;
end if;
end process pCNT_CH_PD;
-----------------------------------------------------------------------------
-- Testbench Logic
-----------------------------------------------------------------------------
pTB_CTRL : process
alias dp_dir is <<signal iUUT.dp_dir_i : std_logic>>;
procedure issue_pd(valid_pd : boolean := true) is
begin
wait until clk = '1' and clk'event;
pd_in <= '1';
wait until clk = '1' and clk'event;
pd_in <= '0';
if(valid_pd = true) then
pd_in_cnt <= pd_in_cnt + 1;
end if;
end procedure issue_pd;
procedure check_pd is
begin
for i in 1 to 12 loop
wait until clk = '1' and clk'event;
end loop; -- i
if(pd_out_cnt /= pd_in_cnt) then
if(pd_out_cnt > pd_in_cnt) then
log("ERROR: Detected faulty Channel PD.", VLOW);
else
log("ERROR: Missing Channel PD.", VLOW);
end if;
error_flag <= true;
end if;
end procedure check_pd;
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
-- Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
--set_log_verbosity(VHIGH);
-- initilialize the Avalon master-bus
mm_m_init(avs_m);
log_header("PD Jitter verification:", VLOW);
setup <= false;
running <= false;
passed <= false;
error_flag <= false;
init <= '0';
pd_in <= '0';
pd_in_cnt <= 0;
abs_position <= (others => '0');
-- Reset
reset_n <= '0';
wait for 100 ns;
wait until clk = '1' and clk'event;
reset_n <= '1';
wait for 200 ns;
-- enable the pulse generator
addr := std_logic_vector(resize(unsigned(PULSE_GEN_CTRL_REG), 32));
data := X"0000_0001";
mm_32b_write(addr, data, avs_s, avs_m);
---------------------------------------------------------------------------
-- DP-DIR = '0'
---------------------------------------------------------------------------
log("DP-DIR = '0'", VLOW);
log_separator_line(VLOW);
dp_dir <= force '0';
wait for 200 ns;
wait until clk = '1' and clk'event;
init <= '1';
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
init <= '0';
wait for 200 ns;
wait until clk = '1' and clk'event;
---------------------------------------------------------------------------
-- DIR-0, Init Pos = 0
---------------------------------------------------------------------------
log("Issueing PD on ABS_POS = 0", VLOW);
for n in 0 to 9 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
log("Go back to ABS_POS = 0", VLOW);
for n in 0 to 9 loop
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
log("Issueing again PD on ABS_POS = 0", VLOW);
for n in 0 to 9 loop
issue_pd(false);
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
for n in 0 to 9 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
wait for 1 us;
---------------------------------------------------------------------------
-- DIR-0, Init Pos = -10
---------------------------------------------------------------------------
log("Issueing PD DIR-0, on ABS_POS = -10", VLOW);
abs_position <= std_logic_vector(to_signed(-10,32));
wait_latency(clk, 3);
init <= '1';
wait_latency(clk, 2);
init <= '0';
wait_latency(clk, 10);
log("Issueing PD on ABS_POS = -10", VLOW);
for n in 0 to 9 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
log("Go back to ABS_POS = -10", VLOW);
for n in 0 to 9 loop
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
log("Issueing again PD on ABS_POS = -10", VLOW);
for n in 0 to 9 loop
issue_pd(false);
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
for n in 0 to 9 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
wait for 1 us;
---------------------------------------------------------------------------
-- DIR-0, Mid-crossing
---------------------------------------------------------------------------
log_separator_line(VLOW);
log("DP-DIR = '0', Mid-Crossing", VLOW);
log_separator_line(VLOW);
abs_position <= X"7FFFFFF8";
wait_latency(clk, 3);
init <= '1';
wait_latency(clk, 2);
init <= '0';
wait_latency(clk, 10);
log("Issueing PD on ABS_POS = 0x7FFFFFF8", VLOW);
for n in 0 to 15 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
log("Go back to ABS_POS = 0x7FFFFFF8", VLOW);
for n in 0 to 15 loop
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
log("Issueing again PD on ABS_POS = 0x7FFFFFF8", VLOW);
for n in 0 to 15 loop
issue_pd(false);
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
for n in 0 to 15 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
log("Performing a zero-crossing", VLOW);
wait_latency(clk, 10);
abs_position <= std_logic_vector(to_signed(-10,32));
wait_latency(clk, 10);
issue_pd;
for n in 0 to 19 loop
abs_position <= std_logic_vector(signed(abs_position)+ 1);
wait_latency(clk, 10);
end loop; -- n
issue_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
wait_latency(clk, 10);
abs_position <= X"7FFFFFF8";
log("Issueing a second set of PDs at ABS_POS = 0x7FFFFFF8", VLOW);
wait_latency(clk, 10);
for n in 0 to 15 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
wait for 1 us;
---------------------------------------------------------------------------
-- DP-DIR = '1'
---------------------------------------------------------------------------
log_separator_line(VLOW);
log("DP-DIR = '1'", VLOW);
log_separator_line(VLOW);
dp_dir <= force '1';
abs_position <= std_logic_vector(to_signed(0,32));
wait for 200 ns;
wait until clk = '1' and clk'event;
init <= '1';
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
init <= '0';
wait for 200 ns;
wait until clk = '1' and clk'event;
---------------------------------------------------------------------------
-- DIR-1, Init Pos = 0
---------------------------------------------------------------------------
log("Issueing PD on ABS_POS = 0", VLOW);
for n in 0 to 9 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
log("Go back to ABS_POS = 0", VLOW);
for n in 0 to 9 loop
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
log("Issueing again PD on ABS_POS = 0", VLOW);
for n in 0 to 9 loop
issue_pd(false);
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
for n in 0 to 9 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
wait for 1 us;
---------------------------------------------------------------------------
-- DIR-1, Init Pos = +10
---------------------------------------------------------------------------
abs_position <= std_logic_vector(to_signed(+10,32));
wait_latency(clk, 3);
init <= '1';
wait_latency(clk, 2);
init <= '0';
wait_latency(clk, 10);
log("Issueing PD on ABS_POS = +10", VLOW);
for n in 0 to 9 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
log("Go back to ABS_POS = +10", VLOW);
for n in 0 to 9 loop
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
log("Issueing again PD on ABS_POS = +10", VLOW);
for n in 0 to 9 loop
issue_pd(false);
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
for n in 0 to 9 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
wait for 1 us;
---------------------------------------------------------------------------
-- DIR-1, Mid-crossing
---------------------------------------------------------------------------
log_separator_line(VLOW);
log("DP-DIR = '1', Mid-Crossing", VLOW);
log_separator_line(VLOW);
abs_position <= X"80000008";
wait_latency(clk, 3);
init <= '1';
wait_latency(clk, 2);
init <= '0';
wait_latency(clk, 10);
log("Issueing PD on ABS_POS = 0x80000008", VLOW);
for n in 0 to 15 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
log("Go back to ABS_POS = 0x80000008", VLOW);
for n in 0 to 15 loop
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
log("Issueing again PD on ABS_POS = 0x80000008", VLOW);
for n in 0 to 15 loop
issue_pd(false);
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
for n in 0 to 15 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
log("Performing a zero-crossing", VLOW);
wait_latency(clk, 10);
abs_position <= std_logic_vector(to_signed(+10,32));
wait_latency(clk, 10);
issue_pd;
for n in 0 to 19 loop
abs_position <= std_logic_vector(signed(abs_position)- 1);
wait_latency(clk, 10);
end loop; -- n
issue_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
wait_latency(clk, 10);
abs_position <= X"80000008";
log("Issueing a second set of PDs at ABS_POS = 0x80000008", VLOW);
wait_latency(clk, 10);
for n in 0 to 15 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
wait for 20 us;
running <= false;
passed <= true after 100 ns;
wait;
end process pTB_CTRL;
failed <= error_flag after 100 ns;
pREPORT_RESULT : process
begin
wait until failed = true or passed = true;
wait for 1 us;
log_separator_line(VLOW);
if(failed = true) then
log("FAILURE: test completed with errors.", VLOW);
elsif(passed = true) then
log("SUCCESS: test successfully completed.", VLOW);
end if;
log_separator_line(VLOW);
test_completed <= true;
end process pREPORT_RESULT;
end architecture behav;

View file

@ -0,0 +1,655 @@
-------------------------------------------------------------------------------
-- Title : simple_frac_div_tb
-- Project : EMB/SMB
-------------------------------------------------------------------------------
-- File : simple_frac_div_tb.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2017-12-06
-- Last update: 2019-12-02
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Testbench for the simple_frac_div.vhd
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.math_real.all;
library OSVVM;
use OSVVM.RandomBasePkg.all;
use OSVVM.RandomPkg.all;
use work.log_pkg.all;
entity simple_frac_div_tb is
-- ..
end entity simple_frac_div_tb;
architecture behav of simple_frac_div_tb is
constant CLK_PERIOD : time := 10 ns;
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
constant MAX_DIST : natural := 10000;
-- define the percentage of reverse steps, with respect to the intended
-- direction, while advancing the position:
-- 0 => no reverse movement at all
-- 20 => 20% of position increments are in the opposite dirtection
-- 49 => Essentially this is an oscillation around the centre position with a
-- tiny bias in the intended direction!
constant POS_RANDOM_PERC : natural range 0 to 49 := 0; -- define
constant INTRA_POS_LATENCY : natural := 5; -- number of clock cycles between position increments
-----------------------------------------------------------------------------
-- TB Functions / Procedures
-----------------------------------------------------------------------------
procedure wait_latency(
signal clk : in std_logic;
cycles : in natural) is
begin
for i in 1 to cycles loop
wait until clk = '1' and clk'event;
end loop; -- i
end procedure wait_latency;
-- convert the div_ratio to a fixed point integer with a 24 bits fractional part
function ratio_to_fixed_point (ratio : real) return std_logic_vector is
variable mantissa : real;
variable int_vec : std_logic_vector(33 downto 0) := (others => '0');
begin
-- Compute the ratio in two steps to avoid intermediate integer
-- representations exceeding 32 bits:
-- Compute first the integer part
int_vec(33 downto 24) := std_logic_vector(to_unsigned(integer(floor(ratio)), 10));
-- Compute the mantissa
mantissa := (ratio-floor(ratio))*real(2**24);
int_vec(23 downto 0) := std_logic_vector(to_unsigned(integer(mantissa), 24));
return int_vec;
end function ratio_to_fixed_point;
-- convert the sub-pixel offset to a fixed point integer with a 24 bits fractional part
function offset_to_fixed_point (off : real; ratio: real) return std_logic_vector is
variable norm_ratio : real;
variable mantissa : real;
variable int_vec : std_logic_vector(33 downto 0) := (others => '0');
begin
norm_ratio := off*ratio;
-- Compute the ratio in two steps to avoid intermediate integer
-- representations exceeding 32 bits:
-- Compute first the integer part
int_vec(33 downto 24) := std_logic_vector(to_unsigned(integer(floor(norm_ratio)), 10));
-- Compute the mantissa
mantissa := (norm_ratio-floor(norm_ratio))*real(2**24);
int_vec(23 downto 0) := std_logic_vector(to_unsigned(integer(mantissa), 24));
return int_vec;
end function offset_to_fixed_point;
function check_result(ratio : real; offset : real; delta_pos : integer; fire_cnt : integer; silent_mode : boolean := false) return boolean is
variable res : boolean;
variable exp_fire : integer;
begin
if(real(delta_pos) < ratio*offset) then
exp_fire := 0;
else
--exp_fire := integer(real(delta_pos)/ratio - offset+0.5);
exp_fire := integer((1.0 + real(delta_pos)/ratio - offset));
end if;
if(silent_mode = false) then
log("Check Result:",VMEDIUM);
log("ratio = " & to_string(ratio) & ", offset = " & to_string(offset) & ", delta_pos = " & to_string(delta_pos),VMEDIUM);
end if;
if(abs(exp_fire-fire_cnt) <= 1) then
res := true;
if(silent_mode = false) then
log("Check Result:",VMEDIUM);
log("ratio = " & to_string(ratio) & ", offset = " & to_string(offset) & ", delta_pos = " & to_string(delta_pos),VMEDIUM);
log("Expected Fire-Pulses = " & to_string(exp_fire) & ", detected = " & to_string(fire_cnt),VMEDIUM);
end if;
else
res := false;
log("Check Result:",VMEDIUM);
log("ratio = " & to_string(ratio) & ", offset = " & to_string(offset) & ", delta_pos = " & to_string(delta_pos),VMEDIUM);
log("ERROR: Expected Fire-Pulses = " & to_string(exp_fire) & ", detected = " & to_string(fire_cnt),VMEDIUM);
end if;
return res;
end function check_result;
-----------------------------------------------------------------------------
-- Signal declarations
-----------------------------------------------------------------------------
signal reset_n : std_logic := '0';
signal clk : std_logic := '0';
signal enable : std_logic;
signal upd_max_pos : std_logic;
signal upd_min_pos : std_logic;
signal abs_pos_max : std_logic_vector(31 downto 0);
signal abs_pos_min : std_logic_vector(31 downto 0);
signal dir : std_logic;
signal offset : std_logic_vector(33 downto 0);
signal ratio : std_logic_vector(33 downto 0);
signal abs_pos : std_logic_vector(31 downto 0);
signal fire : std_logic;
signal fire_cnt : std_logic_vector(31 downto 0);
--
signal div_ratio : real := 1.0;
signal pixel_offset : real := 0.0;
signal ideal_fire : real := 0.0;
signal firing_error : real := 0.0;
signal pos : integer := 0;
signal tot_fire_num : integer := 0;
--
signal test_completed : boolean;
signal configuring : boolean;
signal running : boolean;
signal passed : boolean;
signal failed : boolean;
begin -- architecture behav
clk <= not clk after 0.5*CLK_PERIOD;
-----------------------------------------------------------------------------
-- UUTs
-----------------------------------------------------------------------------
iUUT : entity work.simple_frac_div_3
port map (
clk => clk,
enable => enable,
dir => dir,
upd_max_pos => upd_max_pos,
upd_min_pos => upd_min_pos,
abs_pos_max => abs_pos_max,
abs_pos_min => abs_pos_min,
offset => offset,
ratio => ratio,
abs_pos => abs_pos,
fire => fire,
fire_cnt => fire_cnt);
ratio <= ratio_to_fixed_point(div_ratio);
offset <= offset_to_fixed_point(pixel_offset, div_ratio);
abs_pos <= std_logic_vector(to_signed(pos,32));
-----------------------------------------------------------------------------
-- Signal Monitor
-----------------------------------------------------------------------------
pMONITOR : process(clk)
alias ideal_fire_int is <<signal iUUT.ideal_fire : std_logic_vector(49 downto 0)>>;
alias firing_error_int is <<signal iUUT.firing_error : std_logic_vector(49 downto 0)>>;
begin
if(clk = '1' and clk'event) then
ideal_fire <= real(to_integer(unsigned(ideal_fire_int(49 downto 24)))) + (real(to_integer(unsigned(ideal_fire_int(23 downto 0)))) / real(2.0**24));
firing_error <= real(to_integer(unsigned(firing_error_int(49 downto 24)))) + (real(to_integer(unsigned(firing_error_int(23 downto 0)))) / real(2.0**24));
end if;
end process pMONITOR;
-----------------------------------------------------------------------------
-- Support Logic
-----------------------------------------------------------------------------
pSupport : process(clk)
begin
if(clk = '1' and clk'event) then
if(enable = '0') then
tot_fire_num <= 0;
elsif(fire = '1') then
tot_fire_num <= tot_fire_num +1;
end if;
end if;
end process pSupport;
-----------------------------------------------------------------------------
-- Testbench Logic
-----------------------------------------------------------------------------
pTB_CTRL : process
variable delta_pos : integer := 0;
variable init_pos : integer;
variable dir_m : integer;
variable tot_steps : integer;
variable result : boolean;
variable test_idx : natural;
variable rv : RandomPType;
procedure run_test is
variable steps : integer;
variable sel_dir : integer;
begin
log_header("Test-case " & to_string(test_idx), VMEDIUM);
wait_latency(clk, 1);
if dir = '0' then
dir_m := 1;
else
dir_m := -1;
end if;
init_pos := pos;
-- reset the absolute position memory
enable <= '0';
upd_max_pos <= '0';
upd_min_pos <= '0';
wait_latency(clk, 1);
upd_max_pos <= '1';
upd_min_pos <= '1';
wait_latency(clk, 1);
upd_max_pos <= '0';
upd_min_pos <= '0';
-- restart the divider
wait_latency(clk, 1);
enable <= '1';
wait_latency(clk, INTRA_POS_LATENCY);
-- run the steps
steps := 0;
loop_pos: while steps < tot_steps loop
wait_latency(clk, INTRA_POS_LATENCY);
/*
-- check the result and report
delta_pos := dir_m * (pos - init_pos);
result := check_result(div_ratio, pixel_offset, delta_pos, tot_fire_num, true);
exit loop_pos when result = false;
*/
sel_dir := rv.RandInt(1, 100);
if(sel_dir > POS_RANDOM_PERC) then
-- move in the intended direction
pos <= pos + dir_m;
steps := steps + 1;
else
-- move in the opposite direction
pos <= pos - dir_m;
steps := steps - 1;
end if;
end loop loop_pos;
-- wait the propagation of the latency
wait_latency(clk, INTRA_POS_LATENCY);
-- check the result and report
delta_pos := dir_m * (pos - init_pos);
if(result /= false) then
result := check_result(div_ratio, pixel_offset, delta_pos, tot_fire_num);
end if;
log("div_ratio = " & to_string(div_ratio), VMEDIUM);
end procedure run_test;
begin
-- Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
--set_log_verbosity(VHIGH);
log_header("Fractional Divider verification:", VLOW);
test_completed <= false;
configuring <= false;
running <= false;
passed <= false;
failed <= false;
enable <= '0';
dir <= '1';
-- Reset
reset_n <= '0';
wait for 100 ns;
wait until clk = '1' and clk'event;
reset_n <= '1';
result := true;
test_idx := 0;
---------------------------------------------------------------------------
-- Test-00
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 0.0;
dir <= '0';
tot_steps := 100000;
run_test;
end if;
--wait for 5 us;
--test_completed <= true;
---------------------------------------------------------------------------
-- Test-01
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 0.25;
dir <= '0';
tot_steps := 100000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-02
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 0.5;
dir <= '0';
tot_steps := 100000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-03
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 0.75;
dir <= '0';
tot_steps := 100000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-04
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 1.0;
dir <= '0';
tot_steps := 100000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-05
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 1.001;
pixel_offset <= 0.0;
dir <= '0';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-06
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 1.002;
pixel_offset <= 0.9;
dir <= '1';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-07
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 1.333;
pixel_offset <= 1.5;
dir <= '0';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-08
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.008;
pixel_offset <= 0.25;
dir <= '0';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-09
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 0.0;
dir <= '0';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-10
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 0.25;
dir <= '0';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-11
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 0.5;
dir <= '0';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-12
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 0.75;
dir <= '0';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-13
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 1.0;
dir <= '0';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-14
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 0.12;
dir <= '0';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-15
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 0.13;
dir <= '0';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-16
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 126.0;
pixel_offset <= 0.99;
dir <= '0';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-17
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 126.0;
pixel_offset <= 0.0;
dir <= '0';
tot_steps := 10000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-18 - Very long test to check internal-reg-saturation
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 4.000;
pixel_offset <= 0.0;
dir <= '0';
tot_steps := 100000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-19 - Very long test to check internal-reg-saturation
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 1000.000;
pixel_offset <= 0.5;
dir <= '0';
tot_steps := 100000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-20 - Very long test to check internal-reg-saturation
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 999.9;
pixel_offset <= 0.5;
dir <= '0';
tot_steps := 100000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-21 - Very long test to check internal-reg-saturation
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 999.8;
pixel_offset <= 0.5;
dir <= '0';
tot_steps := 100000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-22 - Very long test to check internal-reg-saturation
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 1001.0;
pixel_offset <= 0.5;
dir <= '0';
tot_steps := 100000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-23 - Very long test to check internal-reg-saturation
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 1000.1;
pixel_offset <= 0.5;
dir <= '0';
tot_steps := 100000;
run_test;
end if;
---------------------------------------------------------------------------
-- Test-23 - Very long test to check internal-reg-saturation
---------------------------------------------------------------------------
if(result /= false) then
test_idx := test_idx+1;
div_ratio <= 1000.2;
pixel_offset <= 0.5;
dir <= '0';
tot_steps := 100000;
run_test;
end if;
---------------------------------------------------------------------------
-- Random Tests
---------------------------------------------------------------------------
for n in 1 to 20 loop
if(result /= false) then
test_idx := test_idx+1;
-- the div_ratio fractional part must be a multiple of 0.001
div_ratio <= 0.001*real(rv.RandInt(1000, 50000));
if((rv.RandInt(1,10) mod 2) = 0) then
dir <= '0';
else
dir <= '1';
end if;
tot_steps := rv.RandInt(5000, 20000);
run_test;
end if;
end loop; -- n
wait for 200 ns;
log_separator_line(VLOW);
if(result = false) then
failed <= true;
log("FAILURE: test completed with errors.", VLOW);
else
passed <= true;
log("SUCCESS: test successfully completed.", VLOW);
end if;
log_separator_line(VLOW);
test_completed <= true;
running <= false;
wait;
end process pTB_CTRL;
end architecture behav;

View file

@ -0,0 +1,307 @@
-------------------------------------------------------------------------------
-- Title : spitting_verify_tb
-- Project : Pulse-Generator
-------------------------------------------------------------------------------
-- File : spitting_verify_tb.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2018-09-11
-- Last update: 2019-05-22
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Verify the spitting logic in pulse-generator
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.math_real.all;
use work.log_pkg.all;
use work.avalon_verify_pkg.all;
use work.pulse_generator_3_pkg.all;
entity spitting_verify_tb is
-- ..
end entity spitting_verify_tb;
architecture behav of spitting_verify_tb is
constant CLK_PERIOD : time := 10 ns;
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
-----------------------------------------------------------------------------
-- TB Functions / Procedures
-----------------------------------------------------------------------------
procedure wait_latency(
signal clk : in std_logic;
cycles : in natural) is
begin
for i in 1 to cycles loop
wait until clk = '1' and clk'event;
end loop; -- i
end procedure wait_latency;
-----------------------------------------------------------------------------
-- Signal declarations
-----------------------------------------------------------------------------
signal reset_n : std_logic := '0';
signal clk : std_logic := '0';
signal init : std_logic;
signal pd_in : std_logic;
signal abs_position : std_logic_vector(31 downto 0);
signal dp_dir : std_logic;
signal pulse_out : std_logic;
signal filtered_pd : std_logic;
signal ch_pd : std_logic;
signal ch_mask : std_logic;
signal raw_pulse_out : std_logic;
signal avs_address : std_logic_vector(9 downto 0);
signal avs_write : std_logic;
signal avs_writedata : std_logic_vector(31 downto 0);
signal avs_read : std_logic;
signal avs_readdatavalid : std_logic;
signal avs_readdata : std_logic_vector(31 downto 0);
--
signal avs_m : mm_m_rec_t;
signal avs_s : mm_s_rec_t;
--
signal pd_in_cnt : integer;
signal pd_out_cnt : integer;
--
signal test_completed : boolean;
signal setup : boolean;
signal running : boolean;
signal error_flag : boolean;
signal passed : boolean;
signal failed : boolean;
begin -- architecture behav
clk <= not clk after 0.5*CLK_PERIOD;
-----------------------------------------------------------------------------
-- UUT
-----------------------------------------------------------------------------
iUUT: entity work.pulse_generator_3
generic map (
pulse_delay_equal_en => true,
out_pulse_condition => true)
port map (
clk => clk,
reset_n => reset_n,
init => init,
pd_in => pd_in,
abs_position => abs_position,
dp_dir => dp_dir,
pulse_out => pulse_out,
filtered_pd => filtered_pd,
ch_pd => ch_pd,
ch_mask => ch_mask,
raw_pulse_out => raw_pulse_out,
avs_address => avs_address,
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdatavalid => avs_readdatavalid,
avs_readdata => avs_readdata);
-----------------------------------------------------------------------------
-- Avalon interface
-----------------------------------------------------------------------------
clk_clk <= clk;
reset_reset_n <= reset_n;
avs_s.mm_readdata <= avs_readdata;
avs_s.mm_readdatavalid <= avs_readdatavalid;
avs_s.mm_waitrequest <= '0';
avs_s.use_readvalid <= true;
avs_address <= avs_m.mm_address(avs_address'range);
avs_write <= avs_m.mm_write;
avs_writedata <= avs_m.mm_writedata;
avs_read <= avs_m.mm_read;
pCNT_CH_PD : process(reset_n, clk)
begin
if(reset_n = '0') then
pd_out_cnt <= 0;
elsif(clk = '1' and clk'event) then
if(ch_pd = '1') then
pd_out_cnt <= pd_out_cnt + 1;
end if;
end if;
end process pCNT_CH_PD;
-----------------------------------------------------------------------------
-- Testbench Logic
-----------------------------------------------------------------------------
pTB_CTRL : process
alias dp_dir is <<signal iUUT.dp_dir_i : std_logic>>;
procedure issue_pd(valid_pd : boolean := true) is
begin
wait until clk = '1' and clk'event;
pd_in <= '1';
wait until clk = '1' and clk'event;
pd_in <= '0';
if(valid_pd = true) then
pd_in_cnt <= pd_in_cnt + 1;
end if;
end procedure issue_pd;
procedure check_pd is
begin
for i in 1 to 12 loop
wait until clk = '1' and clk'event;
end loop; -- i
if(pd_out_cnt /= pd_in_cnt) then
if(pd_out_cnt > pd_in_cnt) then
log("ERROR: Detected faulty Channel PD.", VLOW);
else
log("ERROR: Missing Channel PD.", VLOW);
end if;
error_flag <= true;
end if;
end procedure check_pd;
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
-- Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
--set_log_verbosity(VHIGH);
-- initilialize the Avalon master-bus
mm_m_init(avs_m);
log_header("PD Jitter verification:", VLOW);
setup <= false;
running <= false;
passed <= false;
error_flag <= false;
init <= '0';
pd_in <= '0';
pd_in_cnt <= 0;
abs_position <= (others => '0');
-- Reset
reset_n <= '0';
wait for 100 ns;
wait until clk = '1' and clk'event;
reset_n <= '1';
wait for 200 ns;
-- enable the pulse generator
addr := std_logic_vector(resize(unsigned(PULSE_GEN_CTRL_REG), 32));
data := X"0000_0001";
mm_32b_write(addr, data, avs_s, avs_m);
---------------------------------------------------------------------------
-- DP-DIR = '0'
---------------------------------------------------------------------------
log("DP-DIR = '0'", VLOW);
log_separator_line(VLOW);
dp_dir <= force '0';
wait for 200 ns;
wait until clk = '1' and clk'event;
init <= '1';
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
init <= '0';
wait for 200 ns;
wait until clk = '1' and clk'event;
---------------------------------------------------------------------------
-- DIR-0, Init Pos = 0
---------------------------------------------------------------------------
log("Issueing PD on ABS_POS = 0", VLOW);
for n in 0 to 9 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
log("Go back to ABS_POS = 0", VLOW);
for n in 0 to 9 loop
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)- 1);
end loop; -- n
log("Issueing again PD on ABS_POS = 0", VLOW);
for n in 0 to 9 loop
issue_pd(false);
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
for n in 0 to 9 loop
issue_pd;
check_pd;
wait_latency(clk, 10);
abs_position <= std_logic_vector(signed(abs_position)+ 1);
end loop; -- n
wait for 1 us;
wait for 20 us;
running <= false;
passed <= true after 100 ns;
wait;
end process pTB_CTRL;
failed <= error_flag after 100 ns;
pREPORT_RESULT : process
begin
wait until failed = true or passed = true;
wait for 1 us;
log_separator_line(VLOW);
if(failed = true) then
log("FAILURE: test completed with errors.", VLOW);
elsif(passed = true) then
log("SUCCESS: test successfully completed.", VLOW);
end if;
log_separator_line(VLOW);
test_completed <= true;
end process pREPORT_RESULT;
end architecture behav;

View file

@ -0,0 +1,512 @@
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000009
0000000A
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000013
00000014
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
0000001D
0000001E
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000027
00000028
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000031
00000032
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
0000003C
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000064
00000014
00000064
00000064
00000064
00000064
00000064
00000064

View file

@ -0,0 +1,662 @@
-------------------------------------------------------------------------------
-- Title : tof_comp_tb
-- Project : Pulse-Generator
-------------------------------------------------------------------------------
-- File : tof_comp_tb.vhd
-- Author : GMG
-- Company : Global Inkjet Systems
-- Created : 2019-06-20
-- Last update: 2020-04-15
-- SVN ID : Git
-- Standard : VHDL'2008
-------------------------------------------------------------------------------
-- Description:
-- Verifies Time-of-Flight Compensation
-------------------------------------------------------------------------------
library std;
use std.textio.all;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_textio.all;
use ieee.math_real.all;
use work.log_pkg.all;
use work.avalon_verify_pkg.all;
use work.pulse_generator_3_pkg.all;
entity tof_comp_tb is
-- ..
end entity tof_comp_tb;
architecture behav of tof_comp_tb is
constant CLK_PERIOD : time := 10 ns;
-- Logging Verbosity Level
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
constant SIM_CYCLES : natural := 15;
-- DIV_RATIO: head-pitch/ encoder-global-resolution
constant DIV_RATIO : real := 1.0;
constant SAMPLING_PERIOD : natural := 1000; -- Use a sample period of 10 us
-- for the test
type cfg_data_t is array (natural range <>) of std_logic_vector(31 downto 0);
constant TOF_COMP_TABLE_LEN : natural := 512;
subtype tof_table_t is cfg_data_t(0 to TOF_COMP_TABLE_LEN-1);
constant tof_comp_file : string := "./../src/test/tof_comp/tof_table_1.cfg";
-----------------------------------------------------------------------------
-- Signal declarations
-----------------------------------------------------------------------------
signal reset_n : std_logic := '0';
signal clk : std_logic := '0';
signal init : std_logic;
signal pd_in : std_logic;
signal abs_position : std_logic_vector(31 downto 0);
signal dp_dir : std_logic;
signal fire_req : std_logic;
signal fire_req_vec : std_logic_vector(31 downto 0);
signal filtered_pd : std_logic;
signal ch_pd : std_logic;
signal ch_mask : std_logic;
signal raw_fire_req : std_logic;
signal avs_address : std_logic_vector(10 downto 0);
signal avs_write : std_logic;
signal avs_writedata : std_logic_vector(31 downto 0);
signal avs_read : std_logic;
signal avs_readdatavalid : std_logic;
signal avs_readdata : std_logic_vector(31 downto 0);
--
signal avs_m : mm_m_rec_t;
signal avs_s : mm_s_rec_t;
--
signal step_pos : std_logic;
signal step_neg : std_logic;
signal vel_meas : std_logic_vector(19 downto 0);
signal vel_sampling_per : std_logic_vector(19 downto 0);
--
signal end_of_stimuli : boolean;
signal test_completed : boolean;
signal setup : boolean;
signal running : boolean;
signal passed : boolean;
signal failed : boolean;
shared variable error_flag : boolean;
signal vel_meas_cnt : natural;
signal vel_upd_flag : std_logic;
--
signal fire_req_d : std_logic;
signal raw_fire_req_d : std_logic;
signal fire_cnt : integer;
signal raw_fire_cnt : integer;
-----------------------------------------------------------------------------
-- TB Functions / Procedures
-----------------------------------------------------------------------------
procedure wait_latency(
signal clk : in std_logic;
cycles : in natural) is
begin
for i in 1 to cycles loop
wait until clk = '1' and clk'event;
end loop; -- i
end procedure wait_latency;
procedure set_div_ratio(
div_ratio : real;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
variable ratio_int : integer;
variable ratio_slv : std_logic_vector(33 downto 0);
begin
-- set the division ratio
ratio_int := integer(div_ratio*real(2**24));
ratio_slv := std_logic_vector(to_unsigned(ratio_int, 34));
-- Set the integer part of the div-ratio
data(31 downto 10) := (others => '0');
data( 9 downto 0) := ratio_slv(33 downto 24);
addr := std_logic_vector(resize(unsigned(DIV_RATIO_INT), 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Set the fractional part of the div-ratio
data(31 downto 24) := (others => '0');
data(23 downto 0) := ratio_slv(23 downto 0);
addr := std_logic_vector(resize(unsigned(DIV_RATIO_FRAC), 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
end procedure set_div_ratio;
procedure read_cfg_file(
fname : in string;
num_data : in natural;
read_data : out cfg_data_t) is
file f_id : text;
variable status : file_open_status;
variable InLine : line;
variable word : std_logic_vector(31 downto 0);
begin
file_open(status, f_id, fname, read_mode);
if(status /= open_ok) then
log("ERROR: Failed to open file " & fname & ".", VLOW);
error_flag := true;
else
READ_LOOP: for idx in 0 to num_data-1 loop
readline(f_id, InLine);
hread(InLine, word);
read_data(idx) := word;
end loop; -- READ_LOOP
file_close(f_id);
end if;
end procedure read_cfg_file;
procedure config_tof_comp_lut(
tof_table : in tof_table_t;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
for n in 0 to TOF_COMP_TABLE_LEN-1 loop
data := tof_table(n);
addr := std_logic_vector(resize(unsigned(TOF_COMP_LUT_OFFSET)+n, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
end loop; -- n
log("ToF Compensation LUT configured.", VMEDIUM);
end procedure config_tof_comp_lut;
procedure setup_tof_comp(
enc_speed_norm : natural;
vel_sampl_win : natural := SAMPLING_PERIOD;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
addr := std_logic_vector(resize(unsigned(ENC_SPEED_MEAS_W_REG), 32));
data := std_logic_vector(to_unsigned(vel_sampl_win, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
addr := std_logic_vector(resize(unsigned(TOF_COMPENSATION_REG), 32));
data := x"0000" & std_logic_vector(to_unsigned(enc_speed_norm,16));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
end procedure setup_tof_comp;
procedure apply_pg_cfg(
div_ratio : real;
offset_dir0 : integer;
offset_dir1 : integer;
delay : integer;
dir : std_logic;
tof_enable : std_logic;
enc_speed_norm : natural;
signal mm_s_rec : in mm_s_rec_t;
signal mm_m_rec : out mm_m_rec_t) is
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
variable ratio_int : integer;
variable ratio_slv : std_logic_vector(33 downto 0);
variable tof_table : tof_table_t;
begin
log_separator_line(VMEDIUM);
log("Configuring Pulse-Generator registers ...", VMEDIUM);
log_separator_line(VMEDIUM);
log("Div-Ratio = " & to_string(div_ratio), VMEDIUM);
-- Disable/Re-enable first the whole pulse_generator
addr := std_logic_vector(resize(unsigned(PULSE_GEN_CTRL_REG), 32));
data := (others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
data := (0 => '1', 16 => '1', others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Disable the Channel Controller sequencer
addr := std_logic_vector(resize(unsigned(CH_CTRL_CTRL_REG), 32));
data := (others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Set the division ratio
set_div_ratio(div_ratio, mm_s_rec, mm_m_rec);
-- Disable/Enable the fractional divider
addr := std_logic_vector(resize(unsigned(FRAC_DIV_CTRL_REG), 32));
data := (others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
data := (0 => '1', others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Configure the rest of the pulse_generator:
-- Configure the Channel Offset (Both DIR_0 and DIR_1):
-- DIR_0
addr := std_logic_vector(resize(unsigned(CH_OFFSET_D0_REG),32));
data := std_logic_vector(to_unsigned(offset_dir0, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- DIR_1
addr := std_logic_vector(resize(unsigned(CH_OFFSET_D1_REG), 32));
data := std_logic_vector(to_unsigned(offset_dir1, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Configure the Channel Delay:
addr := std_logic_vector(resize(unsigned(CH_DELAY_REG), 32));
data := std_logic_vector(to_unsigned(delay, 32));
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
-- Read the tof configuration file
read_cfg_file(tof_comp_file, TOF_COMP_TABLE_LEN, tof_table);
-- upload the table
config_tof_comp_lut(tof_table, mm_s_rec, mm_m_rec);
-- apply tof compensation
setup_tof_comp(enc_speed_norm, SAMPLING_PERIOD, mm_s_rec, mm_m_rec);
-- enable the pulse-generator: bypass_ch_ctrl = '1',
addr := std_logic_vector(resize(unsigned(PULSE_GEN_CTRL_REG), 32));
data := (0 => '1', 1 => '1', 4 => dir, 12 => tof_enable, 16 => '1', others => '0');
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
if(tof_enable = '0') then
log("ToF Compensation Disabled.", VMEDIUM);
else
log("ToF Compensation Enabled.", VMEDIUM);
end if;
if(dir = '0') then
log("Ch-Ctrl disabled, direction = DIR-0", VMEDIUM);
else
log("Ch-Ctrl disabled, direction = DIR-1", VMEDIUM);
end if;
log_separator_line(VMEDIUM);
end procedure apply_pg_cfg;
-----------------------------------------------------------------------------
-- End declarative part
-----------------------------------------------------------------------------
begin -- architecture behav
clk <= not clk after 0.5*CLK_PERIOD;
-----------------------------------------------------------------------------
-- UUT
-----------------------------------------------------------------------------
iUUT: entity work.pulse_generator_3
generic map (
PULSE_DELAY_EQUAL_EN => true,
TOF_COMP_EN => true)
port map (
clk => clk,
reset_n => reset_n,
init => init,
pd_in => pd_in,
abs_position => abs_position,
enc_vel => vel_meas,
enc_speed_meas_w => vel_sampling_per,
dp_dir => dp_dir,
fire_req_vec => fire_req_vec,
filtered_pd => filtered_pd,
ch_pd => ch_pd,
ch_mask => ch_mask,
raw_fire_req => raw_fire_req,
avs_address => avs_address,
avs_write => avs_write,
avs_writedata => avs_writedata,
avs_read => avs_read,
avs_readdatavalid => avs_readdatavalid,
avs_readdata => avs_readdata);
fire_req <= fire_req_vec(0);
iVEL : entity work.simple_enc_vel_detect
port map (
clk => clk,
init => init,
step_pos => step_pos,
step_neg => step_neg,
sampling_period => vel_sampling_per,
vel_meas => vel_meas);
-----------------------------------------------------------------------------
-- Avalon interface
-----------------------------------------------------------------------------
clk_clk <= clk;
reset_reset_n <= reset_n;
avs_s.mm_readdata <= avs_readdata;
avs_s.mm_readdatavalid <= avs_readdatavalid;
avs_s.mm_waitrequest <= '0';
avs_s.use_readvalid <= true;
avs_address <= avs_m.mm_address(avs_address'range);
avs_write <= avs_m.mm_write;
avs_writedata <= avs_m.mm_writedata;
avs_read <= avs_m.mm_read;
-----------------------------------------------------------------------------
-- Testbench Logic
-----------------------------------------------------------------------------
pVEL_MEAS_CNT : process(clk)
alias new_meas is <<signal iVEL.sampling_pulse : std_logic>>;
begin
if(clk = '1' and clk'event) then
vel_upd_flag <= new_meas;
if(init = '1') then
vel_meas_cnt <= 0;
elsif(new_meas = '1') then
vel_meas_cnt <= vel_meas_cnt + 1;
end if;
end if;
end process pVEL_MEAS_CNT;
pSTIMULI : process
-- increments the abs pos every period clock cycles, first the specified
-- number of positive steps, then negative steps, then repeat until the
-- timing window is finished
procedure gen_abs_pos(
pos_inc_num : in natural;
neg_inc_num : in natural;
period : in natural;
signal step_pos : out std_logic;
signal step_neg : out std_logic;
signal abs_position : out std_logic_vector(31 downto 0)) is
variable curr_vel_cnt : natural := vel_meas_cnt;
variable pos_cnt : natural;
variable neg_cnt : natural;
variable go_on : boolean;
begin
wait until clk = '1' and clk'event;
pos_cnt := 0;
neg_cnt := 0;
go_on := true;
while go_on = true loop
-- generate first positive steps
if(pos_cnt < pos_inc_num) then
abs_position <= std_logic_vector(signed(abs_position)+1);
step_pos <= '1';
pos_cnt := pos_cnt+1;
wait until clk = '1' and clk'event;
step_pos <= '0';
wait_latency(clk, period-1);
end if;
-- then generate negative steps
if(neg_cnt < neg_inc_num) then
abs_position <= std_logic_vector(signed(abs_position)-1);
step_neg <= '1';
neg_cnt := neg_cnt+1;
wait until clk = '1' and clk'event;
step_neg <= '0';
wait_latency(clk, period-1);
end if;
if(curr_vel_cnt /= vel_meas_cnt) then
go_on := false;
else
if(pos_cnt >= pos_inc_num and neg_cnt >= neg_inc_num)then
wait_latency(clk, period);
end if;
end if;
end loop;
end procedure gen_abs_pos;
begin
end_of_stimuli <= false;
--
pd_in <= '0';
abs_position <= (others => '0');
step_pos <= '0';
step_neg <= '0';
-- wait until init is deasserted
wait until falling_edge(init);
gen_abs_pos(
pos_inc_num => 50, neg_inc_num => 0, period => 10,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
gen_abs_pos(
pos_inc_num => 40, neg_inc_num => 0, period => 10,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
gen_abs_pos(
pos_inc_num => 30, neg_inc_num => 0, period => 10,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
gen_abs_pos(
pos_inc_num => 20, neg_inc_num => 0, period => 10,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
gen_abs_pos(
pos_inc_num => 10, neg_inc_num => 0, period => 10,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
gen_abs_pos(
pos_inc_num => 0, neg_inc_num => 10, period => 10,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
gen_abs_pos(
pos_inc_num => 0, neg_inc_num => 20, period => 10,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
gen_abs_pos(
pos_inc_num => 50, neg_inc_num => 5, period => 10,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
gen_abs_pos(
pos_inc_num => 50, neg_inc_num => 15, period => 10,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
gen_abs_pos(
pos_inc_num => 500, neg_inc_num => 0, period => 10,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
gen_abs_pos(
pos_inc_num => 150, neg_inc_num => 0, period => 6,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
gen_abs_pos(
pos_inc_num => 100, neg_inc_num => 0, period => 40,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
gen_abs_pos(
pos_inc_num => 100, neg_inc_num => 0, period => 40,
step_pos => step_pos, step_neg => step_neg, abs_position => abs_position);
wait for 200 us;
-- completed
end_of_stimuli <= true;
wait;
end process pSTIMULI;
-----------------------------------------------------------------------------
-- Check the output
-----------------------------------------------------------------------------
pOUT_CNT : process(clk)
begin
if(clk = '1' and clk'event) then
fire_req_d <= fire_req;
raw_fire_req_d <= raw_fire_req;
if(init = '1') then
fire_cnt <= 0;
elsif(fire_req = '1' and fire_req = '0') then
fire_cnt <= fire_cnt+1;
end if;
if(init = '1') then
raw_fire_cnt <= 0;
elsif(raw_fire_req = '1' and raw_fire_req_d = '0') then
raw_fire_cnt <= raw_fire_cnt+1;
end if;
end if;
end process pOUT_CNT;
-----------------------------------------------------------------------------
-- Testbench Main
-----------------------------------------------------------------------------
pTB_CTRL : process
variable addr : std_logic_vector(31 downto 0) := (others => '0');
variable data : std_logic_vector(31 downto 0) := (others => '0');
begin
-- Set the verbosity level for logging
set_log_verbosity(VERBOSITY_LEVEL);
--set_log_verbosity(VHIGH);
-- initilialize the Avalon master-bus
mm_m_init(avs_m);
log_header("Time-of-Flight Compensation verification:", VLOW);
setup <= false;
running <= false;
passed <= false;
error_flag := false;
init <= '0';
-- Reset
reset_n <= '0';
wait for 100 ns;
wait until clk = '1' and clk'event;
reset_n <= '1';
---------------------------------------------------------------------------
-- Pulse-Generator Configuration
---------------------------------------------------------------------------
wait for 200 ns;
apply_pg_cfg(
div_ratio => DIV_RATIO,
offset_dir0 => 0,
offset_dir1 => 0,
delay => 100,
dir => '0',
tof_enable => '1',
enc_speed_norm => 256,
mm_s_rec => avs_s, mm_m_rec => avs_m);
---------------------------------------------------------------------------
-- Movement Simulation
---------------------------------------------------------------------------
wait for 200 ns;
wait until clk = '1' and clk'event;
init <= '1';
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
wait until clk = '1' and clk'event;
init <= '0';
wait for 200 ns;
running <= true;
wait until clk = '1' and clk'event;
wait until (end_of_stimuli = true) or (vel_meas_cnt = SIM_CYCLES + 1);
running <= false;
if(fire_cnt /= raw_fire_cnt) then
log("Error: Fire-Cnt = " & to_string(fire_cnt) & ". Raw-Pulse-Cnt = " & to_string(raw_fire_cnt), VLOW);
error_flag := true;
else
log("Completed: Generated " & to_string(fire_cnt) & " fire-requests", VLOW);
end if;
--
passed <= true after 100 ns;
wait;
end process pTB_CTRL;
failed <= error_flag after 100 ns;
pREPORT_RESULT : process
begin
wait until failed = true or passed = true;
wait for 1 us;
log_separator_line(VLOW);
if(failed = true) then
log("FAILURE: test completed with errors.", VLOW);
elsif(passed = true) then
log("SUCCESS: test successfully completed.", VLOW);
end if;
log_separator_line(VLOW);
test_completed <= true;
end process pREPORT_RESULT;
end architecture behav;

View file

@ -0,0 +1,158 @@
%%/////////////////////////////////////////////////////////////////////////////
%% Title : wh_wheel_corr
%%/////////////////////////////////////////////////////////////////////////////
%% File : wh_wheel_corr.m
%% Author : Gianmarco Girau
%% Company : GIS
%% Target : GIS-HMB board
%% Dependency : none
%%/////////////////////////////////////////////////////////////////////////////
%% Description: Verify the stability of loop corrections for W&H
%%/////////////////////////////////////////////////////////////////////////////
%% Last update: 2019-06-07
%%/////////////////////////////////////////////////////////////////////////////
%% Revisions :
%% Date Version Author Description
%% 2016-09-16 01.00.0a gmg Created
%%/////////////////////////////////////////////////////////////////////////////
close all
clear all
clc
%head_pitch_um = 20.0
head_pitch_um = 4.23*5.0
encoder_res_um = 5.0
image_pixel_lenght = 100
div_ratio_nom = head_pitch_um/encoder_res_um
wheel_circum = image_pixel_lenght*div_ratio_nom
total_rotations = 100;
% Define a error vector for wheel rotations
wheel_error_v = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, ...
2, 2, 3, 3, 4, 4, 5, 5, 4, 4, ...
3, 3, 2, 2, 1, 1, 0, 0, -1, -1, ...
-2, -2, -3, -3, -4, -4, -5, -5, -4, -4, ...
-3, -3, -2, -2, -1, -1, 0, 0, 0, 0, ...
0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 1, 1, ...
1, 1, 0, 0, -1, -1, -1, -1, 0, 0, -40, 0, 0, +80];
N = total_rotations - length(wheel_error_v)
wheel_error_v = [wheel_error_v 40*ones(1,N)];
wheel_error_v = zeros(1,total_rotations);
%wheel_error_v(10) = 40
wheel_error_v(10:end) = 40;
%{
% Continuously changing
error_rel_max = 0.1
x = 0:total_rotations-1;
wheel_error_v = (0.1*wheel_circum)*sin(2*pi*x/total_rotations);
%}
%{
% Change and poause
error_rel_max = 0.1
x = 0:total_rotations-1;
%k = 5.0;
k = 10;
x = floor(x/k);
wheel_error_v = (0.1*wheel_circum)*sin(2*pi*x/(total_rotations/k));
%}
% Continuously changing
%{
error_rel_max = 0.1
x = 0:total_rotations-1;
wheel_error_v = (0.1*wheel_circum)*sin(2*pi*x/total_rotations);
%}
pd_pos(1) = 0;
tot_pixels(1) = 0;
end_image(1) = 0;
pos_error(1) = 0;
div_ratio(1) = div_ratio_nom;
for n = 1:total_rotations
delta_dist = wheel_circum + wheel_error_v(n);
pd_pos(n+1) = pd_pos(n)+ delta_dist;
tot_pixels(n+1) = tot_pixels(n)+ delta_dist/div_ratio(n);
end_image(n+1) = end_image(n)+div_ratio(n)*image_pixel_lenght;
pos_error(n+1) = pd_pos(n+1)-end_image(n+1);
% No Correction
%div_ratio(n+1) = div_ratio_nom;
% Basic Correction: FLL
%div_ratio(n+1) = div_ratio_nom+pos_error(n+1)/image_pixel_lenght;
% Correction Accumulation:
%div_ratio(n+1) = div_ratio(n)+pos_error(n+1)/image_pixel_lenght;
% PLL Correction:
delta_error = pos_error(n+1)-pos_error(n);
tot_error = pos_error(n+1);
% 1
%alpha = 1.0;
%beta = 0.05;
% 2
%alpha = 1.0;
%beta = 0.5;
% 3
alpha = 1.0;
beta = 1.0;
div_ratio(n+1) = div_ratio(n)+(alpha*delta_error+beta*tot_error)/image_pixel_lenght;
end
figure(1);
plot(wheel_error_v, 'r*')
grid on;
title('Wheel Errors')
%{
figure(2);
plot(pd_pos, 'b');
grid on;
title('PD position')
figure(3);
plot(tot_pixels, 'b');
grid on;
title('Total Pixels')
figure(4);
plot(end_image, 'b^');
grid on;
title('End Image')
%}
figure(5);
plot(div_ratio, 'k^');
grid on;
title('Division Ratio')
figure(6);
plot(pos_error, 'b^');
grid on;
title('Position Error')
pd_pos(end)
tot_pixels(end)
effective_ratio = pd_pos(end)/tot_pixels(end)

View file

@ -2,4 +2,6 @@ Pulse-Generator major versions:
- 1: Original, now depracated cause it doers not include a bug fix on the Queue&Delay block
- 2: Include Pixel-Pitch Correction, Time-of-Flight Compensation, Q&D block bug fix
- 2: Include Pixel-Pitch Correction, Time-of-Flight Compensation, Q&D block bug fix
- 3: Generate multiple subpixel offsets. Removed legacy code like output pulse conditioning and overdrive detection.