SlideShare a Scribd company logo
Lecture - 07
Stack Control
 A stack is a sequence of storage locations that are
accessible from only one end referred to as the top of
the stack.
 Two operations: Push and Pop.
 Push or pop changes the position of the stack top by
an amount that depends on the length of the operand
pushed or popped.
 A stack is controlled by an address register called the
stack pointer SP. It contains the address of the new
stack top.
Stack Control in Motorola 680X0
 Motorola 680X0 has no explicit hardware for stack support.
But its various addressing modes make it easy to treat any
contiguous region of its external memory M as a stack.
 Suppose the address register A2 of the 680X0 is designated
as stack pointer and the stack grows toward the low
addresses of M.
 To push the content of D6 (data register) into the stack
requires a single instruction MOVE.L D6, -(A2) which is
equivalent to A2:=A2-4 and M(A2):=D6.
 The pop instruction is MOVE.L (A2)+, D6 which is equivalent
to D6:=M(A2) and A2:=A2+4
Stack Control in Motorola 680X0
Prior the execution of MOVE.L D6, -(A2)
Stack Control in Motorola 680X0
After the execution of MOVE.L D6, -(A2)
Number of Addresses
 Three-address instruction:
ADD Z, X, Y
Z:= X+Y.
 Two-address instruction:
ADD X, Y
X:= X+Y.
 One-address instruction:
ADD X
AC:=AC+X.
Instruction Comment
LOAD A AC:=A
MULTIPY B AC:= AC * B
STORE T M(T):= AC
LOAD C AC:= C
MULTIPLY C AC:=AC * C
ADD T AC:= AC + T
STORE X M(X) : = AC
One address machine
Instruction Comment
MOVE T, A T:=A
MULTIPLY T, B T:= T * B
MOVE X, C X:=C
MULTIPLY X, C X:= X * C
ADD X, T X:=X+T
Two address machine
Instruction Comment
MULTIPLY T, A, B T:= A * B
MULTIPLY X, C, C X:= C * C
ADD X, X, T X:= X + T
Three address machine
Implement X:=A×B+C×C, where A, B, C and X are stored in the memory.
Number of Addresses
Accumulator Architectures
 Instruction set:
add A, sub A, mult A, div A, . . .
load A, store A
 Example: A*B - (A+B*C)
load B
mul C
add A
store D
load A
mul B
sub D
B B*C A+B*C AA+B*C A*B A*B-(A+B*C)
Accumulator Architecture : Pros and Cons
 Pros
– Very low hardware requirements
– Easy to design and understand
 Cons
– Accumulator becomes the bottleneck
– Little ability for parallelism or pipelining
– High memory traffic
Zero Address Machine (Stack
Based Architecture)
 Addresses are eliminated by storing operands in a
push-down stack.
 All the operands are required to be in the top locations
in the stack.
 Stack pointer automatically keeps track of the stack top.
 Push and pop operations are needed to transfer data to
and from the stack.
 For example, X+Y is invoked by ADD that causes the
top two operands, which should be X and Y, to be
removed from the stack and added. The resulting sum
X+Y is then placed at the top of the stack.
Stack Architectures
Example: A*B - (A+C*B)
push A
push B
mul
push A
push C
push B
mul
add
sub
A B
A
A*B
A*B
A*B
A*B
A
A
C
A*B
A A*B
A C B B*C A+B*C result
Stack Architecture: Pros and Cons
 Pros
- implicit operand addressing. Maintained by top of the
stack.
- Low hardware requirements.
 Cons
- Stack becomes the bottleneck.
- Little ability for parallelism or pipelining.
- Data is not always at the top of stack when need, so
additional instructions like POP and SWAP are
needed.
The Requirements for Instruction Set
 It should be complete. We should be able to construct a
machine language program to evaluate any function that
is computable using a reasonable amount of memory
space.
 It should be efficient. The frequently required functions
can be performed rapidly using relatively few instructions.
 It should be regular. The instruction set should contain
expected opcodes and addressing modes.
 The instruction should be compatible with those of
existing machine.
Classification of Instruction
 Data transfer instructions – Copy information.
Example: load, store, move instruction.
 Arithmetic instructions – Perform operations on
numerical data. Example: add, sub, mul, div etc.
 Logical instructions - Boolean and non-numerical
operations. Example: AND, NOT etc.
 Program control instructions – It change the
sequence in which program are executed. Example:
Branch instruction.
 Input-Output (IO) instructions – It cause information
to be transferred to or from external IO devices.
Example: PRINT LINE.

More Related Content

What's hot

addressing mode 1
addressing mode 1addressing mode 1
addressing mode 1
samrana gultasab
 
Ch 7 tutoring notes quadratics
Ch 7 tutoring notes quadraticsCh 7 tutoring notes quadratics
Ch 7 tutoring notes quadraticssrobbins4
 
Dynamic Programming Code-Optimization Algorithm (Compiler Design)
Dynamic Programming Code-Optimization Algorithm (Compiler Design)Dynamic Programming Code-Optimization Algorithm (Compiler Design)
Dynamic Programming Code-Optimization Algorithm (Compiler Design)
Dhrumil Panchal
 
Sequential circuit multiplier
Sequential circuit multiplierSequential circuit multiplier
Sequential circuit multiplier
Subhram
 
Exp 3
Exp 3Exp 3
Cse presentation ratul
Cse presentation ratulCse presentation ratul
Cse presentation ratul
Hassan Ratul
 
Hierarchical inheritance
Hierarchical inheritanceHierarchical inheritance
Hierarchical inheritance
zindadili
 
7. Pointer Arithmetic
7. Pointer Arithmetic7. Pointer Arithmetic
7. Pointer Arithmetic
Gem WeBlog
 
Bca 2nd sem-u-4 central processing unit and pipeline
Bca 2nd sem-u-4 central processing unit and pipelineBca 2nd sem-u-4 central processing unit and pipeline
Bca 2nd sem-u-4 central processing unit and pipeline
Rai University
 
Matlab gnu octave
Matlab gnu octaveMatlab gnu octave
Matlab gnu octave
pramodkumar1804
 
C language flowcharat
C language flowcharatC language flowcharat
C language flowcharat
cprogram
 
Lo14
Lo14Lo14
Lo14
liankei
 
6
66
Queues
QueuesQueues
Assigment 3
Assigment 3Assigment 3
Assigment 3
sukumaraser
 
Assembly language part I
Assembly language part IAssembly language part I
Assembly language part I
Mohammed A. Imran
 
Mini project title prime number generator
Mini project title prime number generatorMini project title prime number generator
Mini project title prime number generator
Md. Asad Chowdhury Dipu
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
mohanrathod18
 

What's hot (20)

addressing mode 1
addressing mode 1addressing mode 1
addressing mode 1
 
Ch 7 tutoring notes quadratics
Ch 7 tutoring notes quadraticsCh 7 tutoring notes quadratics
Ch 7 tutoring notes quadratics
 
Dynamic Programming Code-Optimization Algorithm (Compiler Design)
Dynamic Programming Code-Optimization Algorithm (Compiler Design)Dynamic Programming Code-Optimization Algorithm (Compiler Design)
Dynamic Programming Code-Optimization Algorithm (Compiler Design)
 
Sequential circuit multiplier
Sequential circuit multiplierSequential circuit multiplier
Sequential circuit multiplier
 
Dld
DldDld
Dld
 
Exp 3
Exp 3Exp 3
Exp 3
 
Cse presentation ratul
Cse presentation ratulCse presentation ratul
Cse presentation ratul
 
Hierarchical inheritance
Hierarchical inheritanceHierarchical inheritance
Hierarchical inheritance
 
7. Pointer Arithmetic
7. Pointer Arithmetic7. Pointer Arithmetic
7. Pointer Arithmetic
 
Bca 2nd sem-u-4 central processing unit and pipeline
Bca 2nd sem-u-4 central processing unit and pipelineBca 2nd sem-u-4 central processing unit and pipeline
Bca 2nd sem-u-4 central processing unit and pipeline
 
2
22
2
 
Matlab gnu octave
Matlab gnu octaveMatlab gnu octave
Matlab gnu octave
 
C language flowcharat
C language flowcharatC language flowcharat
C language flowcharat
 
Lo14
Lo14Lo14
Lo14
 
6
66
6
 
Queues
QueuesQueues
Queues
 
Assigment 3
Assigment 3Assigment 3
Assigment 3
 
Assembly language part I
Assembly language part IAssembly language part I
Assembly language part I
 
Mini project title prime number generator
Mini project title prime number generatorMini project title prime number generator
Mini project title prime number generator
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 

Similar to Lecture 07

MICROPROCESSOR INSTRUCTION SET OF 8085
MICROPROCESSOR INSTRUCTION SET OF 8085MICROPROCESSOR INSTRUCTION SET OF 8085
MICROPROCESSOR INSTRUCTION SET OF 8085
Sumadeep Juvvalapalem
 
Stack
StackStack
8085 instruction set.pptx
8085 instruction set.pptx8085 instruction set.pptx
8085 instruction set.pptx
AchintKaur27
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
JLoknathDora
 
computer notes - Data Structures - 8
computer notes - Data Structures - 8computer notes - Data Structures - 8
computer notes - Data Structures - 8ecomputernotes
 
Instruction set of 8085
Instruction set of 8085Instruction set of 8085
Instruction set of 8085
venkateshkannat
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction Format
Dhrumil Panchal
 
Lec5-Stack-bukc-28022024-112316am (1) .pptx
Lec5-Stack-bukc-28022024-112316am (1) .pptxLec5-Stack-bukc-28022024-112316am (1) .pptx
Lec5-Stack-bukc-28022024-112316am (1) .pptx
haaamin01
 
05 instruction set design and architecture
05 instruction set design and architecture05 instruction set design and architecture
05 instruction set design and architectureWaqar Jamil
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
Tirumalesh Nizampatnam
 
instruction-set-of-8085 (1).ppt
instruction-set-of-8085 (1).pptinstruction-set-of-8085 (1).ppt
instruction-set-of-8085 (1).ppt
ssuserb448e2
 
Instruction set-of-8085
Instruction set-of-8085Instruction set-of-8085
Instruction set-of-8085saleForce
 
Array stack-queue1
Array stack-queue1Array stack-queue1
Array stack-queue1
Rajendran
 
Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
OliverKane3
 
Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
OliverKane3
 
Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085
Shubham Singh
 
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSINTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
Swapnil Mishra
 
UNIT-3.pptx
UNIT-3.pptxUNIT-3.pptx
UNIT-3.pptx
TirthPatel479872
 

Similar to Lecture 07 (20)

MICROPROCESSOR INSTRUCTION SET OF 8085
MICROPROCESSOR INSTRUCTION SET OF 8085MICROPROCESSOR INSTRUCTION SET OF 8085
MICROPROCESSOR INSTRUCTION SET OF 8085
 
Microprocessor 11el01
Microprocessor 11el01Microprocessor 11el01
Microprocessor 11el01
 
Stack
StackStack
Stack
 
8085 instruction set.pptx
8085 instruction set.pptx8085 instruction set.pptx
8085 instruction set.pptx
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
computer notes - Data Structures - 8
computer notes - Data Structures - 8computer notes - Data Structures - 8
computer notes - Data Structures - 8
 
Instruction set of 8085
Instruction set of 8085Instruction set of 8085
Instruction set of 8085
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction Format
 
Lec5-Stack-bukc-28022024-112316am (1) .pptx
Lec5-Stack-bukc-28022024-112316am (1) .pptxLec5-Stack-bukc-28022024-112316am (1) .pptx
Lec5-Stack-bukc-28022024-112316am (1) .pptx
 
05 instruction set design and architecture
05 instruction set design and architecture05 instruction set design and architecture
05 instruction set design and architecture
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
instruction-set-of-8085 (1).ppt
instruction-set-of-8085 (1).pptinstruction-set-of-8085 (1).ppt
instruction-set-of-8085 (1).ppt
 
Instruction set-of-8085
Instruction set-of-8085Instruction set-of-8085
Instruction set-of-8085
 
Array stack-queue1
Array stack-queue1Array stack-queue1
Array stack-queue1
 
Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
 
Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
 
Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085
 
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSINTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
 
UNIT-3.pptx
UNIT-3.pptxUNIT-3.pptx
UNIT-3.pptx
 

Recently uploaded

Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 

Recently uploaded (20)

Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 

Lecture 07

  • 2. Stack Control  A stack is a sequence of storage locations that are accessible from only one end referred to as the top of the stack.  Two operations: Push and Pop.  Push or pop changes the position of the stack top by an amount that depends on the length of the operand pushed or popped.  A stack is controlled by an address register called the stack pointer SP. It contains the address of the new stack top.
  • 3. Stack Control in Motorola 680X0  Motorola 680X0 has no explicit hardware for stack support. But its various addressing modes make it easy to treat any contiguous region of its external memory M as a stack.  Suppose the address register A2 of the 680X0 is designated as stack pointer and the stack grows toward the low addresses of M.  To push the content of D6 (data register) into the stack requires a single instruction MOVE.L D6, -(A2) which is equivalent to A2:=A2-4 and M(A2):=D6.  The pop instruction is MOVE.L (A2)+, D6 which is equivalent to D6:=M(A2) and A2:=A2+4
  • 4. Stack Control in Motorola 680X0 Prior the execution of MOVE.L D6, -(A2)
  • 5. Stack Control in Motorola 680X0 After the execution of MOVE.L D6, -(A2)
  • 6. Number of Addresses  Three-address instruction: ADD Z, X, Y Z:= X+Y.  Two-address instruction: ADD X, Y X:= X+Y.  One-address instruction: ADD X AC:=AC+X.
  • 7. Instruction Comment LOAD A AC:=A MULTIPY B AC:= AC * B STORE T M(T):= AC LOAD C AC:= C MULTIPLY C AC:=AC * C ADD T AC:= AC + T STORE X M(X) : = AC One address machine Instruction Comment MOVE T, A T:=A MULTIPLY T, B T:= T * B MOVE X, C X:=C MULTIPLY X, C X:= X * C ADD X, T X:=X+T Two address machine Instruction Comment MULTIPLY T, A, B T:= A * B MULTIPLY X, C, C X:= C * C ADD X, X, T X:= X + T Three address machine Implement X:=A×B+C×C, where A, B, C and X are stored in the memory. Number of Addresses
  • 8. Accumulator Architectures  Instruction set: add A, sub A, mult A, div A, . . . load A, store A  Example: A*B - (A+B*C) load B mul C add A store D load A mul B sub D B B*C A+B*C AA+B*C A*B A*B-(A+B*C)
  • 9. Accumulator Architecture : Pros and Cons  Pros – Very low hardware requirements – Easy to design and understand  Cons – Accumulator becomes the bottleneck – Little ability for parallelism or pipelining – High memory traffic
  • 10. Zero Address Machine (Stack Based Architecture)  Addresses are eliminated by storing operands in a push-down stack.  All the operands are required to be in the top locations in the stack.  Stack pointer automatically keeps track of the stack top.  Push and pop operations are needed to transfer data to and from the stack.  For example, X+Y is invoked by ADD that causes the top two operands, which should be X and Y, to be removed from the stack and added. The resulting sum X+Y is then placed at the top of the stack.
  • 11. Stack Architectures Example: A*B - (A+C*B) push A push B mul push A push C push B mul add sub A B A A*B A*B A*B A*B A A C A*B A A*B A C B B*C A+B*C result
  • 12. Stack Architecture: Pros and Cons  Pros - implicit operand addressing. Maintained by top of the stack. - Low hardware requirements.  Cons - Stack becomes the bottleneck. - Little ability for parallelism or pipelining. - Data is not always at the top of stack when need, so additional instructions like POP and SWAP are needed.
  • 13. The Requirements for Instruction Set  It should be complete. We should be able to construct a machine language program to evaluate any function that is computable using a reasonable amount of memory space.  It should be efficient. The frequently required functions can be performed rapidly using relatively few instructions.  It should be regular. The instruction set should contain expected opcodes and addressing modes.  The instruction should be compatible with those of existing machine.
  • 14. Classification of Instruction  Data transfer instructions – Copy information. Example: load, store, move instruction.  Arithmetic instructions – Perform operations on numerical data. Example: add, sub, mul, div etc.  Logical instructions - Boolean and non-numerical operations. Example: AND, NOT etc.  Program control instructions – It change the sequence in which program are executed. Example: Branch instruction.  Input-Output (IO) instructions – It cause information to be transferred to or from external IO devices. Example: PRINT LINE.