博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

笔记No.1 关于NIOS II的讨论[BBS版]

Posted on 2011-11-25 09:01  Mr. Lan  阅读(522)  评论(0)    收藏  举报

关于FPGA+DDR2 SDRAM 实现NIOS II系统,在Altera论坛里讨教了一些前辈,现搬过来,备以后查阅。

#1. lan54160

Hi friends,
I want to control DDR2 and Ethernet with NIOS II on my board. ADC results are read from LVDS_rx module and store on DDR2 and then stream out via Ethernet. On my board, there is no SDRAM except for a DDR2, so I want to use on-chip memory for Nios ii . Can I get it?

Any advice and guidance will be appreciated.

#2. Socrates

Why not using DDR2 memory? It doesn't matter what memory type it is, since You need to use either DMA (better SGDMA for faster transfers) or write Your own Avalon Memory Master controller. How fast ADC is?

#3.dsl

You can put your code+data into internal memory (probably tightly coupled) while still using the external DDR2 memory for large items (like the ethernel buffers).

However you may have to be careful about the size of the code.
I don't know how small the TCP/IP stack can be, but even the 'hello world' program pulls in enough stuff from libc to be a little large for internal memory.

My suspicion is that the IP stack won't be that concise! Enough code to send IPv4 UDP packets should be quite small, but you'll need something to give the system it's IP address.

OTOH if you avoid all of libc, you can do quite useful stuff using internal memory.

#4. lan54160

Quote:
Originally Posted by Socrates View Post
Why not using DDR2 memory? It doesn't matter what memory type it is, since You need to use either DMA (better SGDMA for faster transfers) or write Your own Avalon Memory Master controller. How fast ADC is?
400Msps ADC. DDR2 memory is used to store ADC result . if it's used for nios II ,what about the ADC ?

#5. Socrates

I doubt You'll be able to run Nios on on-chip memory... Nios II/e probably worth trying, but that Cyclone III You use is kinda small.

#6.lan54160

Quote:
Originally Posted by Socrates View Post
Why not using DDR2 memory? It doesn't matter what memory type it is, since You need to use either DMA (better SGDMA for faster transfers) or write Your own Avalon Memory Master controller. How fast ADC is?


If I use the DDR2 memory for nios ii cpu and buffer several thousands bytes of adc results , now how to control the DDR2 ?

#7. Socrates

It's done by DDR2 controller in SOPC. I've already mentioned that You need either DMA or own memory master core.

#8.lan54160

Quote:
Originally Posted by Socrates View Post
It's done by DDR2 controller in SOPC. I've already mentioned that You need either DMA or own memory master core.

oh, i see...

Can I use the DDR2 memory as two separate blocks ,one for nios ii cpu and the other fo adc result ?

#9. Socrates

Sure, why not. If You'll use SGDMA, then You can allocate memory using malloc() or use fixed value.

#10. dsl

I'm not sure what the minimum M9K footprint for a nios cpu is, but it is relatively small!
- 1 M9K for the registers
- Remove the dynamic branch prediction logic (this is a 'hidden' option)
- Read code from tightly coupled memory
- No data cache, data can be in the same M9K as the code
- No JTAG debug
- Boot directly from the instruction memory (no separate M9K for epcs (etc) boot)
- Write small, tight code without any libc bloat and with minimal wrapper layers.

Additional: Following the device of cyber-friend Socrates, I create my Qsys system which cosists of Nios ii cpu, DDR2 SDRAM controller(the device on my board is a single 2Gb), PIO, RS232 etc.  Now, my code can runs on the DDR2 smoothly.