altera_mf.vhd
来自「free hardware ip core about sparcv8,a so」· VHDL 代码 · 共 1,741 行 · 第 1/5 页
VHD
1,741 行
sign := -1; else ASSERT FALSE REPORT "Illegal Character "& s(i) & "i n string parameter! " SEVERITY ERROR; end if; when '0' => digit := 0; when '1' => digit := 1; when '2' => digit := 2; when '3' => digit := 3; when '4' => digit := 4; when '5' => digit := 5; when '6' => digit := 6; when '7' => digit := 7; when '8' => digit := 8; when '9' => digit := 9; when others => ASSERT FALSE REPORT "Illegal Character "& s(i) & "in string parameter! " SEVERITY ERROR; end case; newdigit := newdigit * 10 + digit; end loop; return (sign*newdigit);end;end pllpack;-- END OF PACKAGE pllpacklibrary ieee;use ieee.std_logic_1164.all;-- DFFPentity DFFP isport( 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 DFFP;architecture behave of DFFP isbeginprocess (CLK, PRN, CLRN) begin if (PRN = '0') then Q <= '1'; elsif (CLRN = '0') then Q <= '0'; elsif (CLK'event and (ENA = '1')) then Q <= D; end if; end process;end behave;--///////////////////////////////////////////////////////////////////////////---- Entity Name : MF_mn_cntr---- Description : Simulation model for the M and N counter. This is a-- common model for the input counter and the loop feedback-- counter of the Stratix PLL and Stratix II PLL.----///////////////////////////////////////////////////////////////////////////library ieee;use IEEE.std_logic_1164.all;entity MF_mn_cntr isport ( clk : IN std_logic; reset : IN std_logic := '0'; cout : OUT std_logic; initial_value : IN integer := 1; modulus : IN integer := 1; time_delay : IN integer := 0; ph : IN integer := 0);end MF_mn_cntr;architecture behave of MF_mn_cntr isbegin process (clk, reset) variable count : integer := 1; variable first_rising_edge : boolean := true; variable tmp_cout : std_logic; begin if (reset = '1') then count := 1; tmp_cout := '0'; first_rising_edge := true; elsif (clk'event and clk = '1' and first_rising_edge) then first_rising_edge := false; tmp_cout := clk; elsif (not first_rising_edge) then if (count < modulus) then count := count + 1; else count := 1; tmp_cout := not tmp_cout; end if; end if; cout <= transport tmp_cout after time_delay * 1 ps; end process;end behave;--/////////////////////////////////////////////////////////////////////////////---- Entity Name : stx_scale_cntr---- Description : Simulation model for the output scale-down counters.-- This is a common model for the L0, L1, G0, G1, G2, G3, E0,-- E1, E2 and E3 output counters of the Stratix PLL.----/////////////////////////////////////////////////////////////////////////////library ieee;use IEEE.std_logic_1164.all;entity stx_scale_cntr isport ( clk : IN std_logic; reset : IN std_logic := '0'; initial : IN integer := 1; high : IN integer := 1; low : IN integer := 1; mode : IN string := "bypass"; time_delay : IN integer := 0; ph_tap : IN natural := 0; cout : OUT std_logic);end stx_scale_cntr;architecture behave of stx_scale_cntr isbegin process (clk, reset) variable tmp_cout : std_logic := '0'; variable count : integer := 1; variable output_shift_count : integer := 0; variable first_rising_edge : boolean := false; variable high_reg : integer := 0; variable low_reg : integer := 0; variable init : boolean := true; begin if (reset = '1') then count := 1; output_shift_count := 0; tmp_cout := '0'; first_rising_edge := false; elsif (clk'event) then if (init) then init := false; high_reg := high; low_reg := low; end if; if (mode = " off") then tmp_cout := '0'; elsif (mode = "bypass") then tmp_cout := clk; elsif (not first_rising_edge) then if (clk = '1') then output_shift_count := output_shift_count + 1; if (output_shift_count = initial) then tmp_cout := clk; first_rising_edge := true; 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_reg*2) + 1)) then tmp_cout := '0'; low_reg := low; elsif (mode = " odd" and (count = high_reg*2)) then tmp_cout := '0'; low_reg := low; elsif (count = (high_reg + low_reg)*2 + 1) then tmp_cout := '1'; count := 1; -- reset count high_reg := high; end if; end if; end if; cout <= transport tmp_cout after time_delay * 1 ps; end process;end behave;--/////////////////////////////////////////////////////////////////////////////---- Entity Name : arm_scale_cntr---- Description : Simulation model for the output scale-down counters.-- This is a common model for the C0, C1, C2, C3, C4 and C5-- output counters of the Stratix II PLL.----/////////////////////////////////////////////////////////////////////////////library ieee;use IEEE.std_logic_1164.all;entity arm_scale_cntr is port ( clk : IN std_logic; reset : IN std_logic := '0'; initial : IN integer := 1; high : IN integer := 1; low : IN integer := 1; mode : IN string := "bypass"; ph_tap : IN integer := 0; cout : OUT std_logic );end arm_scale_cntr;architecture behave of arm_scale_cntr isbegin process (clk, reset) variable tmp_cout : std_logic := '0'; variable count : integer := 1; variable output_shift_count : integer := 1; variable first_rising_edge : boolean := false; begin if (reset = '1') then count := 1; output_shift_count := 1; tmp_cout := '0'; first_rising_edge := false; elsif (clk'event) then if (mode = " off") then tmp_cout := '0'; elsif (mode = "bypass") then 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";
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?