Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20641 Discussions

Can Nios Read 128-bit-wide data?

Altera_Forum
Honored Contributor II
1,318 Views

I'm trying to add a new module.Gernerally saied , it is a RAM , 128-bit-wide( that means 1 Word = 128 Bit), 512Word.  

I also add a NIOS II Processor, and try to read a Word from th RAM in software. 

As far as I know , we usually use NIOS to read 32-bit-wide data, or less , for example , IORD( XX_BASE , 0) , for NIOS Processor is 32-bit-wide.  

 

Can NIOS read 128-bit-wide data when it accesses the RAM?How can I write the software to do that? 

 

Thank you!
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
436 Views

Can NIOS read 128-bit-wide in one access to the RAM?

0 Kudos
Altera_Forum
Honored Contributor II
436 Views

No. NIOS has a 32-bit wide data bus. If you perform a 128-bit read, the NIOS will actually perform 4 reads to get the data.  

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
436 Views

 

--- Quote Start ---  

No. NIOS has a 32-bit wide data bus. If you perform a 128-bit read, the NIOS will actually perform 4 reads to get the data.  

 

Jake 

--- Quote End ---  

 

 

So , what if I use a DMA component to read 128-bit-wide data? 

For example : 

//////// Code start////////////# define TRANSFER_SIZE 2 

int return_code ; 

alt_dma_rxchan tx, rx ; 

 

if( (tx= alt_dma_txchan_open("/dev/dma")) == 0 )  

printf( "create dma failed" ) ; 

return -1 ; 

} if( (rx= alt_dma_rxchan_open("/dev/dma")) == 0 ) 

printf(" create dma failed" ) ; 

return -1 ; 

//// configure the DMA  

alt_dma_txchan_ioctl( tx , ALT_DMA_SET_MODE_128 , (void*) (RAM_BASE) ) ; 

alt_dma_rxchan_ioctl( rx , ALT_DMA_SET_MODE_128 , (void*)(DEST_BASE) ) ;  

///// start transfer 

return_code = alt_dma_txchan_send( tx , RAM_BASE , TRANSFER_SIZE , 0 , 0 ) ; 

return_code = alt_dma_rxchan_prepare( rx , DEST_BASE , TRANSFER_SIZE , 0 , 0 ) ;  

//////// Code end 

 

 

Could I make it work?
0 Kudos
Altera_Forum
Honored Contributor II
436 Views

What exactly is your requirement?  

If your requirement is that you must read a 128-bit data word in one clock cycle then you are going to have to either use a DMA controller or write your own little hardware component to do it. 

If you're just trying to be efficient, using a DMA controller may not be the best solution if at the end of the day you've got to read the data using the NIOS anyway. Typically DMA is used when you need to transfer a large amount of data in as short amount of time as possible. 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
436 Views

Thanks for your reply. 

Nowadays I know using Nios to read directly is efficient rather than DMA. 

I will try more.
0 Kudos
Reply