求助。用VHDL语言设计74ls192中遇到的问题
时间:10-02
整理:3721RD
点击:
输入 输出
clr cp1 cp2 q3 q2 q1 q0 d3 d2 d1 d0
1 × × × × × × × 0 0 0 0
0 0 × × a b c y a b c y
0 1 1 × × × × 加计数
0 1 1 × × × × 减计数
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
ENTITY LS192 IS
port (clr,set,cp1,cp2 : in STD_LOGIC;
q : in STD_LOGIC_VECTOR(3DOWNTO 0);
d: out STD_LOGIC_VECTOR(3DOWNTO 0);
jinwei:out STD_LOGIC;
jiewei:out STD_LOGIC);
end ENTITY LS192 ;
architecture behav of LS192 is
signal conut1_4 : STD_LOGIC_VECTOR(3DOWNTO 0);
signal conut2_4 : STD_LOGIC_VECTOR(3DOWNTO 0);
signal a1 : STD_LOGIC;
signal a2 : STD_LOGIC;
begin
process( clr,set,cp1,q) --jifaqi
begin
if(clr='1')then --qingling
conut1_4<="0000";
a1<='0';
jinwei<='0';
elsif(set='0')then --zhishu
conut1_4(0)<=q(0);
conut1_4(1)<=q(1);
conut1_4(2)<=q(2);
conut1_4(3)<=q(3);
elsif(cp1'event and cp1 = '1')then --
if(conut1_4="1001")then
conut1_4<="0000";
a1<='1';
else
conut1_4<=conut1_4+1;
if(a1='1')then
a1<='0';
end if;
end if;
end if;
d(0)<=conut1_4(0) ;
d(1)<=conut1_4(1) ;
d(2)<=conut1_4(2) ;
d(3)<=conut1_4(3) ;
jinwei<=a1;
end process;
process( clr,set,cp2,q) --jianfa
begin
if(clr='1')then --qingling
conut2_4<="0000";
a2<='0';
jiewei<='0';
elsif(set='0')then --zhishu
conut2_4(0)<=q(0);
conut2_4(1)<=q(1);
conut2_4(2)<=q(2);
conut2_4(3)<=q(3);
elsif(cp2'event and cp2 = '1')then --
if(conut2_4="0000")then
conut2_4<="1001";
a2<='1';
else
conut2_4<=conut2_4-1;
if(a2='1')then
a2<='0';
end if;
end if;
end if;
d(0)<=conut2_4(0) ;
d(1)<=conut2_4(1) ;
d(2)<=conut2_4(2) ;
d(3)<=conut2_4(3) ;
jiewei<=a2;
end process;
end architecture behav;
clr cp1 cp2 q3 q2 q1 q0 d3 d2 d1 d0
1 × × × × × × × 0 0 0 0
0 0 × × a b c y a b c y
0 1 1 × × × × 加计数
0 1 1 × × × × 减计数
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
ENTITY LS192 IS
port (clr,set,cp1,cp2 : in STD_LOGIC;
q : in STD_LOGIC_VECTOR(3DOWNTO 0);
d: out STD_LOGIC_VECTOR(3DOWNTO 0);
jinwei:out STD_LOGIC;
jiewei:out STD_LOGIC);
end ENTITY LS192 ;
architecture behav of LS192 is
signal conut1_4 : STD_LOGIC_VECTOR(3DOWNTO 0);
signal conut2_4 : STD_LOGIC_VECTOR(3DOWNTO 0);
signal a1 : STD_LOGIC;
signal a2 : STD_LOGIC;
begin
process( clr,set,cp1,q) --jifaqi
begin
if(clr='1')then --qingling
conut1_4<="0000";
a1<='0';
jinwei<='0';
elsif(set='0')then --zhishu
conut1_4(0)<=q(0);
conut1_4(1)<=q(1);
conut1_4(2)<=q(2);
conut1_4(3)<=q(3);
elsif(cp1'event and cp1 = '1')then --
if(conut1_4="1001")then
conut1_4<="0000";
a1<='1';
else
conut1_4<=conut1_4+1;
if(a1='1')then
a1<='0';
end if;
end if;
end if;
d(0)<=conut1_4(0) ;
d(1)<=conut1_4(1) ;
d(2)<=conut1_4(2) ;
d(3)<=conut1_4(3) ;
jinwei<=a1;
end process;
process( clr,set,cp2,q) --jianfa
begin
if(clr='1')then --qingling
conut2_4<="0000";
a2<='0';
jiewei<='0';
elsif(set='0')then --zhishu
conut2_4(0)<=q(0);
conut2_4(1)<=q(1);
conut2_4(2)<=q(2);
conut2_4(3)<=q(3);
elsif(cp2'event and cp2 = '1')then --
if(conut2_4="0000")then
conut2_4<="1001";
a2<='1';
else
conut2_4<=conut2_4-1;
if(a2='1')then
a2<='0';
end if;
end if;
end if;
d(0)<=conut2_4(0) ;
d(1)<=conut2_4(1) ;
d(2)<=conut2_4(2) ;
d(3)<=conut2_4(3) ;
jiewei<=a2;
end process;
end architecture behav;
其功能是一个同步的十进制可逆计数器,具有双时钟输入,并有清除和置数等功能
两个进程整合不到一块。主要是:d(0)<=conut2_4(0) ;
d(1)<=conut2_4(1) ;
d(2)<=conut2_4(2) ;
d(3)<=conut2_4(3) ;
和d(0)<=conut1_4(0) ;
d(1)<=conut1_4(1) ;
d(2)<=conut1_4(2) ;
d(3)<=conut1_4(3) ;
d是输出,用led显示。这两个进程要怎么整合到一块
遇到的是,d这个输出信号改怎么赋值?谢谢大神们啊,
