Forum Discussion

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

Copying code from EPCS to MRAM

Hello,

I have a board with Stratix II and EPCS16. EPCS16 has plenty of space left over the configuration data for the FPGA (EP2S30). This space can probably be used for storing code for the embedded Nios processor. Can code be copied to MRAM and run from there on startup ? The MRAM blocks of the FPGA can not be initialized, but a bootloader can write to them. Can the MRAM blocks be combined with M4K blocks to form a larger internal memory for code to execute from ?

Thanks in advance

6 Replies

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

    Yes. Point the Reset Address of your processor at the epcs_controller, all code sections at the MRAM, build your code, and program the EPCS (using the Nios II Flash Programmer).

    That's it...
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Can the MRAM blocks be combined with M4K blocks to form a larger internal memory for code to execute from ?

    --- Quote End ---

    The "On-Chip Memory (RAM or ROM)" MegaWizard lists only "Auto" and the individual RAM block types in the "Block type" drop-down list, so you can't specifically choose the combination of MRAM and M4K there.

    Setting "Block type" to "Auto" in combination with the suggestion in the previous post might be all you need. The Fitter might put some of the memory in MRAM on its own.

    If you want to allow or force a combination of MRAM and M4Ks without M512s, you need to use a mechanism outside SOPC Builder. You could use LogicLock. Assign the on-chip RAM block of hierarchy to a LogicLock region containing all the MRAM and M4K blocks you want to allow the on-chip RAM to use. If this region includes RAM blocks you don't want used by this block of hierarchy, then you can exclude those using one or more additional LogicLock regions. QII 8.0 allows effectively nonrectangular regions by carving out keep-out areas with other regions. This is covered in the Quartus handbook in Volume 2, Section III, Chapter 10, under "Creating Non-Rectangular LogicLock Regions".
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    uraslacker: thanks

    Brad,

    What I need is as much on-chip program memory as possible for my application. Each MRAM block is 512 Kbit (64 KB). So if I use an FPGA with more than one MRAM, for example EP2S60 with 2 MRAMs, they will be combined to form a 128 KB memory

    But if my FPGA only has one MRAM (EP2S30) - I want to still have more program memory by combining it with M4Ks or M512. If I understand you correctly, the only way to do this is with LogicLock ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    With "Block type" set to "Auto", Quartus should use MRAM and other RAM block types as needed without your using LogicLock. My LogicLock suggestion was just in case you specifically wanted MRAM and M4K together as mentioned in your first post but for some reason wanted not to use M512.

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

    Additionally, you don't need to limit yourself to just one (onchip) memory. While dicing your code up amongst multiple memories does add complexity, it is possible, and should be considered if cost is a concern. See the relevant documentation with respect to custom linker scripts to find out more about this option.

    You'll find that the "auto" option doesn't magically span multiple memory types.

    Cheers and Good Luck!