Xilinx VHDL RAM 的初始化

2019-03-25 08:51发布

在网上找到一个RAM的程序,如下。
但我还想加一个Restart的输入口,加了一个process,当Restart和clk为1的时候通过data(10)<="11111111";进行初始化,可是报错说RAM连了太多的驱动。

请教高人,有没有别的办法初始化呢

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

entity ram is         
generic(width:integer :=8;length:integer:=256);                              
port(clk:in std_logic;
      r_add,w_add:in std_logic_vector(7 downto 0);
                restart,r_en,w_en:in std_logic;
      d_in:in std_logic_vector(width-1 downto 0);
      d_out:out std_logic_vector(width-1 downto 0));
end entity;
architecture art of ram is
type memory is array (0 to length-1) of std_logic_vector(width-1 downto 0);
signal data:memory;
begin
process(clk,w_add,w_en,d_in)
begin
   if clk'event and clk='1' then
    if w_en='1' then              
    data(conv_integer(w_add))<=d_in;
   end if;
  end if;
end process;
process(clk,r_add,r_en,data)
begin
    if clk'event and clk='1' then
        if r_en='1' then
     d_out<=data(conv_integer(r_add));
    end if;
   end if;
end process;
end art;

[ 本帖最后由 timdong 于 2012-10-28 01:31 编辑 ] 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。