|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
在VHDL中,一个record能不能作为signal传递?
如下面这个程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std.all;
use work.complex_num.all;
entity w_rom is
port(
addr : in integer;
dout : out complex
);
end w_rom;
architecture arch of w_rom is
type romtable is array (0 to 7) of complex;
constant romdata : romtable :=
( ("0000000100000000","0000000000000000"), -- 1
("0000000010110101","1111111101001011"), -- 0.7071 - 0.7071i
("0000000000000000","1111111100000000"), -- 0.0000 - 1.0000i
("1111111101001011","1111111101001011"), -- -0.7071 - 0.7071i
("1111111100000000","0000000000000000"), -- -1.0000 - 0.0000i
("1111111100000000","0000000000000000"), -- -0.7071 + 0.7071i
("0000000000000000","0000000100000000"), -- -0.0000 + 1.0000i
("0000000010110101","0000000010110101") -- 0.7071 + 0.7071i
);
begin
process(addr)
begin
dout <= romdata(addr);
end process;
end arch;
complex是我定义在work.complex_num里的一个record,有re和img两个部分。我用下面这个testbench运行的时候
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
use work.complex_num.all;
entity tb_w_rom is end tb_w_rom;
architecture arch of tb_w_rom is
component w_rom
port(
addr : in integer;
dout : out complex
);
end component;
signal addr : integer;
signal dout : complex;
begin
c1 : w_rom port map (addr, dout);
addr <= 1;
--1 after 10 ns,
--2 after 20 ns,
--3 after 30 ns,
--4 after 40 ns,
--5 after 50 ns,
--6 after 60 ns,
--7 after 70 ns;
end arch;
在compile的时候没有任何error或者warning,但是run的时候程序就指在dout <= romdata(addr);(程序里红色)的这一行不能运行,请教一下是不是record不能这么传递。
非常感谢。 |
|