나는 RS232 송신기 모듈을 스파르타의 VHDL에 쓰려고한다. 자일링스의 시뮬레이션에 따르면, 잘 작동하는 것처럼 보이지만, 디바이스에 배치하려고하면 간단히 작동하지 않는다. 나는 그것이 래치에 문제가 될 수 있다는 것을 알았지 만, 어떻게 든 그것들을 정확히 지적 할 수는 없다. 50Mhz 클럭을 사용하고 전송 비트율은 115200bps입니다.vhdl 래치의 RS232 송신기 모듈?
Xst:737 - Found 1-bit latch for signal <ready>. 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.
Xst:737 - Found 1-bit latch for signal <state_0>. 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; -- 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 nadajnikRS is
Port (start : in STD_LOGIC;
reset : in STD_LOGIC;
clk : in STD_LOGIC;
DI : in STD_LOGIC_VECTOR(7 downto 0);
RS_TX : out STD_LOGIC;
busy : out STD_LOGIC);
end nadajnikRS;
architecture Behavioral of transRS is
signal register : STD_LOGIC_VECTOR(8 downto 0) := (others => '1');
signal counter : INTEGER range 0 to 9 := 0;
signal baud_clk : STD_LOGIC := '0';
signal ready : STD_LOGIC := '0';
type states is (working, free);
signal state: states := free;
signal baud_counter : INTEGER range 0 to 220 := 215;
begin
baud_clock: process (clk)
begin
if rising_edge(clk) then
if (ready = '1') then
if (baud_counter < 218) then
if (baud_counter = 217) then
baud_clk <= '1';
end if;
baud_counter <= baud_counter+1;
else
baud_counter <= 0;
baud_clk <= '0';
end if;
else
baud_counter <= 0;
end if;
end if;
end process baud_clock;
shiftregister : process (baud_clk)
begin
if rising_edge(baud_clk) then
if (state = free) then
RS_TX <= '0';
register (7 downto 0) <= DI;
else
RS_TX <= register(0);
register <= '1' & register(8 downto 1);
end if;
end if;
end process shiftregister;
bitcounter : process (baud_clk)
begin
if rising_edge(baud_clk) then
counter <= counter + 1;
if (counter = 10) then
counter <= 1;
end if;
end if;
end process bitcounter;
shiftstate: process (reset, counter, start)
begin
if (reset = '1') then
ready <= '0';
end if;
if (start = '1') then
ready <= '1';
state <= free;
end if;
if (counter = 1) then
state <= working;
elsif (counter = 10) then
state <= free;
end if;
end process;
statemachine : process (state)
begin
case state is
when working => busy <= '1';
when free => busy <= '0' ;
end case;
end process statemachine;
end Behavioral;
내가 두 래치 경고를 얻을 :
이 내 VHDL 코드입니다. 레지스터는 이후 나는, Ghaad
내 baud_clock 및 shiftregister 프로세스의 민감도 목록을 단일 이벤트로 변경했지만 래치 문제를 수정하지 않았습니다. – Ghaad
감도 목록을 변경해도 합성에는 아무런 영향이 없습니다. 이것은 더 깊은 문제를 나타내는 것일뿐입니다. 래치 문제를 해결하려면, 위의 템플릿을 따르도록 프로세스를 변경하십시오. 특히'if (rising_edge (clk)) ... end if;'구조의 앞이나 뒤에 선언문이 없는지 확인하십시오. – zennehoy
그래도 여전히 도움이되지 않는다면, 코드를 치우고 빌드하려는 회로의 Register-Transfer-Level 블록 다이어그램을 그립니다.이것은 HDL-HDL을 배우는 것이 프로그래밍 언어가 아닌 하드웨어 * 기술 * 언어 일 때 매우 중요한 단계입니다! – zennehoy