Fundamental of Computer

Post on 13-Feb-2016

40 views 3 download

description

Fundamental of Computer. Suthida Chaichomchuen : SCC std@kmitnb.ac.th. Computer Components. Hardware (architecture) Software (instruction set). Basic Hardware. Bits Bytes Registers Memory Processor Data Bus. Hardware Components. Internal hardware Microprocessor Memory Registers - PowerPoint PPT Presentation

Transcript of Fundamental of Computer

1

Fundamental of Computer

Suthida Chaichomchuen : SCCstd@kmitnb.ac.th

2

Computer Components

Hardware (architecture) Software (instruction set)

3

Basic Hardware

Bits Bytes Registers Memory Processor Data Bus

4

Hardware Components

Internal hardware– Microprocessor– Memory– Registers

External hardware– Input/Output Devices

5

Software Organization

Programs Data files Operating System

6

Computer storage

Bit– On : 1– Off : 0

Byte– data : 8 bits– parity : 1 bit (automatically setting)

7

Related bytes

Word Doubleword Quadword Paragraph Kilobyte Megabyte

8

Binary numbers

Bit value : 1 1 1 1 1 1 1 1Position value : 128 64 32 16 8 4 2 1Bit number : 7 6 5 4 3 2 1 0

9

Binary arithmetic

Decimal Binary 65 01000001 +42 +00101010 107 01101011

Decimal Binary 60 00111100 +53 +00110101 113 01110001

10

Negative Binary Numbers

Number +65 : 01000001Reverse the bits : 10111110Add 1 : 1Number -65 : 10111111

Reverse the bit value and add 1

11

Hexadecimal Representation

Binary : 1011 1001 1100 1110Decimal : 11 9 12 14Hexadecimal : B 9 C E

12

System Unit

A system board– Microprocessor– ROM– RAM

Power supply Expansion slots

13

Processors (Intel family)

8088/80188 8086/80186 80286 80386 80486 Pentium (or 80586) PentiumPro (or 6x86)

14

Processors : 8088/80188

16-bit registers 8-bit data bus address up to 1 million bytes of memory registers process 2 bytes/time data bus transfer 1 byte/time operate in real mode

15

Processors : 8086/80186

16-bit registers 16-bit data bus & run faster address up to 1 million bytes of memory registers process 2 bytes/time data bus transfer 2 bytes/time operate in real mode

16

Processors : 80286

16-bit registers 16-bit data bus & run faster address up to 16 million bytes of memory operate in real mode or protected mode

17

Processors : 80386

32-bit registers 32-bit data bus address up to 4 billion bytes of memory operate in real mode or protected mode

18

Processors : 80486

32-bit registers 32-bit data bus address up to 4 billion bytes of memory operate in real mode or protected mode processor is designed for enhanced

performance

19

Processors : Pentium (or 80586)

32-bit registers 64-bit data bus execute more than one instruction/clock

cycle

20

Processors : PentiumPro (or 80686)

advances the capacity of registers and the data bus– connected to a build-in storage cache by

a 64-bit wide bus

21

Logical Units in Processor

Bus Interface Unit <BIU> – Manage the bus control unit, segment

registers and instruction queue.– Provide access to instructions.

Execution Unit <EU>– Execute instructions and get data that

the BIU delivered.

22

Internal Memory

ROM (Read Only Memory) RAM (Random Access Memory)

23

Map of Base Memory

64K base system ROM

192K memory expansionarea (ROM)

640K memory (RAM) conventional memory

upper memory

128K video display area (RAM)

Start Address

Dec Hex960K F0000

768K C0000

640K A0000

zero 00000

Purpose

24

Addressing data in memory

System stores the data in memory in reverse-byte sequence :– low-order byte : low memory address– high-order byte : high memory address

25

memory

Address 7613most significant byte

register 05 29

29 05

Address 7612least significant byte

Addressing data in memory

26

Segments

A segment is a special area defined in a program that begins on a paragraph boundary, that is, at a location evenly divisible by 16, or hex 10.

27

Main Segments

Code Segment <CS>– contains the machine instructions that

are to execute Data Segment <DS>

– contains a program’s defined data, constants, and work areas.

28

Main Segments . . .

Stack Segment <SS>– contains any data and addresses that

you need to save temporarily or for use by your own “called” subroutines.

29

Segment Boundaries

Stack Segment

Data SegmentCode Segment

Memory

Relocatable in memory

Address

Address

Address

SS

DS

CSSegmentRegisters

30

Segment Offsets

Offset is the distance in bytes from the segment address to another location within the segment.

A 2-byte offset can range from 0000H - FFFFH (0-65,535).

Memory location = segment address + offset value

31

Offset 32H

X

Segment address 038E0H

X. . .

DS segment address : 038E0HOffset : +0032HActual address : 03912H

Segment Offsets

32

Addressing Capacity

8086/8088 Addressing– 16 bits for addressing

80286 Addressing– 24 bits for addressing

80386/486/Pentium Addressing– In protected mode use 48 bits for

addressing

33

Registers

The processor’s registers are used to control instructions being executed, to handle addressing of memory, and to provide arithmetic capability.

34

Registers

Segment Registers Pointer Registers General-Purpose Registers Index Registers Flags Register

35

Segment Registers

CS register– Contains the starting address of a

program’s code segment. DS register

– Contains the starting address of a program’s data segment.

36

Segment Registers . . .

SS register– The system stores the starting address

of a program’s stack segment in the SS register.

ES register– Used by some string operations to

handle memory addressing.

37

Segment Registers . . .

FS and GS register– Additional extra segment registers on

the 80386 and later processors.

38

Pointer Registers

Instruction Pointer (IP) register– Contains the offset address of the next

instruction that is to execute.– IP indicates the current instruction within

the currently executing code segment.

39

Pointer Registers . . .

Stack Pointer (SP) register– Refers to the current word being

processed in the stack. Base Pointer (BP) register

– Facilitates referencing parameters.

40

General-Purpose Registers

AX register : Accumulator– Used for operations involving input/outp

ut and most arithmetic.

EAX:

AX: AH AL

41

General-Purpose Registers

BX register : Base register– Used as an index to extend addressing.

EBX:

BX: BH BL

42

General-Purpose Registers . . .

CX register : Count register– Contains a value to control the number

of times a loop is repeated.– Contains a value to shift bits left or right.

ECX:

CX: CH CL

43

General-Purpose Registers . . .

EDX:

DX: DH DL

DX register : Data register– Used for input/output operations– Used for multiply and divide operations

that involve large values.

44

Index Registers

SI register– source index register is required for some

string operations– SI is associates with DS register

DI register– destination index register is required for

some string operations– DI is associates with ES register

45

Flags Register

Flag: O D I T S Z A P C

Bit no.: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

46

Flags Register

OF (overflow)– Indicates overflow of a high-order bit

following arithmetic. DF (direction)

– Determines left or right direction for moving or comparing string data.

IF (interrupt)– Indicates that all external interrupts are to

be processed or ignored.

47

Flags Register . . .

TF (trap)– Permits operation of the processor in

single-step mode. SF (sign)

– Contains the resulting sign of an arithmetic operation.

– 0 : positive / 1 : negative

48

Flags Register . . .

ZF (zero)– Indicates the result of an arithmetic or

comparison operation.– 0 : nonzero / 1 : zero

AF (auxiliary carry)– Contains a carry out of bit 3 on 8-bit

data, for specialized arithmetic.

49

Flags Register . . .

PF (parity)– Indicates even or odd parity of a low-

order 8-bit data operation. CF (carry)

– Contains carries from a high-order bit following an arithmetic operation.

– Contains the contents of the last bit of a shift or rotate operation.