1.写一个带使能信号、清零信号、置数信号的六进制计数器的VHDL程序.2.由六进制、十进制计数器构成60进制
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/10 15:53:20
1.写一个带使能信号、清零信号、置数信号的六进制计数器的VHDL程序.2.由六进制、十进制计数器构成60进制
模多少的?任意?
我写了个模70的,如果要其他的自己修改参数就行了
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity count_led is port(
rst,clk:in std_logic;
y:out std_logic_vector(13 downto 0));
end count_led;
architecture Behavioral of count_led is
signal oc:std_logic;
signal data:std_logic_vector(3 downto 0);
Signal Data1:std_logic_vector(3 downto 0);
Signal Data2:std_logic_vector(3 downto 0);
signal count_1:STD_LOGIC_vector (3 DOWNTO 0);
signal count_2:STD_LOGIC_vector (3 DOWNTO 0);
signal outdata1:std_logic_vector(6 downto 0);
signal outdata2:std_logic_vector(6 downto 0);
begin
count1:process(rst,clk)
begin
if (rst='1') then
count_1<="0000";count_2<="0000";
elsif (rising_edge(clk)) then
if (count_1="1001") then
count_1<="0000";oc<='1';
else count_1<=count_1+1;oc<='0';
end if;
if(oc='1')then
count_2<=count_2+1;
elsif (count_2="0110") then
count_2<="0000";
end if;
end if;
Data1<=count_1;Data2<=count_2;
end process;
led1:process(rst,clk)
begin
if (rst='1') then
outdata1<="0000000";
else if (rising_edge(clk)) then
case data1 is
WHEN "0000"=>outdata1<="1111110";
WHEN "0001"=>outdata1<="0110000";
WHEN "0010"=>outdata1<="1101101";
WHEN "0011"=>outdata1<="1111001";
WHEN "0100"=>outdata1<="0110011";
WHEN "0101"=>outdata1<="1011011";
WHEN "0110"=>outdata1<="0011111";
WHEN "0111"=>outdata1<="1110000";
WHEN "1000"=>outdata1<="1111111";
WHEN "1001"=>outdata1<="1111011";
when others=>outdata1<="0000000";
end case;
case data2 is
WHEN "0000"=>outdata2<="1111110";
WHEN "0001"=>outdata2<="0110000";
WHEN "0010"=>outdata2<="1101101";
WHEN "0011"=>outdata2<="1111001";
WHEN "0100"=>outdata2<="0110011";
WHEN "0101"=>outdata2<="1011011";
WHEN "0110"=>outdata2<="0011111";
WHEN "0111"=>outdata2<="1110000";
WHEN "1000"=>outdata2<="1111111";
WHEN "1001"=>outdata2<="1111011";
when others=>outdata2<="0000000";
end case;
end if;
end if;
end process;
y<=outdata2&outdata1;
end Behavioral;
我写了个模70的,如果要其他的自己修改参数就行了
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity count_led is port(
rst,clk:in std_logic;
y:out std_logic_vector(13 downto 0));
end count_led;
architecture Behavioral of count_led is
signal oc:std_logic;
signal data:std_logic_vector(3 downto 0);
Signal Data1:std_logic_vector(3 downto 0);
Signal Data2:std_logic_vector(3 downto 0);
signal count_1:STD_LOGIC_vector (3 DOWNTO 0);
signal count_2:STD_LOGIC_vector (3 DOWNTO 0);
signal outdata1:std_logic_vector(6 downto 0);
signal outdata2:std_logic_vector(6 downto 0);
begin
count1:process(rst,clk)
begin
if (rst='1') then
count_1<="0000";count_2<="0000";
elsif (rising_edge(clk)) then
if (count_1="1001") then
count_1<="0000";oc<='1';
else count_1<=count_1+1;oc<='0';
end if;
if(oc='1')then
count_2<=count_2+1;
elsif (count_2="0110") then
count_2<="0000";
end if;
end if;
Data1<=count_1;Data2<=count_2;
end process;
led1:process(rst,clk)
begin
if (rst='1') then
outdata1<="0000000";
else if (rising_edge(clk)) then
case data1 is
WHEN "0000"=>outdata1<="1111110";
WHEN "0001"=>outdata1<="0110000";
WHEN "0010"=>outdata1<="1101101";
WHEN "0011"=>outdata1<="1111001";
WHEN "0100"=>outdata1<="0110011";
WHEN "0101"=>outdata1<="1011011";
WHEN "0110"=>outdata1<="0011111";
WHEN "0111"=>outdata1<="1110000";
WHEN "1000"=>outdata1<="1111111";
WHEN "1001"=>outdata1<="1111011";
when others=>outdata1<="0000000";
end case;
case data2 is
WHEN "0000"=>outdata2<="1111110";
WHEN "0001"=>outdata2<="0110000";
WHEN "0010"=>outdata2<="1101101";
WHEN "0011"=>outdata2<="1111001";
WHEN "0100"=>outdata2<="0110011";
WHEN "0101"=>outdata2<="1011011";
WHEN "0110"=>outdata2<="0011111";
WHEN "0111"=>outdata2<="1110000";
WHEN "1000"=>outdata2<="1111111";
WHEN "1001"=>outdata2<="1111011";
when others=>outdata2<="0000000";
end case;
end if;
end if;
end process;
y<=outdata2&outdata1;
end Behavioral;
1.写一个带使能信号、清零信号、置数信号的六进制计数器的VHDL程序.2.由六进制、十进制计数器构成60进制
设计一个计数器,输入计数脉冲和清零信号,输出2位16进制计数值.计数器的计数规律如下:清零信号有效时输
分别用整体预置数法和整体清零法,实现十进制计数器74160构成47进制计数器,画出连线图,并标明进位
数电课程设计可变模计数器,模为4、8、12、16.在控制信号的控制下实现变模计数
高数计数器器251有一程序 用高数计数器对编码脉冲信号计数 作限位控制正反转 现在我不想用限位控制 我想把ab脉冲 与p
试用74LS161集成计数器构成一个六十进制计数器,要求用反馈预置数法实现
用【Matlab】设计一个去除30Hz信号中50Hz的信号的小程序.
如何用同步十进制双时钟可逆计数器74LS192构成16进制的可逆计数器
触发器构成的计数器是多少进制计数器
周期信号频谱分析的matlab程序?
一道数电题目,如图,试用异步清零构成十二位计数器.
为什么测频时选用不同的闸门时间会改变测量的准确度?用7位电子计数器测量5MHz的信号频率,