实现74160的所有功能
时间:10-02
整理:3721RD
点击:
不能在同一进程中判断判断两个时钟沿,但是用两个进程是不是不能对同一输出dout赋值,求助,谢谢!
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity demo74160 is
port (clk,rst,ld,ep,et:in std_logic;
data:in std_logic_vector(3 downto 0);
dout:out std_logic_vector(3 downto 0);
cout:out std_logic
);
end demo74160;
architecture behav of demo74160 is
shared variable Q:std_logic_vector(3 downto 0);
begin
process(clk,rst,ld,ep,et)
begin
if rst='0' then
Q:=(others=>'0');
elsif (clk'event and clk='1') then
if ld='0' then
Q:=data;
else
if(ep='1' and et='1') then
if Q '0');
else
if(clk'event and clk='0') then
if ld='1' then
if(ep='0' and et='1') then
Q:=Q;
elsif(et='0') then
Q:=Q;
cout<='0';
end if;
end if;
end if;
end if;
if P=9 then cout<='1';
else cout<='0';
end if; dout<=Q;
end process;
end behav;
如何解决这些错误