我設計了一個實體乘法和一個實現此實體的體系結構,但我不知道如何爲此編寫測試臺。換句話說:我如何將價值傳遞給我的架構? 我不確定這段代碼是否正確,但我不能測試它,而不傳遞值。VHDL中的測試臺
library ieee;
use ieee.numeric_std.all;
use ieee.std_logic_1164.all;
entity multiply is
port (
in_A : in std_ulogic_vector(7 downto 0);
in_B : in std_ulogic_vector(7 downto 0);
out_Q : out std_ulogic_vector(15 downto 0)
);
end multiply;
architecture multiply_arch of multiply is
signal p0 : std_ulogic_vector(7 downto 0);
signal p1 : std_ulogic_vector(7 downto 0);
signal p2 : std_ulogic_vector(7 downto 0);
signal p3 : std_ulogic_vector(7 downto 0);
signal p4 : std_ulogic_vector(7 downto 0);
signal p5 : std_ulogic_vector(7 downto 0);
signal p6 : std_ulogic_vector(7 downto 0);
signal p7 : std_ulogic_vector(7 downto 0);
begin
p0 <= (7 downto 0 => in_A(0)) and in_B;
p1 <= (7 downto 0 => in_A(1)) and in_B;
p2 <= (7 downto 0 => in_A(2)) and in_B;
p3 <= (7 downto 0 => in_A(3)) and in_B;
p4 <= (7 downto 0 => in_A(4)) and in_B;
p5 <= (7 downto 0 => in_A(5)) and in_B;
p6 <= (7 downto 0 => in_A(6)) and in_B;
p7 <= (7 downto 0 => in_A(7)) and in_B;
out_Q(15 downto 1) <= std_ulogic_vector((unsigned(p0) + unsigned(p1&"0") + unsigned(p2&"00") + unsigned(p3&"000") + unsigned(p4&"0000") + unsigned(p5&"00000") + unsigned(p6&"000000") + unsigned(p7&"0000000")));
end architecture multiply_arch;
-1很明顯的作業。顯然還沒有閱讀他們關於VHDL編碼的第一章,或者哪一章涉及到實體實例。 – Philippe