📄 xilinx_simprims.vhd
字号:
architecture behav of BSCAN_VIRTEX2 isbegin CAPTURE <= '0'; DRCK1 <= '0'; DRCK2 <= '0'; RESET <= '0'; SEL1 <= '0'; SEL2 <= '0'; SHIFT <= '0'; TDI <= '0'; UPDATE <= '0'; end;library ieee;use ieee.std_logic_1164.all; entity BSCAN_SPARTAN3 is port (CAPTURE : out STD_ULOGIC; DRCK1 : out STD_ULOGIC; DRCK2 : out STD_ULOGIC; RESET : out STD_ULOGIC; SEL1 : out STD_ULOGIC; SEL2 : out STD_ULOGIC; SHIFT : out STD_ULOGIC; TDI : out STD_ULOGIC; UPDATE : out STD_ULOGIC; TDO1 : in STD_ULOGIC; TDO2 : in STD_ULOGIC);end;architecture behav of BSCAN_SPARTAN3 isbegin CAPTURE <= '0'; DRCK1 <= '0'; DRCK2 <= '0'; RESET <= '0'; SEL1 <= '0'; SEL2 <= '0'; SHIFT <= '0'; TDI <= '0'; UPDATE <= '0'; end;library ieee; use ieee.std_logic_1164.all;entity BUFGMUX is port (O : out std_logic; I0, I1, S : in std_logic); end;architecture beh of BUFGMUX is begin o <= to_X01(I0) when to_X01(S) = '0' else I1; end;library ieee; use ieee.std_logic_1164.all;entity BUFG is port (O : out std_logic; I : in std_logic); end;architecture beh of BUFG is begin o <= to_X01(i); end;library ieee; use ieee.std_logic_1164.all;entity BUFGP is port (O : out std_logic; I : in std_logic); end;architecture beh of BUFGP is begin o <= to_X01(i); end;library ieee; use ieee.std_logic_1164.all;entity BUFGDLL is port (O : out std_logic; I : in std_logic); end;architecture beh of BUFGDLL is begin o <= to_X01(i); end;library ieee; use ieee.std_logic_1164.all;entity IBUFG is generic ( CAPACITANCE : string := "DONT_CARE"; IOSTANDARD : string := "LVCMOS25"); port (O : out std_logic; I : in std_logic); end;architecture beh of IBUFG is begin o <= to_X01(i) after 1 ns; end;library ieee; use ieee.std_logic_1164.all;entity IBUF is generic ( CAPACITANCE : string := "DONT_CARE"; IOSTANDARD : string := "LVCMOS25"); port (O : out std_logic; I : in std_logic); end;architecture beh of IBUF is begin o <= to_X01(i) after 1 ns; end;library ieee;use ieee.std_logic_1164.all;entity OBUF is generic ( CAPACITANCE : string := "DONT_CARE"; DRIVE : integer := 12; IOSTANDARD : string := "LVCMOS25"; SLEW : string := "SLOW"); port (O : out std_ulogic; I : in std_ulogic); end;architecture beh of OBUF isbegin o <= to_X01(i) after 5 ns / (drive/8+1) when SLEW = "SLOW" else to_X01(i) after 4 ns / (drive/8+1); end;library ieee;use ieee.std_logic_1164.all;entity IOBUF is generic ( CAPACITANCE : string := "DONT_CARE"; DRIVE : integer := 12; IOSTANDARD : string := "LVCMOS25"; SLEW : string := "SLOW"); port ( O : out std_ulogic; IO : inout std_logic; I, T : in std_ulogic);end;architecture beh of IOBUF isbegin io <= 'X' after 4 ns / (drive/8+1) when to_X01(t) = 'X' else I after 5 ns / (drive/8+1) when (to_X01(t) = '0') and (SLEW = "SLOW") else I after 4 ns / (drive/8+1) when (to_X01(t) = '0') else 'Z' after 2 ns / (drive/8+1) when to_X01(t) = '1'; o <= to_X01(io) after 1 ns;end;library ieee;use ieee.std_logic_1164.all;entity OBUFT is generic ( CAPACITANCE : string := "DONT_CARE"; DRIVE : integer := 12; IOSTANDARD : string := "LVCMOS25"; SLEW : string := "SLOW"); port ( O : out std_ulogic; I, T : in std_ulogic);end;architecture beh of OBUFT isbegin o <= I after 5 ns / (drive/8+1) when (to_X01(t) = '0') and (SLEW = "SLOW") else I after 4 ns / (drive/8+1) when to_X01(t) = '0' else 'Z' after 4 ns / (drive/8+1) when to_X01(t) = '1' else 'X' after 4 ns / (drive/8+1);end;----- CELL DCM ---------- dcm_clock_divide_by_2 -----library IEEE;use IEEE.STD_LOGIC_1164.all;entity dcm_clock_divide_by_2 is port( clock_out : out std_ulogic := '0'; clock : in std_ulogic; clock_type : in integer; rst : in std_ulogic );end dcm_clock_divide_by_2;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.VPKG.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 PROCEDURE GenericValueCheckMessage ( CONSTANT HeaderMsg : IN STRING := " Attribute Syntax Error "; CONSTANT GenericName : IN STRING := ""; CONSTANT EntityName : IN STRING := ""; CONSTANT InstanceName : IN STRING := ""; CONSTANT GenericValue : IN STRING := ""; Constant Unit : IN STRING := ""; Constant ExpectedValueMsg : IN STRING := ""; Constant ExpectedGenericValue : IN STRING := ""; CONSTANT TailMsg : IN STRING;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -