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++
12600 Discussions

NIOS beginner- interfacing with hardware module

Altera_Forum
Honored Contributor II
30,606 Views

Hello! I am an absolute beginner in NIOS and would really appreciate if someone can help me with some advice with the following: 

 

I have a working hardware module synthesized in FPGA. I actually need to tell the hardware to initiate its process and give me the result once it is done. As usual during pre-silicon phase, I created a testing environment to do this. However now as it is in the hardware, I need to have something else to talk with it. I was planning to make a qsys component of it and interface with a very basic and dumb software which will just give the initiation trigger to my hardware module and once result is ready, it will read it from the hardware. I have only 1-2 days to make this software interface as my project deadline is approaching.  

 

Hence, if anyone can refer me to any tutorial or any sample program which does the above (I can adapt it for my need) or any advice about how can I start implementing it then it will be really really helpful. I just need to have this software interface just to initiate the process in hardware and get result back once it is done. Btw, I am using stratix V fpga.
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
29,850 Views

Well, to make it a Qsys component what you would normally do would be to implement an Avalon-MM Slave interface with some control registers, and then create a _sw.tcl and associated .c/.h with a HAL driver to manipulate those control registers. 

 

But since you a pressed for time, maybe you might prefer to just instantiate PIO in/out modules and connect your new hardware together in the top level. Then the software is simply a few library routines that manipulate the PIO hardware as your component expects. 

 

The examples are here: 

http://www.altera.com/support/examples/exm-list.jsp?cat=embedded 

 

The checksum accelerator is probably as good a starting point as any.
0 Kudos
Altera_Forum
Honored Contributor II
29,850 Views

 

--- Quote Start ---  

Well, to make it a Qsys component what you would normally do would be to implement an Avalon-MM Slave interface with some control registers, and then create a _sw.tcl and associated .c/.h with a HAL driver to manipulate those control registers. 

 

But since you a pressed for time, maybe you might prefer to just instantiate PIO in/out modules and connect your new hardware together in the top level. Then the software is simply a few library routines that manipulate the PIO hardware as your component expects. 

 

The examples are here: 

http://www.altera.com/support/examples/exm-list.jsp?cat=embedded 

 

The checksum accelerator is probably as good a starting point as any. 

--- Quote End ---  

 

 

 

Thanks for the input. I was also thinking about System Console. Did you use it ? I went through the manual and it seems like I can utilize it to serve the purpose. Any suggestion?
0 Kudos
Altera_Forum
Honored Contributor II
29,850 Views

You can use system console instead of a NIOS, to execute the necessary reads/writes. You would write a program that executes on the PC in a TCL interpreter instead of writing a program that executes on the NIOS. The construction of your hardware component and it's integration to the hardware is basically the same. 

 

 

But if your needs are even more modest than that, and just need to see "something" control your new component, you can also use the In-System Sources and Probes tool.
0 Kudos
Altera_Forum
Honored Contributor II
29,850 Views

 

--- Quote Start ---  

You can use system console instead of a NIOS, to execute the necessary reads/writes. You would write a program that executes on the PC in a TCL interpreter instead of writing a program that executes on the NIOS. The construction of your hardware component and it's integration to the hardware is basically the same. 

But if your needs are even more modest than that, and just need to see "something" control your new component, you can also use the In-System Sources and Probes tool. 

--- Quote End ---  

 

 

I am using the signal-tap now and everything looks good. I just need a way to demo my project and show that my hardware is functional. I guess, as I don't have much time, I might go for system console as it seems easier to pick-up. In that case, I need to have have a slave interface for my hardware and connect it with jtag to avalon master module in qsys. Am I right?
0 Kudos
Altera_Forum
Honored Contributor II
29,850 Views

 

--- Quote Start ---  

I am using the signal-tap now and everything looks good. I just need a way to demo my project and show that my hardware is functional. I guess, as I don't have much time, I might go for system console as it seems easier to pick-up. In that case, I need to have have a slave interface for my hardware and connect it with jtag to avalon master module in qsys. Am I right? 

--- Quote End ---  

 

 

Your understanding of system-console and adding a slave port is correct. 

 

However, because I said "In-System Sources and Probes" tool and you came back with "SignalTap", I did just want to clarify that these are not the same tool. The sources and probes tool allows you to inject stimulus and observe outputs in a PC GUI. It allows a fairly direct connection to whatever ports your new component already has. http://www.altera.com/literature/hb/qts/qts_qii53021.pdf 

 

Going the Qsys route and adding an Avalon-MM Slave port and using either system-console or NIOS to control it is more labor and doesn't really demonstrate any great technological achievement, it's just nice packaging. If you are developing commercial IP, it is kind of normal. But if you are an engineering student being evaluated on the correct operation of your new component, it doesn't add anything (unless the assignment said to do that).
0 Kudos
Altera_Forum
Honored Contributor II
29,850 Views

Hello Ted, 

 

I created a custom component and interfaced it with NIOS II processor using Avalon MM interface. Now how to create the .c/.h file to access the custom component from NIOS EDS. I mean.. how to get the pre-defined functions that will be used for communication through that interface?? 

 

Help is really appreciated.
0 Kudos
Altera_Forum
Honored Contributor II
29,850 Views

 

--- Quote Start ---  

Hello Ted, 

 

I created a custom component and interfaced it with NIOS II processor using Avalon MM interface. Now how to create the .c/.h file to access the custom component from NIOS EDS. I mean.. how to get the pre-defined functions that will be used for communication through that interface?? 

 

Help is really appreciated. 

--- Quote End ---  

 

 

See this document: http://www.altera.com/literature/hb/nios2/n2sw_nii52005.pdf 

 

It's outdated, but also this appnote is useful: http://www.altera.com/literature/an/an459.pdf
0 Kudos
Reply