Download presentation
1
Chapter 2.2 Machine Language
2
Machine Language To apply the stored-program concept, CPUs are designed to recognize instructions encoded as bit patterns. This collection of instructions along with the encoding system is called the machine language. An instruction expressed in this language is called a machine-level instruction or a machine instruction.
3
Machine language: definitions
Machine instruction = an instruction coded as a bit pattern directly recognizable by the CPU Machine language = the set of all instructions recognized by a machine
4
Machine language philosophies
Two philosophies of CPU architectures: Reduced Instruction Set Computing (RISC) Few, simple, efficient, and fast instructions Example: PowerPC from Apple/IBM/Motorola Complex Instruction Set Computing (CISC) Many, convenient, and powerful instructions Example: Pentium from Intel
5
Machine instruction types
When discussing the instructions in a machine’s repertoire, it is helpful to recognize that they can be classified into three categories: Data Transfer group Arithmetic/Logic group Control group
6
Machine instruction types
Data Transfer: copy data between CPU and main memory Arithmetic/Logic: use existing data values to compute a new data value Control: direct the execution of the program
7
Figure 2.2 Adding values stored in memory
8
Data Transfer part
9
Data Transfer Part A request to fill a general-purpose register with the contents of a memory cell is commonly referred to as a LOAD instruction A request to transfer the contents of a register to a memory cell is called a STORE instruction.
10
Data Transfer part LOAD STORE
11
ARITHMETIC / LOGIC GROUP
It consists of the instructions that tells the control unit to request an activity within the arithmetic / logic unit.
12
It includes: Basic arithmetic operations Boolean operations
AND OR XOR Shift or Rotate operations They are available within most arithmetic / logic units They allow the contents of registers to be moved to the right or the left within the register. Examples:
13
Control Group The control group consists of those instructions that direct the execution of the program rather than the manipulation of data.
14
Figure 2.2 Adding values stored in memory
15
Control group Step five in Fig 2.2 falls into this category.
16
Control This group contains many other instructions, such as the family of JUMP instructions used to direct the control unit to execute an instruction other than the next one in the list. Example : Fig 2.3 on page 85
17
Figure 2.3 Dividing values stored in memory
19
An Illustrative Machine Language
Let us now consider how the instructions of a typical computer are encoded. The machine that we will use for our discussion is described in Appendix C and summarized in Fig 2.4. It has 16 general-purpose registers and 256 main memory cells. Each of the memory cells has a capacity of eight bits.
20
Figure 2.4: The architecture of the machine described in Appendix C
21
Parts of a machine instruction
Op-code: specifies which machine operation to execute One per instruction Operand: more detailed information about this operation Number of operands varies depending on op-code
22
Figure 2.5 The composition of an instruction for the machine in Appendix C
23
Figure 2.6 Decoding the instruction 35A7
24
Figure 2.7 An encoded version of the instructions in Figure 2.2
25
Figure 2.2 Adding values stored in memory
26
Chapter 2.3 Program Execution
27
Program execution A computer follows a program stored in its memory by copying the instructions from memory into the control unit as needed.
28
Program execution Controlled by two special-purpose registers
Program counter: address of next instruction Instruction register: current instruction
29
Program execution Steps performed by control unit Fetch Decode Execute
30
Machine cycle. The control unit performs its job by continually repeating an algorithm that guides it through a three-step process known as the machine cycle.
31
Figure 2.8 The machine cycle
32
Figure 2.9 Decoding the instruction B258
33
Figure 2. 10 The program from Figure 2
Figure The program from Figure 2.7 stored in main memory ready for execution
34
Figure 2.11 Performing the fetch step of the machine cycle
35
Figure 2.11 Performing the fetch step of the machine cycle (cont’d)
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.