Post on 18-Dec-2015
Operand And Instructions Operand And Instructions RepresentationRepresentation
By By
Dave MaungDave Maung
Different types of Different types of Operand/InstructionOperand/Instruction
Zero Operands per instruction Zero Operands per instruction One Operands per instructionOne Operands per instruction Two Operands per instructionTwo Operands per instruction Three operands per instructionThree operands per instruction
Zero Operand Per InstructionZero Operand Per Instruction
Also known as Stack Architecture Also known as Stack Architecture because Operand are kept in stack.because Operand are kept in stack.
To add an instruction using zero To add an instruction using zero operand, take two values and add operand, take two values and add them together and put the result them together and put the result back to then stack.back to then stack.
Operand must be implicitOperand must be implicit
An example of Instruction An example of Instruction used on a stack computer used on a stack computer
Push XPush X
Push 7Push 7
AddAdd
Pop XPop X
One Operand Per InstructionOne Operand Per Instruction
Architecture that limit each Architecture that limit each instruction to single operand is instruction to single operand is known as 1-address design.known as 1-address design.
Relies on implicit operand for Relies on implicit operand for each instruction to store in each instruction to store in special register known as an special register known as an accumulator.accumulator.
Step to process one operand Step to process one operand per Instructionper Instruction
1.1. Processor extracts the current Processor extracts the current value of the accumulatorvalue of the accumulator
2.2. Performs the specified Performs the specified operation using the extracted operation using the extracted value and the operandvalue and the operand
3.3. place the result back in the place the result back in the accumulator accumulator
Example of One operand per Example of One operand per instructioninstruction
Add XAdd X
Accumulator Accumulator accumulator + X accumulator + X
Disadvantage of One Operand Disadvantage of One Operand Per Instruction Per Instruction
It does not allow instructions to It does not allow instructions to specify two values.specify two values.
It requires two instructions that It requires two instructions that load the value into the load the value into the accumulator and then need to accumulator and then need to store the values back in the new store the values back in the new locationlocation
Two Operands Per InstructionTwo Operands Per Instruction
Overcomes the limitation 1-Overcomes the limitation 1-address systemsaddress systems
Using 2 address process, an Using 2 address process, an operation can be applied to a operation can be applied to a specified value.specified value.
It also offers data movement It also offers data movement instructions that treat the instructions that treat the operand as source and operand as source and destination.destination.
Example two operand per Example two operand per instructioninstruction
Add X YAdd X Y
Specifies that the value of X is to Specifies that the value of X is to be added to the current value of be added to the current value of YY
Y Y Y + X Y + X
Three Operand Per Instruction Three Operand Per Instruction
Similar as Two Operand Per Similar as Two Operand Per Instruction except that it can Instruction except that it can operate three input value per operate three input value per instructioninstruction
Example of three operand per Example of three operand per instructioninstruction
Add X Y ZAdd X Y Z
Specifies an assignment of Specifies an assignment of
Z Z X + Y X + Y
Operand that specifies a Operand that specifies a source must be source must be
A signed constantA signed constant An Unsigned constantAn Unsigned constant The content of a registerThe content of a register The value in a memory locationThe value in a memory location
Operand the specifies a Operand the specifies a destination must be: destination must be:
A signed registerA signed register A pair of contiguous registersA pair of contiguous registers A memory locationA memory location
Von Nuemann BoottleneckVon Nuemann Boottleneck
Operand addressing is the central Operand addressing is the central weakness of a von Neumann weakness of a von Neumann architecture.architecture.
memory access may become a memory access may become a bottleneck because instructions are bottleneck because instructions are stored in memory and a processor stored in memory and a processor must make at least one memory per must make at least one memory per instruction.instruction.
To Optimize the performance, To Optimize the performance, operand must be taken from a operand must be taken from a register instead of memory.register instead of memory.
Types of EncodingTypes of Encoding
1. Explicit Operand Encoding1. Explicit Operand Encoding
2. Implicit Operand Encoding2. Implicit Operand Encoding
Implicit Operand EncodingImplicit Operand Encoding
The Opcode specifies the types The Opcode specifies the types of operands.of operands.
A processor that uses a implicit A processor that uses a implicit encoding contains multiple encoding contains multiple operand code for a given operand code for a given operationoperation
Example of Implicit EncodingExample of Implicit Encoding
Disadvantage of Implicit Disadvantage of Implicit encodingencoding
Multiple opcodes are needed for Multiple opcodes are needed for a given operation.a given operation.
A list of opcodes can become A list of opcodes can become large, when a processor allows large, when a processor allows many types of operands.many types of operands.
Explicit EncodingExplicit Encoding
Using Explicit can overcome the Using Explicit can overcome the disadvantage of implicit disadvantage of implicit encoding.encoding.
Each operand is represented by Each operand is represented by two fields:two fields: Type of OperandType of Operand Type of ValueType of Value
Example of Explicit Operand Example of Explicit Operand EncodingEncoding
Tradeoffs in the choice of Tradeoffs in the choice of operandsoperands
Ease of ProgrammingEase of Programming Fewer InstructionsFewer Instructions Smaller InstructionsSmaller Instructions Larger Range of Immediate Larger Range of Immediate
ValuesValues Faster Operand Fetch and Faster Operand Fetch and
DecodeDecode Decreased Hardware sizeDecreased Hardware size
Fewer InstructionsFewer Instructions
Reduces the number of instruction in Reduces the number of instruction in a program by increasing the a program by increasing the expressive power of operandsexpressive power of operands
Lowers the count of instructions by Lowers the count of instructions by increasing the number of addresses increasing the number of addresses
Disadvantage:Disadvantage:
Each instruction will be largerEach instruction will be larger
Disadvantage of keeping smaller Disadvantage of keeping smaller instructioninstruction
Decreases the expressive Decreases the expressive power.power.
Increases the number of Increases the number of instructions instructions
Smaller InstructionsSmaller Instructions
How to keep smaller How to keep smaller Instruction? Instruction?
1. Limiting the number of 1. Limiting the number of operandsoperands
2. Limiting the set of operands 2. Limiting the set of operands typestypes
3. Limiting maximum size of an 3. Limiting maximum size of an operand keep instruction smalloperand keep instruction small
Larger Range of Immediate Larger Range of Immediate valuesvalues
Increasing the size allows larger Increasing the size allows larger values because the size of a values because the size of a field in the operand determines field in the operand determines the numeric range of immediate the numeric range of immediate values.values.
Disadvantage:Disadvantage:Larger instruction resultsLarger instruction results
Faster Operand Fetch and Faster Operand Fetch and DecodeDecode
How to operate hardware How to operate hardware faster?faster? First, limit the number of First, limit the number of
operandsoperands Second, limit the possible types of Second, limit the possible types of
each operandeach operand
Decreased Hardware sizeDecreased Hardware size
How to decrease the hardware How to decrease the hardware size?size? limits the types and complexity of limits the types and complexity of
operandsoperands Reduces the size of circuitry Reduces the size of circuitry
Values in MemoryValues in Memory
Every processors include at least Every processors include at least one instruction that allows an one instruction that allows an operand to specify value in memoryoperand to specify value in memory
Values in the operand interpreted as Values in the operand interpreted as an memory address.an memory address.
This memory address is for the This memory address is for the professor to perform memory lookup.professor to perform memory lookup.
Advantage of memory look upAdvantage of memory look up
Helps ease programmingHelps ease programming Helps allowing arbitrary Helps allowing arbitrary
instruction to reference memory. instruction to reference memory. improves performance.improves performance.
Operand Addressing ModesOperand Addressing Modes
Instruction register is used to Instruction register is used to hold an instruction that is being hold an instruction that is being decoded.decoded.
A immediate value can be found A immediate value can be found in instruction registerin instruction register
SummarySummary
Covered different type of Covered different type of Operand instruction, Von Operand instruction, Von Neumann Bottleneck, different Neumann Bottleneck, different choice of operandchoice of operand