首页 > 解决方案 > 如何解决闩锁警告?

问题描述

我有一个关于 VHDL 的问题。以下代码用于游戏中的玩家回合选择器。它模拟得很好,但是当我生成一个比特流时,它有一个警告说:“[Synthesizer 8-327] infer latch for variable 'teToca_reg' [”C: /...../ Eleccion.vhd “: 137] ” 主要问题是由一个过程中的分配产生的,我需要它来让“cambio”信号接收该游戏中转弯的第一个值,并能够在每次按下 B1 后进行更改。出现问题的原因是稍后在相反方向上组合完成分配,因此输出“teToca”采用更改后的值。当游戏结束并且“win”给出一个值时,信号“FinPartida”设置为 1,因此“teToca”接收一个新值。

proceso_switch: process(clk,reset)
    begin
        if reset = '1' then
            cambia <= '0';
        elsif clk'event and clk='1' then
            if FinPartida='1' then
                cambia <= tetoca; --LATCH
            elsif state = S_JUEGO and flanco='1' and B1='1' and posicion/=9 and pos1(posicion)='0' and pos2(posicion)='0' then
                cambia <= NOT cambia; --OK
            end if; 
        end if;
    end process;

teToca <=   empieza when state = S_ESPERA and reset = '0' else  
            '0' when state = S_ESPERA and reset = '1' else      
            --PLATCH--                                                                                                                
            cambia when state = S_JUEGO AND (flanco='1' and B1='1' and posicion/=9 and pos1(posicion)='0' and pos2(posicion)='0') else
            --LATCH--
            '0' when state = S_JUEGO AND win="001" else 
            '1' when state = S_JUEGO AND win="100";     

turno <= teToca;

标签: vhdlwarningsfpgaxilinx

解决方案


推荐阅读