tbhourtqhour.tdf

来自「veriloghdl 交通灯veriloghdl 交通灯veriloghdl 交」· TDF 代码 · 共 34 行

TDF
34
字号
subdesign tBHOURtQHOUR
(
 clk			:	input;
 rst			:	input;
 shihour[3..0]	:	output;
 gehour[3..0]	:	output;
)
variable
 count[5..0]:dff;
 shihourcount[3..0]:dff;
 gehourcount[3..0]:dff;
begin
count[].clk=clk;
shihourcount[].clk=clk;
gehourcount[].clk=clk;
if rst then count[].d=0;
			shihourcount[].d=0;
			gehourcount[].d=0;
elsif count[].q==59 
	then count[].d=0;
	if shihourcount[].q==2 AND gehourcount[].q==3
		then shihourcount[].d=0; gehourcount[].d=0;
	elsif gehourcount[].q==9
		then shihourcount[].d=shihourcount[].q+1;
			 gehourcount[].d=0;
	else gehourcount[].d=gehourcount[].q+1;
	end if;
else count[].d=count[].q+1;
end if;
shihour[3..0]=shihourcount[3..0];
gehour[3..0]=gehourcount[3..0];
end;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?