Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
9 years ago

nios 2 custom instruction having multiple inputs

Hello Everyone,

I am implementing sobel edge detection on de2 board using nios2 processor. I want to create custom instruction for sobel kernel. I have created verilog module for my sobel kernel.

question is nios2 custom instruction allows only two inputs dataa and datab while in my sobel kernel , I have eight inputs. can anyone guide me how to create custom instruction for multiple inputs.

Here I have attached my verilog code also.

Thanks

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You cant move 8 inputs to a custom instruction in a single clock. You can use the register file interface, or use multiple opcodes to break up the data from the execution.

    Often, custom instructions are being used to speed things up. So if you care about performance, you need to look at where the 8 input data are coming from. If they aren't already in the register file, the NIOS would need to take some time to get them there before executing the CI. - maybe that's fine or maybe that's terrible depending on your goal.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Ted,

    I have image matrix in my nios2 c code. I will take 8 surrounding pixel values and want to set them as an input arguments for custom instruction. Can you guide me about register file interface because in my case it will be the only option to perform my task.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Ted,

    I have image matrix in my nios2 c code. I will take 8 surrounding pixel values and want to set them as an input arguments for custom instruction. Can you guide me about register file interface because in my case it will be the only option to perform my task.