Soft-Core Processor Design - CiteSeer
Soft-Core Processor Design - CiteSeer
Soft-Core Processor Design - CiteSeer
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Most instructions take 5 cycles to execute. Execution time of the MUL instruction varies from<br />
5 to 8 cycles, depending on the FPGA device it is implemented in. MSTEP and shift instructions<br />
take 6 cycles to execute. Memory operations take 5 or more cycles to execute, depending on the<br />
memory latency and bus arbitration. Although each instruction takes at least 5 cycles to execute,<br />
due to pipelined execution, one instruction per cycle will finish its execution in the ideal case. In<br />
reality, less than one instruction will commit per cycle, since some instructions take more than 5<br />
cycles to execute. The pipeline implementation is not visible to user programs, except for the<br />
instructions in the delay slot, and the WRCTL instruction. An instruction in the delay slot<br />
executes out of the original program order. Any WRCTL instruction modifying the STATUS<br />
register has to be followed by a NOP instruction. NOP is a pseudo instruction implemented as<br />
MOV %r0, %r0.<br />
Systems using the Nios processor can use both on- and off-chip memory for instruction and<br />
data storage. Memory is byte addressable, and words and halfwords are stored in memory using<br />
little-endian byte ordering. All memory addresses are word aligned for 32-bit Nios, and halfword<br />
aligned for 16-bit Nios. Special control signals, called byte-enable lines, are used when a partial<br />
word has to be written to the memory. Systems using off-chip memory can use the on-chip<br />
memory as instruction and data caches. Caches are direct-mapped with write-through write<br />
policy for the data cache. The instruction cache is read-only. If a program writes to the instruction<br />
memory, the corresponding lines in the instruction cache have to be invalidated. Cache support is<br />
only provided for the 32-bit Altera Nios.<br />
Several Nios datapath parameters can be customized. The pipeline can be optimized for speed<br />
or area. The instruction decoder can be implemented in logic or in memory. Implementation in<br />
logic is faster, while memory implementation uses on-chip memory and leaves more resources for<br />
user-logic. According to [38], both 16- and 32-bit Nios can run at clock speeds over 125 MHz.<br />
This number varies depending on the target FPGA device.<br />
3.1.4. Interrupt Handling<br />
There are three possible sources of interrupts in the Nios architecture: internal exceptions,<br />
software interrupts, and I/O interrupts. Internal exceptions occur because of unexpected results in<br />
instruction execution. <strong>Soft</strong>ware-interrupts are explicit calls to trap routines using TRAP<br />
instruction, often used for operating system calls. I/O interrupts come from I/O devices external<br />
to the Nios processor, which may reside both on and off-chip.<br />
The Nios architecture supports up to 64 vectored interrupts. Internal exceptions have<br />
predefined exception numbers, while software-interrupts provide the exception number as an<br />
19