2
最近、私はVHDLを使って16ビットRAMを書いています。私のコードは次のとおりです。私が直面VHDLの定数データをRAMに設定
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;
entity RAM is
port(
PC_in: in std_logic_vector (5 downto 0);
EN_WR_in: in std_logic_vector (1 downto 0);
RAM_in : in std_logic_vector(15 downto 0);
RAM_out : out std_logic_vector(15 downto 0);
test : out integer
);
end RAM;
architecture Behavioral of RAM is
type ram_t is array (63 downto 0) of std_logic_vector(15 downto 0);
signal ram : ram_t;
begin
PROCESS (EN_WR_in)
BEGIN
if (EN_WR_in(1)='1') then
IF (EN_WR_in(0) = '1') THEN
ram(conv_integer(unsigned(PC_in))) <= RAM_in;
else
RAM_out <= ram(conv_integer(unsigned(PC_in)));
end if;
else
RAM_out <="ZZZZZZZZZZZZZZZZ";
end if;
END PROCESS;
ram(20) <= "0000100010010000";
end Behavioral;
問題は、私はちょうど
ram(20) <= "0000100010010000";
しかし、一定のデータがシミュレーション中に存在していなかったようにRAM内のいくつかの定数データを設定する必要があります。それを解決する方法はありますか?
ありがとうございました。あなたはそれを宣言するとき
をあなたも、あなたのRAMブロックを初期化する機能を使用することができます。 '信号ラム:ram_t:= load_from_file (ファイル名); ' – trondd
関数を使いたいのであれば、[this](http://stackoverflow.com/questions/10555729/bram-init-in-vhdl) – jrast