WH-17 - Updated Pixel-Pitch correction mechanism to be robust against missing PD or misplaced PD.
This commit is contained in:
parent
7ace4d4965
commit
932b221414
5 changed files with 223 additions and 102 deletions
|
|
@ -183,10 +183,16 @@
|
|||
"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": "13",
|
||||
"bit_len": "12",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
|
|
@ -432,8 +438,15 @@
|
|||
"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_loop_filter_corr": {
|
||||
"pixel_pitch_skip_corr_thres": {
|
||||
"type": "w",
|
||||
"address": "25",
|
||||
"reset": "0x400000",
|
||||
"width": "24",
|
||||
"description": "Alignment error threshold causing a correction to be skipped"
|
||||
},
|
||||
"pixel_pitch_loop_filter_corr": {
|
||||
"address": "26",
|
||||
"width": "32",
|
||||
"description": "Loop filter coefficient for pixel-pitch correction",
|
||||
"fields": {
|
||||
|
|
@ -453,35 +466,35 @@
|
|||
},
|
||||
"pixel_pitch_pos_err_curr": {
|
||||
"type": "r",
|
||||
"address": "26",
|
||||
"address": "27",
|
||||
"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": "27",
|
||||
"address": "28",
|
||||
"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_pos_err_min": {
|
||||
"type": "r",
|
||||
"address": "28",
|
||||
"address": "29",
|
||||
"reset": "0x00",
|
||||
"width": "24",
|
||||
"description": "Minimum 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": "29",
|
||||
"address": "30",
|
||||
"reset": "0x00",
|
||||
"width": "32",
|
||||
"description": "Division-Ratio Correction (32-LSBs)"
|
||||
},
|
||||
"pixel_pitch_corr_cnt": {
|
||||
"type": "r",
|
||||
"address": "30",
|
||||
"address": "31",
|
||||
"reset": "0x00",
|
||||
"width": "16",
|
||||
"description": "Pixel-pitch corrections count"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ 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
|
||||
|
|
@ -22,6 +24,7 @@ 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 /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
|
||||
|
|
@ -47,6 +50,10 @@ 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
|
||||
|
|
@ -57,10 +64,12 @@ 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_corr_ready_v
|
||||
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_pos
|
||||
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 /ch_ctrl_cfg_tb/iUUT/wh_pos_err
|
||||
add wave -noupdate /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
|
||||
|
|
@ -235,8 +244,8 @@ 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} {187312146 ps} 0} {{Cursor 2} {18003534285 ps} 0}
|
||||
quietly wave cursor active 1
|
||||
WaveRestoreCursors {{Cursor 1} {187312146 ps} 0} {{Cursor 2} {16802400153 ps} 0}
|
||||
quietly wave cursor active 2
|
||||
configure wave -namecolwidth 293
|
||||
configure wave -valuecolwidth 216
|
||||
configure wave -justifyvalue left
|
||||
|
|
@ -251,4 +260,4 @@ configure wave -griddelta 40
|
|||
configure wave -timeline 0
|
||||
configure wave -timelineunits ps
|
||||
update
|
||||
WaveRestoreZoom {16423159132 ps} {19504575836 ps}
|
||||
WaveRestoreZoom {0 ps} {6162874368 ps}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2016-10-24
|
||||
-- Last update: 2019-08-05
|
||||
-- Last update: 2019-08-08
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'93
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -105,7 +105,8 @@ architecture rtl of pulse_generator_2 is
|
|||
signal wh_meas_event, wh_img_end, first_img_started : std_logic;
|
||||
signal tof_lut_wr_en, tof_comp_enable : std_logic;
|
||||
signal tof_saturation, tof_sat_flag : std_logic;
|
||||
signal selected_pulse, selected_pulse_d : std_logic;
|
||||
signal wh_apply_corr_en_d, wh_corr_start, wh_skip_corr : std_logic;
|
||||
signal selected_pulse, selected_pulse_d, clr_pd_queue : 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);
|
||||
|
|
@ -126,8 +127,8 @@ architecture rtl of pulse_generator_2 is
|
|||
signal tof_lut_comp_i : std_logic_vector(15 downto 0);
|
||||
signal enc_speed_meas_w_i, enc_vel_i : std_logic_vector(19 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 : std_logic_vector(23 downto 0);
|
||||
signal ch_ctrl_vector_out, wh_pos_err_abs : std_logic_vector(23 downto 0);
|
||||
signal wh_pos_err, wh_skip_corr_thres : std_logic_vector(23 downto 0);
|
||||
signal wh_pos_err_max, wh_pos_err_min : 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_img_pixel_cnt, wh_image_pixel_len : std_logic_vector(23 downto 0);
|
||||
|
|
@ -238,7 +239,6 @@ begin
|
|||
|
||||
-- make sure the PD queue is always cleared whenever there is a change of direction
|
||||
dir_change <= dp_dir_i xor dp_dir_d;
|
||||
init_qd <= not enable or init or dir_change;
|
||||
|
||||
-- channel offset selection
|
||||
pCH_OFF_SEL : process(clk)
|
||||
|
|
@ -261,6 +261,7 @@ begin
|
|||
pDIR_CHG : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
init_qd <= not enable or init or dir_change or clr_pd_queue or wh_corr_start;
|
||||
if(bypass_ch_ctrl = '1') then
|
||||
dp_dir_i <= sw_ctrl_dp_dir;
|
||||
else
|
||||
|
|
@ -420,19 +421,20 @@ begin
|
|||
wh_img_pixel_cnt <= std_logic_vector(unsigned(wh_img_pixel_cnt)+1);
|
||||
end if;
|
||||
loc_pd_d <= loc_pd;
|
||||
wh_apply_corr_en_d <= wh_apply_corr_en;
|
||||
init_wh <= init or (not enable) or (not wh_apply_corr_en);
|
||||
if(init_wh = '1') then
|
||||
div_ratio_corr <= (others => '0');
|
||||
elsif(wh_corr_ready = '1') then
|
||||
elsif(wh_corr_ready = '1' and wh_skip_corr = '0') then
|
||||
div_ratio_corr <= std_logic_vector(signed(div_ratio_corr)+signed(div_ratio_corr_new));
|
||||
end if;
|
||||
div_ratio_i <= std_logic_vector(signed(div_ratio)+signed(div_ratio_corr));
|
||||
if(init_wh = '1' ) then
|
||||
if(init_wh = '1' or wh_skip_corr = '1') then
|
||||
first_img_started <= '0';
|
||||
elsif(fire_enable = '1' and div_pulse = '1') then
|
||||
first_img_started <= '1';
|
||||
end if;
|
||||
if(init_wh = '1' ) then
|
||||
if(init_wh = '1' or wh_skip_corr = '1') then
|
||||
wh_error_meas_started <= '0';
|
||||
elsif(wh_meas_event = '1' and first_img_started = '1') then
|
||||
wh_error_meas_started <= not wh_error_meas_started;
|
||||
|
|
@ -440,7 +442,7 @@ begin
|
|||
if(wh_meas_event = '1' and wh_error_meas_started = '0') then
|
||||
start_pos <= abs_pos_d;
|
||||
end if;
|
||||
if((loc_pd_d and wh_img_end) = '1') then
|
||||
if((loc_pd_d and wh_img_end) = '1' or wh_skip_corr = '1') then
|
||||
basic_pos_error <= (others => '0');
|
||||
elsif(wh_meas_event = '1' and wh_error_meas_started = '1') then
|
||||
if(loc_pd_d = '1') then
|
||||
|
|
@ -456,7 +458,7 @@ begin
|
|||
end if;
|
||||
wh_corr_ready_v <= wh_corr_ready_v(wh_corr_ready_v'left-1 downto 0) & wh_error_meas_avail;
|
||||
pos_error <= std_logic_vector(signed(basic_pos_error & 24x"0") - signed(div_ratio));
|
||||
if(init_wh = '1' ) then
|
||||
if(init_wh = '1' or wh_skip_corr = '1') then
|
||||
wh_pos_err_old <= (others => '0');
|
||||
elsif(wh_corr_ready_v(0) = '1') then
|
||||
wh_pos_err_old <= wh_pos_err;
|
||||
|
|
@ -465,6 +467,18 @@ begin
|
|||
wh_loop_err <= std_logic_vector(signed(wh_delta_err)*signed(wh_loop_filt_delta)+signed(wh_tot_err)*signed(wh_loop_filt_tot));
|
||||
end if;
|
||||
div_ratio_corr_ext <= std_logic_vector(signed(wh_loop_err(wh_loop_err'left-8 downto 8))*signed(wh_pos_err_2_corr));
|
||||
-- Compute the absolute value of the position-error. Use a simple 1's
|
||||
-- complement if you need to do sign inversion
|
||||
if(wh_pos_err(wh_pos_err'left) = '1') then
|
||||
wh_pos_err_abs <= not wh_pos_err;
|
||||
else
|
||||
wh_pos_err_abs <= wh_pos_err;
|
||||
end if;
|
||||
if(unsigned(wh_pos_err_abs) > unsigned(wh_skip_corr_thres) and first_img_started = '1') then
|
||||
wh_skip_corr <= '1';
|
||||
elsif(loc_pd = '1') then
|
||||
wh_skip_corr <= '0';
|
||||
end if;
|
||||
if(init_wh = '1') then
|
||||
wh_pos_err_max <= (others => '0');
|
||||
elsif(wh_corr_ready = '1' and signed(wh_pos_err) > signed(wh_pos_err_max)) then
|
||||
|
|
@ -485,6 +499,8 @@ begin
|
|||
|
||||
wh_img_end <= '1' when unsigned(wh_img_pixel_cnt) = unsigned(wh_image_pixel_len) else '0';
|
||||
|
||||
wh_corr_start <= wh_apply_corr_en and not wh_apply_corr_en_d;
|
||||
|
||||
wh_meas_event <= loc_pd_d xor wh_img_end;
|
||||
|
||||
div_ratio_corr_new <= std_logic_vector(resize(signed(div_ratio_corr_ext(div_ratio_corr_ext'left downto 16)),div_ratio'length));
|
||||
|
|
@ -802,6 +818,7 @@ begin
|
|||
sw_ctrl_dp_dir <= '0';
|
||||
enable_out <= '0';
|
||||
abort_fire <= '0';
|
||||
clr_pd_queue <= '0';
|
||||
--
|
||||
ch_offset_dir0 <= (others => '0');
|
||||
ch_offset_dir1 <= (others => '0');
|
||||
|
|
@ -830,9 +847,11 @@ begin
|
|||
wh_apply_corr_en <= '0';
|
||||
wh_image_pixel_len <= (others => '0');
|
||||
wh_pos_err_2_corr <= (others => '0');
|
||||
wh_skip_corr_thres <= (22 => '1', others => '0');
|
||||
wh_loop_filt_delta <= std_logic_vector(to_signed(256, 16));
|
||||
wh_loop_filt_tot <= std_logic_vector(to_signed(256, 16));
|
||||
elsif(clk = '1' and clk'event) then
|
||||
clr_pd_queue <= '0';
|
||||
-- CTRL registers
|
||||
if(avs_write_i = '1' and avs_address(9 downto 5) = "00000") then
|
||||
case avs_addr is
|
||||
|
|
@ -847,6 +866,7 @@ begin
|
|||
enable_out <= avs_writedata(16);
|
||||
abort_fire <= avs_writedata(17);
|
||||
rst_diag_regs <= avs_writedata(18);
|
||||
clr_pd_queue <= avs_writedata(19);
|
||||
when CH_OFFSET_D0_REG =>
|
||||
ch_offset_dir0 <= avs_writedata;
|
||||
when CH_DELAY_REG =>
|
||||
|
|
@ -882,6 +902,8 @@ begin
|
|||
wh_image_pixel_len <= avs_writedata(23 downto 0);
|
||||
when WH_POS_ERR_2_CORR_REG =>
|
||||
wh_pos_err_2_corr <= avs_writedata;
|
||||
when WH_SKIP_CORR_THRES_REG =>
|
||||
wh_skip_corr_thres <= avs_writedata(23 downto 0);
|
||||
when WH_LOOP_FILT_COEFF =>
|
||||
wh_loop_filt_delta <= avs_writedata(15 downto 0);
|
||||
wh_loop_filt_tot <= avs_writedata(31 downto 16);
|
||||
|
|
@ -950,6 +972,8 @@ begin
|
|||
avs_readdata_i <= X"00" & wh_image_pixel_len;
|
||||
when WH_POS_ERR_2_CORR_REG =>
|
||||
avs_readdata_i <= wh_pos_err_2_corr;
|
||||
when WH_SKIP_CORR_THRES_REG =>
|
||||
avs_readdata_i <= X"00" & wh_skip_corr_thres;
|
||||
when WH_LOOP_FILT_COEFF =>
|
||||
avs_readdata_i <= wh_loop_filt_tot & wh_loop_filt_delta;
|
||||
when WH_POS_ERR_CURR_REG =>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2018-08-22
|
||||
-- Last update: 2019-08-02
|
||||
-- Last update: 2019-08-08
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -21,37 +21,38 @@ use ieee.numeric_std.all;
|
|||
|
||||
package pulse_generator_2_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 OVERDRV_THRES_REG : std_logic_vector(4 downto 0) := 5x"09";
|
||||
constant OVERDRV_EVENT_REG : 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 SP_OFFSET_INT : std_logic_vector(4 downto 0) := 5x"0D";
|
||||
constant SP_OFFSET_FRAC : 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_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 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_LOOP_FILT_COEFF : std_logic_vector(4 downto 0) := 5x"19";
|
||||
constant WH_POS_ERR_CURR_REG : std_logic_vector(4 downto 0) := 5x"1A";
|
||||
constant WH_POS_ERR_MAX_REG : std_logic_vector(4 downto 0) := 5x"1B";
|
||||
constant WH_POS_ERR_MIN_REG : std_logic_vector(4 downto 0) := 5x"1C";
|
||||
constant WH_DIV_RATIO_CORR_REG : std_logic_vector(4 downto 0) := 5x"1D";
|
||||
constant WH_CORR_CNT_REG : std_logic_vector(4 downto 0) := 5x"1E";
|
||||
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 OVERDRV_THRES_REG : std_logic_vector(4 downto 0) := 5x"09";
|
||||
constant OVERDRV_EVENT_REG : 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 SP_OFFSET_INT : std_logic_vector(4 downto 0) := 5x"0D";
|
||||
constant SP_OFFSET_FRAC : 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_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 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";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2019-05-17
|
||||
-- Last update: 2019-07-26
|
||||
-- Last update: 2019-08-09
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -63,6 +63,7 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
|
||||
constant APPLY_CORR_EN : boolean := true;
|
||||
constant APPLY_EMUL_CORR : boolean := false;
|
||||
constant SKIP_PD_EN : boolean := true;
|
||||
|
||||
constant PD_OFFSET : natural := 10;
|
||||
|
||||
|
|
@ -170,14 +171,17 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
|
||||
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_r : real;
|
||||
signal wh_pos_err_r : real;
|
||||
signal wheel_corr_on : std_logic;
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
|
@ -391,6 +395,12 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
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*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');
|
||||
|
|
@ -440,9 +450,44 @@ begin -- architecture behav
|
|||
|
||||
pGET_WH_ERR : process
|
||||
alias wh_pos_err is <<signal iUUT.wh_pos_err : std_logic_vector(23 downto 0)>>;
|
||||
|
||||
alias wh_corr_meas_ready is <<signal iUUT.wh_corr_ready_v : std_logic_vector(4 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
|
||||
wh_pos_err_r <= real(to_integer(signed(wh_pos_err)))/256.0;
|
||||
wait until clk = '1' and clk'event;
|
||||
|
||||
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(1));
|
||||
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;
|
||||
|
||||
end if;
|
||||
end process pGET_WH_ERR;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
|
@ -512,7 +557,11 @@ begin -- architecture behav
|
|||
|
||||
if((wheel_pos + 1) = integer(WHEEL_CIRCUM+real(wheel_error(pd_in_cnt))+0.5)) then
|
||||
-- it's time to issue a new PD
|
||||
pd_in <= '1';
|
||||
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;
|
||||
|
|
@ -530,6 +579,18 @@ begin -- architecture behav
|
|||
|
||||
end process pSTIMULI;
|
||||
|
||||
pSKIP_PD : process
|
||||
begin
|
||||
if(pd_in_cnt = 45 or pd_in_cnt = 50 or pd_in_cnt = 57 or pd_in_cnt = 64 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
|
||||
-----------------------------------------------------------------------------
|
||||
|
|
@ -579,6 +640,7 @@ begin -- architecture behav
|
|||
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;
|
||||
|
|
@ -627,46 +689,58 @@ begin -- architecture behav
|
|||
-- measur the error, then apply correction
|
||||
while end_of_stimuli = false loop
|
||||
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
wait_latency(clk, 20);
|
||||
|
||||
end if;
|
||||
|
||||
end loop;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue