2013-03-26 24 views
0

我想知道如何聲明二維內存與通用數據寬度與通用數據寬度VHDL多維存儲

package mem_pkg is 
    subtype data is std_logic_vector(7 downto 0); 
    type data_vector is array(natural range <>) of data; 
end; 
entity mem is 
port (
    clk : in std_logic; 
    we : in std_logic -- write enable 
    a: in unsigned(4 downto 0); -- address 
    di : in data; -- data_in 
    do : out data -- data_out 
); 
end mem; 

而不是7,我想要的數據寬度是通用。

回答

0

這不是二維的 - 這是一個向量,這是(微妙)不同的向量。

一個二維數組是

type data_vector is array (natural range <>, natural range <>) of integer; 

但是,回到你的問題:

直到「最近」(VHDL 2008)你不能有一個約束陣列的約束陣列。但現在你可以這樣做:

type mem is array(natural range <>) of std_logic_vector; 
signal store : mem(0 to 15)(7 downto 0); 

VHDL 2008 - 只是新的東西」 有更多的細節:

http://books.google.co.uk/books?id=ETxLguPMEY0C&lpg=PA241&ots=q7u_Mn0SFR&dq=vhdl%202008%20just%20the%20new%20stuff%20p%20120&pg=PA120#v=snippet&q=alias%20of%20a%20register%20file%20signal&f=false

+0

謝謝,但它不是由在XST – 2013-03-26 19:15:17

+0

我支持擔心在Xilinx抱怨他們最終需要支持* 5年前的*標準時,您將不得不加入全體團隊。 – 2013-03-27 10:23:31