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

Custom instruction

Altera_Forum
Honored Contributor II
1,138 Views

Hi, 

How can I control the clock enable and other signals for implemented custom instruction with hardware inside the NIOS II (sequential)?  

Maybe some more examples have Altera (not only combinatorial example leading_zero_detector)? 

Thank you for help
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
273 Views

I have the same problem. I need to know how to determine the number of clock cycles per instruction in order to get the results. Thanks in advance for any help you could give.

0 Kudos
Altera_Forum
Honored Contributor II
273 Views

A lot of the logic of the custom instruction interface can be seen in the RTL viewer. 

I suspect that the 'clock enable' is the signal used to stop the cpu during pipeline stalls - so a variable length custom instruction must assert 'done' while clock enable is asserted (but need not otherwise look at it). 

A fixed length instruction (where the interface counts the clocks for you) will almost certainly have to apply the clock enable to everything.
0 Kudos
Altera_Forum
Honored Contributor II
273 Views

Thanks for replying. I'm working with Quartus II 12.0 subscription edition. The problem is that I don't have a way to change the instructions to fixed length,because it's automatically assigned the instruction to variable length. Is there any way of doing that? 

 

Thanks in advance.
0 Kudos
Altera_Forum
Honored Contributor II
273 Views

I would have thought it was best to generate the 'done' signal from within your own logic. 

After all you will have an internal signal (or can easily generate one) that is asserted when the result is available. 

I thought I remembered there being an option for 'fixed length', maybe it can only be set when you create the component. 

I do remember that it wasn't obvious how to edit the details - IIRC you have to run the component editor. 

 

There were certainly a pile of bugs in the version of the sopc builder I was using - it got very confused if you added and removed custom instructions from the cpu itself. 

 

All not helped by the only examples just describing how to tick the boxes to include the FP instructions.
0 Kudos
Altera_Forum
Honored Contributor II
273 Views

Thanks. Yeah. I found the way of set it to fixed length, but we should know the number of cycles needed to set that. Therefore better to use variable length and set the done signal when we need the result. I'll try and check. 

 

Thanks for helping.
0 Kudos
Reply