📄 xilinx_simprims.vhd
字号:
); 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 if (rst_ipd'event) then clkout_delay <= 0 ps; elsif (period'event or fb_delay'event) then clkout_delay <= period - fb_delay; end if; wait on period, fb_delay, rst_ipd; end process calculate_clkout_delay;----generate master reset signal-- gen_master_rst : process begin if (rising_edge(clkin_ipd)) then rst_reg(2) <= rst_reg(1) and rst_reg(0) and rst_ipd; rst_reg(1) <= rst_reg(0) and rst_ipd; rst_reg(0) <= rst_ipd; end if; wait on clkin_ipd; end process gen_master_rst; check_rst_width : process variable Message : line; begin if (falling_edge(rst_ipd)) then if ((rst_reg(2) and rst_reg(1) and rst_reg(0)) = '0') then Write ( Message, string'(" Timing Violation Error : RST on instance ")); Write ( Message, Instancepath ); Write ( Message, string'(" must be asserted for 3 CLKIN clock cycles. ")); assert false report Message.all severity error; DEALLOCATE (Message); end if; end if; wait on rst_ipd; end process check_rst_width;----phase shift parameters-- determine_phase_shift : process variable Message : line; variable FINE_SHIFT_RANGE : time; variable first_time : boolean := true; variable ps_in : integer; begin if (first_time = true) then if ((CLKOUT_PHASE_SHIFT = "none") or (CLKOUT_PHASE_SHIFT = "NONE")) then ps_in := 256; elsif ((CLKOUT_PHASE_SHIFT = "fixed") or (CLKOUT_PHASE_SHIFT = "FIXED")) then ps_in := 256 + PHASE_SHIFT; elsif ((CLKOUT_PHASE_SHIFT = "variable") or (CLKOUT_PHASE_SHIFT = "VARIABLE")) then ps_in := 256 + PHASE_SHIFT; end if; first_time := false; end if; if (rst_ipd'event) then if ((CLKOUT_PHASE_SHIFT = "none") or (CLKOUT_PHASE_SHIFT = "NONE")) then ps_in := 256; elsif ((CLKOUT_PHASE_SHIFT = "fixed") or (CLKOUT_PHASE_SHIFT = "FIXED")) then ps_in := 256 + PHASE_SHIFT; elsif ((CLKOUT_PHASE_SHIFT = "variable") or (CLKOUT_PHASE_SHIFT = "VARIABLE")) then ps_in := 256 + PHASE_SHIFT; else end if; ps_lock <= '0'; ps_overflow_out <= '0'; ps_delay <= 0 ps; else if (rising_edge (lock_period)) then if (ps_type = 1) then FINE_SHIFT_RANGE := 10000 ps; elsif (ps_type = 2) then FINE_SHIFT_RANGE := 5000 ps; end if; ps_delay <= (ps_in * period_div / 256); if (PHASE_SHIFT > 0) then if (((ps_in * period_orig) / 256) > (period_orig + FINE_SHIFT_RANGE)) then Write ( Message, string'(" Timing Violation Error : FINE_SHIFT_RANGE on instance ")); Write ( Message, Instancepath ); Write ( Message, string'(" exceeds ")); Write ( Message, FINE_SHIFT_RANGE / 1000.0); Write ( Message, string'(" PHASE_SHIFT * PERIOD/256 = ")); Write ( Message, PHASE_SHIFT); Write ( Message, string'(" * ")); Write ( Message, period_orig / 1000.0/256); Write ( Message, string'(" = ")); Write ( Message, (PHASE_SHIFT) * period_orig / 256 / 1000.0); assert false report Message.all severity error; DEALLOCATE (Message); end if; elsif (PHASE_SHIFT < 0) then if ((period_orig > FINE_SHIFT_RANGE) and ((ps_in * period_orig / 256) < period_orig - FINE_SHIFT_RANGE)) then Write ( Message, string'(" Timing Violation Error : FINE_SHIFT_RANGE on instance ")); Write ( Message, Instancepath ); Write ( Message, string'(" exceeds ")); Write ( Message, FINE_SHIFT_RANGE / 1000.0); Write (
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -