Forum Discussion

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

DDR2 as a program and data memory

Hi All,

Can I use DDR2 as a program memory (option in system library properties) and also as storage memory for some data??

I'm interesting if I can specify some area for program memory and use other space.

Thanks a lot

AD

4 Replies

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

    Sure can. Just tell the tools you wish to do that in the same area.

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

    Thanks Avatar for your replay :).

    I know that I can choose varios memory devices for program memory (all I' ve specified in the system), but I want to be be sure that when writing some thata I'm not colliding with program's data.

    To be clear ... when using IOWR_32DIRECT for writing DDR2 how can I be sure that address I want to use is available? Which addresses is nios system using for program (always starting from address 0x0 or can reserve space for that?)

    thanks

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

    The simple answer is you can't be sure that memory is not being used. Now you could do some profiling to determine how much of the RAM is used by code and how big your stack is, etc. Not a good method.

    If you want to make sure that you are accessing memory appropriately than simply allocate a chunk of memory by creating an array or using malloc or something like that. Then you don't need to worry about where in memory it is located. If you've specified in the IDE system library settings to use your DDR2 for Read-only, Read/write, stack and heap memory, then it will automatically be located in the DDR2.

    You can also use compiler directives to specify what section of memory you would like a global variable to be located in.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for your help. In my case the best solution is to declare an array and with compiler directives locate it in ddr2.

    AD