1 位宽内存数组
Array of 1-bit-wide memory
我正在使用 ISE 14.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_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 ;
合成后我收到此警告:
WARNING:Xst:3012 - Available block RAM resources offer a maximum of two write ports.
You are apparently describing a RAM with 16 separate write ports for signal <Memory>.
The RAM will be expanded on registers.
如何强制 xst 使用大小为 ARRAY_LENGTH 且宽度为 1 的分布式内存块?
我可以创建和使用单独的内存组件(并且有效),但我需要更优雅的解决方案。
您需要创建一个描述可变长度 1 位宽内存的实体,然后使用生成语句创建这些实体的数组。虽然您所做的将提供您在模拟器中要求的功能,但大多数 FPGA 工具只会在您的代码以特定方式编写时提取内存元素。
您可以在此处 http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_7/ise_n_xst_user_guide_v6s6.htm 为您的设备选择适当的文档,找到有关 Xilinx ISE 工具将哪些代码理解为存储器元素的文档。在 'HDL Coding techniques'.
下查看
请注意,如果您的内存长度很大,如果不添加手动流水线,您将无法从中获得最大性能。如果您的内存超过分布式内存的预期有用最大长度,我认为您会收到一条综合消息。假设您使用的是 Spartan 6 设备,您可以在此处找到有关受支持的有用分布式内存大小的信息:http://www.xilinx.com/support/documentation/user_guides/ug384.pdf 第 52 页。
这应该推断出 16 个一位宽的 BlockRAM:
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;
我正在使用 ISE 14.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_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 ;
合成后我收到此警告:
WARNING:Xst:3012 - Available block RAM resources offer a maximum of two write ports.
You are apparently describing a RAM with 16 separate write ports for signal <Memory>.
The RAM will be expanded on registers.
如何强制 xst 使用大小为 ARRAY_LENGTH 且宽度为 1 的分布式内存块?
我可以创建和使用单独的内存组件(并且有效),但我需要更优雅的解决方案。
您需要创建一个描述可变长度 1 位宽内存的实体,然后使用生成语句创建这些实体的数组。虽然您所做的将提供您在模拟器中要求的功能,但大多数 FPGA 工具只会在您的代码以特定方式编写时提取内存元素。
您可以在此处 http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_7/ise_n_xst_user_guide_v6s6.htm 为您的设备选择适当的文档,找到有关 Xilinx ISE 工具将哪些代码理解为存储器元素的文档。在 'HDL Coding techniques'.
下查看请注意,如果您的内存长度很大,如果不添加手动流水线,您将无法从中获得最大性能。如果您的内存超过分布式内存的预期有用最大长度,我认为您会收到一条综合消息。假设您使用的是 Spartan 6 设备,您可以在此处找到有关受支持的有用分布式内存大小的信息:http://www.xilinx.com/support/documentation/user_guides/ug384.pdf 第 52 页。
这应该推断出 16 个一位宽的 BlockRAM:
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;