📄 xilinx_simprims.vhd
字号:
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 ); end if; if ((CLK_FEEDBACK = "none") or (CLK_FEEDBACK = "NONE")) then clkfb_type <= 0; elsif ((CLK_FEEDBACK = "1x") or (CLK_FEEDBACK = "1X")) then clkfb_type <= 1; elsif ((CLK_FEEDBACK = "2x") or (CLK_FEEDBACK = "2X")) then clkfb_type <= 2; else GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "CLK_FEEDBACK", EntityName => "DCM", InstanceName => InstancePath, GenericValue => CLK_FEEDBACK, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are NONE, 1X or 2X", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error ); end if; if ((DESKEW_ADJUST = "source_synchronous") or (DESKEW_ADJUST = "SOURCE_SYNCHRONOUS")) then DESKEW_ADJUST_mode <= 8; elsif ((DESKEW_ADJUST = "system_synchronous") or (DESKEW_ADJUST = "SYSTEM_SYNCHRONOUS")) then DESKEW_ADJUST_mode <= 11; elsif ((DESKEW_ADJUST = "0")) then DESKEW_ADJUST_mode <= 0; elsif ((DESKEW_ADJUST = "1")) then DESKEW_ADJUST_mode <= 1; elsif ((DESKEW_ADJUST = "2")) then DESKEW_ADJUST_mode <= 2; elsif ((DESKEW_ADJUST = "3")) then DESKEW_ADJUST_mode <= 3; elsif ((DESKEW_ADJUST = "4")) then DESKEW_ADJUST_mode <= 4; elsif ((DESKEW_ADJUST = "5")) then DESKEW_ADJUST_mode <= 5; elsif ((DESKEW_ADJUST = "6")) then DESKEW_ADJUST_mode <= 6; elsif ((DESKEW_ADJUST = "7")) then DESKEW_ADJUST_mode <= 7; elsif ((DESKEW_ADJUST = "8")) then DESKEW_ADJUST_mode <= 8; elsif ((DESKEW_ADJUST = "9")) then DESKEW_ADJUST_mode <= 9; elsif ((DESKEW_ADJUST = "10")) then DESKEW_ADJUST_mode <= 10; elsif ((DESKEW_ADJUST = "11")) then DESKEW_ADJUST_mode <= 11; elsif ((DESKEW_ADJUST = "12")) then DESKEW_ADJUST_mode <= 12; elsif ((DESKEW_ADJUST = "13")) then DESKEW_ADJUST_mode <= 13; elsif ((DESKEW_ADJUST = "14")) then DESKEW_ADJUST_mode <= 14; elsif ((DESKEW_ADJUST = "15")) then DESKEW_ADJUST_mode <= 15; else GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "DESKEW_ADJUST_MODE", EntityName => "DCM", InstanceName => InstancePath, GenericValue => DESKEW_ADJUST_MODE, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are SOURCE_SYNCHRONOUS, SYSTEM_SYNCHRONOUS or 1....15", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error ); end if; if ((DFS_FREQUENCY_MODE = "high") or (DFS_FREQUENCY_MODE = "HIGH")) then dfs_mode_type <= 1; elsif ((DFS_FREQUENCY_MODE = "low") or (DFS_FREQUENCY_MODE = "LOW")) then dfs_mode_type <= 0; else GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "DFS_FREQUENCY_MODE", EntityName => "DCM", InstanceName => InstancePath, GenericValue => DFS_FREQUENCY_MODE, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are HIGH or LOW", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error ); end if; if ((DLL_FREQUENCY_MODE = "high") or (DLL_FREQUENCY_MODE = "HIGH")) then dll_mode_type <= 1; elsif ((DLL_FREQUENCY_MODE = "low") or (DLL_FREQUENCY_MODE = "LOW")) then dll_mode_type <= 0; else GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "DLL_FREQUENCY_MODE", EntityName => "DCM", InstanceName => InstancePath, GenericValue => DLL_FREQUENCY_MODE, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are HIGH or LOW", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error ); end if; if ((DSS_MODE = "none") or (DSS_MODE = "NONE")) then else GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "DSS_MODE", EntityName => "DCM", InstanceName => InstancePath, GenericValue => DSS_MODE, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are NONE", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error ); end if; case DUTY_CYCLE_CORRECTION is when false => clk1x_type <= 0; when true => clk1x_type <= 1; when others => GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "DUTY_CYCLE_CORRECTION", EntityName => "DCM", InstanceName => InstancePath, GenericValue => DUTY_CYCLE_CORRECTION, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are TRUE or FALSE", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error ); end case; if ((PHASE_SHIFT < -255) or (PHASE_SHIFT > 255)) then GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "PHASE_SHIFT", EntityName => "DCM", InstanceName => InstancePath, GenericValue => PHASE_SHIFT, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are -255 ... 255", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error ); end if; period_jitter <= SIM_CLKIN_PERIOD_JITTER; cycle_jitter <= SIM_CLKIN_CYCLE_JITTER; case STARTUP_WAIT is when false => null; when true => null; when others => GenericValueCheckMessage (HeaderMsg => "Attribute Syntax Error", GenericName => "STARTUP_WAIT", EntityName => "DCM", InstanceName => InstancePath, GenericValue => STARTUP_WAIT, Unit => "", ExpectedValueMsg => "Legal Values for this attribute are TRUE or FALSE", ExpectedGenericValue => "", TailMsg => "", MsgSeverity => error ); end case;---- fx parameters-- gcd <= 1; for i in 2 to CLKFX_MULTIPLY loop if (((CLKFX_MULTIPLY mod i) = 0) and ((CLKFX_DIVIDE mod i) = 0)) then gcd <= i; end if; end loop; numerator <= CLKFX_MULTIPLY / gcd; denominator <= CLKFX_DIVIDE / gcd; wait; end process INITPROC;---- input wire delays-- WireDelay : block begin VitalWireDelay (CLKIN_ipd, CLKIN, tipd_CLKIN); VitalWireDelay (CLKFB_ipd, CLKFB, tipd_CLKFB); VitalWireDelay (DSSEN_ipd, DSSEN, tipd_DSSEN); VitalWireDelay (PSCLK_ipd, PSCLK, tipd_PSCLK); VitalWireDelay (PSEN_ipd, PSEN, tipd_PSEN); VitalWireDelay (PSINCDEC_ipd, PSINCDEC, tipd_PSINCDEC); VitalWireDelay (RST_ipd, RST, tipd_RST); end block; i_clock_divide_by_2 : dcm_clock_divide_by_2 port map ( clock => clkin_ipd, clock_type => clkin_type, rst => rst_ipd, clock_out => clkin_div); i_max_clkin : dcm_maximum_period_check generic map ( clock_name => "CLKIN", maximum_period => MAXPERCLKIN) port map ( clock => clkin_ipd); i_max_psclk : dcm_maximum_period_check generic map ( clock_name => "PSCLK", maximum_period => MAXPERPSCLK) port map ( clock => psclk_ipd); i_clkin_lost : dcm_clock_lost port map ( lost => clkin_lost_out, clock => clkin_ipd); i_clkfx_lost : dcm_clock_lost port map ( lost => clkfx_lost_out, clock => clkfx_out); clkin_ps0 <= transport clkin_div after ps_delay/4; clkin_ps1 <= transport clkin_ps0 after ps_delay/4; clkin_ps2 <= transport clkin_ps1 after ps_delay/4; clkin_ps <= transport clkin_ps2 after ps_delay/4; clkin_fb0 <= transport (clkin_ps and lock_fb) after period_ps/4; clkin_fb1 <= transport clkin_fb0 after period_ps/4; clkin_fb2 <= transport clkin_fb1 after period_ps/4; clkin_fb <= transport clkin_fb2 after period_ps/4; determine_period_div : process variable clkin_div_edge_previous : time := 0 ps; variable clkin_div_edge_current : time := 0 ps; begin if (rst_ipd'event) then clkin_div_edge_previous := 0 ps; clkin_div_edge_current := 0 ps; period_div <= 0 ps; else if (rising_edge(clkin_div)) then clkin_div_edge_previous := clkin_div_edge_current; clkin_div_edge_current := NOW; if ((clkin_div_edge_current - clkin_div_edge_previous) <= (1.5 * period_div)) then period_div <= clkin_div_edge_current - clkin_div_edge_previous; elsif ((period_div = 0 ps) and (clkin_div_edge_previous /= 0 ps)) then period_div <= clkin_div_edge_current - clkin_div_edge_previous; end if; end if; end if; wait on clkin_div, rst_ipd; end process determine_period_div; determine_period_ps : process variable clkin_ps_edge_previous : time := 0 ps; variable clkin_ps_edge_current : time := 0 ps; begin if (rst_ipd'event) then clkin_ps_edge_previous := 0 ps; clkin_ps_edge_current := 0 ps; period_ps <= 0 ps; else if (rising_edge(clkin_ps)) then clkin_ps_edge_previous := clkin_ps_edge_current; clkin_ps_edge_current := NOW; wait for 0 ps; if ((clkin_ps_edge_current - clkin_ps_edge_previous) <= (1.5 * period_ps)) then period_ps <= clkin_ps_edge_current - clkin_ps_edge_previous; elsif ((period_ps = 0 ps) and (clkin_ps_edge_previous /= 0 ps)) then period_ps <= clkin_ps_edge_current - clkin_ps_edge_previous; end if; end if; end if; wait on clkin_ps, rst_ipd; end process determine_period_ps; assign_lock_ps_fb : process variable lock_ps : std_ulogic := '0'; begin if (rst_ipd'event) then lock_fb <= '0'; lock_ps := '0'; else if (rising_edge(clkin_ps)) then lock_ps := lock_period; lock_fb <= lock_ps; end if; end if; wait on clkin_ps, rst_ipd; end process assign_lock_ps_fb; calculate_clkout_delay : process begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -