diff --git a/generic_ip/encoder_multiply/0/sim/sim_enc_mult.do b/generic_ip/encoder_multiply/0/sim/sim_enc_mult.do index ae41735..4a320e7 100644 --- a/generic_ip/encoder_multiply/0/sim/sim_enc_mult.do +++ b/generic_ip/encoder_multiply/0/sim/sim_enc_mult.do @@ -19,7 +19,7 @@ vmap work ./work # Compile the UUT vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd vcom -2008 -work $WORKLIB $COMMON_PATH/dpram_sclk.vhd -vcom -2008 -work $WORKLIB ./../src/intel/divider.vhd +vcom -2008 -work $WORKLIB ./../src/intel/divider_0.vhd vcom -2008 -work $WORKLIB ./../src/encoder_speed_detect_0.vhd vcom -2008 -work $WORKLIB ./../src/encoder_multiply_0.vhd diff --git a/generic_ip/encoder_multiply/0/sim/sim_speed_detect.do b/generic_ip/encoder_multiply/0/sim/sim_speed_detect.do index d4b0bbf..1ca696e 100644 --- a/generic_ip/encoder_multiply/0/sim/sim_speed_detect.do +++ b/generic_ip/encoder_multiply/0/sim/sim_speed_detect.do @@ -19,7 +19,8 @@ vmap work ./work # Compile the UUT vcom -2008 -work $WORKLIB $COMMON_PATH/common_pkg.vhd vcom -2008 -work $WORKLIB $COMMON_PATH/dpram_sclk.vhd -vcom -2008 -work $WORKLIB ./../src/intel/divider.vhd +vcom -2008 -work $WORKLIB ./../src/intel/divider_0.vhd +#vcom -2008 -work $WORKLIB ./../src/serial_divide_uu.vhd vcom -2008 -work $WORKLIB ./../src/encoder_speed_detect_0.vhd # Compile the constrained random related packages diff --git a/generic_ip/encoder_multiply/0/sim/wave_enc_mult.do b/generic_ip/encoder_multiply/0/sim/wave_enc_mult.do index 6b54678..d052f64 100644 --- a/generic_ip/encoder_multiply/0/sim/wave_enc_mult.do +++ b/generic_ip/encoder_multiply/0/sim/wave_enc_mult.do @@ -49,8 +49,13 @@ add wave -noupdate /encoder_multiply_tb/iMULT/pending_kickoff add wave -noupdate /encoder_multiply_tb/iMULT/sign add wave -noupdate /encoder_multiply_tb/iMULT/sign_i add wave -noupdate /encoder_multiply_tb/iMULT/time_cnt_tc +add wave -noupdate /encoder_multiply_tb/iMULT/delay_vect +add wave -noupdate /encoder_multiply_tb/iMULT/realign_pos_i +add wave -noupdate /encoder_multiply_tb/iMULT/realign_neg_i add wave -noupdate /encoder_multiply_tb/iMULT/realign_pos +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 @@ -110,7 +115,7 @@ add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED/tag_last_i add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED/tag_first add wave -noupdate -radix hexadecimal /encoder_multiply_tb/iSPEED/tag_last TreeUpdate [SetDefaultTree] -WaveRestoreCursors {{Cursor 1} {2725654906 ps} 0} +WaveRestoreCursors {{Cursor 1} {1702355000 ps} 0} quietly wave cursor active 1 configure wave -namecolwidth 260 configure wave -valuecolwidth 126 @@ -126,4 +131,4 @@ configure wave -griddelta 40 configure wave -timeline 0 configure wave -timelineunits ps update -WaveRestoreZoom {0 ps} {8161984512 ps} +WaveRestoreZoom {16300524428 ps} {32624493452 ps} diff --git a/generic_ip/encoder_multiply/0/sim/wave_enc_speed_detect.do b/generic_ip/encoder_multiply/0/sim/wave_enc_speed_detect.do index 4d52b6b..bf78b9c 100644 --- a/generic_ip/encoder_multiply/0/sim/wave_enc_speed_detect.do +++ b/generic_ip/encoder_multiply/0/sim/wave_enc_speed_detect.do @@ -57,13 +57,16 @@ add wave -noupdate -radix unsigned /encoder_speed_detect_tb/iUUT/last_addr add wave -noupdate -radix unsigned /encoder_speed_detect_tb/iUUT/loc_time add wave -noupdate -radix unsigned /encoder_speed_detect_tb/iUUT/time_diff_i add wave -noupdate -radix unsigned /encoder_speed_detect_tb/iUUT/delta_t_i +add wave -noupdate -radix unsigned /encoder_speed_detect_tb/iUUT/delta_t_ii +add wave -noupdate -radix unsigned /encoder_speed_detect_tb/iUUT/delta_t_iii +add wave -noupdate /encoder_speed_detect_tb/iUUT/div_done add wave -noupdate -radix decimal /encoder_speed_detect_tb/iUUT/time_diff add wave -noupdate -radix unsigned /encoder_speed_detect_tb/iUUT/tag_last_i add wave -noupdate -radix hexadecimal /encoder_speed_detect_tb/iUUT/new_tag add wave -noupdate -radix hexadecimal /encoder_speed_detect_tb/iUUT/tag_first add wave -noupdate -radix hexadecimal /encoder_speed_detect_tb/iUUT/tag_last TreeUpdate [SetDefaultTree] -WaveRestoreCursors {{Cursor 1} {10535000 ps} 0} +WaveRestoreCursors {{Cursor 1} {20565000 ps} 0} quietly wave cursor active 1 configure wave -namecolwidth 330 configure wave -valuecolwidth 145 @@ -79,4 +82,4 @@ configure wave -griddelta 40 configure wave -timeline 0 configure wave -timelineunits ps update -WaveRestoreZoom {1695718995 ps} {2649693779 ps} +WaveRestoreZoom {0 ps} {1907949568 ps} diff --git a/generic_ip/encoder_multiply/0/src/encoder_multiply_0.vhd b/generic_ip/encoder_multiply/0/src/encoder_multiply_0.vhd index 36f0a9b..3452c90 100644 --- a/generic_ip/encoder_multiply/0/src/encoder_multiply_0.vhd +++ b/generic_ip/encoder_multiply/0/src/encoder_multiply_0.vhd @@ -6,7 +6,7 @@ -- Author : Gianmarco Girau -- Company : Global Inkjet Systems -- Created : 2019-02-27 --- Last update: 2019-03-19 +-- Last update: 2019-03-20 -- SVN ID : Git -- Standard : VHDL'2008 ------------------------------------------------------------------------------- @@ -48,15 +48,6 @@ end encoder_multiply_0; architecture rtl of encoder_multiply_0 is - /* - function compute_mult(mult_sel : std_logic_vector(2 downto 0)) return std_logic_vector(7 downto 0) is - variable mult_value : std_logic_vector(7 downto 0); - begin - mult_value := (0 => '1', others => '0') sll(to_integer(unsigned(mult_sel))); - return mult_value; - end function compute_mult; - */ - -- number of bits to represent the maximum multiplication value (e.g. 8 => M = 128) constant MULT_W : natural := 8; -- Number of bits used to represent the encoder pulse count, before the multiplication @@ -66,38 +57,79 @@ architecture rtl of encoder_multiply_0 is -- To prevent counter saturation, subtract a fixed amount each time the -- counters exceed a given value - constant NORM_VALUE : natural := 2**(PULSE_CNT_W-3); - + constant NORM_VALUE : natural := 2**(PULSE_CNT_W-3); + subtype shft_left_vec_t is std_logic_vector(M_PULSE_CNT_W-1 downto 0); + subtype shft_right_vec_t is std_logic_vector(30 downto 0); + + function shift_left(operand : shft_left_vec_t; shf_val : natural range 0 to 7) return shft_left_vec_t is + variable result : shft_left_vec_t; + begin + result := operand; + /* + for n in 1 to shf_val loop + result := result(operand'left-1 downto 0) & '0'; + end loop; -- n + */ + for n in 1 to 7 loop + if(n <= shf_val) then + result := result(operand'left-1 downto 0) & '0'; + end if; + end loop; -- n + return result; + end function shift_left; + + function shift_right(operand : shft_right_vec_t; shf_val : natural range 0 to 7) return shft_right_vec_t is + variable result : shft_right_vec_t; + begin + result := operand; + /* + for n in 1 to shf_val loop + result := result(operand'left) & result(operand'left downto 1); + end loop; -- n + */ + for n in 1 to 7 loop + if(n <= shf_val) then + result := result(operand'left) & result(operand'left downto 1); + end if; + end loop; -- n + return result; + end function shift_right; - signal init_d, step_pos, step_neg : std_logic; - signal m_step_pos, m_step_neg : std_logic; - signal sign, sign_i : std_logic; - signal time_cnt_tc : std_logic; - signal norm_pos, norm_pos_d : std_logic; - signal norm_neg, norm_neg_d : std_logic; - signal kickoff, pending_kickoff : std_logic; - signal realign_pos, realign_neg : std_logic; - signal mult_val : std_logic_vector(MULT_W-1 downto 0); - signal pulse_cnt : std_logic_vector(PULSE_CNT_W-1 downto 0); - signal m_pulse_cnt, m_norm_value : std_logic_vector(M_PULSE_CNT_W-1 downto 0); - signal delta_m : std_logic_vector(M_PULSE_CNT_W downto 0); - signal time_cnt : std_logic_vector(27 downto 0); - signal m_delta_t : std_logic_vector(30 downto 0); - signal delta_t_i : std_logic_vector(30 downto 0); + signal init_d, step_pos, step_neg : std_logic; + signal m_step_pos, m_step_neg : std_logic; + signal sign, sign_i : std_logic; + signal time_cnt_tc : std_logic; + signal norm_pos, norm_pos_d : std_logic; + signal norm_neg, norm_neg_d : std_logic; + signal kickoff, pending_kickoff : std_logic; + signal realign_pos, realign_neg : std_logic; + signal realign_pos_d, realign_neg_d : std_logic; + signal realign_pos_i, realign_neg_i : std_logic; + signal delay_vect : std_logic_vector(3 downto 0); + --signal mult_val : std_logic_vector(MULT_W-1 downto 0); + signal pulse_cnt : std_logic_vector(PULSE_CNT_W-1 downto 0); + signal m_pulse_cnt, m_norm_value : std_logic_vector(M_PULSE_CNT_W-1 downto 0); + signal delta_m : std_logic_vector(M_PULSE_CNT_W downto 0); + signal time_cnt : std_logic_vector(27 downto 0); + signal m_delta_t : std_logic_vector(30 downto 0); + signal delta_t_i : std_logic_vector(30 downto 0); begin + /* pSEQ_LOGIC_RST : process(reset_n, clk) begin if(reset_n = '0') then mult_val <= (0 => '1', others => '0'); elsif(clk = '1' and clk'event) then if(init_d = '1') then - mult_val <= std_logic_vector(to_unsigned(1, MULT_W)) sll(to_integer(unsigned(mult_sel))); + --mult_val <= std_logic_vector(to_unsigned(1, MULT_W) sla(to_integer(unsigned(mult_sel)))); + mult_val <= shift_left(std_logic_vector(to_unsigned(1, MULT_W)),to_integer(unsigned(mult_sel))); end if; end if; end process pSEQ_LOGIC_RST; + */ pSEQ_LOGIC : process(clk) variable mult_pulse_cnt : std_logic_vector(M_PULSE_CNT_W-1 downto 0); @@ -136,18 +168,43 @@ begin elsif(time_cnt_tc = '0') then time_cnt <= std_logic_vector(unsigned(time_cnt)-1); end if; - m_delta_t <= delta_t_i srl to_integer(unsigned(mult_sel)); + --m_delta_t <= std_logic_vector(unsigned(delta_t_i) sra to_integer(unsigned(mult_sel))); + m_delta_t <= shift_right(std_logic_vector(unsigned(delta_t_i)), to_integer(unsigned(mult_sel))); sign <= sign_i; - mult_pulse_cnt := std_logic_vector(resize(signed(pulse_cnt), M_PULSE_CNT_W)) sll to_integer(signed('0' & mult_sel)); + --mult_pulse_cnt := std_logic_vector(resize(signed(pulse_cnt), M_PULSE_CNT_W) sla to_integer(signed('0' & mult_sel))); + mult_pulse_cnt := shift_left(std_logic_vector(resize(signed(pulse_cnt), M_PULSE_CNT_W)),to_integer(signed('0' & mult_sel))); delta_m <= std_logic_vector(resize(signed(m_pulse_cnt),delta_m'length) - resize(signed(mult_pulse_cnt),delta_m'length)); + if(m_step_pos = '1' or m_step_neg = '1') then + delay_vect <= (others => '1'); + else + delay_vect <= '0' & delay_vect(3 downto 1); + end if; + --if(delay_vect(0) = '0' and signed(delta_m) = ((to_signed(-1, M_PULSE_CNT_W)) sla(to_integer(unsigned(mult_sel))+2))) then + if(delay_vect(0) = '0' and signed(delta_m) = signed(shift_left(std_logic_vector(to_signed(-4, M_PULSE_CNT_W)), to_integer(unsigned(mult_sel))))) then + realign_pos <= '1'; + else + realign_pos <= '0'; + end if; + --if(delay_vect(0) = '0' and signed(delta_m) = ((to_signed(1, M_PULSE_CNT_W)) sla(to_integer(unsigned(mult_sel))+2))) then + if(delay_vect(0) = '0' and signed(delta_m) = signed(shift_left(std_logic_vector(to_signed(4, M_PULSE_CNT_W)), to_integer(unsigned(mult_sel))))) then + realign_neg <= '1'; + else + realign_neg <= '0'; + end if; + realign_pos_d <= realign_pos; + realign_neg_d <= realign_neg; step_pos_out <= m_step_pos; step_neg_out <= m_step_neg; norm_pos_d <= norm_pos; norm_neg_d <= norm_neg; - m_norm_value <= std_logic_vector(to_unsigned(NORM_VALUE, M_PULSE_CNT_W)) sll (to_integer(unsigned(mult_sel))); + --m_norm_value <= std_logic_vector(to_unsigned(NORM_VALUE, M_PULSE_CNT_W) sla (to_integer(unsigned(mult_sel)))); + m_norm_value <= shift_left(std_logic_vector(to_unsigned(NORM_VALUE, M_PULSE_CNT_W)), to_integer(unsigned(mult_sel))); end if; end process pSEQ_LOGIC; + realign_pos_i <= realign_pos and not realign_pos_d; + realign_neg_i <= realign_neg and not realign_neg_d; + step_pos <= step_pos_in and enable; step_neg <= step_neg_in and enable; @@ -156,13 +213,8 @@ begin time_cnt_tc <= '1' when unsigned(time_cnt) = 1 else '0'; - --realign_pos <= '1' when signed(delta_m) = -4 else '0'; - --realign_neg <= '1' when signed(delta_m) = +4 else '0'; - realign_pos <= '1' when signed(delta_m) = ((to_signed(-1, M_PULSE_CNT_W)) sll(to_integer(unsigned(mult_sel))+2)) else '0'; - realign_neg <= '1' when signed(delta_m) = ((to_signed(1, M_PULSE_CNT_W)) sll(to_integer(unsigned(mult_sel))+2)) else '0'; - - m_step_pos <= '1' when sign = '0' and (kickoff = '1' or realign_pos = '1' or (time_cnt_tc = '1' and signed(delta_m) < 0)) else '0'; - m_step_neg <= '1' when sign = '1' and (kickoff = '1' or realign_neg = '1' or (time_cnt_tc = '1' and signed(delta_m) > 0)) else '0'; + m_step_pos <= '1' when sign = '0' and (kickoff = '1' or realign_pos_i = '1' or (time_cnt_tc = '1' and signed(delta_m) < 0)) else '0'; + m_step_neg <= '1' when sign = '1' and (kickoff = '1' or realign_neg_i = '1' or (time_cnt_tc = '1' and signed(delta_m) > 0)) else '0'; kickoff <= pending_kickoff and (step_pos or step_neg); diff --git a/generic_ip/encoder_multiply/0/src/encoder_speed_detect_0.vhd b/generic_ip/encoder_multiply/0/src/encoder_speed_detect_0.vhd index 49a71e2..8d8f9db 100644 --- a/generic_ip/encoder_multiply/0/src/encoder_speed_detect_0.vhd +++ b/generic_ip/encoder_multiply/0/src/encoder_speed_detect_0.vhd @@ -6,7 +6,7 @@ -- Author : Gianmarco Girau -- Company : Global Inkjet Systems -- Created : 2019-02-27 --- Last update: 2019-03-19 +-- Last update: 2019-03-22 -- SVN ID : Git -- Standard : VHDL'2008 ------------------------------------------------------------------------------- @@ -53,6 +53,20 @@ end encoder_speed_detect_0; architecture rtl of encoder_speed_detect_0 is + -- number of pipeline stages for the divider + constant DIV_PIPE_STAGES : natural := 1; + -- multicycle-path clock cycles + constant DIV_MULTICYCLE_PATH_N : natural := 4; + + attribute altera_attribute : string; + attribute altera_attribute of rtl : architecture is + "-name SDC_STATEMENT ""set_multicycle_path -from {*iDIVIDE|lpm_divide*} -to {*:iVEL_MEAS|delta_t[*]*} -setup 4 -end""; " & + "-name SDC_STATEMENT ""set_multicycle_path -from {*iVEL_MEAS|step_bal_m1[*]} -to {*iDIVIDE|lpm_divide*} -setup -end 4""; " & + "-name SDC_STATEMENT ""set_multicycle_path -from {*iVEL_MEAS|time_diff_i[*]} -to {*iDIVIDE|lpm_divide*} -setup -end 4""; " & + "-name SDC_STATEMENT ""set_multicycle_path -from {*iDIVIDE|lpm_divide*} -to {*:iVEL_MEAS|delta_t[*]*} -hold -end 3""; " & + "-name SDC_STATEMENT ""set_multicycle_path -from {*iVEL_MEAS|step_bal_m1[*]} -to {*iDIVIDE|lpm_divide*} -hold -end 3""; " & + "-name SDC_STATEMENT ""set_multicycle_path -from {*iVEL_MEAS|time_diff_i[*]} -to {*iDIVIDE|lpm_divide*} -hold -end 3"""; + signal step_type, step_pos_i, step_neg_i : std_logic; signal inc_last, inc_first, avg_transient_on : std_logic; signal init_i, time_out_flag_i, new_step : std_logic; @@ -60,14 +74,14 @@ architecture rtl of encoder_speed_detect_0 is signal inc_step_cnt, write_last : std_logic; signal first_step, time_out_flag_d : std_logic; signal last_step_type, enforce_delta_min : std_logic; + --signal div_done : std_logic; -- - signal data_valid : std_logic_vector( 5 downto 0); + signal data_valid : std_logic_vector(DIV_MULTICYCLE_PATH_N*(DIV_PIPE_STAGES+1)+2 downto 0); signal step_cnt, first_addr, last_addr : std_logic_vector( 7 downto 0); - signal div_remain : std_logic_vector( 7 downto 0); signal step_balance, step_bal_m1 : std_logic_vector( 9 downto 0); 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 time_diff_i, delta_t_i, delta_t_ii : std_logic_vector(30 downto 0); signal new_tag, tag_last_i : std_logic_vector(31 downto 0); signal tag_first, tag_last : std_logic_vector(31 downto 0); @@ -133,10 +147,13 @@ begin if(data_valid(0) = '1') then tag_last_i <= tag_last; end if; - if(step_balance(step_balance'left) = '0') then - step_bal_m1 <= std_logic_vector(signed(step_balance)-1); - else - step_bal_m1 <= std_logic_vector(-signed(step_balance)-1); + if(data_valid(2) = '1') then + if(step_balance(step_balance'left) = '0') then + step_bal_m1 <= std_logic_vector(signed(step_balance)-1); + else + step_bal_m1 <= std_logic_vector(-signed(step_balance)-1); + end if; + time_diff_i <= std_logic_vector(resize(unsigned(time_diff),31)); end if; if(init = '1' or new_step = '1') then time_out_cnt <= time_out; @@ -164,6 +181,8 @@ begin end if; end process pSEQ_LOGIC; + delta_t_i <= delta_t_ii; + time_out_flag_i <= '1' when unsigned(time_out_cnt) = 1 else '0'; time_out_flag <= time_out_flag_d; @@ -204,14 +223,14 @@ begin time_diff <= std_logic_vector(resize(unsigned(tag_last_i(loc_time'range))-unsigned(tag_first(loc_time'range)),30)); - time_diff_i <= std_logic_vector(resize(unsigned(time_diff),31)); - - iDIVIDE: entity work.divider + iDIVIDE: entity work.divider_0 + generic map( + PIPELINE_STAGES => 1) port map ( clock => clk, - denom => step_bal_m1(7 downto 0), + denom => step_bal_m1(5 downto 0), numer => time_diff_i, - quotient => delta_t_i, - remain => div_remain); + quotient => delta_t_ii, + remain => open); end architecture rtl; diff --git a/generic_ip/encoder_multiply/0/src/intel/divider.vhd b/generic_ip/encoder_multiply/0/src/intel/divider.vhd deleted file mode 100644 index 25d4d68..0000000 --- a/generic_ip/encoder_multiply/0/src/intel/divider.vhd +++ /dev/null @@ -1,140 +0,0 @@ --- megafunction wizard: %LPM_DIVIDE% --- GENERATION: STANDARD --- VERSION: WM1.0 --- MODULE: LPM_DIVIDE - --- ============================================================ --- File Name: divider.vhd --- Megafunction Name(s): --- LPM_DIVIDE --- --- Simulation Library Files(s): --- lpm --- ============================================================ --- ************************************************************ --- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! --- --- 16.0.2 Build 222 07/20/2016 SJ Lite Edition --- ************************************************************ - - ---Copyright (C) 1991-2016 Altera Corporation. All rights reserved. ---Your use of Altera Corporation's design tools, logic functions ---and other software and tools, and its AMPP partner logic ---functions, and any output files from any of the foregoing ---(including device programming or simulation files), and any ---associated documentation or information are expressly subject ---to the terms and conditions of the Altera Program License ---Subscription Agreement, the Altera Quartus Prime License Agreement, ---the Altera MegaCore Function License Agreement, or other ---applicable license agreement, including, without limitation, ---that your use is for the sole purpose of programming logic ---devices manufactured by Altera and sold by Altera or its ---authorized distributors. Please refer to the applicable ---agreement for further details. - - -LIBRARY ieee; -USE ieee.std_logic_1164.all; - -LIBRARY lpm; -USE lpm.all; - -ENTITY divider IS - PORT - ( - clock : IN STD_LOGIC ; - denom : IN STD_LOGIC_VECTOR (7 DOWNTO 0); - numer : IN STD_LOGIC_VECTOR (30 DOWNTO 0); - quotient : OUT STD_LOGIC_VECTOR (30 DOWNTO 0); - remain : OUT STD_LOGIC_VECTOR (7 DOWNTO 0) - ); -END divider; - - -ARCHITECTURE SYN OF divider IS - - SIGNAL sub_wire0 : STD_LOGIC_VECTOR (30 DOWNTO 0); - SIGNAL sub_wire1 : STD_LOGIC_VECTOR (7 DOWNTO 0); - - - - COMPONENT lpm_divide - GENERIC ( - lpm_drepresentation : STRING; - lpm_hint : STRING; - lpm_nrepresentation : STRING; - lpm_pipeline : NATURAL; - lpm_type : STRING; - lpm_widthd : NATURAL; - lpm_widthn : NATURAL - ); - PORT ( - clock : IN STD_LOGIC ; - denom : IN STD_LOGIC_VECTOR (7 DOWNTO 0); - numer : IN STD_LOGIC_VECTOR (30 DOWNTO 0); - quotient : OUT STD_LOGIC_VECTOR (30 DOWNTO 0); - remain : OUT STD_LOGIC_VECTOR (7 DOWNTO 0) - ); - END COMPONENT; - -BEGIN - quotient <= sub_wire0(30 DOWNTO 0); - remain <= sub_wire1(7 DOWNTO 0); - - LPM_DIVIDE_component : LPM_DIVIDE - GENERIC MAP ( - lpm_drepresentation => "UNSIGNED", - lpm_hint => "MAXIMIZE_SPEED=6,LPM_REMAINDERPOSITIVE=TRUE", - lpm_nrepresentation => "UNSIGNED", - lpm_pipeline => 3, - lpm_type => "LPM_DIVIDE", - lpm_widthd => 8, - lpm_widthn => 31 - ) - PORT MAP ( - clock => clock, - denom => denom, - numer => numer, - quotient => sub_wire0, - remain => sub_wire1 - ); - - - -END SYN; - --- ============================================================ --- CNX file retrieval info --- ============================================================ --- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone V" --- Retrieval info: PRIVATE: PRIVATE_LPM_REMAINDERPOSITIVE STRING "TRUE" --- Retrieval info: PRIVATE: PRIVATE_MAXIMIZE_SPEED NUMERIC "6" --- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0" --- Retrieval info: PRIVATE: USING_PIPELINE NUMERIC "1" --- Retrieval info: PRIVATE: VERSION_NUMBER NUMERIC "2" --- Retrieval info: PRIVATE: new_diagram STRING "1" --- Retrieval info: LIBRARY: lpm lpm.lpm_components.all --- Retrieval info: CONSTANT: LPM_DREPRESENTATION STRING "UNSIGNED" --- Retrieval info: CONSTANT: LPM_HINT STRING "MAXIMIZE_SPEED=6,LPM_REMAINDERPOSITIVE=TRUE" --- Retrieval info: CONSTANT: LPM_NREPRESENTATION STRING "UNSIGNED" --- Retrieval info: CONSTANT: LPM_PIPELINE NUMERIC "3" --- Retrieval info: CONSTANT: LPM_TYPE STRING "LPM_DIVIDE" --- Retrieval info: CONSTANT: LPM_WIDTHD NUMERIC "8" --- Retrieval info: CONSTANT: LPM_WIDTHN NUMERIC "31" --- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock" --- Retrieval info: USED_PORT: denom 0 0 8 0 INPUT NODEFVAL "denom[7..0]" --- Retrieval info: USED_PORT: numer 0 0 31 0 INPUT NODEFVAL "numer[30..0]" --- Retrieval info: USED_PORT: quotient 0 0 31 0 OUTPUT NODEFVAL "quotient[30..0]" --- Retrieval info: USED_PORT: remain 0 0 8 0 OUTPUT NODEFVAL "remain[7..0]" --- Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0 --- Retrieval info: CONNECT: @denom 0 0 8 0 denom 0 0 8 0 --- Retrieval info: CONNECT: @numer 0 0 31 0 numer 0 0 31 0 --- Retrieval info: CONNECT: quotient 0 0 31 0 @quotient 0 0 31 0 --- Retrieval info: CONNECT: remain 0 0 8 0 @remain 0 0 8 0 --- Retrieval info: GEN_FILE: TYPE_NORMAL divider.vhd TRUE --- Retrieval info: GEN_FILE: TYPE_NORMAL divider.inc FALSE --- Retrieval info: GEN_FILE: TYPE_NORMAL divider.cmp FALSE --- Retrieval info: GEN_FILE: TYPE_NORMAL divider.bsf FALSE --- Retrieval info: GEN_FILE: TYPE_NORMAL divider_inst.vhd FALSE --- Retrieval info: LIB_FILE: lpm diff --git a/generic_ip/encoder_multiply/0/src/intel/divider_0.vhd b/generic_ip/encoder_multiply/0/src/intel/divider_0.vhd new file mode 100644 index 0000000..08f721a --- /dev/null +++ b/generic_ip/encoder_multiply/0/src/intel/divider_0.vhd @@ -0,0 +1,141 @@ +-- megafunction wizard: %LPM_DIVIDE% +-- GENERATION: STANDARD +-- VERSION: WM1.0 +-- MODULE: LPM_DIVIDE + +-- ============================================================ +-- File Name: divider_0.vhd +-- Megafunction Name(s): +-- LPM_DIVIDE +-- +-- Simulation Library Files(s): +-- lpm +-- ============================================================ +-- ************************************************************ +-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! +-- +-- 18.0.0 Build 614 04/24/2018 SJ Standard Edition +-- ************************************************************ + + +--Copyright (C) 2018 Intel Corporation. All rights reserved. +--Your use of Intel Corporation's design tools, logic functions +--and other software and tools, and its AMPP partner logic +--functions, and any output files from any of the foregoing +--(including device programming or simulation files), and any +--associated documentation or information are expressly subject +--to the terms and conditions of the Intel Program License +--Subscription Agreement, the Intel Quartus Prime License Agreement, +--the Intel FPGA IP License Agreement, or other applicable license +--agreement, including, without limitation, that your use is for +--the sole purpose of programming logic devices manufactured by +--Intel and sold by Intel or its authorized distributors. Please +--refer to the applicable agreement for further details. + + +library ieee; +use ieee.std_logic_1164.all; + +library lpm; +use lpm.all; + +entity divider_0 is + generic( + PIPELINE_STAGES : natural range 1 to 8 := 3); + port + ( + clock : in std_logic; + denom : in std_logic_vector (5 downto 0); + numer : in std_logic_vector (30 downto 0); + quotient : out std_logic_vector (30 downto 0); + remain : out std_logic_vector (5 downto 0) + ); +end divider_0; + + +architecture SYN of divider_0 is + + signal sub_wire0 : std_logic_vector (30 downto 0); + signal sub_wire1 : std_logic_vector (5 downto 0); + + + + component lpm_divide + generic ( + lpm_drepresentation : string; + lpm_hint : string; + lpm_nrepresentation : string; + lpm_pipeline : natural; + lpm_type : string; + lpm_widthd : natural; + lpm_widthn : natural + ); + port ( + clock : in std_logic; + denom : in std_logic_vector (5 downto 0); + numer : in std_logic_vector (30 downto 0); + quotient : out std_logic_vector (30 downto 0); + remain : out std_logic_vector (5 downto 0) + ); + end component; + +begin + quotient <= sub_wire0(30 downto 0); + remain <= sub_wire1(5 downto 0); + + LPM_DIVIDE_component : LPM_DIVIDE + generic map ( + lpm_drepresentation => "UNSIGNED", + lpm_hint => "MAXIMIZE_SPEED=6,LPM_REMAINDERPOSITIVE=TRUE", + lpm_nrepresentation => "UNSIGNED", + lpm_pipeline => PIPELINE_STAGES, + lpm_type => "LPM_DIVIDE", + lpm_widthd => 6, + lpm_widthn => 31 + ) + port map ( + clock => clock, + denom => denom, + numer => numer, + quotient => sub_wire0, + remain => sub_wire1 + ); + + + +end SYN; + +-- ============================================================ +-- CNX file retrieval info +-- ============================================================ +-- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone V" +-- Retrieval info: PRIVATE: PRIVATE_LPM_REMAINDERPOSITIVE STRING "TRUE" +-- Retrieval info: PRIVATE: PRIVATE_MAXIMIZE_SPEED NUMERIC "6" +-- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0" +-- Retrieval info: PRIVATE: USING_PIPELINE NUMERIC "1" +-- Retrieval info: PRIVATE: VERSION_NUMBER NUMERIC "2" +-- Retrieval info: PRIVATE: new_diagram STRING "1" +-- Retrieval info: LIBRARY: lpm lpm.lpm_components.all +-- Retrieval info: CONSTANT: LPM_DREPRESENTATION STRING "UNSIGNED" +-- Retrieval info: CONSTANT: LPM_HINT STRING "MAXIMIZE_SPEED=6,LPM_REMAINDERPOSITIVE=TRUE" +-- Retrieval info: CONSTANT: LPM_NREPRESENTATION STRING "UNSIGNED" +-- Retrieval info: CONSTANT: LPM_PIPELINE NUMERIC "3" +-- Retrieval info: CONSTANT: LPM_TYPE STRING "LPM_DIVIDE" +-- Retrieval info: CONSTANT: LPM_WIDTHD NUMERIC "6" +-- Retrieval info: CONSTANT: LPM_WIDTHN NUMERIC "31" +-- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock" +-- Retrieval info: USED_PORT: denom 0 0 6 0 INPUT NODEFVAL "denom[5..0]" +-- Retrieval info: USED_PORT: numer 0 0 31 0 INPUT NODEFVAL "numer[30..0]" +-- Retrieval info: USED_PORT: quotient 0 0 31 0 OUTPUT NODEFVAL "quotient[30..0]" +-- Retrieval info: USED_PORT: remain 0 0 6 0 OUTPUT NODEFVAL "remain[5..0]" +-- Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0 +-- Retrieval info: CONNECT: @denom 0 0 6 0 denom 0 0 6 0 +-- Retrieval info: CONNECT: @numer 0 0 31 0 numer 0 0 31 0 +-- Retrieval info: CONNECT: quotient 0 0 31 0 @quotient 0 0 31 0 +-- Retrieval info: CONNECT: remain 0 0 6 0 @remain 0 0 6 0 +-- Retrieval info: GEN_FILE: TYPE_NORMAL divider_0.vhd TRUE +-- Retrieval info: GEN_FILE: TYPE_NORMAL divider_0.inc FALSE +-- Retrieval info: GEN_FILE: TYPE_NORMAL divider_0.cmp FALSE +-- Retrieval info: GEN_FILE: TYPE_NORMAL divider_0.bsf FALSE +-- Retrieval info: GEN_FILE: TYPE_NORMAL divider_0_inst.vhd FALSE +-- Retrieval info: LIB_FILE: lpm diff --git a/generic_ip/encoder_multiply/0/src/test/encoder_multiply_tb.vhd b/generic_ip/encoder_multiply/0/src/test/encoder_multiply_tb.vhd index 7bfd16f..a170c7b 100644 --- a/generic_ip/encoder_multiply/0/src/test/encoder_multiply_tb.vhd +++ b/generic_ip/encoder_multiply/0/src/test/encoder_multiply_tb.vhd @@ -6,7 +6,7 @@ -- Author : GMG -- Company : Global Inkjet Systems -- Created : 2019-03-05 --- Last update: 2019-03-19 +-- Last update: 2019-03-20 -- SVN ID : Git -- Standard : VHDL'2008 ------------------------------------------------------------------------------- @@ -203,7 +203,7 @@ architecture behav of encoder_multiply_tb is end loop; - wait_clk_cycles(10); + wait_clk_cycles(15); -- disable the multiplier enable <= '0'; @@ -294,7 +294,7 @@ architecture behav of encoder_multiply_tb is end loop; - wait_clk_cycles(10); + wait_clk_cycles(15); -- disable the multiplier enable <= '0'; diff --git a/generic_ip/encoder_multiply/0/src/test/encoder_speed_detect_tb.vhd b/generic_ip/encoder_multiply/0/src/test/encoder_speed_detect_tb.vhd index 04bd6c6..3b5f949 100644 --- a/generic_ip/encoder_multiply/0/src/test/encoder_speed_detect_tb.vhd +++ b/generic_ip/encoder_multiply/0/src/test/encoder_speed_detect_tb.vhd @@ -6,7 +6,7 @@ -- Author : GMG -- Company : Global Inkjet Systems -- Created : 2019-03-05 --- Last update: 2019-03-19 +-- Last update: 2019-03-22 -- SVN ID : Git -- Standard : VHDL'2008 ------------------------------------------------------------------------------- @@ -164,7 +164,7 @@ architecture behav of encoder_speed_detect_tb is end loop; - wait_clk_cycles(0); + wait_clk_cycles(15); -- disable the multiplier enable <= '0'; @@ -244,7 +244,7 @@ architecture behav of encoder_speed_detect_tb is end loop; - wait_clk_cycles(0); + wait_clk_cycles(15); -- disable the multiplier enable <= '0';