Hi Matteo,
i don't know if this is the right answer to your question but, to implement a custom instruction, first of all you have to edit the VHDL file (or another HDL description) that implements the functionality of your custom instruction; your top level module must have the I\O signal dataa, datab, result and so on, as described in the document "NiosII Custom Instruction User Guide"; each I\O signal not recognized as this kind of signals, will be an I/O signal of the NIOS II block.
Then you have to enter the HDL file (.vhd if you use VHDL) on the custom instruction field of your NIOS II cpu menù, inside SOPC builder (this is described in the same document). Generate and you will have your custom istruction included in the NIOS II architecture.
The output bit signal of my custom intruction doesn't go out of the chip, but it'd be very easy to do...
bye