📄 altera_mf.vhd
字号:
tmp_cout := clk; first_rising_edge := true; elsif (not first_rising_edge) then if (clk = '1') then if (output_shift_count = initial) then tmp_cout := clk; first_rising_edge := true; else output_shift_count := output_shift_count + 1; end if; end if; elsif (output_shift_count < initial) then if (clk = '1') then output_shift_count := output_shift_count + 1; end if; else count := count + 1; if (mode = " even" and (count = (high*2) + 1)) then tmp_cout := '0'; elsif (mode = " odd" and (count = high*2)) then tmp_cout := '0'; elsif (count = (high + low)*2 + 1) then tmp_cout := '1'; count := 1; -- reset count end if; end if; end if; cout <= transport tmp_cout; end process;end behave;--/////////////////////////////////////////////////////////////////////////////---- Entity Name : MF_pll_reg---- Description : Simulation model for a simple DFF.-- This is required for the generation of the bit slip-signals.-- No timing, powers upto 0.----/////////////////////////////////////////////////////////////////////////////LIBRARY ieee;USE IEEE.std_logic_1164.all;ENTITY MF_pll_reg is PORT ( clk : in std_logic; ena : in std_logic := '1'; d : in std_logic; clrn : in std_logic := '1'; prn : in std_logic := '1'; q : out std_logic );end MF_pll_reg;ARCHITECTURE behave of MF_pll_reg isbegin process (clk, prn, clrn) variable q_reg : std_logic := '0'; begin if (prn = '0') then q_reg := '1'; elsif (clrn = '0') then q_reg := '0'; elsif (clk'event and clk = '1' and (ena = '1')) then q_reg := D; end if; Q <= q_reg; end process;end behave;--///////////////////////////////////////////////////////////////////////////---- START ENTITY HEADER ------------------------------------------------------------- Entity Name : MF_STRATIX_PLL---- Description : The behavioral model for Stratix PLL---- Limitations : Applies to the Stratix and Stratix GX device families-- No support for spread spectrum feature in the model---- Expected results : Up to 10 output clocks, each defined by its own set of-- parameters. Locked output (active high) indicates when the-- PLL locks. clkbad, clkloss and activeclock are used for-- clock switchover to inidicate which input clock has gone-- bad, when the clock switchover initiates and which input-- clock is being used as the reference, respectively.-- scandataout is the data output of the serial scan chain.---- END ENTITY HEADER -----------------------------------------------------------library ieee;library altera_mf;use IEEE.std_logic_1164.all;use altera_mf.pllpack.all;use altera_mf.altera_mf_components.all;entity MF_stratix_pll isgeneric ( operation_mode : string := "normal"; qualify_conf_done : string := "off"; compensate_clock : string := "clk0"; pll_type : string := "auto"; -- EGPP/FAST/AUTO scan_chain : string := "long"; clk0_multiply_by : integer := 1; clk0_divide_by : integer := 1; clk0_phase_shift : string := "0"; clk0_time_delay : string := "0"; clk0_duty_cycle : integer := 50; clk1_multiply_by : integer := 1; clk1_divide_by : integer := 1; clk1_phase_shift : string := "0"; clk1_time_delay : string := "0"; clk1_duty_cycle : integer := 50; clk2_multiply_by : integer := 1; clk2_divide_by : integer := 1; clk2_phase_shift : string := "0"; clk2_time_delay : string := "0"; clk2_duty_cycle : integer := 50; clk3_multiply_by : integer := 1; clk3_divide_by : integer := 1; clk3_phase_shift : string := "0"; clk3_time_delay : string := "0"; clk3_duty_cycle : integer := 50; clk4_multiply_by : integer := 1; clk4_divide_by : integer := 1; clk4_phase_shift : string := "0"; clk4_time_delay : string := "0"; clk4_duty_cycle : integer := 50; clk5_multiply_by : integer := 1; clk5_divide_by : integer := 1; clk5_phase_shift : string := "0"; clk5_time_delay : string := "0"; clk5_duty_cycle : integer := 50; extclk0_multiply_by : integer := 1; extclk0_divide_by : integer := 1; extclk0_phase_shift : string := "0"; extclk0_time_delay : string := "0"; extclk0_duty_cycle : integer := 50; extclk1_multiply_by : integer := 1; extclk1_divide_by : integer := 1; extclk1_phase_shift : string := "0"; extclk1_time_delay : string := "0"; extclk1_duty_cycle : integer := 50; extclk2_multiply_by : integer := 1; extclk2_divide_by : integer := 1; extclk2_phase_shift : string := "0"; extclk2_time_delay : string := "0"; extclk2_duty_cycle : integer := 50; extclk3_multiply_by : integer := 1; extclk3_divide_by : integer := 1; extclk3_phase_shift : string := "0"; extclk3_time_delay : string := "0"; extclk3_duty_cycle : integer := 50; primary_clock : string := "inclk0"; inclk0_input_frequency : integer := 10000; inclk1_input_frequency : integer := 10000; gate_lock_signal : string := "no"; gate_lock_counter : integer := 1; valid_lock_multiplier : integer := 5; invalid_lock_multiplier : integer := 5; switch_over_on_lossclk : string := "off"; switch_over_on_gated_lock : string := "off"; switch_over_counter : integer := 1; enable_switch_over_counter : string := "off"; feedback_source : string := "extclk0"; bandwidth_type : string := "auto"; bandwidth : integer := 0; spread_frequency : integer := 0; down_spread : string := "0.0"; pfd_min : integer := 0; pfd_max : integer := 0; vco_min : integer := 0; vco_max : integer := 0; vco_center : integer := 0; -- ADVANCED USER PARAMETERS m_initial : integer := 1; m : integer := 1; n : integer := 1; m2 : integer := 1; n2 : integer := 1; ss : integer := 0; l0_high : integer := 1; l0_low : integer := 1; l0_initial : integer := 1; l0_mode : string := "bypass"; l0_ph : integer := 0; l0_time_delay : integer := 0; l1_high : integer := 1; l1_low : integer := 1; l1_initial : integer := 1; l1_mode : string := "bypass"; l1_ph : integer := 0; l1_time_delay : integer := 0; g0_high : integer := 1; g0_low : integer := 1; g0_initial : integer := 1; g0_mode : string := "bypass"; g0_ph : integer := 0; g0_time_delay : integer := 0; g1_high : integer := 1; g1_low : integer := 1; g1_initial : integer := 1; g1_mode : string := "bypass"; g1_ph : integer := 0; g1_time_delay : integer := 0; g2_high : integer := 1; g2_low : integer := 1; g2_initial : integer := 1; g2_mode : string := "bypass"; g2_ph : integer := 0; g2_time_delay : integer := 0; g3_high : integer := 1; g3_low : integer := 1; g3_initial : integer := 1; g3_mode : string := "bypass"; g3_ph : integer := 0; g3_time_delay : integer := 0; e0_high : integer := 1; e0_low : integer := 1; e0_initial : integer := 1; e0_mode : string := "bypass"; e0_ph : integer := 0; e0_time_delay : integer := 0; e1_high : integer := 1; e1_low : integer := 1; e1_initial : integer := 1; e1_mode : string := "bypass"; e1_ph : integer := 0; e1_time_delay : integer := 0; e2_high : integer := 1; e2_low : integer := 1; e2_initial : integer := 1; e2_mode : string := "bypass"; e2_ph : integer := 0; e2_time_delay : integer := 0; e3_high : integer := 1; e3_low : integer := 1; e3_initial : integer := 1; e3_mode : string := "bypass"; e3_ph : integer := 0; e3_time_delay : integer := 0; m_ph : integer := 0; m_time_delay : integer := 0; n_time_delay : integer := 0; extclk0_counter : string := "e0"; extclk1_counter : string := "e1"; extclk2_counter : string := "e2"; extclk3_counter : string := "e3"; clk0_counter : string := "g0"; clk1_counter : string := "g1"; clk2_counter : string := "g2"; clk3_counter : string := "g3"; clk4_counter : string := "l0"; clk5_counter : string := "l1"; -- LVDS mode parameters enable0_counter : string := "l0"; enable1_counter : string := "l0"; charge_pump_current : integer := 0; loop_filter_r : string := "1.0"; loop_filter_c : integer := 1; common_rx_tx : string := "off"; rx_outclock_resource : string := "auto"; use_vco_bypass : string := "false"; use_dc_coupling : string := "false"; pll_compensation_delay : integer := 0; simulation_type : string := "timing"; skip_vco : string := "off");port ( inclk : in std_logic_vector(1 downto 0); fbin : in std_logic; ena : in std_logic; clkswitch : in std_logic; areset : in std_logic; pfdena : in std_logic; clkena : in std_logic_vector(5 downto 0); extclkena : in std_logic_vector(3 downto 0); scanaclr : in std_logic; scandata : in std_logic; scanclk : in std_logic; clk : out std_logic_vector(5 downto 0); extclk : out std_logic_vector(3 downto 0); clkbad : out std_logic_vector(1 downto 0); activeclock : out std_logic; locked : out std_logic; clkloss : out std_logic; scandataout : out std_logic; -- lvds specific ports comparator : in std_logic := '0'; enable0 : out std_logic; enable1 : out std_logic);END MF_stratix_pll;ARCHITECTURE vital_pll of MF_stratix_pll is-- internal advanced parameter signalssignal i_vco_min : natural;signal i_vco_max : natural;signal i_vco_center : natural;signal i_pfd_min : natural;signal i_pfd_max : natural;signal l0_ph_val : natural;signal l1_ph_val : natural;signal g0_ph_val : natural;signal g1_ph_val : natural;signal g2_ph_val : natural;signal g3_ph_val : natural;signal e0_ph_val : natural;signal e1_ph_val : natural;signal e2_ph_val : natural;signal e3_ph_val : natural;signal i_extclk3_counter : string(1 to 2) := "e3";signal i_extclk2_counter : string(1 to 2) := "e2";signal i_extclk1_counter : string(1 to 2) := "e1";signal i_extclk0_counter : string(1 to 2) := "e0";signal i_clk5_counter : string(1 to 2) := "l1";signal i_clk4_counter : string(1 to 2) := "l0";signal i_clk3_counter : string(1 to 2) := "g3";signal i_clk2_counter : string(1 to 2) := "g2";signal i_clk1_counter : string(1 to 2) := "g1";signal i_clk0_counter : string(1 to 2) := "g0";signal i_charge_pump_current : natural;signal i_loop_filter_r : natural;-- end internal advanced parameter signals-- CONSTANTSCONSTANT EGPP_SCAN_CHAIN : integer := 289;CONSTANT GPP_SCAN_CHAIN : integer := 193;CONSTANT TRST : time := 5000 ps;CONSTANT TRSTCLK : time := 5000 ps;-- signalssignal vcc : std_logic := '1';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -