Altera_Forum
Honored Contributor
17 years agocustom instructions implementation
Hi everybody,
I'm trying to implement a mac unit as custom instruction into the Nios2 to multiply 2 operands and add another. I had no problems describing it in vhdl. Unfortunately I'm stuck now at several other problems. 1. In sopc builder after adding the mac component to the cpu and generating the .ptf file, i build a syslib in Nios2ide using that .ptf. At the beginning of the building process it always says --- Quote Start --- WARNING: module cpu_II_Mac_inst (Mac) not found in component directory (install.ptf) --- Quote End --- What does that mean? What should I add to the install.ptf or the component directory (which is where?) to help him find the module? 2. I need 3 operands - the system.h created anyway by the Nios2ide only lists a macro with 2 operands even if I've set the operands of the custom_instruction_slave to 3 in the component editor --- Quote Start --- #define ALT_CI_MAC_INST(A,B) __builtin_custom_inii(ALT_CI_MAC_INST_N,(A),(B)) --- Quote End --- 3. If I edit that macro in the system.h file to support 3 integer operands --- Quote Start --- #define ALT_CI_MAC_INST(A,B,c) __builtin_custom_iniii(ALT_CI_MAC_INST_N,(A),(B),(c)) --- Quote End --- I get an undefined reference to that function. How do I add the functionality for a third operand? Where are the built-in functions declared and where is the function body, so that I may add a third operand to that function manually? How do I tell the compiler to run these function calls on the hardware described by the hdl-file? I would deeply appreciate any help on this topic because I'm about to get desperate on it. Cheers, Dash