用VHDL语言设计一个N分频器。N的默认值为10.
发布网友
发布时间:2022-04-21 17:17
我来回答
共1个回答
热心网友
时间:2023-06-26 22:22
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity fenpin is
port( clk:in std_logic;
finout:out std_logic);
end fenpin;
architecture bhv of fenpin is
signal tmp:std_logic_vector(3 downto 0);
begin
process(clk)
begin
if clk'event and clk='1' then
if tmp=9 then tmp<="0000";
else tmp<=tmp+1;
end if;
if tmp<5 then finout<='0';
else finout<='1';
end if;
end if;
end process;
end bhv;