📄 month1.vhd
字号:
Library ieee; --月份模块
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity month1 is
Port(clkd,set,reset:in std_logic;
mo1,mo0:in std_logic_vector(3 downto 0); --输入预置月份
month1,month0:buffer std_logic_vector(3 downto 0); --输出月份显示
enyear:out std_logic); --月份满12,进位,年份加1
End month1;
Architecture one of month1 is
Begin
Process(clkd,reset,set,mo1,mo0)
variable cq1,cq0: STD_LOGIC_vector( 3 downto 0);
Begin
if reset='1' then cq1:="0000"; cq0:="0001";
Elsif clkd'event and clkd='1' then
if ( cq1="0001" and cq0="0010" )then cq1:="0000"; cq0:="0000"; enyear<='1'; --月份满12,返回重复计数,年份加1
else enyear<='0';
end if;
if cq0<9 then cq0:=cq0+1;
else cq0:="0000";cq1:=cq1+1; --月份低位满10,进位高位加1
end if;
end if;
month1<=cq1;month0<=cq0;
End process;
End one;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -