我过去几天一直试图合成以下代码:
entity Key is
port(rnum:in std_logic_vector(7 downto 0);knap: out random;clk1:in std_logic);
end Key;
architecture Behavioral of Key is
component Rndgen
port(clk: in std_logic; rndnum: out std_logic_vector(7 downto 0));
end component;
signal randomno: std_logic_vector(7 downto 0);
variable a:random;
--signal clk:std_logic;
--signal temp:std_logic_vector(7 downto 0);
begin
procure: Rndgen port map (clk=>clk1,knap=>randomno);
acquire: process (clk1)
begin
if rising_edge(clk1) then
rnum <= randomno;
end if;
end process;
store: process(clk)
begin
for i in 0 to 7 loop
if rising_edge(clk1) then
a[i]:=rnum;
end if;
end loop;
end process;
end Behavioral;
这是一个顶级模块,具有随机数生成的实例。问题是数组a是一个变量,而rnum是一个信号。但是为了使我的设计正常工作,必须将信号分配给阵列。对不起,如果这听起来有点愚蠢,我是VHDL的新手。 任何帮助,将不胜感激。 -ak