Nios II Custom Instruction User Guide

ID 683242
Date 4/27/2020
Public
Document Table of Contents

2.1.4.2. Internal Register File Custom Instruction Ports

To access the Nios II internal register file, you must implement several custom instruction-specific ports.

The following table lists the internal register file custom instruction-specific optional ports. Use the optional ports only if the custom instruction requires them.

Table 4.  Internal Register File Custom Instruction Ports
Port Name Direction Required Description
readra Input No If readra is high, Nios II processor register a supplies dataa. If readra is low, custom instruction logic reads internal register a.
readrb Input No If readrb is high, Nios II processor register b supplies datab. If readrb is low, custom instruction logic reads internal register b.
writerc Input No If writerc is high, the Nios II processor writes the value on the result port to register c. If writerc is low, custom instruction logic writes to internal register c.
a[4:0] Input No Custom instruction internal register number for data source A.
b[4:0] Input No Custom instruction internal register number for data source B.
c[4:0] Input No Custom instruction internal register number for data destination.

The readra, readrb, writerc, a, b, and c ports behave similarly to dataa. When the custom instruction begins, the processor presents the new values of the readra, readrb, writerc, a, b, and c ports on the rising edge of the processor clock. All six of these ports remain stable during execution of the custom instructions.

To determine how to handle the register file, custom instruction logic reads the active high readra, readrb, and writerc ports. The logic uses the a, b, and c ports as register numbrs. When readra or readrb is asserted, the custom instruction logic ignores the corresponding a or b port, and receives data from the dataa or datab port. When writerc is asserted, the custom instruction logic ignores the c port and writes to the result port.

All other custom instruction port operations behave the same as for combinational and multicycle custom instructions.