2016-03-23 4 views
0

Я пишу процесс, который должен искать каждый входящий бит, следить за тем, чтобы получить или не получить полное количество полученных 1, и, когда придет время, нужно сравнить значение к эталонному значению. Процесс заключается в следующем:сигнал падает до неопределенного, пока все связанные сигналы определены

parity_tester : process(clk, sub_rst, barrel_data_in, barrel_enable, parity_test, parity_ref) 
     variable last_known_enable  : boolean := false; 
     variable last_known_data  : STD_LOGIC := '0'; 
     variable parity_error_out  : STD_LOGIC := '0'; 
     variable parity_ref_reg   : STD_LOGIC := '0'; 
     variable even     : STD_LOGIC := '1'; 
    begin 
     if sub_rst then 
      last_known_enable := false; 
      last_known_data  := '0'; 
      parity_error_out := '0'; 
      even    := '1'; 
     elsif rising_edge(clk) then 
      if barrel_enable then 
       last_known_enable := true; 
       last_known_data  := barrel_data_in; 
      else 
       if last_known_enable then 
        last_known_enable := false; 
        if last_known_data = '1' then 
         even := not even; 
        end if; 
       end if; 
      end if; 

      if parity_test then 
       case parity_bit_in_type is 
        when 0 => 
         parity_error_out := even xnor parity_ref; 
        when 1 => 
         parity_error_out := even xor parity_ref; 
        when 2 => 
         parity_error_out := parity_ref; 
        when 3 => 
         parity_error_out := not parity_ref; 
        when others => 
         parity_error_out := '1'; 
       end case; 
      end if; 
     end if; 
     parity_error <= parity_error_out; 
    end process; 

Здесь я столкнулись с проблемой: все сигналы, как они определены в списке чувствительности процесса определены, но в соответствии с GHDL (имитатор) изменения значений неопределенных всякий раз, когда parity_test идет к истинным : Signals Что я делаю неправильно?

Я удалил то, что было здесь, потому что, когда я перешел на свой ноутбук, ошибка изменилась: его о переключателе корпуса. Я до сих пор не понимаю почему. parity_bit_in_type является общим Природным с диапазоном (от 0 до 3). Если я выберу заявление, которое мне нужно (0 в этом случае) и удалит футляр, все будет работать так, как ожидалось. WebPack ISE, похоже, не жалуется на это, поэтому он начинает ощущаться как ошибка в GHDL.

GHDL версии:

/Downloads/ghdl-gcc-git » ghdl --version 
GHDL 0.34dev (20151126) [Dunoon edition] 
Compiled with GNAT Version: 5.3.0 
mcode code generator 
Written by Tristan Gingold. 

Copyright (C) 2003 - 2015 Tristan Gingold. 
GHDL is free software, covered by the GNU General Public License. There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

минимальный пример, который показывает такое же поведение

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 

entity uart_receiv_parity is 
    generic (
     parity_bit_in_type  : Natural range 0 to 3 
    ); 
    port (
     rst      : in boolean; 
     clk      : in STD_LOGIC; 
     parity_error   : out STD_LOGIC -- Signals that the parity check has failed, is zero if there was none 
    ); 
end entity; 

architecture Behavioral of uart_receiv_parity is 
begin 
    parity_tester : process(clk, rst) 
     variable parity_error_out  : STD_LOGIC := '0'; 
    begin 
     if rst then 
      parity_error_out := '0'; 
     elsif rising_edge(clk) then 
      case parity_bit_in_type is 
       when 0 => 
        parity_error_out := '1'; 
       when 1 => 
        parity_error_out := '0'; 
       when 2 => 
        parity_error_out := '1'; 
       when 3 => 
        parity_error_out := '0'; 
       when others => 
        parity_error_out := '1'; 
      end case; 
     end if; 
     parity_error <= parity_error_out; 
    end process; 
end Behavioral; 
+0

Нет, не знаю. Еще одна любопытная вещь: если я перейду на parity_error_out: = even, неопределенная вещь больше не произойдет. – Cheiron

+0

Какая у вас версия GHDL и бэкэнд? Является ли время до красной зоны зависимым от входных данных? Является ли красное значение 'U' или' X'? – Paebbels

+0

Выполняется ли ошибка, когда вы размещаете процесс в новой архитектуре и применяете к нему стимулы? –

ответ

0

Итак, это был моя вина после того, как все: в тестбенче сигнал был изгнан из двух источников. Поэтому «1» привело к тому, что сигнал управлялся как «1», так и «0», что привело к «х». Когда сигнал должен был быть «0», выход был фактически нулевым.