Forum Discussion
Altera_Forum
Honored Contributor
15 years agoThere are multiple ways to do this depending upon your HDL module. You can include your own module as a custom instruction in the SOPC Builder, as you've suggested. A simpler method would be to interface with the PIO ports. This would require instantiating your module in the high-level HDL file in Quartus, then connect your Nios2 PIO ports to your module.
For example, if you have a Verilog module that outputs a single number as a result of two inputs, simply generate 3 PIOs in your SOPC builder and connect. Your Nios program would write a number to each output PIO, then read from the input PIO after a minimum timing requirement. On the other hand, if your module requires a large amount of data stored in SDRAM (i.e. computing an md5 hash), then using the PIOs might not be such a good idea since they won't have access to the Avalon-MM bus. A 3rd method would be to create your own Avalon-MM component, which would require the most amount of programming. For what it's worth, I haven't had a good experience using Custom Instructions on anything a PIO interface couldn't easily handle. -J