Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Dual access block ram access from nios and custom vhdl

First, Id like to say I'm new to using Altera FPGA's so sorry if this is very simple. I have implemented a dual access block ram in SOPC. One side goes to the nios-II core so i can read and write from my c code. I'd like the other side to be made into external ports so that I can read/write the ram from my custom vhdl code. What is the best way of doing this? Thank you!

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    you need an Avalon-Memory Mapped master to connect to the dual port RAM MM slave. take a look at custom components in SOPC Builder to make your HDL into a SOPC component, or using the component editor to make a simple MM-master that gives you access to the MM signals outside of SOPC Builder. here's a place to start:

    http://www.altera.com/literature/hb/qts/qts_qii54005.pdf
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you! Using the template, I have been able to successfully read and write from vhdl to a block ram instantiated in sopc builder. I am still having a problem doing both at the same time though. What I mean by that is if I one design with read capability another design with write capability, both work fine. But when I attach two master templates (one for read, one for write) to one slave port of the block ram, the write (which works fine) interferes with the read. It seems like the read reads from the wrong address. Do I need some sort of arbitration? I thought this would be handled by the avalon logic?

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    SOPC Builder provides arbitration logic for you but you will need to handle the hazards of accessing the same address. For example if the read and write masters access address 0-1023 you will not know which master will gain arbitration to any of the locations first. If you can prevent the masters from accessing the same range at the same time then you can avoid the data hazard.