Forum Discussion

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

Memory map cannot fit?

I have written my own interface to a SDRAM and trying to add it i SOPC builder as an avalon tristate slave. The component is created without any error messages, but when adding it to my SOPC system I get,

--- Quote Start ---

Memory map cannot fit within the addressable memory space of the nios II Data master which is restricted to 31 adress bits.

--- Quote End ---

--- Quote Start ---

Nios data master cannot address memories over 2^32

--- Quote End ---

--- Quote Start ---

Nios instruction master cannot address memories over 2^32

--- Quote End ---

But both the address bus and the data bus widths are only 32 bits wide, so what can the problem be?

cheers!

10 Replies

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

    --- Quote Start ---

    I have written my own interface to a SDRAM and trying to add it i SOPC builder as an avalon tristate slave. The component is created without any error messages, but when adding it to my SOPC system I get,

    But both the address bus and the data bus widths are only 32 bits wide, so what can the problem be?

    cheers!

    --- Quote End ---

    1. Try "System Menu -> Auto-Assign Base Addresses".

    2. Also what is your sequence of adding the components? You should add your SDRAM after adding the cpu. flash, cpu_ram etc.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I have already tried Auto-assigning base adresses with no luck. The SDRAM component is applied last, after the Nios and tri-state bridge. Maybe I have done something wrong in the earlier steps, it has been a while since I made a component i SOPC. But no errors are reported during construction of the component.

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

    1 - The maximum addressable space for NIOS is 31 bits. This is because NIOS uses the highest bit as cache bypass signal.

    2 - If you do use all 31 bits of address space, you will have absolutely no room for any other components in your system.

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

    But I have a 32-bit address bus, and a 32-bit data bus. Can I restrict the data size from SOPC-builder, so that the CPU doesn't use and see more than for example 8MB? Nios II is a 32-bit processor so I guess that a 32-bit address bus and a 32-but data bus is required.

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

    Just reduce the address space of your component. You can't have more than 2GB of address space. And in reality, you can't have more than 1GB if you want other components in your system.

    If you really need the 4GB address space then you could implement paging in your module. What on earth are you using 4GB of memory for anyway?

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

    --- Quote Start ---

    Nios II is a 32-bit processor so I guess that a 32-bit address bus and a 32-but data bus is required.

    --- Quote End ---

    That's true that NiosII is a 32-bit processor. However when we talk about microprocessors/microcontrollers then saying that it is an n-bit processor refers only to the size of the data-bus. For example, Intel 8085 is an 8-bit processor. Its data-bus is 8-bits but address-bus is 16-bits.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    No I definitely don't need 4GB of ram. So how do I reduce the address space of the component. Auto-assign doesn't seem to work, and when changing manually with Adress Map, the change doesn't stick, or base adrress gets larger then end address. I'm missing something basic here I guess....

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

    I must be confused. The SDRAM interface is your own custom component right? So you wrote it. So just edit it and change it to a smaller address bus size. Am I missing some piece of information here?

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

    I'm confused as well. I changed the adress bus size to 16bits and created a new component before my last post. The component builder sees the address bus as 16 bits, but when added to my system SOPC still maps the address space from 0x00000000 to 0xffffffff. That's why I thought I could change the address space somewhere in SOPC-builder.

    Is there a guide to constructing a memory interface and adding it in SOPC? If so, a can see if I made something wrong earlier on.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I'm confused as well. I changed the adress bus size to 16bits and created a new component before my last post. The component builder sees the address bus as 16 bits, but when added to my system SOPC still maps the address space from 0x00000000 to 0xffffffff. That's why I thought I could change the address space somewhere in SOPC-builder.

    --- Quote End ---

    Yes, you can manually change the addresses, click on the base and end address and change them to new value. I have encountered this problem before in my designs. Auto-assign didn't help and I manually changed most of the addresses.

    --- Quote Start ---

    Is there a guide to constructing a memory interface and adding it in SOPC? If so, a can see if I made something wrong earlier on.

    --- Quote End ---

    Yes, please read the Avalon-MM (Memory Mapped) chapter in Avalon Bus Specs. An easily way to start is this: When you have a system without your SDRAM component, you can assign the addresses to this system by looking at the addresses at any one of the example designs. Notice in the example designs the incremental variation of addresses. When you add your 16-bit address memory, you only need to change the LSBs.