2015-08-19 36 views
2

我想这个箴言报变量的状态:有没有办法在ISim中显示变量?

shared variable Div16 : integer := 0; 

但我在ISIM recieving此错误:

ISIM尚不支持VHDL变量的跟踪。

您可以将变量转换为testbench文件中的信号吗?或者还有什么其他的方式来显示这个值作为波形变化?

完整代码:

entity MAIN_UART is 
    generic (
    DIVISOR: natural := 120 -- DIVISOR = 50,000,000/(16 x BAUD_RATE) 
    -- 9600 -> 120 
    -- 19200 -> 60 
); 
    port (
    CLK: in std_logic;  -- clock 
    RST: in std_logic   -- reset 
); 
end MAIN_UART; 

architecture Behavioral of MAIN_UART is 

    signal Top16: std_logic; -- 1 clk spike at 16x baud rate  
    shared variable Div16 : integer := 0; 

-- constant COUNTER_BITS : natural := integer(ceil(log2(real(DIVISOR)))); 

begin 

-- -------------------------- 
-- Clk16 Clock Generation 
-- -------------------------- 
    process (RST, CLK) 
    begin 
     if RST='1' then 
      Top16 <= '0'; --good 
      Div16 := 0; 
     elsif rising_edge(CLK) then 
      Top16 <= '0'; 
       if Div16 = Divisor then 
        Div16 := 0; 
        Top16 <= '1'; --good 
       else 
        Div16 := Div16 + 1; 
       end if; 
     end if; 
    end process; 

end Behavioral; 
+0

您应该在流程中声明该变量,因此无需将其声明为共享。 – Paebbels

回答

2

您可以添加:

signal Div16_signal : integer := 0; 

然后在随后结束的过程中添加:

Div16_signal <= Div16; 
+0

这解决了它,谢谢! – VKkaps

+1

如果您希望iSim提供比默认值更高的其他基音,则需要声明div16信号,例如SIGNED,并向该变量添加一个转换以指示信号分配:)。 – Paebbels

+0

@Paebbels所以信号声明看起来像这样:“signal Div16_signal:unsignedinteger:= 0;”而且我不完全确定转换语句的变量是什么样子 – VKkaps

0

除的答案@ 0xMB 。

如果您希望iSim提供比默认值更高的其他基数,您需要声明div16信号,例如SIGNED,并向该变量添加一个转换以分配信号。

architecture rtl of myEntity is 
    signal DBG_div16 : SIGNED(31 downto 0); 
begin 

    process(clk) 
    variable div16 : integer := 0; 
    begin 
    -- some code 

    -- assign the variable to a signal, so iSim can display it's value 
    DBG_div16 <= signed(div16, DBG_div16'length); 
    end process; 

end architecture; 
相关问题