Presentation is loading. Please wait.

Presentation is loading. Please wait.

CDCA 2203 Elements of Computer Architecture Open University Malaysia

Similar presentations


Presentation on theme: "CDCA 2203 Elements of Computer Architecture Open University Malaysia"— Presentation transcript:

1 CDCA 2203 Elements of Computer Architecture Open University Malaysia
Class 4 Open University Malaysia Prepared by: Eng Kok Siong Copyright 2010 All Rights Reserved

2 Topic 10: EXAMPLES OF MACHINE LANGUAGE INSTRUCTION SET
Address Space 8088 designed to address up to 220 byte. Numbered sequentially from 0. Instructions executed either in an 8-bit or 16-bit form. A word does not necessary start with a particular byte. For addressing up to 220 , the 8088 microprocessor requires a 20-bit register. Slide 2 2

3 concept. Each segment can hold up to 64K of memory address.
As the 8088 register is only 16 bit, logically it can only address up to 64K. To solve this problem, the 8088 machine designer introduced the segment concept. Each segment can hold up to 64K of memory address. There are four types of segment such as: 1. Code segment 2. Data segment 3. Stack segment and 4. Additional segment To enable the segment register to refer to the location in the 220 byte address space, it requires 20 bits. The technique used by the 8088 machine designer is by using 16 bits and making the other 4 bits as zero. For example, if segment register has the value The address that it shows is Slide 3 3

4 AX is usually for arithmetic operation
Register The process of registers was generally explained in Topic 9. In this section, the usage of register for the 8088 will be explained in detail. The 8088 has 14 registers and all are 16-bits and different from each other. All these registers are listed as following: AX is usually for arithmetic operation BX is used as pointer to the memory CX is used as a loop counter DX is used as connection to AX SI and DI register is used for string operation. BP and SP register are usually used for addressing stacks Four more registers are the segment registers that have been explained earlier. The Instruction Pointer or IP (or PC) shows the next instruction that needs to be executed. The flag is a collection of bits which can be set or reset Slide 4 4

5 D determines the direction string operation. I enables interruptions
A enables trap O is to set when overflow in arithmetic operation occurs. S is to set to 1, if the arithmetic operation results in negative. Z is to set to 1, if the arithmetic operation results in zero. Slide 5 5

6 Instruction Set The Instruction set that is provided by the 8088 contains 300 forms of machine language instructions. For easier understanding, we have divided the instructions into a few groups such as: 1. The first group contains instructions that are used to transfer data in machines in between registers, memory and stacks such as (a) Transfer data from register or memory location (b) Enters data into stacks (c) Takes out data from a stack

7 3. The third group involves the BCD operation (Binary codes Decimal).
2. The second group executes signed and unsigned arithmetic. The multiplication and division of a 32-bit output is stored in AX (lower portion) and DX (upper portion). Among the instructions provided are: (a) Add (b) Subtract (c) Multiply (d) Divide 3. The third group involves the BCD operation (Binary codes Decimal). Slide 7 7

8 4. The fourth group involves Boolean instructions
4. The fourth group involves Boolean instructions and rotate/shift manipulating bits in a word or bit in a few ways. Boolean AND, OR and NOT are examples of operations. 5. The fifth group involves instructions to test and compare and later jump based on the result. The test result and instruction to compare are stored in various bit of the FLAG register. Jxx is a conditional jump instruction set that depends on the previous comparison result (such as bit in a FLAG).

9 The sixth group involves instructions that perform string operation.
The last group is mixed instructions that are not suitable at any place. This includes the I/O exchange and terminating the CPU processes. (a) Terminate program executions (b) Input word from input base (c) Output word from output base

10 Encode Instruction The 8088 instruction need to be encoded into binary form before it is executed. Encoding Instructions are very complex. Types of encoding used depend on the addressing mode. The 8088 has four addressing modes such as immediate addressing, register addressing, direct addressing and indirect addressing. Immediate Addressing This type of instruction involves 2 or 3 bytes. For example, instruction to transfer data immediately into register is

11 Encoding Instructions
To transfer contents from the accumulator into the memory, the instruction code is:

12 Writing Program Writing a program in machine language is very difficult because a programmer needs to give instructions step-by-step in a very low level. A flow chart is usually used by the programmer to make the task easier.

13 To write the program in machine language, programmers need to perform
following steps:- To read the first number Instruction to read input from an input base that will read the input and store it in an AX register. Instructions to store data in AX register into CX register. To read the second number Instructions to read input from an input base into AX. TOTAL First number + Second Number Instruction to add for AX and CX register contents and later store into AX register. Store TOTAL at the location Instruction to store the AX contents into memory location End Instruction to terminate the program

14 Topic 11: Micro-Programming
As stated in the Introduction, a machine language program needs to be interpreted by a microprogram that is at the microprogramming level. A programmer writes this micro program and it is prepared by the machine inventor in a ROM. Most of the computers do not allow any changes over the microprogram. However, the understanding of this level helps us to understand the how the machine operates.

15 The microprogrammer's job is to write a program that is able to control the
registers machine, bus, ALU, memory and other hardware devices. A programmer needs to understand these components in detail. Register: the programmer of a microprogram has additional registers Bus: Bus is a group of wires used to transmit signals Multiplexer: Multiplexer is logic circuit that has 2n input

16 4. Decoder: Decoder receives n input and produces 2n lines of output numbered as 0 to (2n - 1). The reverse of decoder is encoder, which has 2n input and output. 5. ALU: ALU is a logic circuit that deals with arithmetic operations. It has two data input and one data output. It also has a few controller lines.

17 6. Shifter: This circuit can shift the input to left or right, or no shifting is performed at all. 7. Clock: The digital circuit in a computer is based on a clock, which produces pulses periodically. This pulse defines the machine cycle.

18 MAR (Memory Address Register) and MBR (Memory Buffer Register):
8. Main memory: the processor is able to read data from the memory and write to the memory MAR (Memory Address Register) and MBR (Memory Buffer Register): accessing the memory takes a longer time than executing a microinstruction. Thus, the microprogram must keep the right value on the address bus and data bus for few microinstructions. 9. Slide 18 18

19 Data Path The relationship among the components at microprogram level can be shown using data path. Slide 19 19

20 AMUX : Controls the input for left ALU: 0=latch A, 1=MBR.
Control Register To indicate all the signals, we need a control unit of 61 bits, with 1 bit for each control signal. However, by using a few additional components such as decoder, 16 signals bus A, B, and C can be produced by using just 4 bits. Thus, the required bits can be reduced to 22 bits. AMUX : Controls the input for left ALU: 0=latch A, 1=MBR. ALU : Function of ALU: 0=A+B,1=A AND B, 2=A, 3=NOT A. SH : Function of shifter: 0=no shifting, 1=right, 2=left. MBR : Load MBR from shifter: 0=not loading MBR, 1=loading MBR. MAR : Load MAR from latch B: 0=not loading MAR, 1=loading MAR. RD : Request memory reading: 0=not reading, 1=loading MBR from memory. W R : Request memory writing: 0=not writing, 1=writing MBR to memory. ENC : Control storage into register: 0= not loading, 1=loading. C : Choose register to store in if ENC=1: 0=PC, 1=AC and others B : Choose source from bus B: 0=PC, 1=AC and others. A : Choose source from bus A: 0=PC, 1=AC and others. Slide 20 20

21 Symbol Representation
In principle, we can write the mircoprogram in binary, 32 bits for each microinstruction. However, to simplify the microprogramming process, we can use a symbolic language. There are a few ways we can represent this language. As example, to add AC to A and store the result in AC we can represent it as: ENC = 1, C = 1, B = 1, A = 10 A better way is to use the representation as the higher-level language, but maintaining the basis of the microinstruction concept i.e. one line for each microinstruction. To show the ALU function, we can write ALU value Representation 00 ac = a + ac 01 a = andb (ir,smask) 10 ac = a 11 a = not(a) Slide 21 21

22 Nano programming To save the storage space, the nanoprogramming concept is introduced. This method is useful if a microinstruction in a microprogram used repeatedly. To apply this method, we need an additonal storage known as nanostore. All the microinstructions that might be used will be kept in the nanostore. The microprogram will have a list of the nanostore contents. The Microprogram is executed in the following manner. One word is fetched from the control store. This word is used to choose one word from the nanostore. The word from nanostore will be entered into the microinstruction registers. Slide 22 22

23 Topic 12: Case Study Intel 8088
The Microprogramming architecture for all CPU is almost same because all these CPU is a progression from the 8086 and 8088. The 8088 uses the combination of a micro program and logic gates to provide a good function and minimize the size of microprogrammes. The Intel Microprocessor uses vertical microinstructions . Slide 23 23

24 Lower Section The lower section is same as the ones in the data path in most computers. It consists of ALU which receives two inputs, perform simple functions and produce an output. Input comes from three 16-bit registers such as TMPA, TMPB and TMPC that are loaded first into ALU. The lower section of data path consists of few registers such as AX, BX, CX, DX, SI, DI, BP and SP. A register can be copied from a register into the ALU bus and from there, it is entered into a temporary register TMPA, TMPB or TMPC, which is used as an ALU input. Slide 24 24

25 Upper Section The upper section of a data path is related with arithmetic address. Bear in mind that the main memory in the 8088 is formed by adding 16 bits into a suitable segment register to perform a 20-bit physical address. The upper section consists of the registers to load the four particular segments instruction program and two more load registers. Slide 25 25

26 programs and drives the data path.
Controller Section As additional to the data path, the 8088 has a controller section that stores micro programs and drives the data path. When a machine language instructions starts, the byte is stored in an IR. The Hardware unit, labeled as Decode Group fetches the information from IR and uses in the whole machine. Slide 26 26

27 Micro Instruction The Microinstruction 8088 consists of 21 bits. The Microprograms require 504 words and are stored in a ROM 504 X 21 in the controller section. When a machine instruction is accessed, the PLA changes the opcode into a beginning address for micro-programs that conducts this instruction. The right section is an 11-bit micro instruction that are vertically coded. It consists the ALU functions codes, operand and code controller field type of microinstruction. The six types of microinstructions are: 1. ALU Operation. 2. Memory Operation. 3. Near Jump. 4. Far Jump. 5. Calling Micro program. 6. Management Slide 27 27


Download ppt "CDCA 2203 Elements of Computer Architecture Open University Malaysia"

Similar presentations


Ads by Google