Hello world;I have created my first custom IP for matrix multiplication, and i want to access it using a custom instruction, how can I make this?, my IP is compatible with the avalon bus interfaces. Thanks.
All you have to do is add another interface to your existing custom IP, with the new interface being a custom instruction slave. e.g. one custom instruction slave interface, and one or more Avalon interfaces for loading/storing your matrix.Then simply glue the opcodes to your desired behavior of your existing IP. The only real trick is that you need to be careful with cache coherency (since your existing Avalon interfaces will not being going through the NIOS cache, if you have one).
Given that the matrix multiply won't be quick, you really want an interface that will allow it to progress asynchronously.Also and extra couple of clocks to initiate the action won't make much difference. So you might as well request the mutiply using an Avalon slave. You should be able to dual-port an M9K memory block to your matrix code and one of the cpus tightly coupled data ports. That will give both sides single clock access and avoid any problems with the data cache.
--- Quote Start --- Given that the matrix multiply won't be quick, you really want an interface that will allow it to progress asynchronously. --- Quote End --- Both custom instruction and Avalon-MM support either asynchronous or synchronous styles of execution.
Moving this post to the Nios portion of the forum so that people will see it.I agree with DSL, for this sort of thing you don't want a highly latent matrix multiply stalling the processor pipeline. You can make a non-blocking custom instruction to get around this but if you are going to go through all that effort you might as well take the processor out of the loop and feed a matrix multiply IP with a DMA to maximize the throughput.