--- Quote Start ---
What the other member suggested is generally exact. PIOs are very inefficient if you want to write an external register and aMM slave interface is more convenient.
But in your case I see you don't have a 'real' memory interface, being your external module totally asynchronous (and maybe combinatorial?): so I don't see any improvement in switching from PIO to Avalon MM.
However giving you informatio about Avalon MM here is not feasible, since it would require a lot of space. You'll learn more by browsing Nios/sopc documentation or searching in the forum.
Regards
Cris
--- Quote End ---
Thanks Cris. Yes it is combinatorial with a the module just doing some addition/subtraction on 8 8-bit numbers and giving out an 8-bit result. Concerning the lack of improvement in switching from PIO to MM, I have to say that my application is for learning purposes and so I want to explore all the possibilities.
Anyway, from reading literature, I found I could create a custom instruction that would work with combinational circuits. The custom instruction module accepts two 32-bit inputs and give out a 32-bit output, which is more or less what my module needs. So i implemented that. But now I don't know how to pass the inputs to that custom logic module. Given that my inputs are for example 1, 2,.., 8, I thought I could have the data in two arrays and then send these arrays as pointers by calling the builtinn_custom_inpp as:
# define ALT_CI_MYCALC_C_INSTR_N 0x0# define ALT_CI_MYMACRO(A,B) __builtin_custom_inpp ALT_CI_MYCALC_C_INSTR_N (A), (B))
alt_u8 small_1= {1,2,3,4};
alt_u8 small_2= {5,6,7,8};
alt_u8 *array_1 = &small_1;
alt_u8 *array_2 = &small_2;
int custom_int_res = 0;
custom_int_res = ALT_CI_MYMACRO((void *)array_1,(void *)array_2);
But I am not getting the right result this way. Is the use of pointers correct in this situation? If yes, can somebody please help me find where I have gone wrong in my usage of pointers?
Thanks