Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: Programming NIOSII interfaced with custom component, using Avalon MM Interface

  1. #1
    Join Date
    Nov 2013
    Posts
    88
    Rep Power
    1

    Default Programming NIOSII interfaced with custom component, using Avalon MM Interface

    Hello Everyone,

    I am trying to interface NIOS II with a custom component using Avalon MM Inferface where NIOS acts as Master.
    During the C coding, how do i get access to the function to send/receive data through the Avalon MM interface ?
    Can i get direct access to the ports dedicated for the interface ? and Do i need to follow some particular protocol while C coding for the interface ?

  2. #2
    Join Date
    Sep 2012
    Posts
    68
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    You'll want to use the IOWR(),IORD() functions to access Avalon-MM registers in your peripheral (assuming that you're trying to read/write registers). See the software handbook (http://www.altera.com/literature/hb/...2sw_nii5v2.pdf), page 9-4 in particular. Or you can use the direct functions (ex IORD_32DIRECT()).

  3. #3
    Join Date
    Nov 2013
    Posts
    88
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    Thanks.. that helped.
    Other than this i have a very basic confusion. In my project, i want to transfer 128 16-bit values to the custom component (slave) and this values will be used by component to evaluate the final output and that output will again be sent back to NIOS (master).
    So should i just write IOWR_32DIRECT() 128 times as below:
    IOWR_32DIRECT(BASE, OFFSET0, DATA0);IOWR_32DIRECT(BASE, OFFSET0, DATA1);
    IOWR_32DIRECT(BASE, OFFSET0, DATA2);
    |
    |
    IOWR_32DIRECT(BASE, OFFSET0, DATA127);

    And then read the final output register as:

    IORD_32DIRECT(BASE, OFFSET1);

    If this is correct, does the nios II automatically sends the data sequentially ? Then how does the custom component gets to know when the new data arrives ?? And how NIOS will know when to read the final output register.

    Thanks for your time & effort,
    Anuj

  4. #4
    Join Date
    Jan 2010
    Location
    India
    Posts
    89
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    Your custom component uses 16 bit Avalon data bus or 32 bit Avalon data bus.If it is using 16 bit Avalon data bus then you should write IOWR_16DIRECT instead of IOWR_32DIRECT and same way for IORD function also.
    Other then that your C code is correct.

    Whenever you use IOWR function,Avalon Master generate Avalon write request and provide address of Slave Component Register on Avalon address bus line and provides data on Avalon data bus.Avalon Slave component uses this write request and address information to update its registers.Same way for IORD function,Avalon Master generates read request and address of the Slave component register.In this case slave component provides data on Avalon data bus.

  5. #5
    Join Date
    Nov 2013
    Posts
    88
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    OK.. I got it. Thanks.

    Now when i am compiling my system in Quartus it gives warning as "Warning (20028): Parallel compilation is not licensed and has been disabled" and also says ".sdc file not found".

    Please guide

  6. #6
    Join Date
    Sep 2012
    Posts
    68
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    If you wanted to burst the data to be a little more efficient, you could DMA the data over. Or, I THINK if you have a data cache, you could move data as pointers and that might burst (i.e. don't use the IOWR/RD macros that bypass the cache), but I'm not sure, I've never done that - just read about it on this forum before. If a few wasted clock cycles don't matter, then you could just do a bunch of IORD/WR ops.

    I'm guessing you're using Quartus Web Edition? It doesn't support parallel compilation.

  7. #7
    Join Date
    Nov 2013
    Posts
    88
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    Do you mean to include a DMA block in between Master & Slave ??

    As per the forum discussions, it suggests to optimize the code to avoid parallel computing. But i cannot understand which part of my design is creating this issue and what should i optimize? Is this the data bus width i.e. 16 bit that i am sending in parallel??

    And i did not use Avalon Bridge in the interface.. Is it recommended? I saw in the online lectures that it is necessary but i compiled my code without that too.

  8. #8
    Join Date
    Sep 2012
    Posts
    68
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    A DMA core could be used for efficient burst transfer between memory locations. See the embedded IP user's guide (http://www.altera.com/literature/ug/ug_embedded_ip.pdf), chapters 25 & 26 for the SGDMA and DMA cores. There's also the modular SGDMA (mSGMDA) available on the wiki (http://www.alterawiki.com/wiki/Modular_SGDMA), but I don't have any experience with it.

    The warning (20028) just means that Quartus II won't use multiple cores to synthesize/fit your design. I.e. it may take a little longer to build the image. The standard edition of Quartus II does support it - but I honestly do see a huge improvement, it still uses 1 core on my quad core xeon for the most part.

    When you say "Avalon Bridge", are you referring to the pipelined bridge? You can use those to break up your bus if you have a lot of components and you're having trouble meeting timing. If you just have a few peripherals, and a reasonable clock speed, you probably don't have to bother with it.

  9. #9
    Join Date
    Nov 2013
    Posts
    88
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    I have one more question...

    I made a new component in Qsys to implement my custom design. And from there i got the base address allocated to that component that will be used during the communication through the avalon MM interface (in NIOS). But I got one more option to implement the custom component..

    I created the design in Qsys w/o custom component. Got that design imported in quartus and manually instantiated the HDL file of custom component in the TOP Level file generated by Qsys. I was successful in compiling the code.
    "But how to get the base address allocated to my custom block in this case ?? I need that address while coding in NIOS."

  10. #10
    Join Date
    Jan 2010
    Location
    India
    Posts
    89
    Rep Power
    1

    Default Re: Programming NIOSII interfaced with custom component, using Avalon MM Interface

    Quote Originally Posted by anuj121990 View Post

    "But how to get the base address allocated to my custom block in this case ?? I need that address while coding in NIOS."
    I don't think so you can access your custom component which is not having Avalon Interface using NIOS. Would you please tell what do you want to do with your custom component?

Similar Threads

  1. Relationship among Niosii, Avalon MM interface, DMA etc..
    By nervecell_23 in forum General Discussion Forum
    Replies: 7
    Last Post: January 21st, 2016, 02:28 AM
  2. Avalon -> Dual Port RAM -> custom hardware interface
    By markaren1 in forum General Discussion Forum
    Replies: 2
    Last Post: January 26th, 2013, 01:47 PM
  3. Burstcount value in a master interface custom component
    By dtromson in forum Quartus II and EDA Tools Discussion
    Replies: 0
    Last Post: April 25th, 2012, 05:44 AM
  4. Avalon-MM Tristate Bridge and custom component
    By neptunus in forum General Discussion Forum
    Replies: 1
    Last Post: October 9th, 2011, 10:41 AM
  5. DDR2 Memory Interfaced as Avalon Slave
    By sheshikanth_2000 in forum IP Discussion
    Replies: 1
    Last Post: June 26th, 2008, 01:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •