【问题标题】:Initializing memory in netlist VHDL在网表 VHDL 中初始化内存
【发布时间】:2013-05-18 18:06:24
【问题描述】:

使用 Synopsis DC 工具合成处理器代码后

现在我想使用 .mem 文件初始化此设计中 2 个组件中包含的 2 个 ram

如何使用我拥有的网表文件 - 合成的输出 - 因为我想通过在处理器上再次测试相同的代码来测试合成是否正确

在没有合成之前,只需将 .mem 文件加载到这些 ram 中然后对其进行测试就更容易了

任何帮助

【问题讨论】:

    标签: vhdl synthesis


    【解决方案1】:

    不必费心加载 .mem 文件;只需直接在 VHDL 中初始化内存即可。

    最简单的方法 - 如果它们是 ROM - 是将它们声明为常量数组。如果此声明位于单独的包中,您可以轻松地从编译器或汇编器创建的 hex 文件编写它的创建脚本。

    这是一个让您入门的示例

    package Memories is
    
    type Address is natural range 0 to 2**8 - 1;
    type Byte is std_logic_vector(7 downto 0);
    
    type Memory is array(Address) of Byte;
    
    -- Positional association is convenient if you are filling the whole memory
    -- constant ROM1 : Memory := (X"00", X"11", X"22", and so on);
    -- I'm not going to type out the lot!
    
    -- Named association is better for a simple test program
    constant ROM2 : memory := (
       0     => X"C3",
       1     => X"38",
       2     => X"00",
      16#38# => X"C3",
      16#39# => X"00",
      16#3A# => X"00",
      others => X"FF"
    );
    
    end Memories;
    

    如果它们是 RAM,您可以从同一个常量数组调用初始化它们。

    use Memories.all;
    constant ROM : Memory := ROM2;
    signal   RAM : Memory := ROM2;
    

    即使是我在过去五年中使用过的最原始的合成工具也能正确处理这些构造,所以如果 DC 不能做到这一点,我会感到非常惊讶。

    该初始数据必须由综合工具保存并以某种形式出现在网表中。如果你能理解那个表格,你可以根据需要修改数据,但更新源和重新综合可能更容易。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多