Vhdl 1位宽内存阵列
我正在使用ISE14.7,我正在尝试用一些1位宽的分布式RAM块来创建设计 我的记忆宣言:Vhdl 1位宽内存阵列,vhdl,ram,Vhdl,Ram,我正在使用ISE14.7,我正在尝试用一些1位宽的分布式RAM块来创建设计 我的记忆宣言: type tyMemory is array (0 to MEMORY_NUM - 1) of std_logic_vector(MEMORY_SIZE - 1 downto 0) ; signal Memory: tyMemory := ( others => (others => '0')) ; attribute ram_style : string ; attribute ram_st
type tyMemory is array (0 to MEMORY_NUM - 1) of std_logic_vector(MEMORY_SIZE - 1 downto 0) ;
signal Memory: tyMemory := ( others => (others => '0')) ;
attribute ram_style : string ;
attribute ram_style of Memory : signal is "distributed" ;
我的代码:
MemoryGen : for i in 0 to MEMORY_NUM - 1 generate
process( CLK )
begin
if rising_edge(CLK) then
if CE = '1' then
DataOut(i) <= Memory(i)(Addr(i)) ;
Memory(i)(Addr(i)) <= DataIn(i) ;
end if ;
end if ;
end process ;
end generate ;
MemoryGen:为0中的i生成内存\u NUM-1
过程(CLK)
开始
如果上升沿(CLK),则
如果CE='1',则
DataOut(i)您需要创建一个描述可变长度1位宽内存的实体,然后使用generate语句创建这些实体的数组。虽然您所做的将提供您在模拟器中要求的功能,但大多数FPGA工具仅在您的代码以特定方式编写时才会提取内存元素
通过在此处为您的设备选择合适的文档,您可以找到Xilinx ISE工具将哪些代码理解为内存元素的文档。请参阅“HDL编码技术”
请注意,如果内存长度很大,如果不添加手动流水线,您将无法从中获得最大性能。我认为,如果您的内存超过了分布式内存的预期有效最大长度,您将收到一条合成消息。假设您使用的是Spartan 6设备,您可以在此处找到有关支持的有用分布式内存大小的信息:第52页。这应该可以推断出16个一位宽的块:
architecture ...
attribute ram_style : string;
subtype tyMemory is std_logic_vector(MEMORY_SIZE - 1 downto 0) ;
begin
genMem : for i in 0 to MEMORY_NUM - 1 generate
signal Memory : tyMemory := (others => '0');
attribute ram_style of Memory : signal is "block";
begin
process(clk)
begin
if rising_edge(clk) then
if CE = '1' then
Memory(Addr(i)) <= DataIn(i) ;
DataOut(i) <= Memory(Addr(i)) ;
end if ;
end if ;
end process ;
end generate ;
end architecture;
架构。。。
属性ram_样式:字符串;
子类型tyMemory是标准逻辑向量(内存大小-1到0);
开始
genMem:为0中的i生成内存_NUM-1
信号存储器:tyMemory:=(其他=>'0');
存储器的属性ram_类型:信号为“块”;
开始
过程(clk)
开始
如果上升沿(clk),则
如果CE='1',则
内存(Addr(i))如果要使用块ram,需要将ram_样式设置为block
!分布式RAM是LUTRAM。正如XST所抱怨的,您的RAM描述有16个写端口,而块RAM只有2个。
architecture ...
attribute ram_style : string;
subtype tyMemory is std_logic_vector(MEMORY_SIZE - 1 downto 0) ;
begin
genMem : for i in 0 to MEMORY_NUM - 1 generate
signal Memory : tyMemory := (others => '0');
attribute ram_style of Memory : signal is "block";
begin
process(clk)
begin
if rising_edge(clk) then
if CE = '1' then
Memory(Addr(i)) <= DataIn(i) ;
DataOut(i) <= Memory(Addr(i)) ;
end if ;
end if ;
end process ;
end generate ;
end architecture;