VHDL 30进制减计数器编写 不知道对不对 望帮帮忙 谢谢
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity d is
port(clk: in bit;
oc: out bit;
y: out integer range 0 to 29);
end d;
architecture dh of d is
signal q: integer range 0 to 29;
begin
pl: process (clk)
begin
if(clk'event and clk='1') then
if q=29 then
q<=q-1;
elsif
q=0 then
q<=29;
end if;
end if;
if q<15 then
oc<='0';
else
oc<='1';
end if;
y<=q;
end process;
end;
大家看看 对不对 还有我希望在这个计数器上添加 暂停和连续 以及清零的工作 也是有VHDL 该怎么写 谢谢