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

Adding a custom component

Altera_Forum
Honored Contributor II
1,042 Views

Hi all, 

 

I am new to Nios and embedded designing. I have the design files for Nios-II system built for Nios development kit 1C20. I obtained this system from Altera. I want to edit this system using SOPC builder and include a custom HDL component.  

 

This is just for getting started. The custom component is a simple 32b counter. I want to route the MSBs of the counter register to the LEDs on the board. I want to start the counter using some software instruction. 

 

Can someone please help me with this. I have gone through the Quartus-II handbook, Vol 4, SOPC builder. But I am not able to understand how I can do the above. 

 

thanks in advance, 

rajesh
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
308 Views

From the the Nios,you just want to initiate the counter by start command and then counter (i.e. upcounter) will be starting to increment and then you want MSBs on LEDs, continusouly with the respective values of the counter,right? 

 

If this is correct then it is pretty easy,Just map ur output MSBs (24 to 31 or any bits u want) on LEDs (i.e assign those bits to LED pins). 

 

But choice of number of MSBs depends on clock frequency otherwise you will not be able to see the changes on LEDs ( as it will be so fast) 

 

Ex : for 50MHz clock,you should map from bit (26:31) on LED ( i.e 2^25 / 50M = 0.67 sec). 

 

Like this,you can choose ur bits and increament counter and keep MSBs mapping on LEDs. 

 

Hope you understood.
0 Kudos
Altera_Forum
Honored Contributor II
308 Views

Hi Supal, 

 

Thank you very much for the response. You have understood my requirement correctly. But the solution you have provided is not elaborate.  

 

I have worked on FPGA logic design, but I am new to embedded design. I am pretty conversant with Quartus tool, but am new to SOPC. I want to know how I can do the mapping using SOPC builder. I want to know how I can create the enable signal using some software instruction. Do I need to use the Avalon bus. These are the things I need to know. I want to know the procedure. 

 

Is there some tutorial on creating custom components using SOPC builder. The user guide is not of much help. 

 

regards, 

rajesh
0 Kudos
Altera_Forum
Honored Contributor II
308 Views

If you want a counter enable signal for a counter external to your sopc, you can simply use a PIO. Then you connect the counter output to LEDs and control the PIO-output/enable from Nios or whatever you have inside the sopc. 

If you want to completely integrate into sopc builder, you must create a new sopc custom component from any counter hdl code: you must add an Avalon slave interface on one side in order to control the counter and conduits on the other side for count output.
0 Kudos
Altera_Forum
Honored Contributor II
308 Views

http://www.altera.com/customertraining/webex/customcomps/player.html 

 

Open above link and listen and see carefully i think it what you wanted to know.
0 Kudos
Reply