Unformatted text preview:

AddressingSlide 2Addressing ModesImmediate AddressingDirect AddressingRegister AddressingRegister Indirect AddressingSlide 8Slide 9Indexed AddressingSlide 11Slide 12Based Indexed AddressingStack AddressingReverse Polish NotationSlide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Addressing Modes for Branch InstructionsSlide 24Orthogonality of Opcodes and Addressing ModesSlide 26Slide 27Slide 28Slide 29Pentium II Addressing ModesSlide 31Comparison of Addressing ModesInstruction TypesSlide 34Slide 35Slide 36Slide 37Slide 38Slide 39Slide 40Slide 41Slide 42Slide 43TrapsInterruptsThe Intel IA-64Slide 47Slide 48Slide 49Slide 50Slide 51Slide 52Slide 53Slide 54AddressingA large portion of the bits in a program are used to specify where the operands come from rather than what operations are being performed on them.•An ADD instruction requires the specification of three operands: two sources and a destination.•If memory addresses are 32 bits, the instruction takes three 32-bit addresses in addition to the opcode.Two general methods are used to reduce the size of the specificationAddressing•If an operand is to be used several times, it can be moved to a register.To do this, we must perform a LOAD (which includes the full memory address).•A second method is to specify one or more addresses implicitly.Use a two-address instruction, for example.The Pentium II uses two-address instructions while the UltraSPARC II uses three-address instructions.If we have instructions which can work with only one register, we can have one-address instructions.Finally, using a stack we can have zero-address instructions (the JVM IADD, for example).Addressing ModesThere are many different ways we can specify addresses. These are called addressing modes.The simplest way for an instruction to specify an operand is to include the operand rather than an address or some other information describing where the operand is. This is called immediate addressing and the operand is called an immediate operand.•This only works with constants.•The number of values is limited by the size of the field.Immediate AddressingDirect AddressingA method for specifying an operand in memory is just to give its full address. This is called direct addressing.The instruction will always access exactly the same memory location.•Thus direct addressing can only be used to access global variables whose address is known at compile time.•Many programs have global variables so this method is widely used.Register AddressingRegister addressing is conceptually the same as direct addressing but specifies a register rather than a memory location.•Because registers are so important this addressing mode is the most common one on most computers.•Many compilers determine the most frequently used variables and place them in registers.•This addressing mode is known as register mode.•In load/store architectures such as the UltraSPARC II, nearly all instructions use this addressing mode exclusively.Register Indirect AddressingIn this mode, the operand being specified comes from memory or goes to memory, but its address is not hardwired into the instruction, as in direct addressing.Instead the address is contained in a register.When an address is used in this manner it is called a pointer.Register indirect addressing can reference memory without having a full memory address in the instruction.Register Indirect AddressingRegister Indirect AddressingThe previous program used several addressing modes.•The first three instructions use register mode for the first operand, and immediate mode for the second operand (a constant indicated by the # sign).•The body of the loop itself does not contain any memory addresses. It uses register and register indirect mode in the fourth instruction.•The BLT might use a memory address, but mode likely it specifies the address to branch to with an 8-bit offset relative to the BLT instruction itself.Indexed AddressingIt is frequently useful to be able to reference memory words at a known offset from a register. (Remember in IJVM we referenced local variables by giving their offset from LV).Addressing memory by giving a register (explicit or implicit) plus a constant offset is called indexed addressing.•We can also give a memory pointer in the instruction and a small offset in the registerIndexed AddressingIndexed AddressingBased Indexed AddressingSome machines have an addressing mode in which the memory address is computed by adding up to registers plus an (optional) offset.Sometimes this mode is called based-indexed addressing.•One of the registers is the base and the other is the index.•We could have used this mode in the previous program to write:LOOP: MOV R4, (R2+R5)AND R4, (R2+R6)Stack AddressingWe have noted that it is desirable to make machine instructions as short as possible.•The ultimate limit in reducing address lengths is having no addresses at all.•As we have seen, zero-address instructions, such as IADD are possible in conjunction with a stack.•It is traditional in mathematics to put the operator between the operands (x + y), rather than after the operands (x y +).•Between the operands is called infix notation.•After the operands is called postfix or reverse Polish notation.Reverse Polish NotationReverse Polish notation has a number of advantages over infix for expressing algebraic formulas.•Any formula can be expressed without parentheses.•It is convenient for evaluating expressions on computers with stacks.•Infix operators have precedence, which is arbitrary and undesirable.•There are several algorithms for converting infix formulas into Polish notation. This one is by Dijkstra.Reverse Polish Notation•Assume that a formula is composed of the following symbols: variable, the dyadic (two-operand) operators + - * /, and left and right parentheses. A special symbol marks the ends of a formula.•The following slide shows a railroad track from New York to California with a spur that goes to Texas. Each symbol in the formula is represented by a railroad car. The train moves westward.•Cars containing variables always go to California. The special symbol always go to Texas.Reverse Polish NotationReverse Polish NotationThe other symbols must inquire about the contents of the nearest car on the Texas line before entering the switch. The possibilities are:1. The car at the switch heads toward


View Full Document

CSU CIS 600 - ADDRESSING

Documents in this Course
Load more
Download ADDRESSING
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view ADDRESSING and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view ADDRESSING 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?