Altera_Forum
Honored Contributor
12 years agoIssue with the application layer from NIOS II IDE while accessing a custom instructio
Hello,
I have implemented a custom instruction for full adder (just a basic one) in verilog for NIOS II. However when my application code (C) from NIOS II tries to access the macro for the custom instruction, I see one input operand value being tried up to a strange value, 2047 (!). Any guess what might be causing the issue? I have checked almost all the sides, however I could not find the issue. I am attaching the verilog modules with this email, I have tested in Modelsim and there it works good. I am pasting the valid instructions from the file custom_add_hw.tcl below: "add_interface nios_custom_instruction_slave_0 nios_custom_instruction end set_interface_property nios_custom_instruction_slave_0 clockCycle 0https://www.alteraforum.com/forum/attachment.php?attachmentid=6957 set_interface_property nios_custom_instruction_slave_0 operands 2 set_interface_property nios_custom_instruction_slave_0 ENABLED true add_interface_port nios_custom_instruction_slave_0 clk clk Input 1 add_interface_port nios_custom_instruction_slave_0 reset reset Input 1 add_interface_port nios_custom_instruction_slave_0 dataa dataa Input 32 add_interface_port nios_custom_instruction_slave_0 datab datab Input 32 add_interface_port nios_custom_instruction_slave_0 n n Input 3 add_interface_port nios_custom_instruction_slave_0 clk_en clk_en Input 1 add_interface_port nios_custom_instruction_slave_0 start start Input 1 add_interface_port nios_custom_instruction_slave_0 done done Output 1 add_interface_port nios_custom_instruction_slave_0 result result Output 32"https://www.alteraforum.com/forum/attachment.php?attachmentid=6957 https://www.alteraforum.com/forum/attachment.php?attachmentid=6958 https://www.alteraforum.com/forum/attachment.php?attachmentid=6959 Now from the NIOS II IDE, I am trying to call the custom instruction using the macro sumOutput = ALT_CI_CUSTOM_ADD_INST(4,1,10); as shown in the attached .c file. However the output I am getting is, Hello from Nios II! The sum is 2057 which is 2047 (for dataa, I donno why) + 10 (for datab, which gets proper value). Please help me in solving this issue. Thank You, Akhil