Forum Discussion

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

Dual ports - infer or megawizard advantages/disadvantages

Hi all, elementary question perhaps but is there any advantage in instantiating a dual port RAM (or any memory type buffer for that matter) using the IP Catalog/Megafunction Wizard rather than inferring? I suppose the same question could be asked for lots of different functions.

The reason I ask is because what I have done in past projects (rightly or wrongly) is to write a re-usable parameterized module which internally hijacks a megawizard generated module and replaces any fixed numbers with appropriate parameters. This is a bit of a strange way to do it in retrospect (but it works well) and also I had to add parameters to specify RAM type such as M9K or M512 (for Stratix III). Now I am working on a new project with Arria V and some of those settings don't make sense, so I thought why did I ever do it this way? i.e. why not infer and let Quartus work out how to implement the functionality.

I apologize in advance if this question comes up all the time, but I suppose it's always good to hear other views on these things.

Thanks,

D

6 Replies

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

    Generally to ensure compatibility, I would use the IP Catalog and Megafunction.

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

    I generally use VHDL only and let Quartus infer megafunctions to have multivendor compatibility

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

    Inference is usually prefered, as it allows portability into Xilinx devices. You can use attributes on infered ram to force the ram type to M9k/MLAB etc.

    There are some things that cannot be infered, like write-before-read mode.

    Have you read the coding style guidelines from the Quartus handbook - there is a whole section of templates to infer different styles of RAM
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yes I have read the coding guidelines thanks. I think the portability issue is very relevant, more so for us now than a few years ago as it happens. My own opinion is that yes, inference would be better in this regard or at the very least have some form of portability layer to shield the important bits of IP from reliance on specific hardware if at all possible - that's kind of the approach I have taken until very recently.

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

    The way I have seen it done before - have a library that infers ram in the way that each vendor requires the code to be written to infer the ram, ensuring the interface is identical. Then you simply instantitate the memory and just include the appropriate library for the vendor you are currently using.