Altera Nios II Spezifikationen

Stöbern Sie online oder laden Sie Spezifikationen nach Prozessoren Altera Nios II herunter. Altera Nios II Specifications Benutzerhandbuch

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 269
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen

Inhaltsverzeichnis

Seite 1 - San Jose, CA 95134

Nios II Classic Processor Reference GuideSubscribeSend FeedbackNII5V12015.04.02101 Innovation DriveSan Jose, CA 95134www.altera.com

Seite 2 - Contents

• Optional memory management unit (MMU) to support operating systems that require MMUs• Optional memory protection unit (MPU)• Software development en

Seite 3

Instruction DescriptionldbioldbuiostbioldhioldhuiosthioThese operations load/store byte and half-word data from/to peripherals withoutcaching or buffe

Seite 4

Table 3-44: Move InstructionsInstruction Descriptionmovmovhimovimovuimoviamov copies the value of one register to another register. movi moves a 16-bi

Seite 5

Table 3-46: Shift and Rotate InstructionsInstruction DescriptionrolrorroliThe rol and roli instructions provide left bit-rotation. roli uses an immedi

Seite 6

Table 3-48: Conditional Branch InstructionsInstruction DescriptionbgebgeubgtbgtublebleubltbltubeqbneThese instructions provide relative branches that

Seite 7

Instruction DescriptionrdprswrprsThese instructions read and write a general-purpose registers between the currentregister set and another register se

Seite 8

Related InformationUnimplemented Instruction on page 3-45Document Revision HistoryTable 3-50: Document Revision HistoryDate Version ChangesApril 2015

Seite 9

Date Version ChangesSeptember 2004 1.1• Added details for new control register ctl5.• Updated details of debug and break processing to reflect newbeha

Seite 10 - Send Feedback

Instantiating the Nios II Processor42015.04.02NII51004SubscribeSend FeedbackThis chapter describes the Nios® II Processor parameter editor in Qsys. Th

Seite 11 - Related Information

Name DescriptionException VectorException vector memoryRefer to the "General Exception Vectors" section.Exception vector offsetException vec

Seite 12 - Standard Peripherals

Multiply and Divide SettingsThe Nios II/s and Nios II/f cores offer hardware multiply and divide options. You can choose the bestoption to balance emb

Seite 13 - OpenCore Plus Evaluation

Figure 1-1: Example of a Nios II Processor System Nios IIProcessor Core SDRAMControllerOn-Chip ROMTristate bridge tooff-chip memorySystem Inter

Seite 14

General Exception VectorParameters in this section select the memory module where the general exception vector (exceptionaddress) resides, and the loc

Seite 15

Note: The Nios II MMU is optional and mutually exclusive from the Nios II MPU. Nios II systems caninclude either an MMU or MPU, but cannot include bot

Seite 16 - Processor Architecture

Name DescriptionOmit data master portRefer to the "Data Master" Settings.Data cacheData cache line sizeBurst transfersData cache victim buff

Seite 17 - Processor Implementation

Data Master SettingsThe Data Master parameters provide the following options for the Nios II/f core:• Omit data master port—Removes the Avalon-MM data

Seite 18 - Register File

Name DescriptionIllegal instructionRefer to the "Exception Checking" section.Division errorMisaligned memory accessExtra exception informati

Seite 19

Related InformationSOPC Builder to Qsys Migration GuidelinesFor information about upgrading IDs that were manually-assigned values in Qsys, refer to t

Seite 20 - Floating-Point Instructions

Related Information• Programming Model on page 3-1• Programming ModelInterrupt Controller InterfacesThe Interrupt controller setting determines which

Seite 21

Related InformationAltera ASICsECCECC is only available for the Nios II/f core and provides ECC support for Nios II internal RAM blocks,such as instru

Seite 22

MMUWhen Include MMU on the Core Nios II tab is on, the MMU settings on the MMU and MPU Settingstab provide the following options for the MMU in the Ni

Seite 23 - Inference

Related Information• Programming Model on page 3-1• Programming Model• Nios II Core Implementation Details on page 5-1• Nios II Core Implementation De

Seite 24

Because the pins and logic resources in Altera devices are programmable, many customizations arepossible:• You can rearrange the pins on the chip to s

Seite 25 - Reset and Debug Signals

Feature DescriptionHardwareBreakpointsSets a breakpoint on instructions residing in nonvolatile memory, such as flashmemory.Data Triggers Triggers bas

Seite 26 - EIC Interface

Debug Feature No Debug Level 1 Level 2 Level 3 Level 4(39)Download Software No Yes Yes Yes YesSoftware Breakpoints None Unlimited Unlimited Unlimited

Seite 27 - Memory and I/O Organization

Related InformationGeneral Exception Vector on page 4-4Advanced Debug SettingsDebug levels 3 and 4 support trace data collection into an on-chip memor

Seite 28

For information about converting SOPC Builder designs to Qsys, refer to the SOPC Builder to QsysMigration Guidelines.Related InformationSOPC Builder t

Seite 29 - Instruction and Data Buses

To add the floating-point custom instructions to the Nios II processor in Qsys, select Floating PointHardware under Custom Instruction Modules on the

Seite 30 - Data Master Port

Document Revision HistoryTable 4-9: Document Revision HistoryDate Version ChangesApril 2015 2015.04.02 Maintenance release.February 2014 13.1.0• Added

Seite 31 - Cache Memory

Date Version ChangesOctober 2005 5.1.0 Maintenance release.May 2005 5.0.0• Updates to reflect new GUI options in Nios II processor version5.0.• New de

Seite 32

Nios II Core Implementation Details52015.04.02NII51015SubscribeSend FeedbackThis document describes all of the Nios® II processor core implementations

Seite 33 - Address Map

FeatureCoreNios II/e Nios II/s Nios II/fData BusCache – – 512 bytes to 64 KBPipelined MemoryAccess– – –Cache Bypass Methods – –• I/O instructions• Bit

Seite 34

Related Information• Instruction Set Reference on page 8-1• Instruction Set ReferenceDevice Family SupportAll Nios II cores provide the same support f

Seite 35

Custom ComponentsYou can also create custom components and integrate them in Nios II processor systems. For perform‐ance-critical systems that spend m

Seite 36 - Hardware Triggers

The Nios II/f fast core is designed for high execution performance. Performance is gained at the expenseof core size. The base Nios II/f core, without

Seite 37 - Trace Capture

The Nios II/f core also provides a hardware divide option that includes LE-based divide circuitry in theALU.Including an ALU option improves the perfo

Seite 38

Shift and Rotate PerformanceThe performance of shift operations depends on the hardware multiply option. When a hardwaremultiplier is present, the ALU

Seite 39

Bit Fieldsline offsetTable 5-5: Cache Virtual Byte Address FieldsBit Fields31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16line15 14 13 12 11 10 9 8 7

Seite 40 - Programming Model

Data CacheThe data cache memory has the following characteristics:• Direct-mapped cache implementation• Configurable line size of 4, 16, or 32 bytes•

Seite 41

Related Information• Instruction Set Reference on page 8-1• Instruction Set Reference• Processor Architecture on page 2-1• Processor ArchitectureBurst

Seite 42 - Memory Management

The μTLBs are not visible to software. They act as an inclusive cache of the main TLB. The processor firstslook for a hit in the μTLB. If it misses, i

Seite 43 - Virtual Memory Address Space

The A-stage stall occurs if any of the following conditions occurs:• An A-stage memory instruction is waiting for Avalon-MM data master requests to co

Seite 44 - TLB Organization

Instruction Cycles Penaltiesstore (without Avalon-MM transfer) 1store (with Avalon-MM transfer) > 1flushd, flushda (without Avalon-MM transfer) 2fl

Seite 45 - Field Name Description

• Division error• Fast translation lookaside buffer (TLB) miss (MMU only)• Double TLB miss (MMU only)• TLB permission violation (MMU only)• MPU region

Seite 46

• Simulate the behavior of a Nios II processor within your system.• Verify the functionality of your design, as well as evaluate its size and speed qu

Seite 47 - Memory Regions

• Instruction cache• ECC errors (1, 2, or 3 bits) that occur in the instruction cache are recoverable; the Nios II processorflushes the cache line and

Seite 48 - Registers

Bit Field Description Effect onSoftwareAvailable15 Reserved16 Reserved17 Reserved18 Reserved19TLB_RERecoverable (1 bit) ECC error in TLB RAM (hardware

Seite 49 - General-Purpose Registers

OverviewThe Nios II/s core:• Has an instruction cache, but no data cache• Can access up to 2 GB of external address space• Supports optional tightly-c

Seite 50

ALU Option Hardware Details Cycles per instruc‐tionSupported InstructionsEmbedded multiplieron Cyclone III familiesALU includes 32 x 16-bitmultiplier5

Seite 51 - NII51003

• Direct-mapped cache implementation• The instruction master port reads an entire cache line at a time from memory, and issues one read perclock cycle

Seite 52 - The status Register

Stage Letter Stage NameM MemoryW WritebackUp to one instruction is dispatched and/or retired per cycle. Instructions are dispatched and retired in-ord

Seite 53

Instruction Cycles PenaltiesBranch (correctly predictedtaken)2Branch (correctly predictednot taken)1Branch (mispredicted) 4 Pipeline flushtrap, break,

Seite 54 - The estatus Register

at the expense of execution performance. The Nios II/e core is roughly half the size of the Nios II/s core,but the execution performance is substantia

Seite 55 - The ienable Register

Instruction PerformanceThe Nios II/e core dispatches a single instruction at a time, and the processor waits for an instruction tocomplete before fetc

Seite 56 - The exception Register

Document Revision HistoryTable 5-17: Document Revision HistoryDate Version ChangesApril 2015 2015.04.02 Obsolete devices removed (Stratix II, Cyclone

Seite 57 - The tlbacc Register

Date Version ChangesOctober 2005 5.1.0 Maintenance release.May 2005 5.0.0 Maintenance release.September 2004 1.1 Maintenance release.May 2004 1.0 Init

Seite 58 - The tlbmisc Register

Nios II Processor Revision History62015.04.02NII51018SubscribeSend FeedbackEach release of the Nios® II Embedded Design Suite (EDS) introduces improve

Seite 59

Version Release Date Notes9.1 November2009• Added optional external interrupt controller interface.• Added optional shadow register sets.9.0 March 200

Seite 60

Architecture RevisionsArchitecture revisions augment the fundamental capabilities of the Nios II architecture, and affect allNios II cores. A change i

Seite 61 - The badaddr Register

Version Release Date Notes1.01 September2004No changes.1.0 May 2004 Initial release of the Nios II processor architecture.Core RevisionsCore revisions

Seite 62 - The config Register

Version Release Date Notes5.1 SP1 January 2006 Bug Fix:Back-to-back store instructions can cause memory corruption to thestored data. If the first sto

Seite 63 - The mpubase Register

Nios II/s CoreTable 6-4: Nios II/s Core RevisionsVersion Release Date Notes13.1 November2013• Added support for enhanced floating-point custom instruc

Seite 64 - The mpuacc Register

Version Release Date Notes1.1 December2004• Added user-configurable options affecting multiply and shiftoperations. Now designers can choose one of th

Seite 65 - MASK Encoding Region Size

Version Release Date Notes6.1 November2006No changes.6.0 May 2006 No changes.5.1 October 2005 No changes.5.0 May 2005 Support for HardCopy devices (pr

Seite 66

Version Release Date Notes5.0 May 2005 Support for HardCopy devices (previous versions of the JTAG debugmodule did not support HardCopy devices).1.1 D

Seite 67

Date Version ChangesMarch 2009 9.0.0 Maintenance release.November 2008 8.1.0 Maintenance release.May 2008 8.0.0• Added MMU information.• Added MPU inf

Seite 68

Processor Architecture22015.04.02NII51002SubscribeSend FeedbackThis chapter describes the hardware structure of the Nios II processor, including a dis

Seite 69 - The sstatus Register

Application Binary Interface72015.04.02NII51016SubscribeSend FeedbackThis chapter describes the Application Binary Interface (ABI) for the Nios® II pr

Seite 70

Memory AlignmentContents in memory are aligned as follows:• A function must be aligned to a minimum of 32-bit boundary.• The minimum alignment of a da

Seite 71 - Working with the MPU

RegisterName Used byCompilerCalleeSaved(45)Normal Usager16 v vCallee-saved general-purpose registersr17 v vr18 v vr19 v vr20 v vr21 v vr22 v(46)r23 v(

Seite 72 - Debugger Access

StacksThe stack grows downward (i.e. towards lower addresses). The stack pointer points to the last used slot.The frame pointer points to the saved fr

Seite 73 - Working with ECC

Further Examples of StacksThere are a number of special cases for stack layout, which are described in this section.Stack Frame for a Function With al

Seite 74 - MMU TLB RAM

Figure 7-3: Stack Frame Using Variable ArgumentsIn function a()Just prior to calling b()In function b()Just after executing prologueIncomingstackargum

Seite 75 - Exception Processing

Note: An even better way to find out what the prologue has done is to use information stored in theDWARF-2 debugging fields of the executable and link

Seite 76

The equivalent structure representing the arguments is:struct { int a; int b; };The first 16 bytes of the struct are assigned to r4 through r7. Theref

Seite 77

b(&value, i, j);}DWARF-2 DefinitionRegisters r0 through r31 are assigned numbers 0 through 31 in all DWARF-2 debugging sections.Object FilesTab

Seite 78 - Reset Exceptions

Name Value Overflowcheck(49)Relocated AddressRBit MaskMBit ShiftBR_NIOS2_LO16 10 No (S + A) & 0xFFFF 0x003FFFC0 6R_NIOS2_HIADJ16 11 No Adj(S+A) 0x

Seite 79 - Break Exceptions

Figure 2-1: Nios II Processor Core Block DiagramExceptionControllerInternalInterruptControllerArithmeticLogic UnitGeneralPurposeRegisters Control Regi

Seite 80 - Interrupt Exceptions

Name Value Overflowcheck(49)Relocated AddressRBit MaskMBit ShiftBR_NIOS2_TLS_LDO16 30(50)Yes Refer to Thread-Local Storagesection0x003FFFC0 6R_NIOS2_T

Seite 81

Expressions in the table above use the following conventions:• S: Symbol address• A: Addend• PC: Program counter• GP: Global pointer• Adj(X): (((X >

Seite 82 - Internal Interrupt Controller

R_NIOS2_GLOB_DATR_NIOS2_JUMP_SLOTR_NIOS2_RELATIVEA global offset table (GOT) entry referenced using R_NIOS2_GOT16, R_NIOS2_GOT_LO and/orR_NIOS2_GOT_HA

Seite 83

Copy RelocationThe R_NIOS2_COPY relocation is used to mark variables allocated in the executable that are defined in ashared library. The variable’s i

Seite 84 - Illegal Instruction

ldw r6, %tls_ldo(x2)(r2) # R_NIOS2_TLS_LDO16 x2# Value of x2 in r6One 2-word GOT slot is allocated for all R_NIOS2_TLS_LDM16 operations i

Seite 85 - Misaligned Data Address

Linux Function CallsRegister r23 is reserved for the thread pointer on GNU Linux systems. It is initialized by the C library andit may be used directl

Seite 86 - Fast TLB Miss

There are no floating-point exceptions. The optional floating point unit (FPU) does not supportexceptions and any process wanting exact IEEE conforman

Seite 87 - MPU Region Violation

The GOT pointer is loaded using a PC-relative offset to the _gp_got symbol, as shown below.Example 7-12: Loading the GOT Pointernextpc r221: orhi r1

Seite 88 - Exception Processing Flow

The call and jmpi instructions are not available in position-independent code. Instead, all calls are madethrough the GOT. Function addresses may be l

Seite 89

Ltable: .word %gotoff(Label1) .word %gotoff(Label2) .word %gotoff(Label3)Related InformationProcedure Linkage Table on page 7-20Linux Program Lo

Seite 90

Implementation variables generally fit one of three trade-off patterns: more or less of a feature; inclusionor exclusion of a feature; hardware implem

Seite 91

The example below shows the PLT entry when the PLT GOT is close enough to the small data area for arelative jump.Example 7-22: PLT Entry Near Small Da

Seite 92

Example 7-25: Initial PLT Entry.PLTresolve: nextpc r14 orhi r13, r0, %hiadj(_GLOBAL_OFFSET_TABLE_) add r13, r13, r14 ldw r

Seite 93 - Handling Nested Exceptions

provides intrinsic functions which perform the system call. Applications must use those functions ratherthan the system call directly. Atomic operatio

Seite 94

Date Version ChangesMay 2008 8.0.0• Frame pointer description updated.• Relocation table added.October 2007 7.2.0 Maintenance release.May 2007 7.1.0•

Seite 95 - Disabling Maskable Interrupts

Instruction Set Reference82015.04.02NII51017SubscribeSend FeedbackThis section introduces the Nios® II instruction word format and provides a detailed

Seite 96

• A 6-bit opcode field OP• Three 5-bit register fields A, B, and C• An 11-bit opcode-extension field OPXIn most cases, fields A and B specify the sour

Seite 97

OP Instruction OP Instruction OP Instruction OP Instruction0x01 jmpi 0x11 0x21 0x310x02 0x12 0x22 0x32 custom0x03 ldbu 0x13 initda 0x23 ldbuio 0x33 in

Seite 98 - Virtual Address Aliasing

Assembler Pseudo-InstructionsPseudo-instructions are used in assembly source code like regular assembly instructions. Each pseudo-instruction is imple

Seite 99 - Instruction Set Categories

Assembler MacrosThe Nios II assembler provides macros to extract halfwords from labels and from 32-bit immediatevalues. These macros return 16-bit sig

Seite 100 - Move Instructions

Notation Meaning0xNNMM Hexadecimal notationX : Y Bitwise concatenation For example, (0x12 : 0x34) = 0x1234σ(X) The value of X after being sign-extende

Seite 101 - Shift and Rotate Instructions

Related Information• Programming Model on page 3-1• Programming Model• Instruction Set Reference on page 8-1• Instruction Set ReferenceArithmetic Logi

Seite 102 - Program Control Instructions

Exampleadd r6, r7, r8DescriptionCalculates the sum of rA and rB. Stores the result in rC. Usedfor both signed and unsigned addition.UsageCarry Detecti

Seite 103 - Other Control Instructions

Instruction FieldsA = Register index of operand rAB = Register index of operand rBC = Register index of operand rCBit Fields31 30 29 28 27 26 25 24 23

Seite 104 - No-Operation Instruction

UsageCarry Detection (unsigned operands):Following an addi operation, a carry out of the MSB can bedetected by checking whether the unsigned sum is le

Seite 105 - Document Revision History

Bit Fields31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16A B IMM1615 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0IMM16 0x04andInstruction bitwise logical andOpe

Seite 106 - May 2004 1.0 Initial release

DescriptionCalculates the bitwise logical AND of rA and (IMM16 : 0x0000)and stores the result in rB.ExceptionsNoneInstruction TypeIInstruction FieldsA

Seite 107 - Core Nios II Tab

beqInstruction branch if equalOperationif (rA == rB)then PC ← PC + 4 + σ(IMM16)else PC ← PC + 4Assembler Syntaxbeq rA, rB, labelExamplebeq r6, r7, l

Seite 108 - Core Selection

DescriptionIf (signed) rA >= (signed) rB, then bge transfers programcontrol to the instruction at label. In the instruction encoding,the offset giv

Seite 109 - Reset Vector

Instruction FieldsA = Register index of operand rAB = Register index of operand rBIMM16 = 16-bit signed immediate valueBit Fields31 30 29 28 27 26 25

Seite 110 - General Exception Vector

Pseudo-instructionbgtu is implemented with the bltu instruction by swapping theregister operands.bleInstruction branch if less than or equal signedOpe

Seite 111 - Name Description

Assembler Syntaxblt rA, rB, labelExampleblt r6, r7, top_of_loopDescriptionIf (signed) rA < (signed) rB, then blt transfers program controlto the in

Seite 112 - Instruction Master Settings

ContentsIntroduction... 1-1Nios II Processor Syst

Seite 113 - Advanced Features Tab

Custom InstructionsThe Nios II architecture supports user-defined custom instructions. The Nios II ALU connects directly tocustom instruction logic, e

Seite 114 - Control Registers

Instruction TypeIInstruction FieldsA = Register index of operand rAB = Register index of operand rBIMM16 = 16-bit signed immediate valueBit Fields31 3

Seite 115 - Exception Checking

Bit FieldsIMM16 0x1ebrInstruction unconditional branchOperationPC ← PC + 4 + σ(IMM16)Assembler Syntaxbr labelExamplebr top_of_loopDescriptionTransfer

Seite 116 - HardCopy Compatible

ExamplebreakDescriptionBreaks program execution and transfers control to thedebugger break-processing routine. Saves the address of thenext instructio

Seite 117 - MMU and MPU Settings Tab

Usagebret is used by debuggers exclusively and should not appear inuser programs, operating systems, or exception handlers.ExceptionsMisaligned destin

Seite 118

Bit Fields15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0IMM26 0callrInstruction call subroutine in registerOperationra ← PC + 4PC ← rAAssembler Syntaxcallr r

Seite 119 - JTAG Debug Module Tab

DescriptionIf rA == rB, then stores 1 to rC; otherwise, stores 0 to rC.Usagecmpeq performs the == operation of the C programminglanguage. Also, cmpeq

Seite 120 - Debug Level Settings

Instruction FieldsA = Register index of operand rAB = Register index of operand rBIMM16 = 16-bit signed immediate valueBit Fields31 30 29 28 27 26 25

Seite 121 - Break Vector

cmpgeiInstruction compare greater than or equal signed immediateOperationif ((signed) rA >= (signed) σ(IMM16))then rB ← 1else rB ← 0Assembler Syn

Seite 122 - Custom Instruction Tab

DescriptionIf rA >= rB, then stores 1 to rC; otherwise stores 0 to rC.Usagecmpgeu performs the unsigned >= operation of the C program‐ming langu

Seite 123

Instruction FieldsA = Register index of operand rAB = Register index of operand rBIMM16 = 16-bit unsigned immediate valueBit Fields31 30 29 28 27 26 2

Seite 124 - The Quartus II IP File

Table 2-2: Hardware Conformance with IEEE 754-1985 and IEEE 754-2008 Floating-Point StandardFeature Floating-Point HardwareImplementation with IEEE 75

Seite 125

DescriptionSign-extends the immediate value IMMED to 32 bits andcompares it to the value of rA. If rA > σ(IMMED), then cmpgtistores 1 to rB; otherw

Seite 126 - Date Version Changes

Usagecmpgtui performs the unsigned > operation of the C program‐ming language. The maximum allowed value of IMMED is65534. The minimum allowed valu

Seite 127 - 2015.04.02

Pseudo-instructioncmplei is implemented using a cmplti instruction with anIMM16 immediate value of IMMED + 1.cmpleuInstruction compare less than or eq

Seite 128 - NII51015

cmpltInstruction compare less than signedOperationif ((signed) rA < (signed) rB)then rC ← 1else rC ← 0Assembler Syntaxcmplt rC, rA, rBExamplecmpl

Seite 129 - Nios II/f Core

DescriptionSign-extends the 16-bit immediate value IMM16 to 32 bits andcompares it to the value of rA. If rA < σ(IMM16), then cmpltistores 1 to rB;

Seite 130 - Arithmetic Logic Unit

Instruction FieldsA = Register index of operand rAB = Register index of operand rBC = Register index of operand rCBit Fields31 30 29 28 27 26 25 24 23

Seite 131 - Supported Instructions

cmpneInstruction compare not equalOperationif (rA != rB)then rC ← 1else rC ← 0Assembler Syntaxcmpne rC, rA, rBExamplecmpne r6, r7, r8DescriptionIf r

Seite 132 - Memory Access

DescriptionSign-extends the 16-bit immediate value IMM16 to 32 bits andcompares it to the value of rA. If rA != σ(IMM16), then cmpneistores 1 to rB; o

Seite 133 - Instruction Cache

UsageTo access a custom register inside the custom instruction logic,clear the bit readra, readrb, or writerc that corresponds to theregister field. I

Seite 134

DescriptionTreating rA and rB as signed integers, this instruction dividesrA by rB and then stores the integer portion of the resultingquotient to rC.

Seite 135 - Memory Management Unit

Feature Floating-Point HardwareImplementation with IEEE 754-1985Floating-Point Hardware 2Implementation with IEEE 754-2008NaNQuiet ImplementedNo disti

Seite 136 - Execution Pipeline

DescriptionTreating rA and rB as unsigned integers, this instructiondivides rA by rB and then stores the integer portion of theresulting quotient to r

Seite 137 - Instruction Performance

DescriptionCopies the value of estatus into the status register, andtransfers execution to the address in ea.UsageUse eret to return from traps, exter

Seite 138 - Exception Handling

DescriptionIf the Nios II processor implements a direct mapped datacache, flushd writes the data cache line that is mapped to thespecified address bac

Seite 139

Bit FieldsIMM16 0x3bRelated Information• Cache and Tightly-Coupled Memory• flushda on page 8-40• initda on page 8-44• initd on page 8-43flushdaInstruc

Seite 140

UsageUse flushda to write dirty lines back to memory only if theaddressed memory location is currently in the cache, and thenflush the cache line. By

Seite 141 - Nios II/s Core

DescriptionIgnoring the tag, flushi identifies the instruction cache lineassociated with the byte address in rA, and invalidates that line.If the Nios

Seite 142

Bit Fields31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16A 0 0 0x0415 14 13 12 11 10 9 8 7 6 5 4 3 2 1 00x04 0 0x3ainitdInstruction initialize data ca

Seite 143

UsageUse initd after processor reset and before accessing datamemory to initialize the processor’s data cache. Use initd withcaution because it does n

Seite 144

DescriptionIf the Nios II processor implements a direct mapped datacache, initda clears the data cache line without checking for(or writing) a dirty d

Seite 145

Bit Fields31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16A 0 IMM1615 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0IMM16 0x13Related Information• Cache and Tightl

Seite 146 - Nios II/e Core

Related InformationNios II Custom Instruction User GuideFor more information about using floating-point custom instructions in software, refer to the

Seite 147 - Instruction Execution Stages

Bit Fields0x29 0 0x3aRelated InformationCache and Tightly-Coupled MemoryjmpInstruction computed jumpOperationPC ← rAAssembler Syntaxjmp rAExamplejmp

Seite 148 - JTAG Debug Module

Usagejmpi is a low-overhead local jump. jmpi can transfer executionanywhere within the 256-MB range determined by PC31..28. TheNios II GNU linker does

Seite 149

ExceptionsSupervisor-only data addressMisaligned data addressTLB permission violation (read)Fast TLB miss (data)Double TLB miss (data)MPU region viola

Seite 150 - Nios II Versions

DescriptionComputes the effective byte address specified by the sum of rAand the instruction's signed 16-bit immediate value. Loadsregister rB wi

Seite 151 - Version Release Date Notes

Bit FieldsIMM16 0x23Related InformationCache and Tightly-Coupled Memoryldh / ldhioInstruction load halfword from memory or I/O peripheralOperationrB ←

Seite 152 - Architecture Revisions

Table 8-13: ldhBit Fields31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16A B IMM1615 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0IMM16 0x0fTable 8-14: ldhioBit F

Seite 153 - Core Revisions

ExceptionsSupervisor-only data addressMisaligned data addressTLB permission violation (read)Fast TLB miss (data)Double TLB miss (data)MPU region viola

Seite 154

DescriptionComputes the effective byte address specified by the sum of rAand the instruction's signed 16-bit immediate value. Loadsregister rB wi

Seite 155

Bit Fields15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0IMM16 0x37Related InformationCache and Tightly-Coupled MemorymovInstruction move register to registerOp

Seite 156

UsageThe maximum allowed value of IMMED is 65535. Theminimum allowed value is 0. To load a 32-bit constant into aregister, first load the upper 16 bit

Seite 157 - JTAG Debug Module Revisions

Operation(2)N(3)Cycles Result Subnormal Rounding GCCInferencefloatis 250 4 int_to_float(a) NotapplicableNotapplicableCastingfixsi 249 2 float_to_int(a

Seite 158

Examplemovia r6, function_addressDescriptionWrites the address of label to rB.Pseudo-instructionmovia is implemented as:orhi rB, r0, %hiadj(label)addi

Seite 159

UsageCarry Detection (unsigned operands):Before or after the multiply operation, the carry out of the MSBof rC can be detected using the following ins

Seite 160 - Application Binary Interface

Bit FieldsA B C 0x2715 14 13 12 11 10 9 8 7 6 5 4 3 2 1 00x27 0 0x3amuliInstruction multiply immediateOperationrB ← (rA x σ(IMM16)) 31..0Assembler Sy

Seite 161 - Register Usage

Assembler Syntaxmulxss rC, rA, rBExamplemulxss r6, r7, r8DescriptionTreating rA and rB as signed integers, mulxss multiplies rAtimes rB, and stores th

Seite 162 - NII51016

DescriptionTreating rA as a signed integer and rB as an unsigned integer,mulxsu multiplies rA times rB, and stores the 32 high-order bitsof the produc

Seite 163 - Call Saved Registers

UsageUse mulxuu and mul to compute the 64-bit product of two 32-bit unsigned integers. Furthermore, mulxuu can be used as partof the calculation of a

Seite 164 - Further Examples of Stacks

ExceptionsNoneInstruction TypeRInstruction FieldsC = Register index of operand rCBit Fields31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 160 0 C 0x1c15

Seite 165 - Function Prologues

Instruction FieldsA = Register index of operand rAB = Register index of operand rBC = Register index of operand rC31 30 29 28 27 26 25 24 23 22 21 20

Seite 166 - Arguments and Return Values

DescriptionCalculates the bitwise logical OR of rA and (IMM16 : 0x0000)and stores the result in rB.ExceptionsNoneInstruction TypeIInstruction FieldsA

Seite 167 - Return Values

rdctlInstruction read from control registerOperationrC ← ctlNAssembler Syntaxrdctl rC, ctlNExamplerdctl r3, ctl31DescriptionReads the value contained

Seite 168 - Relocation

In Qsys, the Floating Point Hardware component is under Embedded Processors on the ComponentLibrary tab.The Nios II floating-point custom instructions

Seite 169

UsageThe previous register set is specified by status.PRS. By default,status.PRS indicates the register set in use before an exception,such as an exte

Seite 170

Bit Fields31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 160x1f 0 0 0x0515 14 13 12 11 10 9 8 7 6 5 4 3 2 1 00x05 0 0x3arolInstruction rotate leftOperat

Seite 171 - ABI for Linux Systems

DescriptionRotates rA left by the number of bits specified in IMM5 andstores the result in rC. The bits that shift out of the registerrotate into the

Seite 172 - Relocation Operator

Bit Fields31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16A B C 0x0b15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 00x0b 0 0x3asllInstruction shift left logicalOp

Seite 173 - Thread-Local Storage

DescriptionShifts rA left by the number of bits specified in IMM5(inserting zeroes), and then stores the result in rC.Usageslli performs the <<

Seite 174

Bit Fields31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16A B C 0x3b15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 00x3b 0 0x3asraiInstruction shift right arithme

Seite 175 - Linux Function Calls

Examplesrl r6, r7, r8DescriptionShifts rA right by the number of bits specified in rB4..0(inserting zeroes), and then stores the result in rC. Bits 31

Seite 176 - Linux Process Initialization

Instruction FieldsA = Register index of operand rAC = Register index of operand rCIMM5 = 5-bit unsigned immediate valueBit Fields31 30 29 28 27 26 25

Seite 177

Instruction FieldsA = Register index of operand rAB = Register index of operand rBIMM16 = 16-bit signed immediate valueTable 8-19: stbBit Fields31 30

Seite 178

ExceptionsSupervisor-only data addressMisaligned data addressTLB permission violation (write)Fast TLB miss (data)Double TLB miss (data)MPU region viol

Seite 179 - Procedure Linkage Table

Signal Name Type Purposereset_req Reset This optional signal prevents the memory corruption by performing areset handshake before the processor resets

Seite 180

DescriptionComputes the effective byte address specified by the sum of rAand the instruction's signed 16-bit immediate value. Stores rBto the mem

Seite 181 - Linux Conventions

subInstruction subtractOperationrC ← rA – rBAssembler Syntaxsub rC, rA, rBExamplesub r6, r7, r8DescriptionSubtract rB from rA and store the result in

Seite 182

UsageCarry Detection (unsigned operands):The carry bit indicates an unsigned overflow. Before or after asub operation, a carry out of the MSB can be d

Seite 183

Instruction FieldsA = Register index of operand rAB = Register index of operand rBC = Register index of operand rCBit Fields31 30 29 28 27 26 25 24 23

Seite 184 - Instruction Set Reference

Instruction TypeRInstruction FieldsNoneBit Fields31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 160 0 0 0x3615 14 13 12 11 10 9 8 7 6 5 4 3 2 1 00x36 0

Seite 185 - Instruction Opcodes

Bit Fields31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 160 0 0x1d 0x2d15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 00x2d IMM5 0x3awrctlInstruction write to con

Seite 186 - NII51017

UsageThe previous register set is specified by status.PRS. By default,status.PRS indicates the register set in use before an exception,such as an exte

Seite 187 - Assembler Pseudo-Instructions

Instruction FieldsA = Register index of operand rAB = Register index of operand rBC = Register index of operand rCBit Fields31 30 29 28 27 26 25 24 23

Seite 188 - Assembler Macros

Assembler Syntaxxori rB, rA, IMM16Examplexori r6, r7, 100DescriptionCalculates the bitwise logical exclusive OR of rA and (0x0000 :IMM16) and stores t

Seite 189 - Notation Meaning

Date Version ChangesOctober 2007 7.2.0 Added jmpi instruction.May 2007 7.1.0• Added table of contents to Introduction section.• Added Referenced Docum

Seite 190

An EIC can be software-configurable.Note: When the EIC interface and shadow register sets are implemented on the Nios II core, you mustensure that you

Seite 191

A Nios II core uses one or more of the following to provide memory and I/O access:• Instruction master port—An Avalon® Memory-Mapped (Avalon-MM) maste

Seite 192

Figure 2-2: Nios II Memory and I/O OrganizationSMemorySSlavePeripheralAvalon Master PortAvalon Slave PortMSMMTightly CoupledInstructionMemory NTightly

Seite 193

Supervisor Mode...3-1User M

Seite 194

Related InformationAvalon Interface SpecificationsRefer to the Avalon Interface Specifications for details of the Avalon-MM interface.Memory and Perip

Seite 195

operations can complete in a single clock cycle when the data master port is connected to zero-wait-statememory.The Nios II architecture supports on-c

Seite 196

Optimal cache configuration is application specific, although you can make decisions that are effectiveacross a range of applications. For example, if

Seite 197

Accessing Tightly-Coupled MemoryTightly-coupled memories occupy normal address space, the same as other memory devices connected viasystem interconnec

Seite 198

• Hardware translation lookaside buffers (TLBs), accelerating address translation• Separate TLBs for instruction and data accesses• Read, write, and e

Seite 199

Note: The Nios II MPU is optional and mutually exclusive from the Nios II MMU. Nios II systems caninclude either an MPU or MMU, but cannot include bot

Seite 200

Note: While the processor has no minimum clock frequency requirements, Altera recommends that yourdesign’s system clock frequency be at least four tim

Seite 201

Table 2-6: Trigger ActionsAction DescriptionBreak Halt execution and transfer control to the JTAG debug module.External trigger Assert a trigger signa

Seite 202

Execution vs. Data TraceThe JTAG debug module supports tracing the instruction bus (execution trace), the data bus (data trace),or both simultaneously

Seite 203

Date Version ChangesDecember 2010 10.1.0 Added reference to tightly-coupled memory tutorial.July 2010 10.0.0 Maintenance release.November 2009 9.1.0•

Seite 204

No-Operation Instruction... 3-65Potential Uni

Seite 205

Programming Model32015.04.02NII51003SubscribeSend FeedbackThis chapter describes the Nios® II programming model, covering processor features at the as

Seite 206

tion’s access to memory and peripherals. In systems with an MPU, your system software controls themode in which your application code runs. In Nios II

Seite 207

an MMU-based Nios II processor. Do not include an MMU in your Nios II system unless your operatingsystem requires it.Note: The Altera HAL and HAL-base

Seite 208

Whenever an instruction attempts to access a page that either has no TLB mapping, or lacks theappropriate permissions, the MMU generates an exception.

Seite 209

Physical Memory Address SpaceThe 4-GB physical memory is divided into low memory and high memory. The lowest ½ GB of physicaladdress space is low memo

Seite 210

Note: You can configure the number of TLB entries and the number of ways (set associativity) of the TLBwith the Nios II Processor parameter editor in

Seite 211

Related Information• Instantiating the Nios II Processor on page 4-1• Instantiating the Nios II Processor• Nios II Core Implementation Details on page

Seite 212

handle the exception as appropriate. The precise exception effectively prevents the illegal access tomemory.The MPU extends the Nios II processor to s

Seite 213

The region limit uses a less-than instead of a less-than-or-equal-to comparison because less-than providesa more efficient implementation. The limit i

Seite 214

General-Purpose RegistersThe Nios II architecture provides thirty-two 32-bit general-purpose registers, r0 through r31. Someregisters have names recog

Seite 215

Exception Handling...5-12ECC...

Seite 216

Control RegistersControl registers report the status and change the behavior of the processor. Control registers are accesseddifferently than the gene

Seite 217

Register Name Register Contents13 config Refer to The config Register on page 3-23Available only when the MPU or ECC is present.Otherwise reserved.14

Seite 218

Register Name Register Contents8 pteaddr Refer to The pteaddr RegisterAvailable only when the MMU is present. Otherwisereserved.9 tlbacc Refer to The

Seite 219

Table 3-9: status Control Register Field DescriptionsBit Description Access Reset AvailableRSIE RSIE is the register set interrupt-enable bit. When se

Seite 220

Bit Description Access Reset AvailableIL IL is the interrupt level field. The IL field controls whatlevel of external maskable interrupts can be servi

Seite 221

All fields in the estatus register have read/write access. All fields reset to 0.When the Nios II processor takes an interrupt, if status.eh is zero (

Seite 222

Related InformationException Processing on page 3-36The ipending RegisterThe value of the ipending register indicates the value of the enabled interru

Seite 223

Related Information• Instantiating the Nios II Processor on page 4-1• Instantiating the Nios II ProcessorThe pteaddr RegisterThe pteaddr register cont

Seite 224

Issuing a wrctl instruction to the tlbacc register writes the tlbacc register with the specified value. Iftlbmisc.WE = 1, the wrctl instruction also i

Seite 225

Bit FieldsReserved EE WAY RD WE PID15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0PID DBL BAD PERM DTable 3-19: tlbmisc Control Register Field DescriptionsField

Seite 226

ABI for Linux Systems...7-

Seite 227

When system software changes the fields that specify the TLB entry, there is no immediate effect onpteaddr.VPN, tlbmisc.PID, or the tlbacc register. T

Seite 228

Refer to Nios II Exceptions (In Decreasing Priority Order) table in the "Exception Overview" section formore information on these exceptions

Seite 229

Table 3-21: badaddr Control Register Field DescriptionsField Description Access Reset AvailableBADDR BADDR contains the byte instruction address or da

Seite 230

Field Description Access Reset AvailableECCEXE ECCEX is the ECC error exception enable bit. WhenECCEXE = 1, the Nios II processor generates ECC errore

Seite 231

The INDEX and D fields specify the region information to access when an MPU region read or writeoperation is performed. The D field specifies whether

Seite 232

Field Description Access Reset AvailablePERM PERM specifies the access permissions for the region. Read/Write0 Only with MPURD RD is the read region f

Seite 233

MASK Encoding Region Size0x1FFFC00 64 KB0x1FFF800 128 KB0x1FFF000 256 KB0x1FFE000 512 KB0x1FFC000 1 MB0x1FF8000 2 MB0x1FF0000 4 MB0x1FE0000 8 MB0x1FC0

Seite 234

The MT FlagThe MT flag determines the default memory type of an MPU data region. . The MT flag only applies to dataregions. For instruction regions, t

Seite 235

The WR FlagSetting the WR flag signifies that an MPU region write operation should be performed when a wrctlinstruction is issued to the mpuacc regist

Seite 236

When shadow register sets are implemented, status.CRS indicates the register set currently in use. ANios II core can have up to 63 shadow register set

Seite 237

cmpgtu ...8-2

Seite 238

Bit Description Access Reset AvailableRSIE RSIE is the register set interrupt-enable bit. When set to 1, this bitallows the processor to serviceextern

Seite 239

• If the processor is currently running in the normal register set, insert the new register set number inestatus.CRS, and execute eret.• If the proces

Seite 240

MPU region write operations set new values for the attributes of a region. Each MPU region writeoperation consists of the following actions:• Execute

Seite 241

Working with ECCEnabling ECCThe ECC is disabled on system reset. Before enabling the ECC, initialize the Nios II RAM blocks to avoidspurious ECC error

Seite 242

Instruction Cache Tag RAM1. Ensure all code up to the JMP instruction is in the same instruction cache line or is located in anITCM.2. Use a FLUSHI in

Seite 243

Exception ProcessingException processing is the act of responding to an exception, and then returning, if possible, to the pre-exception execution sta

Seite 244

The following table columns specify information for the exceptions:• Exception—Gives the name of the exception.• Type—Specifies the exception type.• A

Seite 245

Exception Type Available Cause Address VectorSupervisor-onlyinstructionInstruction-relatedMMU orMPU10 ea–4(15)General exceptionTrap instruction Instru

Seite 246

Exception Type Available Cause Address VectorMPU regionviolation (data)Instruction-relatedMPU 17 badaddr (dataaddress)General exceptionRelated Informa

Seite 247

The reset state is undefined for all other system components, including but not limited to:• General-purpose registers, except for zero (r0) in the no

Seite 248

rol ...

Seite 249

Understanding Register UsageThe bstatus control register and general-purpose registers bt (r25) and ba (r30) in the normal registerset are reserved fo

Seite 250

• Requested Register Set on page 3-42• Requested Interrupt Level on page 3-42Requested Handler AddressThe RHA specifies the address of the handler ass

Seite 251

For the best interrupt performance, assign a dedicated register set to each of the most time-criticalinterrupts. Less-critical interrupts can share re

Seite 252

Figure 3-2: Relationship Between ienable, ipending, PIE and Hardware InterruptsIPENDING0IPENDING1IPENDING2ipending RegisterIPENDING31irq0irq1irq2irq31

Seite 253

• Fast TLB miss• Double TLB miss• TLB permission violation• MPU region violationNote: All noninterrupt exception handlers must run in the normal regis

Seite 254

Note: All undefined opcodes are reserved. The processor does occasionally use some undefinedencodings internally. Executing one of these undefined opc

Seite 255

A data address is considered misaligned if the byte address is not a multiple of the width of the load orstore instruction data width (four bytes for

Seite 256

There are two kinds of fast TLB miss exceptions:• Fast TLB miss (instruction)—Any instruction fetch can cause this exception.• Fast TLB miss (data)—Lo

Seite 257

There are two kinds of MPU region violation exceptions:• MPU region violation (instruction)—Any instruction fetch can cause this exception.• MPU regio

Seite 258

• RHA—The requested handler address for the interrupt handler assigned to the requested interrupt.• RRS—The requested register set to be used when the

Seite 259

Introduction12015.04.02NII51001SubscribeSend FeedbackThis handbook describes the Nios® II Classic processor from a high-level conceptual description t

Seite 260

Exception Flow with the Internal Interrupt ControllerA general exception handler determines which of the pending interrupts has the highest priority,

Seite 261

Processor Status Registeror FieldSystem Status Before Taking ExceptionExternal Interrupt Asserted (18)Internal Interrupt Asserted or Noninterrupt Exce

Seite 262

Determining the Cause of Interrupt and Instruction-Related ExceptionsThe general exception handler must determine the cause of each exception and then

Seite 263

handle division error exception else if (instruction is signed divide and numerator == 0x80000000

Seite 264

Nested Exceptions with an External Interrupt ControllerWith an EIC, handling of nested interrupts is more sophisticated than with the internal interru

Seite 265

Multiple interrupts can share a register set, with some loss of performance. There are two techniques forsharing register sets:• Set status.RSIE to 0.

Seite 266

The status.IL field controls what level of external maskable interrupts can be serviced. The processorservices a maskable interrupt only if its reques

Seite 267

Note: When the EIC interface and shadow register sets are implemented on the Nios II core, you mustensure that your software, including ISRs, is built

Seite 268

The Nios II architecture provides the following mechanisms to bypass the cache:• When no MMU is present, bit 31 of the address is reserved for bit-31

Seite 269

For example, in a 64-KB direct-mapped cache with a 16-byte line, bits 15:4 are used to select the line.Assume that virtual address 0x1000 is mapped to

Kommentare zu diesen Handbüchern

Keine Kommentare