Electronic – Designing a peripheral for soft core CPU

chip-designfpgaintel-fpgasoftcore

I've been implementing a hardware module in VHDL for part of my university dissertation and I want to implement it as part of a NIOS II core in my cyclone 2 FPGA. This uses the Avalon interface, what resources can I look at designing a generic module? I have no idea where to start with this part of my project.

I don't know whether my design will be a slave or a master. Can someone point me in the relevant direction on designing the part of my project.

So I want my hardware module to form some extra instructions of the CPU to speed up the execution of a specific algorithm. So that we have some Assembly call in my C program that uses the hardware encryption co-processor.

My hardware module is DES Encryption module, and i'd like some extra instructions so that I can interface a CPU core to my module.

Best Answer

You may want to implement this as a custom instruction rather than mem-mapped peripheral. Get started by reading the NIOS II Custom Instruction Guide. You probably want to implement a 'Multicycle' instruction so that you can take a few cycles to calculate the DES values.

The guide explains how the instruction mnemonics trigger your hardware. The result is multiplexed together with the ALU output and directed to the register file. The example in the guide is a CRC generator, so somewhat similar architecturally.