Verilog设计指定寄存器数组在综合时使用block memory资源(Altera)

有的时候我们自己用Verilog代码写的rom或ram会被quartus ii综合成查找表,并没有使用到block memory资源。
以下是在网上查到的一段说明:(没找到原创链接,都是转载,,,)

To use the ramstyle attribute in a Verilog Design File (.v), specify the synthesis attribute delimited by (* and *) preceding the Variable Declaration of an inferred RAM whose implementation you want to control. Specify the synthesis attribute value as “logic”, “M512”, “M4K”, “M9K”, “M20K”, “M144K”, “MLAB”, or “M-RAM” depending on the type of memory block you want the Quartus II software to use when implementing the inferred RAM. If you use the synthesis attribute on anything but a variable that represents a RAM, or if you specify an illegal value, the Quartus II software ignores that synthesis attribute.
By setting the value to “M512”, “M4K”, “M9K”, “M20K”, “M144K”, “MLAB”, or “M-RAM”, you can choose the type of memory block that the Quartus II software uses when implementing the inferred RAM. If the attribute is set to “logic”, then the RAM is implemented in logic cells.

大致意思是说如果我们想要quartus指定一个寄存器数组在布局布线时使用block memory资源。可以通过代码告诉综合工具(只对寄存器数组有效,其他类型的寄存器综合工具会忽略掉)。
具体方法是这样的:

For example, in the following code, the ramstyle synthesis attribute specifies that the inferred RAM my_ram should be implemented using an M512 memory block:

(* ramstyle = "M512" *) reg [0:7] my_ram[0:63];

那现在来实践一下。
我使用的是Arria 10系列的芯片,先来看看该系列芯片的block memory资源都有什么类型,如下图:
(不同系列的芯片其block memory类型是不一样的,写之前要先查看手册,不要照搬我的)
请添加图片描述
可以看到有MLABM20K,那根据上面的例子我就可以把自己写的rom综合到memory block中了。这里我指定到M20K。代码如下图:
在这里插入图片描述

这样就会布局到block memory中了
在这里插入图片描述
如果不加那个条件
在这里插入图片描述
布局的时候就会用寄存器和查找表搭建。
在这里插入图片描述

  • 5
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值