Forum Discussion

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

FPGA memory initialization and management

Hi,

my design is using a cyclone IV on-chip memory. I have two questions (for the moment):

- when configuring the memory with qsys, I don't really understand the data-width choice. If it's 32-bit-wide, does it mean a +1 increment in the address will be a 32-bit increment for the data? If I read something at address a, will *a be a 32-bit word?

- the initialization could be made by a file. What should I use to edit this file? For example I have an 8-bit words memory, I've tried a hexadecimal editor but when reading it (by a software executed on a Nios2 cpu) it's not what I expect.

Thank you for the explanations you can give me.

16 Replies

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

    --- Quote Start ---

    I still don't understand...

    --- Quote End ---

    That's ok. Use this as an opportunity to learn. You have several options.

    1. Use the Eclipse IDE and the debugger to manually write and read memory locations

    2. Add a JTAG-to-Avalon-MM bridge to your Qsys system and read and write memory using that

    3. Create a simulation of your system and look at the memory read/write accesses

    Try any or all three!

    Cheers,

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

    I love to learn new things!

    1. I do use the Eclipse ISE but I don't know how to use a debugger. Is there a tutorial or a document I could read to learn that?

    2. I don't use an Avalon-MM bridge in Qsys. I've read papers about that but it seemed complicated and I preferred the self-made method to use a dual-port memory to access it both with software and with hardware.

    3. I know Modelsim but I don't know how to do that.

    If one of the 3 options seems better for you, please tell me and surely I'll need your help to go further...
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I had a problem messing int and char types. Things seem to work as expected.

    I let you know when I need more help. Thank you.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I love to learn new things!

    --- Quote End ---

    Great! With FPGAs, there are plenty of opportunities.

    --- Quote Start ---

    1. I do use the Eclipse ISE but I don't know how to use a debugger. Is there a tutorial or a document I could read to learn that?

    --- Quote End ---

    Altera has a "My First NIOS II Tutorial" that provides a walk-through of their Eclipse setup.

    --- Quote Start ---

    2. I don't use an Avalon-MM bridge in Qsys. I've read papers about that but it seemed complicated and I preferred the self-made method to use a dual-port memory to access it both with software and with hardware.

    --- Quote End ---

    You can use self-made hardware, but its much more efficient if you create those self-made components as Qsys components and then wire them together in the Qsys GUI as this saves you having to create arbitration logic. Here some tutorials on using the JTAG interface to access custom logic;

    http://www.alterawiki.com/wiki/using_the_usb-blaster_as_an_sopc/qsys_avalon-mm_master_tutorial

    http://www.ovro.caltech.edu/~dwh/correlator/pdf/altera_jtag_to_avalon_analysis.pdf

    http://www.ovro.caltech.edu/~dwh/correlator/pdf/vjtag.pdf

    --- Quote Start ---

    3. I know Modelsim but I don't know how to do that.

    --- Quote End ---

    You need to learn this too. The best way to debug hardware issues is to trace the problem using SignalTap II and then reproduce that problem in simulation, and then debug in the simulator.

    --- Quote Start ---

    If one of the 3 options seems better for you, please tell me and surely I'll need your help to go further...

    --- Quote End ---

    You need to learn them all :)

    Cheers,

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

    Now I try to read the memory to control what happened but I don't know if it's my hardware part that's not not doing as I want or the software one. So I'd like to look at the memory.

    Maybe the In-System Memory Content Editor could help me reading the memory but I don't know how to use it.

    Can you help me?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Now I try to read the memory to control what happened but I don't know if it's my hardware part that's not not doing as I want or the software one. So I'd like to look at the memory.

    Maybe the In-System Memory Content Editor could help me reading the memory but I don't know how to use it.

    Can you help me?

    --- Quote End ---

    I've never used the In-System Memory editor, I prefer using the JTAG-to-Avalon-MM bridge. Go through the tutorial I linked to above, and it shows how to use it.

    Using the JTAG bridge, you can read/write memory, and then using NIOS you can read/write too. Using SignalTap II to trace the RAM I/O you can watch the accesses from either master.

    Cheers,

    Dave