Altera_Forum
Honored Contributor
14 years agoInterfacing custom module with Nios II
Hello,
I have written an AES-128 Encryption module in SystemVerilog, and instead of just flashing it onto the DE2-115 board, and having it show results on LED/7-Segment's etc, I want to connect it to a Nios II Processor - so I can program it using C/C++. So far I have used SOPC and created a Nios II with JTAG_UART, Onchip Memory, and many PIO's. My AES module has - Clock Input (can connect to CLOCK_50), Key[128 bits], PlainText[128 bits], Load, Reset and Outputs are CipherText[128 bits] and a "Done" bit. As PIO's are 32 bit max, I created 4 x 32 bit PIO for each Key, PlainText and CiperText and individual PIO for the others. Then in Top Module I instantiated my Nios II and my AES Module, and simply created Wires and connected the correct outputs from Nios II to inputs on AES and AES Outputs to Nios II inputs. My first question is....is this the correct way to go about it? I then started a project in Eclipse, and have tried writing data down the PIO's from Nios II to the AES module and then try and collect the CipherText thatcomes into the Nios II Input PIO's, and am having little luck. For example I used the following code to write a Key to the AES Module... IOWR_ALTERA_AVALON_PIO_DATA(PIO_KEY12796_BASE, Key0); IOWR_ALTERA_AVALON_PIO_DATA(PIO_KEY9564_BASE, Key1); IOWR_ALTERA_AVALON_PIO_DATA(PIO_KEY6332_BASE, Key2); IOWR_ALTERA_AVALON_PIO_DATA(PIO_KEY3100_BASE, Key3); Where Key"x" are integers which ive preset to 32 bit values. Are these the correct functions to use...I mean, do they hold their value on the wire, or do they simply just send a quick pulse to the module? I just need a bit of a push in the right direction to get this interface working between the two. Any help would be very much appreciated as always :)