Forum Discussion

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

Can Nios Read 128-bit-wide data?

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!

5 Replies

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

    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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- 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?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for your reply.

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

    I will try more.