Forum Discussion
Altera_Forum
Honored Contributor
13 years agoI've not done it for a while, but the sopc builder has a 'wizard' that will created the template for a custom instruction.
You then have to write the vhdl to do the actual operation. I'd start with a simple combinatorial custom instruction - not a bad environment to learn how to write small bits of vhdl since the inputs can be easily set and the outputs printed. It is a shame that the only Altera docs/examples I found concentrated on ticking the GUI boxes to add the existing instrcutions (and mostlf the FP ones). It is certainly easy to write a 32bit 'add with carry' custom instruction (add r0 to r0 to clear the saved carry), ideally you'd need to save/restory the carry bit during interrupt entry/exit - but for simple code avoiding using the instruction during interrupts would be enough. Whether it is worth having an internal wide accumulator (1024 bits in your case) depends on whether you can reuse the provious result - and that depends on exactly what you are trying to achieve. I've only written combinatorial custom instructions (all I needed),