Lecture (coa)

22
Computer Organization and Assembly (COA) Course Code: CE-101 Credit Hour: 2+1 Prerequisite: DLD Kanza Ali Email: [email protected] 1

description

Computer Organization assembly

Transcript of Lecture (coa)

Page 1: Lecture (coa)

1

Computer Organization and Assembly (COA)

Course Code: CE-101Credit Hour: 2+1Prerequisite: DLD

Kanza AliEmail: [email protected]

Page 2: Lecture (coa)

2

Day Time Class Room No

Tuesday 11:00 to 12:00 Class Room 6

Wednesday 11:00 to 1:00 MP Lab

Thursday 12:00 to 1:00 Class Room 5

Schedule

Page 3: Lecture (coa)

3

Basic Computer Architecture

Page 4: Lecture (coa)

4

There must be a mechanism to inform memory that we want to do the read operation

There must be a mechanism to inform memory that we want to read

precisely which element There must be a mechanism

to transfer that data element from

memory to processor

Basic Computer Architecture

Page 5: Lecture (coa)

5

Address Bus, Data Bus, Control Bus

Address Bus

Data Bus

Control Bus

Page 6: Lecture (coa)

6

Address Bus The address bus is unidirectional and address

always travels from processor to memoryData Bus Data moves from both, processor to memory

and memory to processor, so the data bus is bidirectional

Control Bus information from the processor to a peripheral

and some take information from the peripheral to the processor

Address Bus, Data Bus, Control Bus

Page 7: Lecture (coa)

7

A binary number is generated on the address bus, fifth, seventh, eighth, tenth; the cell which is needed

A memory cell is an n-bit location to store data, normally 8-bit also called a byte

The number of bits in a cell is called the cell width

Address Bus

Page 8: Lecture (coa)

8

.

.

.

.

.

Dimensions of MemoryHorizontal Dimension=Width of a

Memory Cell

Vertical Dimension=Size of Memory

0000000000000001

.

.

.

.

.

.

.001000110010010000100101

Binary Addresse

s of Memory

Cells

Page 9: Lecture (coa)

9

Precise synchronization between the processor and the memory is the responsibility of the control bus

Since the memory never wants to listen or to speak of itself. Then why is the control bus bidirectional.

Control Bus

Control Bus

Page 10: Lecture (coa)

10

There are temporary storage places inside the processor called registers

Registers are inside the processor They are used when we need more than one

data element inside the processor at one time

In its operation it is similar to memory It is also knows as scratch pad ram

Registers

Page 11: Lecture (coa)

11

Memory is a limited resource but the number of memory cells is large

Registers are relatively very small in number, and are therefore a very scarce and precious resource

Registers are more than one in number, so we have to precisely identify or name them

Some manufacturers number their registers like r0, r1, r2, others name them like A, B, C, D etc. 11

Nomenclature of the Particular Architecture

Page 12: Lecture (coa)

12

There is a central register in every processor called the accumulator

Traditionally all mathematical and logical operations are performed on the accumulator

The word size of a processor is defined by the width of its accumulator. A 32bit processor has an accumulator of 32 bits

Accumulator

Page 13: Lecture (coa)

13

It does not hold data but holds the address of

Data

Pointer, Index, or Base Register

Page 14: Lecture (coa)

14

This is a special register in every architecture called the flags register

Collection of different Boolean information each bit has an independent meaning

Like the accumulator it is an 8, 16, or 32 bits register but unlike the accumulator it is meaningless as a unit, rather the individual bits carry different meanings

The bits of the accumulator work in parallel as a unit and each bit mean the same thing

The bits of the flags register work independently and individually, and combined its value is meaningless

Flag Register or Program Status Word

Page 15: Lecture (coa)

15

Flag Register

Page 16: Lecture (coa)

16

A program is defined to be “an ordered set of instructions.”

Instructions have a positional relationship. The whole logic depends on this positioning

“The program counter holds the address of the next instruction to be executed.”

This number is called the opcode.

Program Counter or Instruction Pointer

Page 17: Lecture (coa)

17

Mnemonics Symbols are called instruction mnemonics

add, sub, lad

Assembler

The dumb translator that will convert these mnemonics back to the original opcodes is a key program to be used throughout this course and is called the assembler

Add to 152 or some numbers

Page 18: Lecture (coa)

18

Group of Instructions on base of their instructions

Data Movement Instructions

Arithmetic / Logic Instructions

Special Instructions

Program Control Instructions

Page 19: Lecture (coa)

19

These instructions are used to move data from one place to another.

These places can be registers, memory, or even inside peripheral devices. Some

examples are: mov ax, bx ; move data from bx to axlad 1234 ; laod 0234 into accumulator

Data Movement Instructions

Page 20: Lecture (coa)

20

Arithmetic instructions like addition, subtraction, multiplication, division and Logical instructions like logical and, logical or, logical xor, or complement are part of this group. Some examples are:

and ax, 1234 ; AND 1234 with ax add bx, 0534 ; AND 0534 to bxadd bx, [1200] ; ADD data at address 1200 to bx

The bracketed form is a complex variation meaning to add the data placed at address 1200.

Arithmetic and Logic Instructions

Page 21: Lecture (coa)

21

These are instructions that control the program execution and flow by playing with the instruction pointer and altering its normal behavior to point to the next instruction.

cmp ax, 0 ; compare ax with 0jne 1234 ; jump if not equal to the

; instruction at address 1234

Program Control Instructions

Page 22: Lecture (coa)

22

Another group called special instructions works like the special service commandos. They allow changing specific processor behaviors and are used to play with it. They are used rarely but are certainly used in any meaningful program. cli ; clear the interrupt flagsti ; set the interrupt flag

Special Instructions