CORE-73 CORE-80 - Some optimizations to EMS and Encoder Multiplier logic
This commit is contained in:
parent
491d84fc17
commit
63ca72f1c2
9 changed files with 124 additions and 62 deletions
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2018-05-24
|
||||
-- Last update: 2019-12-17
|
||||
-- Last update: 2020-01-21
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL 2008
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -27,7 +27,9 @@ use work.ems_0_pkg.all;
|
|||
|
||||
entity ems_0 is
|
||||
generic(
|
||||
GEN_PRINT_START : boolean := false);
|
||||
ADD_ENC_ZP_LOGIC : boolean := true;
|
||||
ADD_MULT_DEBUG_REG : boolean := true;
|
||||
GEN_PRINT_START : boolean := false);
|
||||
port (
|
||||
clk : in std_logic;
|
||||
reset_n : in std_logic := '1';
|
||||
|
|
@ -94,6 +96,7 @@ architecture rtl of ems_0 is
|
|||
signal m_step_pos, m_step_neg : std_logic;
|
||||
signal step_pos_retimed, step_neg_retimed : std_logic;
|
||||
signal init_mult, enable_mult : std_logic;
|
||||
signal add_enc_zp, add_mult_dbg_regs : std_logic;
|
||||
--
|
||||
signal enc_sel : std_logic_vector( 1 downto 0);
|
||||
signal pd_sel, mult_sel, pd_delay_line : std_logic_vector( 2 downto 0);
|
||||
|
|
@ -106,7 +109,7 @@ architecture rtl of ems_0 is
|
|||
signal delta_init, time_out : std_logic_vector(27 downto 0);
|
||||
signal abs_pos_i, abs_pos_init : std_logic_vector(31 downto 0);
|
||||
signal abs_pos_in, abs_pos_vel : std_logic_vector(31 downto 0);
|
||||
signal delta_t : std_logic_vector(39 downto 0);
|
||||
signal delta_t : std_logic_vector(31 downto 0);
|
||||
|
||||
|
||||
begin
|
||||
|
|
@ -129,7 +132,6 @@ begin
|
|||
pd_mux <= rs422_pd when pd_sel(0) = '0' else ttl_pd_i;
|
||||
p1_mux <= rs422_p1 when enc_sel(0) = '0' else ttl_p1;
|
||||
p2_mux <= rs422_p2 when enc_sel(0) = '0' else ttl_p2;
|
||||
zp_mux <= rs422_zp when enc_sel(0) = '0' else ttl_zp;
|
||||
|
||||
-- Filters
|
||||
iPD_FILT: entity work.digital_lpf
|
||||
|
|
@ -180,6 +182,42 @@ begin
|
|||
rEdge => p2_re,
|
||||
fEdge => p2_fe);
|
||||
|
||||
gENC_ZP_FILT: if ADD_ENC_ZP_LOGIC = true generate
|
||||
|
||||
add_enc_zp <= '1';
|
||||
|
||||
zp_mux <= rs422_zp when enc_sel(0) = '0' else ttl_zp;
|
||||
|
||||
iZP_FILT: entity work.digital_lpf
|
||||
generic map (
|
||||
MAX_ORDER => 32,
|
||||
DEFAULT_ORDER => DEFAULT_FILT_ORDER,
|
||||
DEFAULT_HYST => DEFAULT_FILT_HYST)
|
||||
port map (
|
||||
clk => clk,
|
||||
reset_n => reset_n,
|
||||
ld_cfg => ld_filt_cfg_zp,
|
||||
filt_order => filt_order,
|
||||
hyst => filt_hyst,
|
||||
filt_in => zp_mux,
|
||||
filt_out => zp_i);
|
||||
|
||||
-- Buffer the filtered signals
|
||||
pZP_FiltOut_Buf : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
filt_zp <= zp_i;
|
||||
end if;
|
||||
end process pZP_FiltOut_Buf;
|
||||
|
||||
else generate
|
||||
|
||||
add_enc_zp <= '0';
|
||||
|
||||
filt_zp <= '0';
|
||||
|
||||
end generate gENC_ZP_FILT;
|
||||
|
||||
iZP_FILT: entity work.digital_lpf
|
||||
generic map (
|
||||
MAX_ORDER => 32,
|
||||
|
|
@ -201,7 +239,6 @@ begin
|
|||
filt_pd <= pd_i;
|
||||
filt_p1 <= p1_i;
|
||||
filt_p2 <= p2_i;
|
||||
filt_zp <= zp_i;
|
||||
end if;
|
||||
end process pFiltOut_Buf;
|
||||
|
||||
|
|
@ -337,6 +374,36 @@ begin
|
|||
wrap_neg <= wrap_neg_i when use_multiplier = '0' else m_step_neg;
|
||||
|
||||
abs_position <= abs_pos_i;
|
||||
|
||||
gMULT_DBG_REGs: if ADD_MULT_DEBUG_REG = true generate
|
||||
|
||||
add_mult_dbg_regs <= '1';
|
||||
|
||||
pMULT_DBG_REGs : process(clk)
|
||||
begin
|
||||
if(clk = '1' and clk'event) then
|
||||
if(set_pos_i = '1') then
|
||||
abs_pos_in <= abs_pos_init;
|
||||
elsif(step_pos = '1') then
|
||||
abs_pos_in <= std_logic_vector(signed(abs_pos_in)+1);
|
||||
elsif(step_neg = '1') then
|
||||
abs_pos_in <= std_logic_vector(signed(abs_pos_in)-1);
|
||||
end if;
|
||||
if(set_pos_i = '1') then
|
||||
abs_pos_vel <= abs_pos_init;
|
||||
elsif(step_pos_retimed = '1') then
|
||||
abs_pos_vel <= std_logic_vector(signed(abs_pos_vel)+1);
|
||||
elsif(step_neg_retimed = '1') then
|
||||
abs_pos_vel <= std_logic_vector(signed(abs_pos_vel)-1);
|
||||
end if;
|
||||
end if;
|
||||
end process pMULT_DBG_REGs;
|
||||
|
||||
else generate
|
||||
|
||||
add_mult_dbg_regs <= '0';
|
||||
|
||||
end generate gMULT_DBG_REGs;
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
|
@ -514,7 +581,9 @@ begin
|
|||
ld_filt_cfg_pd <= avs_writedata(16);
|
||||
ld_filt_cfg_p1 <= avs_writedata(17);
|
||||
ld_filt_cfg_p2 <= avs_writedata(18);
|
||||
ld_filt_cfg_zp <= avs_writedata(19);
|
||||
if(add_enc_zp = '1') then
|
||||
ld_filt_cfg_zp <= avs_writedata(19);
|
||||
end if;
|
||||
when CSR_MULT_CFG_ADDR =>
|
||||
use_multiplier <= avs_writedata(0);
|
||||
mult_sel <= avs_writedata( 6 downto 4);
|
||||
|
|
@ -575,9 +644,13 @@ begin
|
|||
when CSR_VEL_TIMEOUT_ADDR =>
|
||||
avs_readdata <= X"0" & time_out;
|
||||
when CSR_ABS_POS_IN_ADDR =>
|
||||
avs_readdata <= abs_pos_in;
|
||||
if(add_mult_dbg_regs = '1') then
|
||||
avs_readdata <= abs_pos_in;
|
||||
end if;
|
||||
when CSR_ABS_POS_VEL_ADDR =>
|
||||
avs_readdata <= abs_pos_vel;
|
||||
if(add_mult_dbg_regs = '1') then
|
||||
avs_readdata <= abs_pos_vel;
|
||||
end if;
|
||||
when others =>
|
||||
avs_readdata <= X"BAD1BAD0";
|
||||
end case;
|
||||
|
|
|
|||
|
|
@ -60,9 +60,7 @@ add wave -noupdate /encoder_multiply_tb/iMULT/realign_pos_d
|
|||
add wave -noupdate /encoder_multiply_tb/iMULT/realign_neg
|
||||
add wave -noupdate /encoder_multiply_tb/iMULT/realign_neg_d
|
||||
add wave -noupdate /encoder_multiply_tb/iMULT/norm_pos
|
||||
add wave -noupdate /encoder_multiply_tb/iMULT/norm_pos_d
|
||||
add wave -noupdate /encoder_multiply_tb/iMULT/norm_neg
|
||||
add wave -noupdate /encoder_multiply_tb/iMULT/norm_neg_d
|
||||
add wave -noupdate -radix decimal /encoder_multiply_tb/iMULT/pulse_cnt
|
||||
add wave -noupdate -radix decimal /encoder_multiply_tb/iMULT/m_pulse_cnt
|
||||
add wave -noupdate -radix unsigned /encoder_multiply_tb/iMULT/m_norm_value
|
||||
|
|
@ -81,6 +79,7 @@ add wave -noupdate -radix unsigned /encoder_multiply_tb/iSPEED/time_out
|
|||
add wave -noupdate /encoder_multiply_tb/iSPEED/step_pos
|
||||
add wave -noupdate /encoder_multiply_tb/iSPEED/step_neg
|
||||
add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED/delta_t
|
||||
add wave -noupdate /encoder_multiply_tb/iSPEED/enforce_delta_min
|
||||
add wave -noupdate /encoder_multiply_tb/iSPEED/step_pos_out
|
||||
add wave -noupdate /encoder_multiply_tb/iSPEED/step_neg_out
|
||||
add wave -noupdate /encoder_multiply_tb/iSPEED/time_out_flag
|
||||
|
|
@ -140,4 +139,4 @@ configure wave -griddelta 40
|
|||
configure wave -timeline 0
|
||||
configure wave -timelineunits ps
|
||||
update
|
||||
WaveRestoreZoom {989186793 ps} {2009434857 ps}
|
||||
WaveRestoreZoom {35459995308 ps} {37500491436 ps}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2019-02-27
|
||||
-- Last update: 2019-04-25
|
||||
-- Last update: 2020-01-21
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
-- enable : do not update the internal state when '0'
|
||||
-- mult_sel: mult_value = 2**mult_sel => max is 7
|
||||
-- delta_t : average time difference between pulses, with signed magnitude,
|
||||
-- fixed point representation (8 bits mantissa), top bit is the sign:
|
||||
-- top bit is the sign:
|
||||
-- 0 => avg time between pos steps, 1 => avg time between neg steps
|
||||
-- step_pos_in : positive encoder step, before multiplication
|
||||
-- step_neg_in : negative encoder step, before multiplication
|
||||
|
|
@ -40,7 +40,7 @@ entity encoder_multiply_0 is
|
|||
init : in std_logic;
|
||||
enable : in std_logic;
|
||||
mult_sel : in std_logic_vector( 2 downto 0);
|
||||
delta_t : in std_logic_vector(39 downto 0);
|
||||
delta_t : in std_logic_vector(31 downto 0);
|
||||
step_pos_in : in std_logic;
|
||||
step_neg_in : in std_logic;
|
||||
step_pos_out : out std_logic;
|
||||
|
|
@ -202,8 +202,8 @@ begin
|
|||
step_pos <= step_pos_in and enable;
|
||||
step_neg <= step_neg_in and enable;
|
||||
|
||||
delta_t_i <= delta_t(38 downto 8);
|
||||
sign_i <= delta_t(39);
|
||||
delta_t_i <= delta_t(30 downto 0);
|
||||
sign_i <= delta_t(31);
|
||||
|
||||
time_cnt_tc <= '1' when unsigned(time_cnt) = 1 else '0';
|
||||
|
||||
|
|
@ -215,11 +215,11 @@ begin
|
|||
m_step_neg <= '1' when realign_neg_i = '1' or (sign = '1' and (kickoff = '1' or (time_cnt_tc = '1' and delta_m_pos = '1'))) else '0';
|
||||
|
||||
kickoff <= pending_kickoff and (step_pos or step_neg);
|
||||
|
||||
norm_pos <= '1' when step_pos = '1' and signed(pulse_cnt) >= 2*NORM_VALUE else '0';
|
||||
norm_neg <= '1' when step_neg = '1' and signed(pulse_cnt) <= -2*NORM_VALUE else '0';
|
||||
|
||||
norm_pos <= '1' when step_pos = '1' and signed(pulse_cnt)-2*NORM_VALUE >= 0 else '0';
|
||||
norm_neg <= '1' when step_neg = '1' and signed(pulse_cnt)+2*NORM_VALUE <= 0 else '0';
|
||||
|
||||
delta_m_pos <= '1' when signed(delta_m) > 0 else '0';
|
||||
delta_m_neg <= '1' when signed(delta_m) < 0 else '0';
|
||||
delta_m_neg <= delta_m(delta_m'left);
|
||||
|
||||
end architecture rtl;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2019-02-27
|
||||
-- Last update: 2019-11-22
|
||||
-- Last update: 2020-01-21
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -46,7 +46,7 @@ entity encoder_speed_detect_0 is
|
|||
time_out : in std_logic_vector(27 downto 0);
|
||||
step_pos : in std_logic;
|
||||
step_neg : in std_logic;
|
||||
delta_t : out std_logic_vector(39 downto 0);
|
||||
delta_t : out std_logic_vector(31 downto 0);
|
||||
step_pos_out : out std_logic;
|
||||
step_neg_out : out std_logic;
|
||||
time_out_flag : out std_logic);
|
||||
|
|
@ -75,6 +75,7 @@ architecture rtl of encoder_speed_detect_0 is
|
|||
signal loc_time, time_out_cnt : std_logic_vector(27 downto 0);
|
||||
signal time_diff : std_logic_vector(29 downto 0);
|
||||
signal time_diff_i, delta_t_i : std_logic_vector(30 downto 0);
|
||||
signal delta_t_min_check : std_logic_vector(30 downto 0);
|
||||
signal new_tag, tag_last_i, gnd_32 : std_logic_vector(31 downto 0);
|
||||
signal tag_first, tag_last : std_logic_vector(31 downto 0);
|
||||
|
||||
|
|
@ -205,12 +206,12 @@ begin
|
|||
last_step_type <= step_type;
|
||||
end if;
|
||||
if(init_i = '1') then
|
||||
delta_t <= "0000" & delta_init & 8x"0";
|
||||
delta_t <= "0000" & delta_init;
|
||||
elsif(data_valid(data_valid'left) = '1') then
|
||||
if(first_step = '1' or enforce_delta_min = '1' or last_step_type /= step_balance(step_balance'left)) then
|
||||
delta_t <= last_step_type & 3x"0" & delta_init & 8x"0";
|
||||
delta_t <= last_step_type & 3x"0" & delta_init;
|
||||
else
|
||||
delta_t <= step_balance(step_balance'left) & delta_t_i & 8x"0";
|
||||
delta_t <= step_balance(step_balance'left) & delta_t_i;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
|
@ -232,7 +233,9 @@ begin
|
|||
inc_last <= new_step;
|
||||
inc_first <= new_step and (not avg_transient_on);
|
||||
|
||||
enforce_delta_min <= '1' when unsigned(delta_t_i) < unsigned(delta_init) else '0';
|
||||
--enforce_delta_min <= '1' when unsigned(delta_t_i) < unsigned(delta_init) else '0';
|
||||
delta_t_min_check <= std_logic_vector(unsigned(delta_t_i) - unsigned(delta_init));
|
||||
enforce_delta_min <= delta_t_min_check(delta_t_min_check'left);
|
||||
|
||||
-- This RAM is for storing tag (time and encoder step-type
|
||||
iTIMING_RAM: entity work.dpram_sclk
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2019-03-05
|
||||
-- Last update: 2019-04-25
|
||||
-- Last update: 2020-01-21
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -67,8 +67,8 @@ architecture behav of encoder_multiply_tb is
|
|||
signal init : std_logic;
|
||||
signal enable : std_logic;
|
||||
signal mult_sel : std_logic_vector(2 downto 0);
|
||||
signal delta_t : std_logic_vector(39 downto 0);
|
||||
signal delta_t_i : std_logic_vector(39 downto 0);
|
||||
signal delta_t : std_logic_vector(31 downto 0);
|
||||
signal delta_t_i : std_logic_vector(31 downto 0);
|
||||
signal avg_steps : std_logic_vector( 6 downto 0);
|
||||
signal delta_init : std_logic_vector(27 downto 0);
|
||||
signal time_out : std_logic_vector(27 downto 0);
|
||||
|
|
@ -159,7 +159,7 @@ architecture behav of encoder_multiply_tb is
|
|||
dir : in std_logic;
|
||||
max_steps : in natural;
|
||||
signal enable : out std_logic;
|
||||
signal delta_t : out std_logic_vector(39 downto 0);
|
||||
signal delta_t : out std_logic_vector(31 downto 0);
|
||||
signal step_pos : out std_logic;
|
||||
signal step_neg : out std_logic;
|
||||
init : in boolean := false) is
|
||||
|
|
@ -187,9 +187,9 @@ architecture behav of encoder_multiply_tb is
|
|||
|
||||
-- set the initial velocity estimation
|
||||
if(init = true) then
|
||||
delta_t(delta_t'left-1 downto 0) <=std_logic_vector(to_unsigned(integer(maximum(DELTA_TMIN,2*MULT_VALUE))*256, 39));
|
||||
delta_t(delta_t'left-1 downto 0) <=std_logic_vector(to_unsigned(integer(maximum(DELTA_TMIN,2*MULT_VALUE)), 31));
|
||||
else
|
||||
delta_t(delta_t'left-1 downto 0) <= std_logic_vector(to_unsigned(integer(t_period*100.0*256.0), delta_t'left));
|
||||
delta_t(delta_t'left-1 downto 0) <= std_logic_vector(to_unsigned(integer(t_period*100.0), delta_t'left));
|
||||
end if;
|
||||
delta_t(delta_t'left) <= dir;
|
||||
wait_clk_cycles(1);
|
||||
|
|
@ -213,7 +213,7 @@ architecture behav of encoder_multiply_tb is
|
|||
if(now-t_ref > (1.0 us)*(real(step_cnt)*t_period)) then
|
||||
wait until clk = '1' and clk'event;
|
||||
-- issue the next step
|
||||
delta_t(delta_t'left-1 downto 0) <= std_logic_vector(to_unsigned(integer(t_period*100.0*256.0), delta_t'left));
|
||||
delta_t(delta_t'left-1 downto 0) <= std_logic_vector(to_unsigned(integer(t_period*100.0), delta_t'left));
|
||||
delta_t(delta_t'left) <= dir;
|
||||
if(dir = '0') then
|
||||
step_pos <= '1';
|
||||
|
|
@ -246,7 +246,7 @@ architecture behav of encoder_multiply_tb is
|
|||
max_steps : in natural;
|
||||
period_noise : in natural range 0 to 100;
|
||||
signal enable : out std_logic;
|
||||
signal delta_t : out std_logic_vector(39 downto 0);
|
||||
signal delta_t : out std_logic_vector(31 downto 0);
|
||||
signal step_pos : out std_logic;
|
||||
signal step_neg : out std_logic;
|
||||
init : in boolean := false) is
|
||||
|
|
@ -276,9 +276,9 @@ architecture behav of encoder_multiply_tb is
|
|||
|
||||
-- set the initial velocity estimation
|
||||
if(init = true) then
|
||||
delta_t(delta_t'left-1 downto 0) <=std_logic_vector(to_unsigned(maximum(DELTA_TMIN,2*MULT_VALUE)*256, 39));
|
||||
delta_t(delta_t'left-1 downto 0) <=std_logic_vector(to_unsigned(maximum(DELTA_TMIN,2*MULT_VALUE), 31));
|
||||
else
|
||||
delta_t(delta_t'left-1 downto 0) <= std_logic_vector(to_unsigned(integer(t_period*100.0*256.0), delta_t'left));
|
||||
delta_t(delta_t'left-1 downto 0) <= std_logic_vector(to_unsigned(integer(t_period*100.0), delta_t'left));
|
||||
end if;
|
||||
delta_t(delta_t'left) <= dir;
|
||||
wait_clk_cycles(1);
|
||||
|
|
@ -303,7 +303,7 @@ architecture behav of encoder_multiply_tb is
|
|||
if(now-t_ref > (1.0 us)*((real(step_cnt-1)+((100.0+real(delta_period))/100.0))*t_period)) then
|
||||
wait until clk = '1' and clk'event;
|
||||
-- issue the next step
|
||||
delta_t(delta_t'left-1 downto 0) <= std_logic_vector(to_unsigned(integer(t_period*100.0*256.0), delta_t'left));
|
||||
delta_t(delta_t'left-1 downto 0) <= std_logic_vector(to_unsigned(integer(t_period*100.0), delta_t'left));
|
||||
delta_t(delta_t'left) <= dir;
|
||||
if(dir = '0') then
|
||||
step_pos <= '1';
|
||||
|
|
@ -340,7 +340,7 @@ architecture behav of encoder_multiply_tb is
|
|||
period_noise : in natural range 0 to 100;
|
||||
*/
|
||||
signal enable : out std_logic;
|
||||
signal delta_t : out std_logic_vector(39 downto 0);
|
||||
signal delta_t : out std_logic_vector(31 downto 0);
|
||||
signal step_pos : out std_logic;
|
||||
signal step_neg : out std_logic;
|
||||
init : in boolean := false) is
|
||||
|
|
@ -378,9 +378,9 @@ architecture behav of encoder_multiply_tb is
|
|||
|
||||
-- set the initial velocity estimation
|
||||
if(init = true) then
|
||||
delta_t(delta_t'left-1 downto 0) <=std_logic_vector(to_unsigned(maximum(DELTA_TMIN,2*MULT_VALUE)*256, 39));
|
||||
delta_t(delta_t'left-1 downto 0) <=std_logic_vector(to_unsigned(maximum(DELTA_TMIN,2*MULT_VALUE), 31));
|
||||
else
|
||||
delta_t(delta_t'left-1 downto 0) <= std_logic_vector(to_unsigned(integer(t_period*100.0*256.0), delta_t'left));
|
||||
delta_t(delta_t'left-1 downto 0) <= std_logic_vector(to_unsigned(integer(t_period*100.0), delta_t'left));
|
||||
end if;
|
||||
delta_t(delta_t'left) <= dir;
|
||||
wait_clk_cycles(1);
|
||||
|
|
@ -543,7 +543,7 @@ begin -- architecture behav
|
|||
end if;
|
||||
end process pGEN_POS;
|
||||
|
||||
delta_t_norm <= to_integer(unsigned(delta_t_i(38 downto 8))) when delta_t_i(39) = '0' else -1*to_integer(unsigned(delta_t_i(38 downto 8)));
|
||||
delta_t_norm <= to_integer(unsigned(delta_t_i(30 downto 0))) when delta_t_i(31) = '0' else -1*to_integer(unsigned(delta_t_i(30 downto 0)));
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Testbench Logic
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : GMG
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2019-03-05
|
||||
-- Last update: 2019-04-18
|
||||
-- Last update: 2020-01-21
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'2008
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -67,7 +67,7 @@ architecture behav of encoder_speed_detect_tb is
|
|||
signal time_out : std_logic_vector(27 downto 0);
|
||||
signal step_pos : std_logic;
|
||||
signal step_neg : std_logic;
|
||||
signal delta_t : std_logic_vector(39 downto 0);
|
||||
signal delta_t : std_logic_vector(31 downto 0);
|
||||
signal step_pos_out : std_logic;
|
||||
signal step_neg_out : std_logic;
|
||||
signal time_out_flag : std_logic;
|
||||
|
|
@ -433,7 +433,7 @@ begin -- architecture behav
|
|||
end if;
|
||||
end process pGEN_POS;
|
||||
|
||||
delta_t_norm <= to_integer(unsigned(delta_t(38 downto 8))) when delta_t(39) = '0' else -1*to_integer(unsigned(delta_t(38 downto 8)));
|
||||
delta_t_norm <= to_integer(unsigned(delta_t(30 downto 0))) when delta_t(31) = '0' else -1*to_integer(unsigned(delta_t(30 downto 0)));
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Testbench Logic
|
||||
|
|
|
|||
|
|
@ -52,8 +52,6 @@ add wave -noupdate /led_tb/iUUT/enc_p1_d
|
|||
add wave -noupdate /led_tb/iUUT/enc_p2_d
|
||||
add wave -noupdate /led_tb/iUUT/one_ms_pulse
|
||||
add wave -noupdate /led_tb/iUUT/pd_event
|
||||
add wave -noupdate /led_tb/iUUT/p1_prev_event
|
||||
add wave -noupdate /led_tb/iUUT/p2_prev_event
|
||||
add wave -noupdate /led_tb/iUUT/pd_cnt_zero_flag
|
||||
add wave -noupdate /led_tb/iUUT/rst_pd_green
|
||||
add wave -noupdate /led_tb/iUUT/pd_red
|
||||
|
|
@ -102,4 +100,4 @@ configure wave -griddelta 40
|
|||
configure wave -timeline 0
|
||||
configure wave -timelineunits ps
|
||||
update
|
||||
WaveRestoreZoom {0 ps} {16252698624 ps}
|
||||
WaveRestoreZoom {33524561308 ps} {49777259932 ps}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-- Author : Gianmarco Girau
|
||||
-- Company : Global Inkjet Systems
|
||||
-- Created : 2017-09-06
|
||||
-- Last update: 2020-01-17
|
||||
-- Last update: 2020-01-21
|
||||
-- SVN ID : Git
|
||||
-- Standard : VHDL'08
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -597,7 +597,9 @@ begin
|
|||
|
||||
iEMS : entity work.ems_0
|
||||
generic map(
|
||||
GEN_PRINT_START => false)
|
||||
ADD_ENC_ZP_LOGIC => false,
|
||||
ADD_MULT_DEBUG_REG => false,
|
||||
GEN_PRINT_START => false)
|
||||
port map (
|
||||
clk => clk,
|
||||
reset_n => reset_n_i,
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ architecture rtl of seb_epd_led_gen_5 is
|
|||
constant END_GREEN_PERIOD_MS : natural := MAX_PERIOD_MS - GREEN_PERIOD_MS;
|
||||
|
||||
signal pd_d, enc_p1_d, enc_p2_d, one_ms_pulse : std_logic;
|
||||
signal p1_prev_event, p2_prev_event : std_logic;
|
||||
signal pd_cnt_zero_flag, rst_pd_green, pd_red, pd_green : std_logic;
|
||||
signal p1_event, p2_event, p1_cnt_zero_flag : std_logic;
|
||||
signal p2_cnt_zero_flag, pd_event, rst_pof_green : std_logic;
|
||||
|
|
@ -146,21 +145,9 @@ begin
|
|||
p1_green <= '0';
|
||||
p2_red <= '0';
|
||||
p2_green <= '0';
|
||||
p1_prev_event <= '0';
|
||||
p2_prev_event <= '0';
|
||||
p1_active <= '0';
|
||||
p2_active <= '0';
|
||||
elsif(clk = '1' and clk'event) then
|
||||
if(init = '1' or (p1_cnt_zero_flag = '1' and p1_event = '0')) then
|
||||
p1_prev_event <= '0';
|
||||
elsif(p1_event = '1') then
|
||||
p1_prev_event <= p1_event;
|
||||
end if;
|
||||
if(init = '1' or (p2_cnt_zero_flag = '1' and p2_event = '0')) then
|
||||
p2_prev_event <= '0';
|
||||
elsif(p2_event = '1') then
|
||||
p2_prev_event <= p2_event;
|
||||
end if;
|
||||
if(init = '1') then
|
||||
p1_cnt <= (others => '0');
|
||||
elsif(p1_event = '1' and p1_red = '0') then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue