Forum Discussion

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

SDRAM Interface to SO-DIMM?

I'm planning a NiosII design and we need a pile of RAM but don't need the high bandwidth of SRAM. It's hard to find SDRAM chips in stock, given their commodity nature, and so I was looking at using an SO-DIMM site instead of a particular SDRAM chip. (That also deals with the problem of someone later deciding we don't have enough memory.)

Hardware-wise, an SO-DIMM looks great (about 3 by 1.5 inches of board space, $30-40 for 128MB 64-bit wide PC133, and $7 or less for the socket). What I'm wondering about is the SDRAM interface SOPC component; can it deal with a memory module? I'm guessing I'll have to hook up an I2C interface to the SPD port and have the bootloader compare the timing info to the parameters the SDRAM interface was built with. It would be nice if we could add a slave port to the SDRAM interface component and make the timing parameters BIOS-settable, but it's not a requirement.

So, any thoughts, anyone?

13 Replies

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

    Mike,

    Will your instruction source require all of this ram or could you get away with say a 16MB chip on board for code and use the SODIMM for data buffer?

    That's kind of what we did with our last coldfire board. It has enough sram on board to run, but detects and uses whatever is in the EDO SIMM slot. So even if the stick goes bad the board still functions.

    What mechanism if any (no MMU) in the Nios stops you from setting a pointer to any address you want and writing or reading? (as long as it exists)

    May not apply to your case.

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

    --- Quote Start ---

    originally posted by kenland+jul 21 2004, 03:23 pm--><div class='quotetop'>quote (kenland @ jul 21 2004, 03:23 pm)</div>

    --- quote start ---

    will your instruction source require all of this ram or could you get away with say a 16mb chip on board for code and use the sodimm for data buffer?

    that&#39;s kind of what we did with our last coldfire board. it has enough sram on board to run, but detects and uses whatever is in the edo simm slot. so even if the stick goes bad the board still functions.[/b]

    --- quote end ---

    we thought of that, but the goal for using an sodimm is to simplify things by having just one memory bank (hence, one memory bus). in our case, memory failure is pretty much system failure, so there&#39;s no benefit there, either. we may have the fatal exception vectors point to internal memory, where it will report the error to the outside world and then hit an infinite loop.

    we&#39;re doing what you&#39;re talking about on a ti dsp board, which has internal and external ram banks. the code lives internally along with data/bss/stack/heap, and we have our own memory allocator that deals with the external memory for bulk use.

    <!--quotebegin-kenland@Jul 21 2004, 03:23 PM

    what mechanism if any (no mmu) in the nios stops you from setting a pointer to any address you want and writing or reading? (as long as it exists)

    --- Quote End ---

    You have to tell the SDRAM interface SOPC component what the maximum size is so it generates the proper addressing hardware and I/O pins. But if the software side assumes that you always have that much memory, there will be trouble. All I need is a mechanism to tell the software side to use only a minimum amount of the RAM, then I can manage the rest myself, but it would be easier if I could just tell the thing to move the top of the heap up and just use malloc/free. There may be a mechanism to do this; I haven&#39;t gotten that far yet.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Mike,

    You&#39;re on the right track. You&#39;re right about the HW constraints (For the maximum size memory anyways). I believe what is necessary in your case is to diverge from the fully automatic SW dev flow and play with a linker script. If you make a SW project in the IDE, there will be a file called "generated.x", in the syslib project system description folder (I think). This file is what tells the linker where to put text, exception, bss, stack, heap, etc. Now I am no linker script expert and I hear fiddling with these can be &#39;fun&#39; so to speak, so I&#39;d recommend small incremental changes to meet your goals... however, it should be pretty straight forward: the sizes of memory (SDRAM for example) are defined here and they will control what the linker is allowed to use.

    If you were to, for example, define a "minimum" SDRAM size that is linked against, and then# defined this into your application code, you might be able to do a walking memory test at boot up to figure out how big the SDRAM really is, and then use this information to know how much is available for your application to use.