Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Unloading Packet

Altera_Forum
Honored Contributor II
1,434 Views

Hi  

 

I am making a video application witch receives UDP packet from a sender on my computer. I receive the packet just fine with the rcvfrom function using the nichestack. Now i need to send these packet out of the nios processor for me to processes with VHDL blocks we have made. I was wondering what was the best way of sending the Char data string out of the nios for processing.  

 

I was think to use just standard PIO to be able to connect those to my HDL blocks.  

 

I was also looking at the UDP offload example but it dose not look like the packet are actually sent outside the SOPC system (witch is what i want)  

 

So i was wondering if there was a better way of outputting data out of the NIOS processor. 

 

thanks
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
363 Views

Type of Data Format you choose is depends on your receiver...., weather UDP packet (if receiver receive data in UDP packet format) or Serial synchronous format if your receiver is any modem or system which read data with respect to clock or if asynchronous data format is receiver is asynchronous system like RS232 etc. 

 

as you mentioned that data to be processed with VHDL block then i feel serial synchronous or parallel synchronous format is best suited for you. 

 

kaushal
0 Kudos
Altera_Forum
Honored Contributor II
363 Views

Using a PIO is the easiest solution, but you need some synchronisation signals in addition to the data signals, to tell to your VHDL component when new data is available, and maybe for your VHDL component to tell to the CPU when it is ready to receive more data. 

OR as an alternative, you can use a DMA. Your VHDL component will just need to have an Avalon Stream Sink interface to receive the data, and you can connect it to a memory-to-stream SGDMA in SOPC Builder / QSys.
0 Kudos
Altera_Forum
Honored Contributor II
363 Views

I think the PIO would be to slow for me because i am transmitting video packet at a high bit rate.  

 

I was actually thinking of using the SGDMA but i just don't understand how, in SOPC, i would send the Avalon Source out of the system for my vhdl block to receive it  

 

I was actually also thinking of using a FIFO with the SGDMA but again i run into the problem of how to i send the other end of the FIFO out of the SOPC
0 Kudos
Altera_Forum
Honored Contributor II
363 Views

The idea is to create your own SOPC component. If your VHDL block has a stream interface (and it's really easy to do, you just need data, ready and valid signals) then you can make a SOPC component from it. Then in SOPC builder, just connect it to the SGDMA.

0 Kudos
Altera_Forum
Honored Contributor II
363 Views

Oh and you may want to use the startofpacket and endofpacket signals on the stream interface too, if you want to work with packets.

0 Kudos
Altera_Forum
Honored Contributor II
363 Views

thanks i think i am going in the right direction. i created a sink to FIFO block so i can take the source of the SGDMA and send it out to the external FIFO.  

 

Now i have another question. How fast dose the DMA work? Because i have data packet of around 2000 char in size coming every 1ms for example (i might get faster). I modified the Simple socket server example and used the recvfrom function. now after i have to make my descriptor for the DMA and send it. I am just afraid that by the time the packet actually gets sent a new packet would have came in and change the data at that address. 

 

now to make sure that there is no problem should i forget about the TCP/IP stack and use the UDP_packet_extractor in the UDP Offload example so the packets wont have the go trough the NIOS at all?
0 Kudos
Altera_Forum
Honored Contributor II
363 Views

The DMA is capable of transferring one word per clock cycle, if the memory is fast enough. If used with a memory controller that can do bursts, it will probably manage to reach this speed, after an initial latency. In your case it will be the CPU and the TCP/IP stack that will be the limiting factor. I still think it should be able to reach this speed though. If you start having problems, check that you are compiling the software with optimisations (-O2) as it gives the TCP/IP stack a significant boost.

0 Kudos
Reply