我們有一個大學項目,我們必須模擬DSP的MAC單元。 對於模擬,我通過EDA操場使用Aldec Riviera Pro 2014.06。 問題是,即使我初始化了一個名爲add_res的32位有符號信號,在仿真時它的值將一直顯示爲XXXX_XXXX。模擬過程中信號值不會被初始化
Here's the simulation's result.
這裏的design.vhd
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
USE IEEE.numeric_std.all;
-----------------------------
ENTITY mac IS
PORT (B, C : IN SIGNED (15 DOWNTO 0);
clk : IN STD_LOGIC;
A : OUT SIGNED (31 DOWNTO 0));
END mac;
-----------------------------
ARCHITECTURE mac_rtl OF mac IS
SIGNAL mul_res: SIGNED (31 DOWNTO 0);
SIGNAL add_res: SIGNED (31 DOWNTO 0) := (others => '0');
BEGIN
mul_res <= B * C;
PROCESS (clk)
BEGIN
A <= mul_res + add_res;
add_res <= A;
END PROCESS;
END mac_rtl;
的代碼而這裏的
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity testbench is
end entity testbench;
architecture BENCH of testbench is
component mac is
port (B, C : in SIGNED (15 DOWNTO 0);
clk : in STD_LOGIC;
A : out SIGNED (31 DOWNTO 0));
end component;
signal StopClock : BOOLEAN;
signal clk : STD_LOGIC;
signal B, C : SIGNED (15 DOWNTO 0);
signal A : SIGNED (31 DOWNTO 0);
begin
ClockGenerator: process
begin
clk <= '0';
wait for 2 ns;
while not StopClock loop
clk <= '0';
wait for 1 ns;
clk <= '1';
wait for 1 ns;
end loop;
wait;
end process ClockGenerator;
Stimulus: process
begin
B <= "0000000000000010";
C <= "0000000000001000";
wait;
end process Stimulus;
DUT : entity work.mac
port map (B, C, clk, A);
end architecture BENCH;
我在這裏和在谷歌搜索一般的testbench.vhd的代碼對於其他人也有同樣的問題,但所給出的解決方案並沒有幫助。
我試過了,並用重置變量從testbench,但沒有。就像它根本不會被初始化,而其他一切正常工作。
你正在嘗試爲模式'out'('A')分配一個信號('add_res'),這是不可能的 – gsm
這是因爲我試圖在那裏實現反饋,因爲它顯示在這裏: [鏈接](http://turbo-cf.narod.ru/docs/MCF5307/MCF5307BUM-MAC.pdf)第2頁。 – jimkats
在IEEE Std 1076-2008中明確允許讀取模式輸出端口。6.5.2接口對象聲明,第13段「** out **。接口對象的值允許更新,如果它不是信號參數,請閱讀。」信號參數表示子程序的類信號接口對象,見6.5.2第1段。代碼暗示的是-2008。 – user1155120