FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6359 Discussions

SG-DMA stream-to-memory with count and EOP

Altera_Forum
Honored Contributor II
1,595 Views

Hi, 

 

I would like to know if it is possible to set up a stream-to-memory transfer for an SG-DMA controller, set the 'bytes_to_transfer' value in a descriptor to a non-zero value, and have the descriptor complete when either the specified number of bytes is transferred or an EOP signal is encountered. 

 

The documentation for the 'bytes_to_transfer' field in the descriptor says: "Specifies the number of bytes to transfer. If this field is 0, the bytes_to_transfer SG-DMA controller core continues transferring data until it encounters an EOP." (ref. Quartus II 8.1 Handbook, Volume 5, Table 21-10). However, it doesn't say whether EOP has any effect when 'bytes_to_transfer' is non-zero. 

 

I would like to set up a chain of descriptors to some memory blocks with the 'bytes_to_transfer' field set to the size of the memory blocks, and when an EOP occurs I would like the DMA transfer to continue with the following descriptor in the following memory block. 

 

Regards, 

Ian Abbott
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
447 Views

It is not possible in the vanilla SGDMA core. I have seen a hack to enable this, but not since Quartus 7.2. I will look to see if i can find it, ping me next week if you don't here from me. 

 

--dalon westergreen
0 Kudos
Altera_Forum
Honored Contributor II
447 Views

Thanks for the reply. It's a shame about the EOP not doing what I'd like. A wild thought: do you think it might be possible to use one of the 'error' signals instead of the EOP signal to do what I want (i.e. complete the current descriptor early and move on to the next descriptor)? If so, would the 'actual_bytes_transferred' count in the descriptor be updated in this case?

0 Kudos
Altera_Forum
Honored Contributor II
447 Views

Hi Ian, 

 

I'm wrapping up a new SGDMA architecture that implements this (slightly differently where you program the length field to the maximum packet size you want to support). I allow you to set interrupts for these cases which I call 'early termination' that way you'll know when it occurs. The functionality isn't perfect since it has a slight issue where an extra word can potentially go out to memory. So for example if you want to limit your packets to say 1500 bytes, you might see 1501, 1502, or 1503 bytes written to memory if the incoming packet was larger than 1500 bytes. This overshoot has to do with the buffer alignment in memory and the transfer length. If you use aligned locations and you set the packet limit to a multiple of the word size I don't think you'll see this issue. 

 

So if you want to take this new SGDMA out for a spin go ahead and send me a PM with your email address and I'll mail you my MM to MM test design. The catch is that I haven't documented it so you may have a little bit of digging around to do. Also it doesn't support descriptor pre-fetching yet as that's another component that needs to be developed and bolted up (this SGDMA is micro-core based). If you have ever used the DMA (non scatter gather) in SOPC Builder you'll find that this one is fairly similar only it buffers descriptors and supports a bunch of additional features. 

 

Cheers, 

JCJB
0 Kudos
Altera_Forum
Honored Contributor II
447 Views

Alternatively you could create a small component that you insert in the Avalon stream between your source and the SGDMA, that forces a EOP followed by an SOP when a certain number of words have been reached.

0 Kudos
Reply