📄 xilinx_simprims.vhd
字号:
CONSTANT MsgSeverity : IN SEVERITY_LEVEL := WARNING ) IS VARIABLE Message : LINE; BEGIN Write ( Message, HeaderMsg ); Write ( Message, STRING'(" The attribute ") ); Write ( Message, GenericName ); Write ( Message, STRING'(" on ") ); Write ( Message, EntityName ); Write ( Message, STRING'(" instance ") ); Write ( Message, InstanceName ); Write ( Message, STRING'(" is set to ") ); Write ( Message, GenericValue ); Write ( Message, Unit ); Write ( Message, '.' & LF ); Write ( Message, ExpectedValueMsg ); Write ( Message, ExpectedGenericValue ); Write ( Message, Unit ); Write ( Message, TailMsg ); ASSERT FALSE REPORT Message.ALL SEVERITY MsgSeverity; DEALLOCATE (Message); END GenericValueCheckMessage; PROCEDURE GenericValueCheckMessage ( CONSTANT HeaderMsg : IN STRING := " Attribute Syntax Error "; CONSTANT GenericName : IN STRING := ""; CONSTANT EntityName : IN STRING := ""; CONSTANT InstanceName : IN STRING := ""; CONSTANT GenericValue : IN INTEGER; CONSTANT Unit : IN STRING := ""; CONSTANT ExpectedValueMsg : IN STRING := ""; CONSTANT ExpectedGenericValue : IN INTEGER; CONSTANT TailMsg : IN STRING; CONSTANT MsgSeverity : IN SEVERITY_LEVEL := WARNING ) IS VARIABLE Message : LINE; BEGIN Write ( Message, HeaderMsg ); Write ( Message, STRING'(" The attribute ") ); Write ( Message, GenericName ); Write ( Message, STRING'(" on ") ); Write ( Message, EntityName ); Write ( Message, STRING'(" instance ") ); Write ( Message, InstanceName ); Write ( Message, STRING'(" is set to ") ); Write ( Message, GenericValue ); Write ( Message, Unit ); Write ( Message, '.' & LF ); Write ( Message, ExpectedValueMsg ); Write ( Message, ExpectedGenericValue ); Write ( Message, Unit ); Write ( Message, TailMsg ); ASSERT FALSE REPORT Message.ALL SEVERITY MsgSeverity; DEALLOCATE (Message); END GenericValueCheckMessage; PROCEDURE GenericValueCheckMessage ( CONSTANT HeaderMsg : IN STRING := " Attribute Syntax Error "; CONSTANT GenericName : IN STRING := ""; CONSTANT EntityName : IN STRING := ""; CONSTANT InstanceName : IN STRING := ""; CONSTANT GenericValue : IN BOOLEAN; Constant Unit : IN STRING := ""; CONSTANT ExpectedValueMsg : IN STRING := ""; CONSTANT ExpectedGenericValue : IN STRING := ""; CONSTANT TailMsg : IN STRING; CONSTANT MsgSeverity : IN SEVERITY_LEVEL := WARNING ) IS VARIABLE Message : LINE; BEGIN Write ( Message, HeaderMsg ); Write ( Message, STRING'(" The attribute ") ); Write ( Message, GenericName ); Write ( Message, STRING'(" on ") ); Write ( Message, EntityName ); Write ( Message, STRING'(" instance ") ); Write ( Message, InstanceName ); Write ( Message, STRING'(" is set to ") ); Write ( Message, GenericValue ); Write ( Message, Unit ); Write ( Message, '.' & LF ); Write ( Message, ExpectedValueMsg ); Write ( Message, ExpectedGenericValue ); Write ( Message, Unit ); Write ( Message, TailMsg ); ASSERT FALSE REPORT Message.ALL SEVERITY MsgSeverity; DEALLOCATE (Message); END GenericValueCheckMessage; PROCEDURE GenericValueCheckMessage ( CONSTANT HeaderMsg : IN STRING := " Attribute Syntax Error "; CONSTANT GenericName : IN STRING := ""; CONSTANT EntityName : IN STRING := ""; CONSTANT InstanceName : IN STRING := ""; CONSTANT GenericValue : IN INTEGER; CONSTANT Unit : IN STRING := ""; CONSTANT ExpectedValueMsg : IN STRING := ""; CONSTANT ExpectedGenericValue : IN STRING := ""; CONSTANT TailMsg : IN STRING; CONSTANT MsgSeverity : IN SEVERITY_LEVEL := WARNING ) IS VARIABLE Message : LINE; BEGIN Write ( Message, HeaderMsg ); Write ( Message, STRING'(" The attribute ") ); Write ( Message, GenericName ); Write ( Message, STRING'(" on ") ); Write ( Message, EntityName ); Write ( Message, STRING'(" instance ") ); Write ( Message, InstanceName ); Write ( Message, STRING'(" is set to ") ); Write ( Message, GenericValue ); Write ( Message, Unit ); Write ( Message, '.' & LF ); Write ( Message, ExpectedValueMsg ); Write ( Message, ExpectedGenericValue ); Write ( Message, Unit ); Write ( Message, TailMsg ); ASSERT FALSE REPORT Message.ALL SEVERITY MsgSeverity; DEALLOCATE (Message); END GenericValueCheckMessage; PROCEDURE GenericValueCheckMessage ( CONSTANT HeaderMsg : IN STRING := " Attribute Syntax Error "; CONSTANT GenericName : IN STRING := ""; CONSTANT EntityName : IN STRING := ""; CONSTANT InstanceName : IN STRING := ""; CONSTANT GenericValue : IN REAL; CONSTANT Unit : IN STRING := ""; CONSTANT ExpectedValueMsg : IN STRING := ""; CONSTANT ExpectedGenericValue : IN STRING := ""; CONSTANT TailMsg : IN STRING; CONSTANT MsgSeverity : IN SEVERITY_LEVEL := WARNING ) IS VARIABLE Message : LINE; BEGIN Write ( Message, HeaderMsg ); Write ( Message, STRING'(" The attribute ") ); Write ( Message, GenericName ); Write ( Message, STRING'(" on ") ); Write ( Message, EntityName ); Write ( Message, STRING'(" instance ") ); Write ( Message, InstanceName ); Write ( Message, STRING'(" is set to ") ); Write ( Message, GenericValue ); Write ( Message, Unit ); Write ( Message, '.' & LF ); Write ( Message, ExpectedValueMsg ); Write ( Message, ExpectedGenericValue ); Write ( Message, Unit ); Write ( Message, TailMsg ); ASSERT FALSE REPORT Message.ALL SEVERITY MsgSeverity; DEALLOCATE (Message); END GenericValueCheckMessage; procedure detect_resolution ( constant model_name : in string ) IS variable test_value : time; variable Message : LINE; BEGIN test_value := 1 ps; if (test_value = 0 ps) then Write (Message, STRING'(" Simulator Resolution Error : ")); Write (Message, STRING'(" Simulator resolution is set to a value greater than 1 ps. ")); Write (Message, STRING'(" In order to simulate the ")); Write (Message, model_name); Write (Message, STRING'(", the simulator resolution must be set to 1ps or smaller ")); ASSERT FALSE REPORT Message.ALL SEVERITY ERROR; DEALLOCATE (Message); end if; END detect_resolution; 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; elsif (CLKDV_DIVIDE = 8.0) then divide_type <= 16; elsif (CLKDV_DIVIDE = 9.0) then divide_type <= 18; elsif (CLKDV_DIVIDE = 10.0) then divide_type <= 20; elsif (CLKDV_DIVIDE = 11.0) then divide_type <= 22; elsif (CLKDV_DIVIDE = 12.0) then divide_type <= 24; elsif (CLKDV_DIVIDE = 13.0) then divide_type <= 26; elsif (CLKDV_DIVIDE = 14.0) then divide_type <= 28; elsif (CLKDV_DIVIDE = 15.0) then divide_type <= 30; elsif (CLKDV_DIVIDE = 16.0) then divide_type <= 32; else GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "CLKDV_DIVIDE", EntityName => "DCM", InstanceName => InstancePath, GenericValue => CLKDV_DIVIDE, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, or 16.0", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error ); end if; if ((CLKFX_DIVIDE <= 0) or (32 < CLKFX_DIVIDE)) then GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "CLKFX_DIVIDE", EntityName => "DCM", InstanceName => InstancePath, GenericValue => CLKFX_DIVIDE, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are 1....32", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error ); end if; if ((CLKFX_MULTIPLY <= 1) or (32 < CLKFX_MULTIPLY)) then GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "CLKFX_MULTIPLY", EntityName => "DCM", InstanceName => InstancePath, GenericValue => CLKFX_MULTIPLY, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are 2....32", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error ); end if; case CLKIN_DIVIDE_BY_2 is when false => clkin_type <= 0; when true => clkin_type <= 1; when others => GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "CLKIN_DIVIDE_BY_2", EntityName => "DCM", InstanceName => InstancePath, GenericValue => CLKIN_DIVIDE_BY_2, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are TRUE or FALSE", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error ); end case; if ((CLKOUT_PHASE_SHIFT = "none") or (CLKOUT_PHASE_SHIFT = "NONE")) then ps_type <= 0; elsif ((CLKOUT_PHASE_SHIFT = "fixed") or (CLKOUT_PHASE_SHIFT = "FIXED")) then ps_type <= 1; elsif ((CLKOUT_PHASE_SHIFT = "variable") or (CLKOUT_PHASE_SHIFT = "VARIABLE")) then ps_type <= 2; else GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "CLKOUT_PHASE_SHIFT", EntityName => "DCM", InstanceName => InstancePath, GenericValue => CLKOUT_PHASE_SHIFT, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are NONE, FIXED or VARIABLE", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -