Operand And Instructions Representation By Dave Maung.

32
Operand And Operand And Instructions Instructions Representation Representation By By Dave Maung Dave Maung

Transcript of Operand And Instructions Representation By Dave Maung.

Page 1: Operand And Instructions Representation By Dave Maung.

Operand And Instructions Operand And Instructions RepresentationRepresentation

By By

Dave MaungDave Maung

Page 2: Operand And Instructions Representation By Dave 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

Page 3: Operand And Instructions Representation By Dave Maung.

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

Page 4: Operand And Instructions Representation By Dave Maung.

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

Page 5: Operand And Instructions Representation By Dave Maung.

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.

Page 6: Operand And Instructions Representation By Dave Maung.

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

Page 7: Operand And Instructions Representation By Dave Maung.

Example of One operand per Example of One operand per instructioninstruction

Add XAdd X

Accumulator Accumulator accumulator + X accumulator + X

Page 8: Operand And Instructions Representation By Dave Maung.

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

Page 9: Operand And Instructions Representation By Dave Maung.

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.

Page 10: Operand And Instructions Representation By Dave Maung.

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

Page 11: Operand And Instructions Representation By Dave Maung.

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

Page 12: Operand And Instructions Representation By Dave Maung.

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

Page 13: Operand And Instructions Representation By Dave Maung.

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

Page 14: Operand And Instructions Representation By Dave Maung.

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

Page 15: Operand And Instructions Representation By Dave Maung.

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.

Page 16: Operand And Instructions Representation By Dave Maung.

Types of EncodingTypes of Encoding

1. Explicit Operand Encoding1. Explicit Operand Encoding

2. Implicit Operand Encoding2. Implicit Operand Encoding

Page 17: Operand And Instructions Representation By Dave Maung.

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

Page 18: Operand And Instructions Representation By Dave Maung.

Example of Implicit EncodingExample of Implicit Encoding

Page 19: Operand And Instructions Representation By Dave Maung.

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.

Page 20: Operand And Instructions Representation By Dave Maung.

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

Page 21: Operand And Instructions Representation By Dave Maung.

Example of Explicit Operand Example of Explicit Operand EncodingEncoding

Page 22: Operand And Instructions Representation By Dave Maung.

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

Page 23: Operand And Instructions Representation By Dave Maung.

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

Page 24: Operand And Instructions Representation By Dave Maung.

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

Page 25: Operand And Instructions Representation By Dave Maung.

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

Page 26: Operand And Instructions Representation By Dave Maung.

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

Page 27: Operand And Instructions Representation By Dave Maung.

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

Page 28: Operand And Instructions Representation By Dave Maung.

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

Page 29: Operand And Instructions Representation By Dave Maung.

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.

Page 30: Operand And Instructions Representation By Dave Maung.

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.

Page 31: Operand And Instructions Representation By Dave Maung.

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

Page 32: Operand And Instructions Representation By Dave Maung.

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