📄 any_odd.vhd
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity any_odd is
generic (data_width : integer := 8);
port(input2 : in std_logic_vector(data_width - 1 downto 0);
clk_in : in std_logic;
clk_out : out std_logic);
end entity any_odd;
architecture div2 of any_odd is
signal cout1,cout2 : std_logic_vector(data_width - 1 downto 0);
signal clk1,clk2 : std_logic;
begin
process(clk_in)------rising edge
begin
if clk_in'event and clk_in='1' then
if cout1 < (conv_integer(input2)-1) then
cout1 <= cout1 + 1;
else cout1 <= (others => '0');
end if;
if cout1 < (conv_integer(input2)-1)/2 then
clk1 <= '1';
else clk1 <= '0';
end if;
end if;
end process;
---------------------------
process(clk_in)------falling edge
begin
if clk_in'event and clk_in='0' then
if cout2 < (conv_integer(input2)-1) then
cout2 <= cout2 + 1;
else cout2 <= (others => '0');
end if;
if cout2 < (conv_integer(input2)-1)/2 then
clk2 <= '1';
else clk2 <= '0';
end if;
end if;
end process;
clk_out <= clk1 or clk2;
end architecture div2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -