Altera_Forum
Honored Contributor
18 years agoSDC syntax for declaring generated clocks
Hello,
Below, I have pasted a module that i have created. Now, i want to declare the outputs of this module as clocks in the SDC constraint file. entity CLKCTRL is Port ( -- Clock CLK : in std_logic; -- Reset RESZ : in std_logic; -- System Bus Clock Divider Value BUSDIV : in std_logic_vector(1 downto 0); -- Output 0 Clock Divider Value O0DIV : in std_logic_vector(5 downto 0); -- Output 1 Clock Divider Value O1DIV : in std_logic_vector(5 downto 0); -- System Clock HCLK : out std_logic; -- Output 0 Clock O0CLK : out std_logic; -- Output 0 Inverted Clock O0CLKZ : out std_logic; -- Output 1 Clock O1CLK : out std_logic; -- Output 1 Inverted Clock O1CLKZ : out std_logic); end CLKCTRL; architecture Behavioral of CLKCTRL is -- System Clock Counter signal count_HCLK : std_logic_vector(1 downto 0); -- Output 0 Clock Counter signal count_O0CLK : std_logic_vector(5 downto 0); -- Output 1 Clock Counter signal count_O1CLK : std_logic_vector(5 downto 0); -- System Clock signal s_HCLK : std_logic; -- Output 0 Clock signal s_O0CLK : std_logic; -- Output 1 Clock signal s_O1CLK : std_logic; begin -- Based on the Value of BUSDIV -- System Clock is selected HCLK <= CLK when BUSDIV = "00" else s_HCLK; -- Based on the Value of O0DIV -- Output 0 Clock is selected O0CLK <= CLK when O0DIV = "000000" else s_O0CLK; -- Based on the Value of O0DIV -- Output 0 Inverted Clock is selected O0CLKZ <= not CLK when O0DIV = "000000" else not s_O0CLK; -- Based on the Value of O1DIV -- Output 1 Clock is selected O1CLK <= CLK when O1DIV = "000000" else s_O1CLK; -- Based on the Value of O1DIV -- Output 1 Inverted Clock is selected O1CLKZ <= not CLK when O1DIV = "000000" else not s_O1CLK; p_1: process(RESZ, CLK) begin if RESZ = '0' then count_HCLK <= (others => '0'); count_O0CLK <= (others => '0'); count_O1CLK <= (others => '0'); s_HCLK <= '0'; s_O0CLK <= '0'; s_O1CLK <= '0'; elsif CLK'event and CLK = '1' then -- Clock Generation for System Clock if count_HCLK >= conv_std_logic_vector(((conv_integer(BUSDIV)+1)/2),2) then if count_HCLK = BUSDIV then count_HCLK <= (others => '0'); else count_HCLK <= count_HCLK + 1; end if; s_HCLK <= '1'; else count_HCLK <= count_HCLK + 1; s_HCLK <= '0'; end if; -- Clock Generation for Output 0 Clock if count_O0CLK >= conv_std_logic_vector(((conv_integer(O0DIV)+1)/2),6) then if count_O0CLK = O0DIV then count_O0CLK <= (others => '0'); else count_O0CLK <= count_O0CLK + 1; end if; s_O0CLK <= '1'; else count_O0CLK <= count_O0CLK + 1; s_O0CLK <= '0'; end if; -- Clock Generation for Output 1 Clock if count_O1CLK >= conv_std_logic_Vector(((conv_integer(O1DIV)+1)/2),6) then if count_O1CLK = O1DIV then count_O1CLK <= (others => '0'); else count_O1CLK <= count_O1CLK + 1; end if; s_O1CLK <= '1'; else count_O1CLK <= count_O1CLK + 1; s_O1CLK <= '0'; end if; end if; end process p_1; end Behavioral; Regards, Anil.