kcount.vhd
来自「Fire&password数字系统实验」· VHDL 代码 · 共 57 行
VHD
57 行
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity kcount is
port (A,B : in std_logic;
C,D,E : out std_logic);
end kcount;
architecture kcount_arc of kcount is
begin
process(A,B)
variable counter : integer range 0 to 3;
constant md : integer :=3;
begin
if(B='1')then
counter := 0;
E<='0';
elsif(A'event and A ='1')then
counter :=counter+1;
if(counter = md)then
counter:=0;
E<='1';
end if;
end if;
if(counter=0)then
C<='0'; D<='0';
elsif(counter=1)then
C<='1'; D<='0';
else
C<='0'; D<='1';
end if;
end process;
end kcount_arc;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?