From 3b1d16da676f2dbb9ce48724da42e62461280d38 Mon Sep 17 00:00:00 2001 From: Christos Spirotis Date: Wed, 21 Nov 2018 12:15:44 +0000 Subject: [PATCH] ELGIP-22 Pulse generator bug fix. New version is 1.0 --- .../1/doc/pulse_generator_1.json | 22 ++++++++-------- .../1/src/pulse_generator_1.vhd | 25 ++++++++++++++++--- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/generic_ip/pulse_generator/1/doc/pulse_generator_1.json b/generic_ip/pulse_generator/1/doc/pulse_generator_1.json index 356187b..49b9ea0 100644 --- a/generic_ip/pulse_generator/1/doc/pulse_generator_1.json +++ b/generic_ip/pulse_generator/1/doc/pulse_generator_1.json @@ -1,16 +1,18 @@ [{ "ip_name": "pulse_gen_1", "bus": "csr", - "description": "Generate Fire-Requests, based on the absolute position and PD inputs", + "description": "Generate Fire-Requests, based on the absolute position and PD inputs", + "addr_hi_bit" : "9", + "addr_lo_bit" : "5", "sub_blocks": { "local": { "instance": "", - "process": "cpp, htm", + "process": "cpp, txt", "offset": "0x0" }, - "generic_sequencer_15": { + "generic_sequencer": { "instance": "channel", - "process": "cpp, htm", + "process": "cpp, txt", "offset": "0x20" } }, @@ -48,13 +50,13 @@ "minor_number" : { "type" : "c", "bit_len" : "8", - "reset" : "0x01", + "reset" : "0x00", "description" : "Minor number" }, "major_number" : { "type" : "c", "bit_len" : "8", - "reset" : "0x00", + "reset" : "0x01", "description" : "Major number" }, @@ -217,7 +219,7 @@ }, "fractional_divider_control": { "address": "7", - "width": "8", + "width": "3", "description": "Fractional Divider Control Register", "fields": { "enable": { @@ -234,7 +236,7 @@ }, "udp_min_pos": { "type": "r", - "bit_len": "6", + "bit_len": "1", "reset": "0x0", "description": "Clear the encoder jitter for DIR-1" } @@ -292,7 +294,7 @@ "type": "w", "address": "10", "reset": "0x00", - "width": "32", + "width": "16", "description": "Overdrive event counter" }, "divider_ratio_int": { @@ -313,7 +315,7 @@ "type": "w", "address": "13", "reset": "0x00", - "width": "32", + "width": "10", "description": "Integer part of the Sub-pixel Offset" }, "subpixel_offset_fraction": { diff --git a/generic_ip/pulse_generator/1/src/pulse_generator_1.vhd b/generic_ip/pulse_generator/1/src/pulse_generator_1.vhd index 2e7b59b..4c28034 100644 --- a/generic_ip/pulse_generator/1/src/pulse_generator_1.vhd +++ b/generic_ip/pulse_generator/1/src/pulse_generator_1.vhd @@ -6,7 +6,7 @@ -- Author : Gianmarco Girau -- Company : Global Inkjet Systems -- Created : 2016-10-24 --- Last update: 2018-08-23 +-- Last update: 2018-10-08 -- SVN ID : Git -- Standard : VHDL'93 ------------------------------------------------------------------------------- @@ -88,7 +88,10 @@ architecture rtl of pulse_generator_1 is signal pd_in_d, filt_pd_i, abs_pos_lsb, ch_ctrl_start_req_ii : std_logic := '0'; signal prevent_div_restart, rst_jitter, rst_diag_regs : std_logic; signal fire_req, fire_req_d, fire_req_p : std_logic; + signal mid_cross, mid_crossed, zero_cross : std_logic; + signal close_to_zero, close_to_mid : 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); signal avs_addr : std_logic_vector( 4 downto 0); signal pulse_width, pulse_width_ext, init_v : std_logic_vector( 7 downto 0); @@ -121,9 +124,16 @@ begin pd_pulse <= pd_in and not pd_in_d; - gen_filt_pd <= '1' when pd_pulse = '1' and (first_pd = '1' or (dp_dir_i = '0' and signed(abs_position) > signed(last_pd_pos)) or (dp_dir_i = '1' and signed(abs_position) < signed(last_pd_pos))) else '0'; + gen_filt_pd <= '1' when pd_pulse = '1' and (first_pd = '1' or + (dp_dir_i = '0' and close_to_zero = '1' and signed(abs_position) > signed(last_pd_pos)) or + (dp_dir_i = '0' and close_to_mid = '1' and unsigned(abs_position) > unsigned(last_pd_pos)) or + (dp_dir_i = '1' and close_to_zero = '1' and signed(abs_position) < signed(last_pd_pos)) or + (dp_dir_i = '1' and close_to_mid = '1' and unsigned(abs_position) < unsigned(last_pd_pos))) else '0'; - set_first_pd <= '1' when init_qd = '1' or (dp_dir_i = '0' and upd_max_pos_i = '1') or (dp_dir_i = '1' and upd_min_pos_i = '1') or rst_jitter = '1' else '0'; + close_to_zero <= '1' when abs_position(31 downto 30) = "00" or abs_position(31 downto 30) = "11" else '0'; + close_to_mid <= '1' when abs_position(31 downto 30) = "01" or abs_position(31 downto 30) = "10" else '0'; + + set_first_pd <= '1' when init_qd = '1' or (dp_dir_i = '0' and upd_max_pos_i = '1') or (dp_dir_i = '1' and upd_min_pos_i = '1') or rst_jitter = '1' or (mid_cross = '1' and mid_crossed = '0') else '0'; pPD_JITTER_MNG : process(clk) begin @@ -139,8 +149,17 @@ begin if(set_first_pd = '1' or gen_filt_pd = '1') then last_pd_pos <= abs_position; end if; + abs_pos_msb_old <= abs_position(31 downto 30); + if(init_qd = '1' or zero_cross = '1') then + mid_crossed <= '0'; + elsif(mid_cross = '1') then + mid_crossed <= '1'; + end if; end if; end process pPD_JITTER_MNG; + + mid_cross <= '1' when (dp_dir_i = '0' and abs_position(31 downto 30) = "10" and abs_pos_msb_old = "01") or (dp_dir_i = '1' and abs_position(31 downto 30) = "01" and abs_pos_msb_old = "10") else '0'; + zero_cross <= '1' when (dp_dir_i = '0' and abs_position(31 downto 30) = "00" and abs_pos_msb_old = "11") or (dp_dir_i = '1' and abs_position(31 downto 30) = "11" and abs_pos_msb_old = "00") else '0'; filtered_pd <= filt_pd;