diff --git a/generic_ip/pulse_generator/2/doc/pulse_generator_2.json b/generic_ip/pulse_generator/2/doc/pulse_generator_2.json index 59f6aa5..fc0a048 100644 --- a/generic_ip/pulse_generator/2/doc/pulse_generator_2.json +++ b/generic_ip/pulse_generator/2/doc/pulse_generator_2.json @@ -416,15 +416,22 @@ } } }, - "pixel_pitch_pos_err_2_corr": { + "pixel_pitch_corr_stripe_num": { "type": "w", "address": "22", "reset": "0x00", + "width": "24", + "description": "Number of stripes to be considered for pixel pitch correction: corresponds to the number of pixels composing the label, head width included)" + }, + "pixel_pitch_pos_err_2_corr": { + "type": "w", + "address": "23", + "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" + "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": { - "address": "23", + "address": "24", "width": "32", "description": "Loop filter coefficient for pixel-pitch correction", "fields": { @@ -444,35 +451,35 @@ }, "pixel_pitch_pos_err_curr": { "type": "r", - "address": "24", + "address": "25", "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", + "address": "26", "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": "26", + "address": "27", "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": "27", + "address": "28", "reset": "0x00", "width": "32", "description": "Division-Ratio Correction (32-LSBs)" }, "pixel_pitch_corr_cnt": { "type": "r", - "address": "28", + "address": "29", "reset": "0x00", "width": "16", "description": "Pixel-pitch corrections count" diff --git a/generic_ip/pulse_generator/2/sim/wave_ch_ctrl_cfg.do b/generic_ip/pulse_generator/2/sim/wave_ch_ctrl_cfg.do index 92739a0..03d3797 100644 --- a/generic_ip/pulse_generator/2/sim/wave_ch_ctrl_cfg.do +++ b/generic_ip/pulse_generator/2/sim/wave_ch_ctrl_cfg.do @@ -52,8 +52,10 @@ add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_error_meas_started add wave -noupdate /ch_ctrl_cfg_tb/iUUT/init_wh add wave -noupdate /ch_ctrl_cfg_tb/iUUT/loc_pd_d add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_meas_event -add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_mask_fe -add wave -noupdate /ch_ctrl_cfg_tb/iUUT/first_po_started +add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_img_end +add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/wh_img_pixel_cnt +add wave -noupdate -radix unsigned /ch_ctrl_cfg_tb/iUUT/wh_image_pixel_len +add wave -noupdate /ch_ctrl_cfg_tb/iUUT/first_img_started add wave -noupdate /ch_ctrl_cfg_tb/iUUT/wh_corr_ready_v add wave -noupdate /ch_ctrl_cfg_tb/iUUT/start_pos add wave -noupdate /ch_ctrl_cfg_tb/iUUT/abs_pos_d @@ -112,11 +114,9 @@ add wave -noupdate /ch_ctrl_cfg_tb/iUUT/avs_read_i add wave -noupdate /ch_ctrl_cfg_tb/iUUT/de_queue_error add wave -noupdate /ch_ctrl_cfg_tb/iUUT/cnt_dir add wave -noupdate /ch_ctrl_cfg_tb/iUUT/dp_dir_i -add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_mask_d add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_start_req_i add wave -noupdate /ch_ctrl_cfg_tb/iUUT/set_first_pd add wave -noupdate /ch_ctrl_cfg_tb/iUUT/pulse_out_ii -add wave -noupdate /ch_ctrl_cfg_tb/iUUT/loc_pulse_out_d add wave -noupdate /ch_ctrl_cfg_tb/iUUT/loc_pulse add wave -noupdate /ch_ctrl_cfg_tb/iUUT/first_pulse add wave -noupdate /ch_ctrl_cfg_tb/iUUT/dp_dir_d @@ -251,4 +251,4 @@ configure wave -griddelta 40 configure wave -timeline 0 configure wave -timelineunits ps update -WaveRestoreZoom {0 ps} {3081416704 ps} +WaveRestoreZoom {16423159132 ps} {19504575836 ps} diff --git a/generic_ip/pulse_generator/2/src/pulse_generator_2.vhd b/generic_ip/pulse_generator/2/src/pulse_generator_2.vhd index e30824b..6abfd1f 100644 --- a/generic_ip/pulse_generator/2/src/pulse_generator_2.vhd +++ b/generic_ip/pulse_generator/2/src/pulse_generator_2.vhd @@ -6,7 +6,7 @@ -- Author : Gianmarco Girau -- Company : Global Inkjet Systems -- Created : 2016-10-24 --- Last update: 2019-07-18 +-- Last update: 2019-07-26 -- SVN ID : Git -- Standard : VHDL'93 ------------------------------------------------------------------------------- @@ -81,7 +81,7 @@ architecture rtl of pulse_generator_2 is signal ch_mask_i, bypass_ch_ctrl, bypass_delay_equal : std_logic; signal div_pulse, gated_pulse, retimed_pulse, pulse_out_i : std_logic; signal avs_write_i, avs_read_d, avs_read_i, de_queue_error : std_logic; - signal cnt_dir, dp_dir_i, ch_mask_d, ch_ctrl_start_req_i : std_logic; + signal cnt_dir, dp_dir_i, ch_ctrl_start_req_i : std_logic; signal set_first_pd, pulse_out_ii : std_logic; signal loc_pulse, first_pulse, dp_dir_d : std_logic; signal overdrive_rst, overdrv_event, pulse_scale_out : std_logic; @@ -101,7 +101,7 @@ architecture rtl of pulse_generator_2 is signal seq_bus_valid, spit_nco_msb : std_logic; 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 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; @@ -129,6 +129,7 @@ architecture rtl of pulse_generator_2 is signal wh_pos_err : 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); 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); @@ -412,8 +413,11 @@ 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; + if(init_wh = '1' or wh_img_end = '1') then + wh_img_pixel_cnt <= (others => '0'); + elsif(fire_enable = '1' and div_pulse = '1') then + wh_img_pixel_cnt <= std_logic_vector(unsigned(wh_img_pixel_cnt)+1); + end if; loc_pd_d <= loc_pd; init_wh <= init or (not enable) or (not wh_apply_corr_en); if(init_wh = '1') then @@ -423,19 +427,19 @@ begin end if; div_ratio_i <= std_logic_vector(signed(div_ratio)+signed(div_ratio_corr)); if(init_wh = '1' ) then - first_po_started <= '0'; - elsif(ch_mask_i = '1' and ch_mask_d = '0') then - first_po_started <= '1'; + first_img_started <= '0'; + elsif(fire_enable = '1' and div_pulse = '1') then + first_img_started <= '1'; end if; if(init_wh = '1' ) then wh_error_meas_started <= '0'; - elsif(wh_meas_event = '1' and first_po_started = '1') then + elsif(wh_meas_event = '1' and first_img_started = '1') then wh_error_meas_started <= not wh_error_meas_started; end if; if(wh_meas_event = '1' and wh_error_meas_started = '0') then start_pos <= abs_pos_d; end if; - if((loc_pd_d and ch_mask_fe) = '1') then + if((loc_pd_d and wh_img_end) = '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 @@ -444,7 +448,7 @@ begin basic_pos_error <= std_logic_vector(resize(signed(start_pos)-signed(abs_pos_d), basic_pos_error'length)); end if; end if; - if(wh_error_meas_started = '1' and (loc_pd_d or ch_mask_fe) = '1') then + if(wh_error_meas_started = '1' and (loc_pd_d or wh_img_end) = '1') then wh_error_meas_avail <= '1'; else wh_error_meas_avail <= '0'; @@ -478,7 +482,9 @@ begin end if; end process pDIV_RATIO_CORR; - wh_meas_event <= loc_pd_d xor ch_mask_fe; + wh_img_end <= '1' when unsigned(wh_img_pixel_cnt) = unsigned(wh_image_pixel_len) else '0'; + + 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)); @@ -818,6 +824,7 @@ begin enc_speed_norm_coeff <= std_logic_vector(to_unsigned(256,16)); -- wh_apply_corr_en <= '0'; + wh_image_pixel_len <= (others => '0'); wh_pos_err_2_corr <= (others => '0'); wh_loop_filt_delta <= std_logic_vector(to_signed(256, 16)); wh_loop_filt_tot <= std_logic_vector(to_signed(256, 16)); @@ -865,6 +872,8 @@ begin when TOF_COMP_CTRL_REG => tof_comp_enable <= avs_writedata(0); enc_speed_norm_coeff <= avs_writedata(31 downto 16); + when WH_PIXEL_NUM => + 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_LOOP_FILT_COEFF => @@ -928,6 +937,8 @@ begin 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_PIXEL_NUM => + 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_LOOP_FILT_COEFF => diff --git a/generic_ip/pulse_generator/2/src/pulse_generator_2_pkg.vhd b/generic_ip/pulse_generator/2/src/pulse_generator_2_pkg.vhd index 0c1894d..a03b64d 100644 --- a/generic_ip/pulse_generator/2/src/pulse_generator_2_pkg.vhd +++ b/generic_ip/pulse_generator/2/src/pulse_generator_2_pkg.vhd @@ -6,7 +6,7 @@ -- Author : GMG -- Company : Global Inkjet Systems -- Created : 2018-08-22 --- Last update: 2019-07-03 +-- Last update: 2019-07-26 -- SVN ID : Git -- Standard : VHDL'2008 ------------------------------------------------------------------------------- @@ -43,13 +43,14 @@ package pulse_generator_2_pkg is constant FIRE_REQ_CNT_REG : std_logic_vector(4 downto 0) := 5x"13"; 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_POS_ERR_MIN_REG : std_logic_vector(4 downto 0) := 5x"1A"; - constant WH_DIV_RATIO_CORR_REG : std_logic_vector(4 downto 0) := 5x"1B"; - constant WH_CORR_CNT_REG : std_logic_vector(4 downto 0) := 5x"1C"; + constant WH_PIXEL_NUM : std_logic_vector(4 downto 0) := 5x"16"; + constant WH_POS_ERR_2_CORR_REG : std_logic_vector(4 downto 0) := 5x"17"; + constant WH_LOOP_FILT_COEFF : std_logic_vector(4 downto 0) := 5x"18"; + constant WH_POS_ERR_CURR_REG : std_logic_vector(4 downto 0) := 5x"19"; + constant WH_POS_ERR_MAX_REG : std_logic_vector(4 downto 0) := 5x"1A"; + constant WH_POS_ERR_MIN_REG : std_logic_vector(4 downto 0) := 5x"1B"; + constant WH_DIV_RATIO_CORR_REG : std_logic_vector(4 downto 0) := 5x"1C"; + constant WH_CORR_CNT_REG : std_logic_vector(4 downto 0) := 5x"1D"; constant SEQ_CSR_OFFSET : std_logic_vector(10 downto 0) := 11x"20"; constant SEQ_RAM_OFFSET : std_logic_vector(10 downto 0) := 11x"200"; diff --git a/generic_ip/pulse_generator/2/src/test/ch_ctrl_cfg_tb.vhd b/generic_ip/pulse_generator/2/src/test/ch_ctrl_cfg_tb.vhd index 45903ff..8e20745 100644 --- a/generic_ip/pulse_generator/2/src/test/ch_ctrl_cfg_tb.vhd +++ b/generic_ip/pulse_generator/2/src/test/ch_ctrl_cfg_tb.vhd @@ -6,7 +6,7 @@ -- Author : GMG -- Company : Global Inkjet Systems -- Created : 2019-05-17 --- Last update: 2019-06-20 +-- Last update: 2019-07-26 -- SVN ID : Git -- Standard : VHDL'2008 ------------------------------------------------------------------------------- @@ -381,7 +381,12 @@ architecture behav of ch_ctrl_cfg_tb is data := (0 => '1', others => '0'); mm_32b_write(addr, data, mm_s_rec, mm_m_rec); - -- Compute and constant for W&H Correction + -- Specify the image-length for wheel correction + addr := std_logic_vector(resize(unsigned(WH_PIXEL_NUM), 32)); + data := std_logic_vector(to_unsigned(IMG_LEN, 32)); + mm_32b_write(addr, data, mm_s_rec, mm_m_rec); + + -- Compute the constant for W&H Correction addr := std_logic_vector(resize(unsigned(WH_POS_ERR_2_CORR_REG), 32)); data := std_logic_vector(to_unsigned(integer(round((1.0/real(IMG_LEN))*(2.0**32))), 32)); mm_32b_write(addr, data, mm_s_rec, mm_m_rec);