0
我已經用VHDL做了一個雙端口寄存器庫,我想測試它以確保它能正常工作。我會如何去做這件事?我知道我想做什麼(將寄存器2設置爲常量,在測試程序中讀出它,寫入寄存器3並將其讀回並查看我是否具有相同的結果)。我只是VHDL的新手,所以我不知道是否有控制檯,測試程序是如何構建的,或者如何實例化寄存器文件,甚至不知道如何編譯它(I'迄今爲止一直使用quartus)。如何測試一個VHDL文件
這是我的寄存器文件:
所有的use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
-- Register File
entity RF is
port(
signal clk, we: in std_logic;
signal ImmediateValue : in std_logic_vector(15 downto 0);
signal RegisterSelectA, RegisterSelectB : in integer range 0 to 15;
signal AOut, BOut : out std_logic_vector(15 downto 0)
);
end RF
architecture behavior of RF is
array std_logic_vector_field is array(15 downto 0) of std_logic_vector(15 downto 0);
variable registers : std_logic_vector(15 downto 0);
process (clk, we, RegisterSelectA, RegisterSelectB, ImmediateValue)
wait until clk'event and clk = '1';
registers(RegisterSelectA) := ImmediateValue when we = '1';
AOut <= registers(RegisterSelectA);
BOut <= registers(RegisterSelectB);
end process;
end behavior;
什麼是爲downvote原因呢? –