⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xilinx_simprims.vhd

📁 free hardware ip core about sparcv8,a soc cpu in vhdl
💻 VHD
📖 第 1 页 / 共 5 页
字号:
architecture dcm_clock_divide_by_2_V of dcm_clock_divide_by_2 is  signal clock_div2 : std_ulogic := '0';  signal rst_reg : std_logic_vector(2 downto 0);begin  CLKIN_DIVIDER : process  begin    if (rising_edge(clock)) then      clock_div2 <= not clock_div2;    end if;    wait on clock;  end process CLKIN_DIVIDER;  gen_reset : process    begin    if (rising_edge(clock)) then      rst_reg(0) <= rst;      rst_reg(1) <= rst_reg(0) and rst;      rst_reg(2) <= rst_reg(1) and rst_reg(0) and rst;    end if;    wait on clock;  end process gen_reset;  assign_clkout : process  begin    if ((clock_type = 0) and (rst = '0')) then      clock_out <= clock;    elsif ((clock_type = 1) and (rst = '0')) then      clock_out <= clock_div2;    elsif (rst = '1') then      clock_out <= '0';      wait until falling_edge(rst_reg(2));    end if;    wait on clock_div2, clock, rst;  end process assign_clkout;end dcm_clock_divide_by_2_V;----- dcm_maximum_period_check  -----library IEEE;use IEEE.STD_LOGIC_1164.all;library STD;use STD.TEXTIO.all;entity dcm_maximum_period_check is  generic (    InstancePath : string := "*";    clock_name : string := "";    maximum_period : time);  port(    clock : in std_ulogic    );end dcm_maximum_period_check;architecture dcm_maximum_period_check_V of dcm_maximum_period_check isbegin  MAX_PERIOD_CHECKER : process    variable clock_edge_previous : time := 0 ps;    variable clock_edge_current : time := 0 ps;    variable clock_period : time := 0 ps;    variable Message : line;  begin    clock_edge_previous := clock_edge_current;    clock_edge_current := NOW;    if (clock_edge_previous > 0 ps) then      clock_period := clock_edge_current - clock_edge_previous;    end if;    if (clock_period > maximum_period) then      Write ( Message, string'(" Timing Violation Warning : Input Clock Period of"));      Write ( Message, clock_period );      Write ( Message, string'(" on the ") );      Write ( Message, clock_name );      Write ( Message, string'(" port ") );      Write ( Message, string'(" of DCM instance ") );      Write ( Message, InstancePath );      Write ( Message, string'(" exceeds allotted value of ") );      Write ( Message, maximum_period);      Write ( Message, string'(" at simulation time ") );      Write ( Message, clock_edge_current);      Write ( Message, '.' & LF );      assert false report Message.all severity warning;      DEALLOCATE (Message);    end if;    wait on clock;  end process MAX_PERIOD_CHECKER;end dcm_maximum_period_check_V;----- dcm_clock_lost  -----library IEEE;use IEEE.STD_LOGIC_1164.all;entity dcm_clock_lost is  port(    lost : out std_ulogic := '1';    clock : in std_ulogic    );end dcm_clock_lost;architecture dcm_clock_lost_V of dcm_clock_lost is  signal period : time := 0 ps;  signal lost_r : std_ulogic := '0';  signal lost_f : std_ulogic := '0';  signal clock_negedge, clock_posedge : std_ulogic;  signal temp1 : boolean := false;  signal temp2 : boolean := false;  signal clock_low, clock_high : std_ulogic := '0';begin  determine_period : process    variable clock_edge_previous : time := 0 ps;    variable clock_edge_current : time := 0 ps;  begin    if (rising_edge(clock)) then      clock_edge_previous := clock_edge_current;      clock_edge_current := NOW;      if (period /= 0 ps and ((clock_edge_current - clock_edge_previous) <= (1.5 * period))) then        period <= NOW - clock_edge_previous;      elsif (period /= 0 ps and ((NOW - clock_edge_previous) > (1.5 * period))) then        period <= 0 ps;      elsif ((period = 0 ps) and (clock_edge_previous /= 0 ps)) then        period <= NOW - clock_edge_previous;      end if;    end if;    wait on clock;  end process determine_period;  CLOCK_LOST_CHECKER : process    variable clock_low, clock_high : std_ulogic := '0';  begin    if (rising_edge(clock)) then      clock_low := '0';      clock_high := '1';      clock_posedge <= '0';      clock_negedge <= '1';    end if;    if (falling_edge(clock)) then      clock_high := '0';      clock_low := '1';      clock_posedge <= '1';      clock_negedge <= '0';    end if;    wait on clock;  end process CLOCK_LOST_CHECKER;  SET_RESET_LOST_R : process    begin    if (rising_edge(clock)) then      wait for 0 ps;      wait for 0 ps;      wait for 0 ps;      if (period /= 0 ps) then        lost_r <= '0';      end if;      wait for (period * 9.1)/10;      if ((clock_low /= '1') and (clock_posedge /= '1')) then        lost_r <= '1';      end if;    end if;    wait on clock;  end process SET_RESET_LOST_R;  SET_RESET_LOST_F : process    begin    if (falling_edge(clock)) then      if (period /= 0 ps) then        lost_f <= '0';      end if;      wait for (period * 9.1)/10;      if ((clock_high /= '1') and (clock_negedge /= '1')) then        lost_f <= '1';      end if;    end if;    wait on clock;  end process SET_RESET_LOST_F;  assign_lost : process    begin      if (lost_r'event) then        lost <= lost_r;      end if;      if (lost_f'event) then        lost <= lost_f;      end if;      wait on lost_r, lost_f;    end process assign_lost;end dcm_clock_lost_V;----- DCM  -----library IEEE;use IEEE.std_logic_1164.all;use IEEE.VITAL_Timing.all;library STD;use STD.TEXTIO.all;library unisim;use unisim.simple_simprim_pck.all;entity DCM is  generic (    TimingChecksOn : boolean := true;    InstancePath : string := "*";    Xon : boolean := true;    MsgOn : boolean := false;    thold_PSEN_PSCLK_negedge_posedge : VitalDelayType := 0.000 ns;    thold_PSEN_PSCLK_posedge_posedge : VitalDelayType := 0.000 ns;    thold_PSINCDEC_PSCLK_negedge_posedge : VitalDelayType := 0.000 ns;    thold_PSINCDEC_PSCLK_posedge_posedge : VitalDelayType := 0.000 ns;    tipd_CLKFB : VitalDelayType01 := (0.000 ns, 0.000 ns);    tipd_CLKIN : VitalDelayType01 := (0.000 ns, 0.000 ns);    tipd_DSSEN : VitalDelayType01 := (0.000 ns, 0.000 ns);    tipd_PSCLK : VitalDelayType01 := (0.000 ns, 0.000 ns);    tipd_PSEN : VitalDelayType01 := (0.000 ns, 0.000 ns);    tipd_PSINCDEC : VitalDelayType01 := (0.000 ns, 0.000 ns);    tipd_RST : VitalDelayType01 := (0.000 ns, 0.000 ns);    tpd_CLKIN_LOCKED : VitalDelayType01 := (0.000 ns, 0.000 ns);    tpd_PSCLK_PSDONE : VitalDelayType01 := (0.000 ns, 0.000 ns);    tperiod_CLKIN_POSEDGE : VitalDelayType := 0.000 ns;    tperiod_PSCLK_POSEDGE : VitalDelayType := 0.000 ns;    tpw_CLKIN_negedge : VitalDelayType := 0.000 ns;    tpw_CLKIN_posedge : VitalDelayType := 0.000 ns;    tpw_PSCLK_negedge : VitalDelayType := 0.000 ns;    tpw_PSCLK_posedge : VitalDelayType := 0.000 ns;    tpw_RST_posedge : VitalDelayType := 0.000 ns;    tsetup_PSEN_PSCLK_negedge_posedge : VitalDelayType := 0.000 ns;    tsetup_PSEN_PSCLK_posedge_posedge : VitalDelayType := 0.000 ns;    tsetup_PSINCDEC_PSCLK_negedge_posedge : VitalDelayType := 0.000 ns;    tsetup_PSINCDEC_PSCLK_posedge_posedge : VitalDelayType := 0.000 ns;    CLKDV_DIVIDE : real := 2.0;    CLKFX_DIVIDE : integer := 1;    CLKFX_MULTIPLY : integer := 4;    CLKIN_DIVIDE_BY_2 : boolean := false;    CLKIN_PERIOD : real := 0.0;                         --non-simulatable    CLKOUT_PHASE_SHIFT : string := "NONE";    CLK_FEEDBACK : string := "1X";    DESKEW_ADJUST : string := "SYSTEM_SYNCHRONOUS";     --non-simulatable    DFS_FREQUENCY_MODE : string := "LOW";    DLL_FREQUENCY_MODE : string := "LOW";    DSS_MODE : string := "NONE";                        --non-simulatable    DUTY_CYCLE_CORRECTION : boolean := true;    FACTORY_JF : bit_vector := X"C080";                 --non-simulatable    MAXPERCLKIN : time := 1000000 ps;                   --non-modifiable simulation parameter    MAXPERPSCLK : time := 100000000 ps;                 --non-modifiable simulation parameter    PHASE_SHIFT : integer := 0;    SIM_CLKIN_CYCLE_JITTER : time := 300 ps;            --non-modifiable simulation parameter    SIM_CLKIN_PERIOD_JITTER : time := 1000 ps;          --non-modifiable simulation parameter    STARTUP_WAIT : boolean := false                     --non-simulatable    );  port (    CLK0 : out std_ulogic := '0';    CLK180 : out std_ulogic := '0';    CLK270 : out std_ulogic := '0';    CLK2X : out std_ulogic := '0';    CLK2X180 : out std_ulogic := '0';    CLK90 : out std_ulogic := '0';    CLKDV : out std_ulogic := '0';    CLKFX : out std_ulogic := '0';    CLKFX180 : out std_ulogic := '0';    LOCKED : out std_ulogic := '0';    PSDONE : out std_ulogic := '0';    STATUS : out std_logic_vector(7 downto 0) := "00000000";    CLKFB : in std_ulogic := '0';    CLKIN : in std_ulogic := '0';    DSSEN : in std_ulogic := '0';    PSCLK : in std_ulogic := '0';    PSEN : in std_ulogic := '0';    PSINCDEC : in std_ulogic := '0';    RST : in std_ulogic := '0'    );  attribute VITAL_LEVEL0 of DCM : entity is true;end DCM;architecture DCM_V of DCM is  component dcm_clock_divide_by_2    port(      clock_out : out std_ulogic;      clock : in std_ulogic;      clock_type : in integer;      rst : in std_ulogic      );  end component;  component dcm_maximum_period_check    generic (      InstancePath : string := "*";      clock_name : string := "";      maximum_period : time);    port(      clock : in std_ulogic      );  end component;  component dcm_clock_lost    port(      lost : out std_ulogic;      clock : in std_ulogic      );  end component;  signal CLKFB_ipd, CLKIN_ipd, DSSEN_ipd : std_ulogic;  signal PSCLK_ipd, PSEN_ipd, PSINCDEC_ipd, RST_ipd : std_ulogic;  signal clk0_out : std_ulogic;  signal clk2x_out, clkdv_out : std_ulogic := '0';  signal clkfx_out, locked_out, psdone_out, ps_overflow_out, ps_lock : std_ulogic := '0';  signal clkfb_type : integer;  signal divide_type : integer;  signal clkin_type : integer;  signal ps_type : integer;  signal deskew_adjust_mode : integer;  signal dfs_mode_type : integer;  signal dll_mode_type : integer;  signal clk1x_type : integer;  signal lock_period, lock_delay, lock_clkin, lock_clkfb : std_ulogic := '0';  signal lock_out : std_logic_vector(1 downto 0) := "00";  signal lock_fb : std_ulogic := '0';  signal fb_delay_found : std_ulogic := '0';  signal clkin_div : std_ulogic;  signal clkin_ps, clkin_ps0, clkin_ps1, clkin_ps2 : std_ulogic;  signal clkin_fb, clkin_fb0, clkin_fb1, clkin_fb2 : std_ulogic;  signal ps_delay : time := 0 ps;  signal clkin_period_real : VitalDelayArrayType(2 downto 0) := (0.000 ns, 0.000 ns, 0.000 ns);  signal period : time := 0 ps;  signal period_div : time := 0 ps;  signal period_orig : time := 0 ps;  signal period_ps : time := 0 ps;  signal clkout_delay : time := 0 ps;  signal fb_delay : time := 0 ps;  signal period_fx, remain_fx : time := 0 ps;  signal period_dv_high, period_dv_low : time := 0 ps;  signal cycle_jitter, period_jitter : time := 0 ps;  signal clkin_window, clkfb_window : std_ulogic := '0';  signal clkin_5050 : std_ulogic := '0';  signal rst_reg : std_logic_vector(2 downto 0) := "000";  signal numerator, denominator, gcd : integer := 1;  signal clkin_lost_out : std_ulogic;  signal clkfx_lost_out : std_ulogic;  signal remain_fx_temp : integer := 0;  signal clkin_period_real0_temp : time := 0 ps;  signal ps_lock_temp : std_ulogic := '0';  signal clk0_temp : std_ulogic := '0';  signal clk2x_temp : std_ulogic := '0';  signal no_stop : boolean := false;  signal clkfx180_en : std_ulogic := '0';  signal status_out  : std_logic_vector(7 downto 0) := "00000000";begin  INITPROC : process  begin    detect_resolution      (model_name => "DCM"       );    if (CLKDV_DIVIDE = 1.5) then      divide_type <= 3;    elsif (CLKDV_DIVIDE = 2.0) then      divide_type <= 4;    elsif (CLKDV_DIVIDE = 2.5) then      divide_type <= 5;    elsif (CLKDV_DIVIDE = 3.0) then      divide_type <= 6;    elsif (CLKDV_DIVIDE = 3.5) then      divide_type <= 7;    elsif (CLKDV_DIVIDE = 4.0) then      divide_type <= 8;    elsif (CLKDV_DIVIDE = 4.5) then      divide_type <= 9;    elsif (CLKDV_DIVIDE = 5.0) then      divide_type <= 10;    elsif (CLKDV_DIVIDE = 5.5) then      divide_type <= 11;    elsif (CLKDV_DIVIDE = 6.0) then      divide_type <= 12;    elsif (CLKDV_DIVIDE = 6.5) then      divide_type <= 13;    elsif (CLKDV_DIVIDE = 7.0) then      divide_type <= 14;    elsif (CLKDV_DIVIDE = 7.5) then      divide_type <= 15;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -