📄 fenlu.vhd
字号:
Library ieee; --输出选择模块
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity fenlu is
Port(clk,reset,set:in std_logic;
en:in std_logic_vector(1 downto 0);
b0,b1,b2,b3,b4,b5,b6:in std_logic_vector(3 downto 0); --输入端口B,接计时模块,输出计时显示
c0,c1,c2,c3,c4,c5,c6:in std_logic_vector(3 downto 0); --输入端口C,接日期模块,输出日期显示
d0,d1,d2,d3,d4,d5,d6:out std_logic_vector(3 downto 0)); --输出端口D,输出显示
End;
Architecture one of fenlu is
begin
process(clk)
variable Q0,Q1,Q2,Q3,Q4,Q5,Q6:std_logic_vector(3 downto 0);
begin
if clk'event and clk='1' then
if reset='1' then Q0:="0000";Q1:="0000";Q2:="0000";Q3:="0000";Q4:="0000";Q5:="0000";Q6:="0000"; --复位,RESET=1
else if set='1' then --使能,EN=1
if en="00" then Q0:=b0;Q1:=b1;Q2:=b2;Q3:=b3;Q4:=b4;Q5:=b5;Q6:=b6; --分路选择,EN=00,计时;EN=11,日期
elsif en="11" then Q0:=c0;Q1:=c1;Q2:=c2;Q3:=c3;Q4:=c4;Q5:=c5;Q6:=c6;
end if;
else Q0:=Q0;Q1:=Q1;Q2:=Q2;Q3:=Q3;Q4:=Q4;Q5:=Q5;Q6:=Q6; --EN=0,暂停
end if;
end if;
end if;
d0<=Q0;d1<=Q1;d2<=Q2;d3<=Q3;d4<=Q4;d5<=Q5;d6<=Q6;
end process;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -