Four Methods to Invoke FPGA Memory Units

First, what is XPM? Many people may not have heard of or used it. Its full name is Xilinx Parameterized Macros, which are Xilinx’s parameterized macros, similar to the instantiation and usage of primitives. You can check which XPMs can be instantiated in Vivado under Tools->Language Templates. 
Four Methods to Invoke FPGA Memory Units
Four Methods to Invoke FPGA Memory Units
From the above image, it can be seen that the currently instantiable XPMs mainly include three types: cross-clock domain processing, FIFO, and MEMORY.
Taking MEMORY as an example, in Vivado, you can invoke the storage unit in the FPGA through the following four methods, and you can choose either Block RAM or Distributed RAM.
Method 1: RTL Code
After defining a memory variable, you can specify its resource type in front:
(*ram_style = “block” *) reg [3:0] mem_bram [15:0] ;
(*ram_style = “distributed” *) reg [3:0] mem_dram [15:0] ;
Using RTL code is very flexible, but due to the lack of many control items, the result after synthesis may not be optimal.
Method 2: Primitive
Using primitives can also instantiate MEMORY, but not many engineers have used it this way, because there are simply too many interfaces, making it less practical. 
Four Methods to Invoke FPGA Memory Units
Method 3: IP Core
This method is probably the most commonly used, but it has clear drawbacks:
When modifying parameters, you need to reopen the IP and then Generate;
Different versions of Vivado also need to be updated;
Sometimes parameters in the IP are overlooked, leading to results that are not what you want;
Recently, I encountered such a problem during debugging: the default output delay in FIFO is 1, meaning the output data is delayed by one clock cycle compared to the read enable, and the Output Registers are not checked by default. However, this option was changed at some point, causing the final output result of the program to always have issues. While debugging, I was continuously checking the RTL code until I pinpointed the problem in the FIFO module. If we were using XPM at that time, it would have been easy to spot the error from the code.
Method 4: XPM_MEMORY
Relatively speaking, the disadvantages of XPM are not very obvious; the pure code instantiation method is more flexible and simpler.
Source | Scientific Computing Technomania
Four Methods to Invoke FPGA Memory Units
Four Methods to Invoke FPGA Memory Units
Four Methods to Invoke FPGA Memory Units
☞ For business cooperation: ☏ Please call 010-82306118 / ✐ Or email [email protected]
Four Methods to Invoke FPGA Memory Units

Click

Here “Read the original text”, directly to the Electronic Technology Application Official Website

Leave a Comment