vhdl语言,根据给出的异步复位功能的模16加法计数器,写一个带同步复位功能的模10的加法计数器。
libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycnt16ispo...
library ieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entity cnt16 is
port(clk,clr : instd_logic;
q:buffer std_logic_vector(3 downto 0));
end;
architecture one ofcnt16 is
begin
process(clr,clk)
begin
ifclr=’1’ thenq<=”0000”;
elsifclk’event and clk=’1’ then
q<=q+1;
endif;
endprocess;
end; 展开
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entity cnt16 is
port(clk,clr : instd_logic;
q:buffer std_logic_vector(3 downto 0));
end;
architecture one ofcnt16 is
begin
process(clr,clk)
begin
ifclr=’1’ thenq<=”0000”;
elsifclk’event and clk=’1’ then
q<=q+1;
endif;
endprocess;
end; 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏20(财富值+成长值)
2个回答
展开全部
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity cnt10 is
port(clk,clr : in std_logic;
cnt: buffer std_logic_vector(3 downto 0)
);
end cnt10;
architecture aa of cnt10 is
begin
process(clr,clk)
begin
wait until clk'event and clk='1'
if (clr ='1'or cant=9) then
cnt<="0000";
else
cnt <= cnt+ 1;
end if;
end process;
end cant;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity cnt10 is
port(clk,clr : in std_logic;
cnt: buffer std_logic_vector(3 downto 0)
);
end cnt10;
architecture aa of cnt10 is
begin
process(clr,clk)
begin
wait until clk'event and clk='1'
if (clr ='1'or cant=9) then
cnt<="0000";
else
cnt <= cnt+ 1;
end if;
end process;
end cant;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity cnt10 is
port(
clk,clr : in std_logic;
q : buffer std_logic_vector(3 downto 0)
);
end;
architecture one of cnt10 is
signal count : integer range 0 to 9:=0;
begin
process(clr,clk)
begin
if(clk'event and clk='1')then
if (clr ='1') then
q<="0000";
else
count <= count + 1;
if(count = 9) then
count <= 0;
q <= q+1;
end if;
end if;
end if;
end process;
end;
end;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity cnt10 is
port(
clk,clr : in std_logic;
q : buffer std_logic_vector(3 downto 0)
);
end;
architecture one of cnt10 is
signal count : integer range 0 to 9:=0;
begin
process(clr,clk)
begin
if(clk'event and clk='1')then
if (clr ='1') then
q<="0000";
else
count <= count + 1;
if(count = 9) then
count <= 0;
q <= q+1;
end if;
end if;
end if;
end process;
end;
end;
追问
process(clr,clk)这句有人说clr要去掉,请问需要么?谢谢了
追答
可以去掉。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |