根据设备的不同,这将创建至少8K或16K深存储器。
至于推断这种RAM,您可能需要进行试验,以确保综合工具能够将您的代码理解为RAM模板。
当然应该创建一个通用的1位宽RAM作为模块,然后将其中的12个实例化为一个实例化数组(或生成for循环)。
目前尚不清楚这些工具是否可以通过简单编写每位写入启用来满足您的需求,但值得一试。
这可以在程序循环中编码,如:
整数i;
总是@(posedge wr_clk)
for(i = 0; i 以下为原文
It wouldn't make sense for a small memory like 256 x 12, but a third option is to use the RAMB in 1 bit wide mode, so you would need one RAMB per bit, 12 in all. Depending on the device, this would create a minimum of 8K or 16K deep memory.
As far as inferring this sort of RAM, you may need to experiment in order to make sure that the synthesis tool can understand your code to be a RAM template. It certainly should work to create a generic 1-bit wide RAM as a module and then instantiate 12 of them as an array of intantiations (or in a generate for loop). It's not clear whether the tools would give you what you want by simply coding a per-bit write enable, but it's worth a try. That could be coded in a procedural loop like:
integer i;
always @ (posedge wr_clk)
for (i = 0;i < WIDTH;i = i + 1) if (wr_ena) RAM[wr_addr] <= din;
If you're lucky the tools will fit that into distributed RAM for you.
-- Gabor


淘帖
762

/9 


