WH-18 - Time-of-Flight Compensation initial commit - WIP
This commit is contained in:
parent
c156dd3121
commit
767e0e57c1
13 changed files with 1759 additions and 64 deletions
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-09-06
|
||||
-- Last update: 2019-06-06
|
||||
-- Last update: 2019-06-20
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -295,7 +295,7 @@ begin
|
|||
ch_mask => ch_mask,
|
||||
raw_pulse_out => ch_raw_pulse,
|
||||
enc_pulse => open,
|
||||
avs_address => cs_addr(9 downto 0),
|
||||
avs_address => cs_addr(10 downto 0),
|
||||
avs_write => cs_pg_write_en,
|
||||
avs_writedata => cs_write_data,
|
||||
avs_read => cs_pg_read_en,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : simple encoder velocity detection
|
||||
-- Project : project independent
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : simple_enc_vel_detect_0.vhd
|
||||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2019-06-18
|
||||
-- Last update: 2019-07-01
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- This block detects encoder velocity by measuring the balance of encoder
|
||||
-- positive and negative steps over consecutive sampling periods.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity simple_enc_vel_detect is
|
||||
generic(SAMPLING_PERIOD : natural range 0 to 16383 := 10000); -- 10000 => 10 us @100MHz clock
|
||||
port (
|
||||
clk : in std_logic; -- Must be 100 MHz
|
||||
init : in std_logic;
|
||||
step_pos : in std_logic;
|
||||
step_neg : in std_logic;
|
||||
vel_meas : out std_logic_vector(14 downto 0));
|
||||
|
||||
end simple_enc_vel_detect;
|
||||
|
||||
architecture RTL of simple_enc_vel_detect is
|
||||
|
||||
signal init_i, sampling_pulse : std_logic;
|
||||
|
||||
signal sampling_per_cnt : std_logic_vector(13 downto 0);
|
||||
signal vel_meas_i : std_logic_vector(14 downto 0);
|
||||
signal vel_meas_sat_pos : std_logic_vector(14 downto 0);
|
||||
signal vel_meas_sat_neg : std_logic_vector(14 downto 0);
|
||||
|
||||
begin -- RTL
|
||||
|
||||
pVEL_DETECT : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
init_i <= init;
|
||||
if(init_i = '1' or sampling_pulse = '1') then
|
||||
sampling_per_cnt <= (others => '0');
|
||||
else
|
||||
sampling_per_cnt <= std_logic_vector(unsigned(sampling_per_cnt)+1);
|
||||
end if;
|
||||
if(init_i = '1' or sampling_pulse = '1') then
|
||||
vel_meas_i <= (others => '0');
|
||||
elsif(step_pos = '1' and signed(vel_meas_i) < signed(vel_meas_sat_pos)) then
|
||||
vel_meas_i <= std_logic_vector(signed(vel_meas_i)+1);
|
||||
elsif(step_neg = '1' and signed(vel_meas_i) > signed(vel_meas_sat_neg)) then
|
||||
vel_meas_i <= std_logic_vector(signed(vel_meas_i)-1);
|
||||
end if;
|
||||
if(init_i = '1') then
|
||||
vel_meas <= (others => '0');
|
||||
elsif(sampling_pulse = '1') then
|
||||
vel_meas <= vel_meas_i;
|
||||
end if;
|
||||
end if;
|
||||
end process pVEL_DETECT;
|
||||
|
||||
sampling_pulse <= '1' when unsigned(sampling_per_cnt) = SAMPLING_PERIOD-1 else '0';
|
||||
|
||||
-- define positive and negative saturation thresholds
|
||||
vel_meas_sat_pos <= (vel_meas_i'left => '0', others => '1');
|
||||
vel_meas_sat_neg <= (vel_meas_i'left => '1', others => '0');
|
||||
|
||||
end RTL;
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
"ip_name": "pulse_generator_2",
|
||||
"bus": "csr",
|
||||
"description": "Generate Fire-Requests, based on the absolute position and PD inputs - W&H specific variant",
|
||||
"addr_hi_bit" : "9",
|
||||
"addr_hi_bit" : "10",
|
||||
"addr_lo_bit" : "5",
|
||||
"sub_blocks": {
|
||||
"local": {
|
||||
|
|
@ -191,7 +191,7 @@
|
|||
"type": "w",
|
||||
"address": "5",
|
||||
"reset": "0x00",
|
||||
"width": "32",
|
||||
"width": "16",
|
||||
"description": "Channel Delay (Delay Equalization)"
|
||||
},
|
||||
"channel_controller_control": {
|
||||
|
|
@ -367,17 +367,66 @@
|
|||
"width": "32",
|
||||
"description": "Fire-Request counter"
|
||||
},
|
||||
"wh_pos_err_2_corr": {
|
||||
"type": "w",
|
||||
"tof_comp_ctrl": {
|
||||
"address": "20",
|
||||
"reset": "0x00",
|
||||
"width": "32",
|
||||
"description": "Static value used by the logic to compute W&H wheel correction: need to be set to the number of 2^32/pixel_num, where pixel_num is the number of stripes programmed in the Pulse-Generator for a Print-Operation corresponding to a full wheel rotation"
|
||||
"description": "Time-of-Flight Compensation Control",
|
||||
"fields": {
|
||||
"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."
|
||||
},
|
||||
"reserved0": {
|
||||
"type": "rsv",
|
||||
"bit_len": "14",
|
||||
"description": ""
|
||||
},
|
||||
"enc_speed_norm": {
|
||||
"type": "w",
|
||||
"bit_len": "16",
|
||||
"reset": "0x100",
|
||||
"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)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"wh_loop_filter_corr": {
|
||||
"tof_comp_status": {
|
||||
"address": "21",
|
||||
"width": "32",
|
||||
"description": "Loop filter coefficient for W&H wheel correction",
|
||||
"description": "Time-of-Flight Compensation Status",
|
||||
"fields": {
|
||||
"enc_vel": {
|
||||
"type": "r",
|
||||
"bit_len": "16",
|
||||
"reset": "0x0",
|
||||
"description": "Encoder Velocity: balance between positive and negative encoder steps over a sampling window of 100 us"
|
||||
},
|
||||
"tof_lut_comp": {
|
||||
"type": "r",
|
||||
"bit_len": "16",
|
||||
"reset": "0x0",
|
||||
"description": "Current value of the Time-of-Flight compensation"
|
||||
}
|
||||
}
|
||||
},
|
||||
"pixel_pitch_pos_err_2_corr": {
|
||||
"type": "w",
|
||||
"address": "22",
|
||||
"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/pixel_num, where pixel_num is the number of stripes programmed in the Pulse-Generator for a Print-Operation corresponding to a full wheel rotation"
|
||||
},
|
||||
"pixel_pitch_loop_filter_corr": {
|
||||
"address": "23",
|
||||
"width": "32",
|
||||
"description": "Loop filter coefficient for pixel-pitch correction",
|
||||
"fields": {
|
||||
"delta_error_coeff": {
|
||||
"type": "w",
|
||||
|
|
@ -393,33 +442,33 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"wh_pos_err_curr": {
|
||||
"type": "r",
|
||||
"address": "22",
|
||||
"reset": "0x00",
|
||||
"width": "24",
|
||||
"description": "W&H wheel misalignment measured on the last rotation [encoder steps], represented as signed, fixed point with 16-bits integer part and 8-bits mantissa"
|
||||
},
|
||||
"wh_pos_err_max": {
|
||||
"type": "r",
|
||||
"address": "23",
|
||||
"reset": "0x00",
|
||||
"width": "24",
|
||||
"description": "Maximum recorded value of W&H wheel misalignment [encoder steps], represented as signed, fixed point with 16-bits integer part and 8-bits mantissa"
|
||||
},
|
||||
"wh_div_ratio_corr": {
|
||||
"pixel_pitch_pos_err_curr": {
|
||||
"type": "r",
|
||||
"address": "24",
|
||||
"reset": "0x00",
|
||||
"width": "24",
|
||||
"description": "Pixel-pitch misalignment measured on the last rotation [encoder steps], represented as signed, fixed point with 16-bits integer part and 8-bits mantissa"
|
||||
},
|
||||
"pixel_pitch_pos_err_max": {
|
||||
"type": "r",
|
||||
"address": "25",
|
||||
"reset": "0x00",
|
||||
"width": "24",
|
||||
"description": "Maximum recorded value of pixel-pitch misalignment [encoder steps], represented as signed, fixed point with 16-bits integer part and 8-bits mantissa"
|
||||
},
|
||||
"pixel_pitch_div_ratio_corr": {
|
||||
"type": "r",
|
||||
"address": "26",
|
||||
"reset": "0x00",
|
||||
"width": "32",
|
||||
"description": "Division-Ratio Correction (32-LSBs)"
|
||||
},
|
||||
"wh_rotation_cnt": {
|
||||
"pixel_pitch_corr_cnt": {
|
||||
"type": "r",
|
||||
"address": "25",
|
||||
"address": "27",
|
||||
"reset": "0x00",
|
||||
"width": "16",
|
||||
"description": "Rotation Count"
|
||||
"description": "Pixel-pitch corrections count"
|
||||
},
|
||||
"channel_controller_seq": {
|
||||
"type": "w",
|
||||
|
|
@ -427,6 +476,13 @@
|
|||
"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"
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
|
@ -37,6 +37,7 @@ if {$COMP_ONLY == 0} {
|
|||
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 $SRC_PATH/pulse_conditioning_2.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/altera/generic_seq_ram_15.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_15_pkg.vhd
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ if {$COMP_ONLY == 0} {
|
|||
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 $SRC_PATH/pulse_conditioning_2.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/altera/generic_seq_ram_15.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_15_pkg.vhd
|
||||
|
|
|
|||
83
generic_ip/pulse_generator/2/sim/sim_tof_comp.do
Normal file
83
generic_ip/pulse_generator/2/sim/sim_tof_comp.do
Normal 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/15
|
||||
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
|
||||
vcom -2008 -work $WORKLIB $FPM_PATH/simple_enc_vel_detect.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_conditioning_2.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/altera/generic_seq_ram_15.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_15_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $SEQUENCER_PATH/src/generic_sequencer_15.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/simple_frac_div_2.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_2_pkg.vhd
|
||||
vcom -2008 -work $WORKLIB $SRC_PATH/pulse_generator_2.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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
257
generic_ip/pulse_generator/2/sim/wave_tof_comp.do
Normal file
257
generic_ip/pulse_generator/2/sim/wave_tof_comp.do
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
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/pulse_out
|
||||
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_pulse_out
|
||||
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 /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/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/pulse_out
|
||||
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_pulse_out
|
||||
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/pulse_out_i
|
||||
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_mask_d
|
||||
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/pulse_out_ii
|
||||
add wave -noupdate /tof_comp_tb/iUUT/loc_pulse_out_d
|
||||
add wave -noupdate /tof_comp_tb/iUUT/loc_pulse
|
||||
add wave -noupdate /tof_comp_tb/iUUT/first_pulse
|
||||
add wave -noupdate /tof_comp_tb/iUUT/dp_dir_d
|
||||
add wave -noupdate /tof_comp_tb/iUUT/overdrive_rst
|
||||
add wave -noupdate /tof_comp_tb/iUUT/overdrv_event
|
||||
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/fire_req_d
|
||||
add wave -noupdate /tof_comp_tb/iUUT/fire_req_p
|
||||
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/bypass_pulse_cond
|
||||
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/ch_mask_fe
|
||||
add wave -noupdate /tof_comp_tb/iUUT/first_po_started
|
||||
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/pulse_width
|
||||
add wave -noupdate /tof_comp_tb/iUUT/pulse_width_ext
|
||||
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/overdrive_events
|
||||
add wave -noupdate /tof_comp_tb/iUUT/overdrive_thres
|
||||
add wave -noupdate /tof_comp_tb/iUUT/pulse_interval
|
||||
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/wh_pos_err_abs
|
||||
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/pd_in_cnt
|
||||
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_offset
|
||||
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
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {2606443 ps} 0} {{Cursor 2} {115074585 ps} 0}
|
||||
quietly wave cursor active 1
|
||||
configure wave -namecolwidth 283
|
||||
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} {240909824 ps}
|
||||
|
|
@ -6,14 +6,15 @@
|
|||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-10-24
|
||||
-- Last update: 2019-06-11
|
||||
-- Last update: 2019-07-02
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'93
|
||||
-------------------------------------------------------------------------------
|
||||
-- Description:
|
||||
-- The Pulse Generator implements the following functionalities:
|
||||
-- PD queue, with channel specific offset (positional)
|
||||
-- Pulse Scaling (Fractional Divider)
|
||||
-- Fire-Request-Generation (Fractional Divider)
|
||||
-- Spitting Functionality
|
||||
-- Delay Equalization: compensate for the difference in the channel latency
|
||||
-- when daisy-chaining multiple EMBs.
|
||||
-- Pulse-Width conditioning, for transmission over the POF (to be moved out
|
||||
|
|
@ -36,7 +37,8 @@ entity pulse_generator_2 is
|
|||
PULSE_DELAY_EQUAL_EN : boolean := true;
|
||||
OUT_PULSE_CONDITION : boolean := true;
|
||||
OVERDRIVE_CHECK : boolean := true;
|
||||
DIAG_COUNTERS : boolean := true);
|
||||
DIAG_COUNTERS : boolean := true;
|
||||
TOF_COMP_EN : boolean := true);
|
||||
port(
|
||||
clk : in std_logic;
|
||||
reset_n : in std_logic := '1';
|
||||
|
|
@ -45,6 +47,7 @@ entity pulse_generator_2 is
|
|||
-- Sequencer I/Os
|
||||
pd_in : in std_logic;
|
||||
abs_position : in std_logic_vector(31 downto 0);
|
||||
enc_vel : in std_logic_vector(14 downto 0) := (others => '0');
|
||||
dp_dir : out std_logic;
|
||||
pulse_out : out std_logic;
|
||||
-- diagnostic outputs
|
||||
|
|
@ -56,7 +59,7 @@ entity pulse_generator_2 is
|
|||
-----------------------------------------------------------------------
|
||||
-- Avalon MM Interface
|
||||
-----------------------------------------------------------------------
|
||||
avs_address : in std_logic_vector( 9 downto 0);
|
||||
avs_address : in std_logic_vector(10 downto 0);
|
||||
avs_write : in std_logic;
|
||||
avs_writedata : in std_logic_vector(31 downto 0);
|
||||
avs_read : in std_logic;
|
||||
|
|
@ -69,7 +72,7 @@ architecture rtl of pulse_generator_2 is
|
|||
-- constants
|
||||
|
||||
constant CSR_IP_ID : std_logic_vector(31 downto 0) := x"0000FF13";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000200";
|
||||
constant CSR_IP_VER : std_logic_vector(31 downto 0) := x"00000201";
|
||||
|
||||
|
||||
signal init_de, init_qd, enable, loc_pd, pd_queue_error : std_logic;
|
||||
|
|
@ -99,6 +102,8 @@ architecture rtl of pulse_generator_2 is
|
|||
signal wh_apply_corr_en, wh_error_meas_avail, wh_corr_ready : std_logic;
|
||||
signal wh_error_meas_started, init_wh, loc_pd_d : std_logic;
|
||||
signal wh_meas_event, ch_mask_fe, first_po_started : std_logic;
|
||||
signal tof_lut_wr_en, tof_comp_enable : std_logic;
|
||||
signal tof_saturation, tof_sat_flag : std_logic;
|
||||
--
|
||||
signal abs_pos_msb_old : std_logic_vector( 1 downto 0);
|
||||
signal ch_ctrl_csr_addr, ch_ctrl_trigger_in : std_logic_vector( 3 downto 0);
|
||||
|
|
@ -107,17 +112,24 @@ architecture rtl of pulse_generator_2 is
|
|||
signal pulse_width, pulse_width_ext, init_v : std_logic_vector( 7 downto 0);
|
||||
signal ch_ctrl_start_addr : std_logic_vector( 7 downto 0);
|
||||
signal ch_ctrl_address : std_logic_vector( 7 downto 0);
|
||||
signal avs_address_i : std_logic_vector( 9 downto 0);
|
||||
signal tof_lut_wr_addr, tof_lut_addr : std_logic_vector( 8 downto 0);
|
||||
signal avs_address_i : std_logic_vector(10 downto 0);
|
||||
signal enc_vel_i : std_logic_vector(14 downto 0);
|
||||
signal wh_rotat_cnt : std_logic_vector(15 downto 0);
|
||||
signal overdrive_events, overdrive_thres : std_logic_vector(15 downto 0);
|
||||
signal pulse_interval, basic_pos_error : std_logic_vector(15 downto 0);
|
||||
signal wh_loop_filt_tot, wh_loop_filt_delta : std_logic_vector(15 downto 0);
|
||||
signal ch_delay, ch_delay_i : std_logic_vector(15 downto 0);
|
||||
signal enc_speed_norm_coeff, tof_lut_wr_data : std_logic_vector(15 downto 0);
|
||||
signal tof_lut_wr_q, tof_lut_comp : std_logic_vector(15 downto 0);
|
||||
signal tof_lut_comp_i : std_logic_vector(15 downto 0);
|
||||
signal img_size, pixel_cnt : std_logic_vector(23 downto 0);
|
||||
signal ch_ctrl_vector_out : std_logic_vector(23 downto 0);
|
||||
signal wh_pos_err, wh_pos_err_max : std_logic_vector(23 downto 0);
|
||||
signal wh_pos_err_old, wh_tot_err, wh_delta_err : std_logic_vector(23 downto 0);
|
||||
signal wh_pos_err_abs : std_logic_vector(23 downto 0);
|
||||
signal ch_offset, ch_delay, avs_readdata_i : std_logic_vector(31 downto 0);
|
||||
signal norm_enc_vel : std_logic_vector(30 downto 0);
|
||||
signal ch_offset, avs_readdata_i : std_logic_vector(31 downto 0);
|
||||
signal ch_ctrl_writedata, ch_ctrl_readdata : std_logic_vector(31 downto 0);
|
||||
signal ch_ctrl_csr_writedata : std_logic_vector(31 downto 0);
|
||||
signal ch_ctrl_csr_readdata : std_logic_vector(31 downto 0);
|
||||
|
|
@ -350,14 +362,6 @@ begin
|
|||
|
||||
start_img <= start_img_req and not start_img_req_d;
|
||||
img_completed <= '1' when fire_enable = '1' and unsigned(pixel_cnt) = unsigned(img_size) else '0';
|
||||
|
||||
-- DO NOT REMOVE: USED BY THE TESTBENCH!
|
||||
p_ch_mask_d : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
ch_mask_d <= ch_mask_i;
|
||||
end if;
|
||||
end process p_ch_mask_d;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Fractional Divider
|
||||
|
|
@ -407,6 +411,7 @@ begin
|
|||
if(clk = '1' and clk'event) then
|
||||
-- latch the absolute-position to prevent excessive degradation of timing
|
||||
abs_pos_d <= abs_position;
|
||||
ch_mask_d <= ch_mask_i;
|
||||
ch_mask_fe <= not ch_mask_i and ch_mask_d;
|
||||
loc_pd_d <= loc_pd;
|
||||
init_wh <= init or (not enable) or (not wh_apply_corr_en);
|
||||
|
|
@ -529,7 +534,7 @@ begin
|
|||
clk => clk,
|
||||
init => init_de,
|
||||
cnt_dir => '0',
|
||||
delay => ch_delay,
|
||||
delay => (X"0000" & ch_delay_i),
|
||||
ext_time => (others => '0'),
|
||||
wave_in => gated_pulse,
|
||||
wave_out => retimed_pulse,
|
||||
|
|
@ -604,6 +609,68 @@ begin
|
|||
overdrv_event <= '0';
|
||||
|
||||
end generate gNOT_ODRV_CHK;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Time-of-Flight Compensation
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
gTOF_COMP_GEN: if TOF_COMP_EN = true and PULSE_DELAY_EQUAL_EN = true generate
|
||||
|
||||
pTOF_COMP : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
-- if the encoder speed is negative, do a 1's complement (no need to
|
||||
-- waste resources with the 2's complement).
|
||||
-- Note: you don't really care to know whether the encoder speed
|
||||
-- matches the direction used for generating fire-request, because
|
||||
-- fire-request are not generated in the wrong direction
|
||||
if(enc_vel(enc_vel'left) = '1') then
|
||||
enc_vel_i <= not enc_vel;
|
||||
else
|
||||
enc_vel_i <= enc_vel;
|
||||
end if;
|
||||
if(tof_saturation = '1') then
|
||||
tof_lut_addr <= (others => '1');
|
||||
else
|
||||
tof_lut_addr <= norm_enc_vel(norm_enc_vel'left-14 downto (norm_enc_vel'left-14-tof_lut_addr'left));
|
||||
end if;
|
||||
if(init or (not enable) or (not tof_comp_enable)) then
|
||||
tof_sat_flag <= '0';
|
||||
elsif(tof_saturation = '1') then
|
||||
tof_sat_flag <= '1';
|
||||
end if;
|
||||
ch_delay_i <= std_logic_vector(unsigned(ch_delay)+unsigned(tof_lut_comp));
|
||||
end if;
|
||||
end process pTOF_COMP;
|
||||
|
||||
norm_enc_vel <= std_logic_vector(unsigned(enc_vel_i)*unsigned(enc_speed_norm_coeff));
|
||||
|
||||
tof_saturation <= '1' when unsigned(norm_enc_vel(norm_enc_vel'left downto norm_enc_vel'left-13)) /= 0 else '0';
|
||||
|
||||
tof_lut_comp_i <= tof_lut_comp when tof_comp_enable = '1' else (others => '0');
|
||||
|
||||
iTOF_COMP_LUT : entity work.dpram_sclk
|
||||
generic map (
|
||||
WIDTH => TOF_COMP_LUT_WIDTH,
|
||||
DEPTH => TOF_COMP_LUT_DEPTH)
|
||||
port map (
|
||||
clk => clk,
|
||||
addr_a => tof_lut_wr_addr,
|
||||
we_a => tof_lut_wr_en,
|
||||
data_a => tof_lut_wr_data,
|
||||
q_a => tof_lut_wr_q,
|
||||
addr_b => tof_lut_addr,
|
||||
we_b => '0',
|
||||
data_b => (others => '0'),
|
||||
q_b => tof_lut_comp);
|
||||
|
||||
end generate gTOF_COMP_GEN;
|
||||
|
||||
gTOF_COMP_NOGEN: if TOF_COMP_EN = false or PULSE_DELAY_EQUAL_EN = false generate
|
||||
|
||||
ch_delay_i <= ch_delay;
|
||||
|
||||
end generate gTOF_COMP_NOGEN;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Pulse Width Conditioning
|
||||
|
|
@ -676,21 +743,25 @@ begin
|
|||
-- Relative addresses between 0 and 511 => C&S regs
|
||||
-- Relative addresses between 512 and 1023 => Sequencer RAM
|
||||
|
||||
avs_write_i <= '1' when avs_write = '1' and avs_address(9) = '0' else '0';
|
||||
ch_ctrl_write <= '1' when avs_write = '1' and avs_address(9) = '1' else '0';
|
||||
ch_ctrl_csr_write <= '1' when avs_write = '1' and avs_address(9 downto 5) = "00001" else '0';
|
||||
avs_write_i <= '1' when avs_write = '1' and avs_address(10 downto 9) = "00" else '0';
|
||||
ch_ctrl_write <= '1' when avs_write = '1' and avs_address(10 downto 9) = "01" else '0';
|
||||
ch_ctrl_csr_write <= '1' when avs_write = '1' and avs_address(10 downto 5) = "000001" else '0';
|
||||
tof_lut_wr_en <= '1' when avs_write = '1' and avs_address(10 downto 9) = "10" else '0';
|
||||
|
||||
avs_read_i <= '1' when avs_read = '1' and avs_address(9) = '0' else '0';
|
||||
ch_ctrl_read <= '1' when avs_read = '1' and avs_address(9) = '1' else '0';
|
||||
ch_ctrl_csr_read <= '1' when avs_read = '1' and avs_address(9 downto 5) = "00001" else '0';
|
||||
avs_read_i <= '1' when avs_read = '1' and avs_address(10 downto 9) = "00" else '0';
|
||||
ch_ctrl_read <= '1' when avs_read = '1' and avs_address(10 downto 9) = "01" else '0';
|
||||
ch_ctrl_csr_read <= '1' when avs_read = '1' and avs_address(10 downto 5) = "000001" else '0';
|
||||
|
||||
avs_addr <= avs_address(4 downto 0);
|
||||
|
||||
ch_ctrl_address <= avs_address(ch_ctrl_address'range);
|
||||
ch_ctrl_csr_addr <= avs_address(ch_ctrl_csr_addr'range);
|
||||
tof_lut_wr_addr <= avs_address(tof_lut_wr_addr'range);
|
||||
|
||||
ch_ctrl_writedata <= avs_writedata;
|
||||
ch_ctrl_csr_writedata <= avs_writedata;
|
||||
tof_lut_wr_data <= avs_writedata(tof_lut_wr_data'range);
|
||||
|
||||
|
||||
pINIT : process(clk)
|
||||
begin
|
||||
|
|
@ -740,6 +811,9 @@ begin
|
|||
div_offset <= (others => '0');
|
||||
div_ratio <= (others => '0');
|
||||
--
|
||||
tof_comp_enable <= '0';
|
||||
enc_speed_norm_coeff <= std_logic_vector(to_unsigned(256,16));
|
||||
--
|
||||
wh_apply_corr_en <= '0';
|
||||
wh_pos_err_2_corr <= (others => '0');
|
||||
wh_loop_filt_delta <= std_logic_vector(to_signed(256, 16));
|
||||
|
|
@ -761,7 +835,7 @@ begin
|
|||
when CH_OFFSET_D0_REG =>
|
||||
ch_offset_dir0 <= avs_writedata;
|
||||
when CH_DELAY_REG =>
|
||||
ch_delay <= avs_writedata;
|
||||
ch_delay <= avs_writedata(15 downto 0);
|
||||
when CH_CTRL_CTRL_REG =>
|
||||
ch_ctrl_start_req_ii <= avs_writedata(0);
|
||||
ch_ctrl_start_addr <= avs_writedata(15 downto 8);
|
||||
|
|
@ -785,6 +859,9 @@ begin
|
|||
div_offset(33 downto 24) <= avs_writedata( 9 downto 0);
|
||||
when SP_OFFSET_FRAC =>
|
||||
div_offset(23 downto 0) <= avs_writedata(23 downto 0);
|
||||
when TOF_COMP_CTRL_REG =>
|
||||
tof_comp_enable <= avs_writedata(0);
|
||||
enc_speed_norm_coeff <= avs_writedata(31 downto 16);
|
||||
when WH_POS_ERR_2_CORR_REG =>
|
||||
wh_pos_err_2_corr <= avs_writedata;
|
||||
when WH_LOOP_FILT_COEFF =>
|
||||
|
|
@ -806,14 +883,14 @@ begin
|
|||
when PULSE_GEN_CTRL_REG =>
|
||||
avs_readdata_i(31 downto 8) <= (8 => ch_mask_i, 9 => fire_enable, 10 => dp_dir, 11 => wh_apply_corr_en,
|
||||
16 => enable_out, 17 => abort_fire, 18 => rst_diag_regs, others => '0');
|
||||
avs_readdata_i( 7 downto 4) <= b"0" & de_queue_error & pd_queue_error & sw_ctrl_dp_dir;
|
||||
avs_readdata_i( 7 downto 4) <= '0' & de_queue_error & pd_queue_error & sw_ctrl_dp_dir;
|
||||
avs_readdata_i( 3 downto 0) <= bypass_delay_equal & bypass_pulse_cond & bypass_ch_ctrl & enable_i;
|
||||
when CH_OFFSET_D0_REG =>
|
||||
avs_readdata_i <= ch_offset_dir0;
|
||||
when CH_OFFSET_D1_REG =>
|
||||
avs_readdata_i <= ch_offset_dir1;
|
||||
when CH_DELAY_REG =>
|
||||
avs_readdata_i <= ch_delay;
|
||||
avs_readdata_i <= X"0000" & ch_delay;
|
||||
when CH_CTRL_CTRL_REG =>
|
||||
avs_readdata_i <= X"0000" & ch_ctrl_start_addr & X"0" & "00" & ch_ctrl_busy & ch_ctrl_start_req_ii;
|
||||
when FRAC_DIV_CTRL_REG =>
|
||||
|
|
@ -843,6 +920,11 @@ begin
|
|||
avs_readdata_i <= pd_in_cnt;
|
||||
when FIRE_REQ_CNT_REG =>
|
||||
avs_readdata_i <= fire_req_cnt;
|
||||
when TOF_COMP_CTRL_REG =>
|
||||
avs_readdata_i <= enc_speed_norm_coeff & 14x"0" & tof_sat_flag & tof_comp_enable;
|
||||
when TOF_COMP_STATUS_REG =>
|
||||
avs_readdata_i(15 downto 0) <= std_logic_vector(resize(signed(enc_vel),16));
|
||||
avs_readdata_i(31 downto 16) <= tof_lut_comp;
|
||||
when WH_POS_ERR_2_CORR_REG =>
|
||||
avs_readdata_i <= wh_pos_err_2_corr;
|
||||
when WH_LOOP_FILT_COEFF =>
|
||||
|
|
@ -853,7 +935,7 @@ begin
|
|||
avs_readdata_i <= X"00" & wh_pos_err_max;
|
||||
when WH_DIV_RATIO_CORR_REG =>
|
||||
avs_readdata_i <= div_ratio_corr(31 downto 0);
|
||||
when WH_ROTATION_CNT_REG =>
|
||||
when WH_CORR_CNT_REG =>
|
||||
avs_readdata_i <= X"0000" & wh_rotat_cnt;
|
||||
when others =>
|
||||
avs_readdata_i <= X"BAD1BAD0";
|
||||
|
|
@ -865,13 +947,15 @@ begin
|
|||
avs_address_i <= avs_address;
|
||||
end if;
|
||||
-- output multiplexer
|
||||
case? avs_address_i( 9 downto 5) is
|
||||
when "00000" =>
|
||||
case? avs_address_i(10 downto 5) is
|
||||
when "000000" =>
|
||||
avs_readdata <= avs_readdata_i;
|
||||
when "00001" =>
|
||||
when "000001" =>
|
||||
avs_readdata <= ch_ctrl_csr_readdata;
|
||||
when "1----" =>
|
||||
when "01----" =>
|
||||
avs_readdata <= ch_ctrl_readdata;
|
||||
when "10----" =>
|
||||
avs_readdata <= X"0000" & tof_lut_wr_q;
|
||||
when others =>
|
||||
avs_readdata <= X"BAD1BAD0";
|
||||
end case?;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2018-08-22
|
||||
-- Last update: 2019-06-10
|
||||
-- Last update: 2019-07-02
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -41,14 +41,21 @@ package pulse_generator_2_pkg is
|
|||
constant ABS_POS_STAT : std_logic_vector(4 downto 0) := 5x"11";
|
||||
constant PD_IN_CNT_REG : std_logic_vector(4 downto 0) := 5x"12";
|
||||
constant FIRE_REQ_CNT_REG : std_logic_vector(4 downto 0) := 5x"13";
|
||||
constant WH_POS_ERR_2_CORR_REG : std_logic_vector(4 downto 0) := 5x"14";
|
||||
constant WH_LOOP_FILT_COEFF : std_logic_vector(4 downto 0) := 5x"15";
|
||||
constant WH_POS_ERR_CURR_REG : std_logic_vector(4 downto 0) := 5x"16";
|
||||
constant WH_POS_ERR_MAX_REG : std_logic_vector(4 downto 0) := 5x"17";
|
||||
constant WH_DIV_RATIO_CORR_REG : std_logic_vector(4 downto 0) := 5x"18";
|
||||
constant WH_ROTATION_CNT_REG : std_logic_vector(4 downto 0) := 5x"19";
|
||||
constant TOF_COMP_CTRL_REG : std_logic_vector(4 downto 0) := 5x"14";
|
||||
constant TOF_COMP_STATUS_REG : std_logic_vector(4 downto 0) := 5x"15";
|
||||
constant WH_POS_ERR_2_CORR_REG : std_logic_vector(4 downto 0) := 5x"16";
|
||||
constant WH_LOOP_FILT_COEFF : std_logic_vector(4 downto 0) := 5x"17";
|
||||
constant WH_POS_ERR_CURR_REG : std_logic_vector(4 downto 0) := 5x"18";
|
||||
constant WH_POS_ERR_MAX_REG : std_logic_vector(4 downto 0) := 5x"19";
|
||||
constant WH_DIV_RATIO_CORR_REG : std_logic_vector(4 downto 0) := 5x"1A";
|
||||
constant WH_CORR_CNT_REG : std_logic_vector(4 downto 0) := 5x"1B";
|
||||
|
||||
constant SEQ_CSR_OFFSET : std_logic_vector(9 downto 0) := 10x"20";
|
||||
constant SEQ_RAM_OFFSET : std_logic_vector(9 downto 0) := 10x"200";
|
||||
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_2_pkg;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2019-05-17
|
||||
-- Last update: 2019-06-11
|
||||
-- Last update: 2019-06-20
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -148,7 +148,7 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
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_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;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2018-09-11
|
||||
-- Last update: 2019-05-22
|
||||
-- Last update: 2019-06-20
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -63,7 +63,7 @@ architecture behav of pd_jitter_verify_tb is
|
|||
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_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;
|
||||
|
|
|
|||
512
generic_ip/pulse_generator/2/src/test/tof_comp/tof_table_1.cfg
Normal file
512
generic_ip/pulse_generator/2/src/test/tof_comp/tof_table_1.cfg
Normal file
|
|
@ -0,0 +1,512 @@
|
|||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
00000014
|
||||
619
generic_ip/pulse_generator/2/src/test/tof_comp_tb.vhd
Normal file
619
generic_ip/pulse_generator/2/src/test/tof_comp_tb.vhd
Normal file
|
|
@ -0,0 +1,619 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- Title : tof_comp_tb
|
||||
-- Project : Pulse-Generator
|
||||
-------------------------------------------------------------------------------
|
||||
-- File : tof_comp_tb.vhd
|
||||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2019-06-20
|
||||
-- Last update: 2019-07-02
|
||||
-- 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_2_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 := 4.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 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(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(14 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;
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- 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;
|
||||
subpixel_off : 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 sub-pixel offset
|
||||
data := (others => '0');
|
||||
addr := std_logic_vector(resize(unsigned(SP_OFFSET_INT), 32));
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
addr := std_logic_vector(resize(unsigned(SP_OFFSET_FRAC), 32));
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
-- 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 apply_tof_comp(
|
||||
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');
|
||||
|
||||
begin
|
||||
|
||||
data := (0 => tof_enable, others => '0');
|
||||
data(31 downto 16) := std_logic_vector(to_unsigned(enc_speed_norm,16));
|
||||
addr := std_logic_vector(resize(unsigned(TOF_COMP_CTRL_REG), 32));
|
||||
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;
|
||||
|
||||
end procedure apply_tof_comp;
|
||||
|
||||
procedure apply_pg_cfg(
|
||||
div_ratio : real;
|
||||
subpixel_off : 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);
|
||||
log("Sub-Pixel Offset = " & to_string(subpixel_off), 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, subpixel_off, 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
|
||||
apply_tof_comp(tof_enable, enc_speed_norm, 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, 16 => '1', others => '0');
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
|
||||
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_2
|
||||
generic map (
|
||||
pulse_delay_equal_en => true,
|
||||
out_pulse_condition => false)
|
||||
port map (
|
||||
clk => clk,
|
||||
reset_n => reset_n,
|
||||
init => init,
|
||||
pd_in => pd_in,
|
||||
abs_position => abs_position,
|
||||
enc_vel => vel_meas,
|
||||
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);
|
||||
|
||||
iVEL: entity work.simple_enc_vel_detect
|
||||
generic map (
|
||||
SAMPLING_PERIOD => SAMPLING_PERIOD)
|
||||
port map (
|
||||
clk => clk,
|
||||
init => init,
|
||||
step_pos => step_pos,
|
||||
step_neg => step_neg,
|
||||
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 => 150, neg_inc_num => 0, period => 6,
|
||||
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;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- 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 => 1.0,
|
||||
subpixel_off => 0.0,
|
||||
offset_dir0 => 0,
|
||||
offset_dir1 => 0,
|
||||
delay => 100,
|
||||
dir => '0',
|
||||
tof_enable => '1',
|
||||
enc_speed_norm => 1024,
|
||||
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;
|
||||
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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue