计数器设计的两种表达方式
1. PROCESS(Clk)
VARIABLE CNT : INTEGER RANGE 0 TO 20;
BEGIN
IF (RST='1')
CNT:=0;
ELSIF CLK'EVENT AND CLK='1'
IF (Cnt=0)
Cnt:=20;
ELSE
Cnt:=Cnt-1;
END IF;
END IF;
END PROCESS;
1. PROCESS(Clk)
VARIABLE CNT : INTEGER RANGE 0 TO 20;
BEGIN
IF (RST='1')
CNT:=0;
ELSIF CLK'EVENT AND CLK='1'
IF (Cnt=20)
Cnt:=0;
ELSE
Cnt:=Cnt+1;
END IF;
END IF;
END PROCESS;