2
\$\begingroup\$

I am working on a project where we are capturing signals from an ADC using a Virtex-5 FPGA and the samples are being stored on a 128K x 256 SRAM from where the data samples are acquired by a PC. I believe the Virtex-5 provides an option for a BRAM and while I understand that the depth is nowhere close to what the SRAM provides, I'd like to make use of the BRAM option in the Virtex-5 as a buffer to hold the samples temporarily until they are acquired by the PC. How difficult would this be to implement ?

\$\endgroup\$
  • \$\begingroup\$ You can easily use the memory generator to create a memory buffer for your design, but having a 256 bits wide data makes it pretty slow. the best way is to create a 256 bits FiFo between your ADC and your PC interface, the size can be less than 128k if you design your interface right or if you need to capture a frame that is 128k large, you should create it in HDL and let the synthesis tool map it for you. \$\endgroup\$ – FarhadA Feb 11 '14 at 8:22
3
\$\begingroup\$

Good news. This is a really common application for ADC interfaces. It's actually very easy to set up the block RAM in Xilinx devices.

You will want to run the "Block Memory Generator" Coregen by Xilinx, which will generate basically a black-box VHDL module that you can instantiate in your top level VHDL module. In the coregen, you can customize your block RAM so that it "looks" just like your existing external SRAM. The only difference will be that you will be connecting signals in your top-level module to the new black-box module that you've instantiated instead of to your external pins.

I'm not sure that you can get a data width of 256 (did you really mean 8?), but I think that you could get a depth of 128K on most Virtex-5 devices. The datasheet showing the Virtex-5 resources table (how much BRAM is available) is available here.

The datasheet that explains Block Memory Generator is here. It can explain the settings, etc.

To launch the block memory generator in ISE 14, right click in the project heirarchy and select "new source". Then select source type as "IP (Core...". Then select Block Memory Generator as the IP type as shown below.

Block Memory Generator

Once the "Block Memory Generator" opens, select whichever options you want, then click configure. It will add the black-box core to your project. You will have to instantiate it in your top level module. You can usually see the "instantiation template" by clicking the core in the project heirarchy and selecting the "View HDL Instantiation Template" in the processes window.

\$\endgroup\$
  • \$\begingroup\$ The way the current setup is the SRAM is 32M and which is structured in a 256 x 128k format. Each 256 length word consists of 16, 16-bit samples which are sent to the SRAM from the FPGA after the data is received from the ADC. When the user wants to acquire the data through the PC, it uses a microcontroller to access the SRAM through the FPGA registers. I don't need the depth to be 128k since I would only need to use it as a buffer, but I believe the 256 width is necessary. \$\endgroup\$ – GamingX Feb 11 '14 at 19:31
  • \$\begingroup\$ I see. You aren't going to get 32M in your Virtex FPGA, but it sounds like you don't need it anyway. I just looked at the tool and it looks like you can indeed set it up to take a 256 bit width (at least on the Spartan 6 target that I'm using right now). \$\endgroup\$ – FL_Engineer Feb 11 '14 at 22:26
  • \$\begingroup\$ Yeah, I don't need the 32 MB. Just enough to hold the buffer before transferring it to the PC. \$\endgroup\$ – GamingX Feb 12 '14 at 0:38
2
\$\begingroup\$

Block RAMs are very easy to get the tools to produce from HDL code - no need to mess with Coregen.

The advantages of doing it without coregen are:

  • No extra tools in the flow
  • you can use constants and generics (or their Verilog equivalents) from the rest of your design to configure the memory depth and width
  • coregen can add several minutes onto a compilation run when you've changed something, whereas a quick tweak to an HDL file doesn't change the compilation time by a noticeable amount in my experience. I have no idea what Coregen is doing all that time!

Check your synthesiser manual for how to write code that will infer block ram, and there are some examples in the answers to this question

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.