내가 자일링스 14.3에서 VHDL 코딩 해요 그리고 Nexys이 보드를 목표로하고있다 *. * 내가 읽은 바로는내 VHDL 코드에 래치가있는 이유는 무엇입니까? 출력이 아닌 경우 문을/경우 또는 때
는 래치는 불완전 거기에서 오는 가능한 모든 경로에 설정하십시오.
나는 여러 번 코드를 살펴 봤지만 여전히 두 개의 래치를 얻고 있습니다. 이제
WARNING:Xst:737 - Found 8-bit latch for signal <DR>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 8-bit latch for signal <P>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
, 등, 일부 신호가 사용되지 않고 큰 덩어리가 주석 때문에 나는 몇 가지 다른 오류를 얻고있다 ...하지만 난 내 코드 아직 아니에요 그것은 문제가되지 않습니다 지금.
그래서 모든 경로가 각 출력을 설정할 때 왜이 코드에서 래치가 계속 발생합니까? 그래서 그들은 변화하지 않거나 말해서 최근 값을 유지;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity project2vhd is
Port (CE_s : in STD_LOGIC;
A0 : in STD_LOGIC;
RD_s : in STD_LOGIC;
WR_s : in STD_LOGIC;
RESET : in STD_LOGIC;
ACK_s : inout STD_LOGIC;
Y1, Y2, Y3 : inout STD_LOGIC;
-- Din : in STD_LOGIC_VECTOR (7 downto 0);
-- Dout : out STD_LOGIC_VECTOR (7 downto 0);
D : inout STD_LOGIC_VECTOR (7 downto 0);
EN_s : out STD_LOGIC;
P : inout STD_LOGIC_VECTOR (7 downto 0));
end project2vhd;
architecture Behavioral of project2vhd is
signal CR : STD_LOGIC_VECTOR (1 downto 0);
signal SR : STD_LOGIC_VECTOR (2 downto 0);
signal DR : STD_LOGIC_VECTOR (7 downto 0);
begin
process (WR_s, ACK_s, RESET, A0, RD_s)
begin
if (RESET = '1') then --if reset is high
Y1 <= '0';
Y2 <= '0';
Y3 <= '0';
D <= "ZZZZZZZZ";
EN_s <= '0'; --check EN_s's value at reset
P <= P;
DR<= DR;
else
D <= D;
DR <= DR;
P <= P;
-- if (CR(0) = '1') then --Mode 1
--
-- Y1 <= ((Y1 and (not Y2) and Y3) or
-- (WR_s and ACK_s and (not Y2) and Y3));
-- Y2 <= '0';
-- Y3 <= (((not Y1) and (not Y2) and Y3) or
-- (WR_s and ACK_s and (not Y2) and Y3) or
-- ((not Y1) and (not Y2) and (not WR_s) and ACK_s) or
-- ((not WR_s) and (not Y2) and Y3));
-- SR(2) <=(((not ACK_s) and (not Y2) and (not Y3)) or --obf
-- (WR_s and (not ACK_s) and (Y1) and (not Y2)) or
-- (WR_s and (not ACK_s) and (not Y2) and Y3) or
-- (WR_s and (not Y1) and (not Y2)));
-- SR(0) <= (((not Y2) and (not Y3)) or --INTR_enable
-- (WR_s and (not Y1) and (not Y2)) or
-- ((not WR_s) and (not ACK_s) and (not Y1) and (not Y2) and Y3));
--
--
-- if (CE_s = '1') then
-- D <= "ZZZZZZZZ";
--
-- else
-- if (WR_s = '0' and A0 = '0') then --Write Data (MODE 1)
-- EN_s <= '0'; -- enable buffer
--
-- DR <= D;
-- P <= D;
--
-- elsif (WR_s = '0' and A0 = '1') then --control Reg Mode (MODE 1 and 0)
-- EN_s <= '0'; -- enable buffer
--
-- CR(0) <= D(0);
-- CR(1) <= D(1);
---- SR(0)
---- SR(1)
---- SR(2)
--
--
-- elsif (RD_s = '0' and A0 = '1') then -- Read Status (MODE 1)
-- EN_s <= '1'; -- disable buffer
--
-- D <= DR;
---- D <= "10101010"
--
-- else
-- EN_s <= '0'; -- enable buffer
-- D <= "ZZZZZZZZ";
--
-- end if;
-- end if;
-- else --Mode 0
SR <= "111";
if (CE_s = '0' and WR_s = '0' and A0 = '1') then
EN_s <= '0'; -- enable buffer
DR <= D;
CR(1) <= D(1);
CR(0) <= D(0);
P <= P;
elsif (CE_s = '0' and WR_s = '0' and A0 = '0') then
EN_s <= '1'; -- disable buffer
P <= DR;
DR <= DR;
else
EN_s <= '0'; -- enable buffer
D <= "ZZZZZZZZ";
DR <= DR;
P <= P;
end if;
-- end if;
end if;
end process;
end Behavioral;
나는 래치를 고치기를 바라는 사람들을 실제로 추가했다. 다시 테스트하려면 자체를 할당 할 때마다 제거했지만 여전히 정확한 래치를 얻고 있습니다. 다른 수정 사항을 알고 있습니까? – twbbas
만약 당신이 어떤 경우에 신호를 할당하지 않는다면, 그 신호를 그 자신에게 할당하는 것과 같은 의미를 갖거나 "마지막 값 기억"은 당신이 래치를 만들었다는 것을 의미합니다. 래치를 원하지 않으면 입력 문에 기반한 값을 조건문의 모든 코드 경로에서 각 출력에 명시 적으로 할당해야합니다. –