DOC

Chapter 2 Parts of a Computer System

By Carol Perry,2014-06-30 07:06
7 views 0
Chapter 2 Parts of a Computer System

Chapt

    Chapter 2: Parts of a Computer System

    Introduction

    1. In this part you will learn how the memory and CPU look to the assembly language programmer for IBM PC and compatible systems which have Intel 80x86 CPU.

    2. Writing a program in assembly language requires knowledge of the computer’s hardware and details of its instruction set.

    3. The main internal hardware features of a computer are the

    microprocessor,

    memory, and registers. Software consists of the various programs and data files (including the operating system) stored on all kinds of disk. Writing a program in assembly language requires knowledge of the computer’s hardware and details of its instruction set. The main internal hardware features of a computer are the microprocessor, memory, and registers; the main external hardware features are the computer’s I/O devices such as the

    keyboard, monitor, all sorts of disks and so on. Software consists of the various programs and data files (including the operating system) stored on all kinds of disk.

    Contents

    1. Computer System

    2 . Hardware and software

    3 Registers

    4 Memory

1. Computer System

    An important hardware element of the PC is the system unit, which contains a system board, power supply, and expansion slots for optional boards. Feature of the system board are an Intel (or equivalent) microprocessor, read-only memory (ROM), and random access memory (RAM).Processors vary in their speed and capacity of memory, registers, and data bus. A data bus transfers data between the processor, memory, and external devices, in effect managing the data traffic.

    (1) Master the concepts, model of the memory in IBM PC

    (2) Master the registers in 80x86 CPU

    (3) Mater the software that used in programming with assembly language (4) Know I/O device in IBM PC

     Followings a brief description of various Intel processors:

2 . Hardware and software

    2.2.1 The Hardware of Computer

    1 The composition of CPU

    (1)Execution unit and bus interface unit

? As illustrated in the more figure, the processor is partitioned into two logical

    units: an execution unit (EU) and a bus interface unit (BIU). ? The role of the EU is to execute instructions. ? The BIU delivers instructions and data to the EU.

(2) EU: Execution Unit

    The EU contains an Arithmetic and logic unit(ALU), a control unit(CU), and a number of registers. These features provide for execution of instruction and arithmetic and logical operations.

     (3) BIU: Bus interface Unit

    ? The most important function of the BIU is to manage the bus control unit, segment registers, and instruction queue. The BIU controls the buses that transfer data to the EU, to memory, and to external I/O devices, whereas the segment registers control memory addressing.

    ? Another function of the BIU is to provide access to instructions. Because the instructions for a program that is executing are in memory the BIU must access instructions from memory and place them in a Instruction queue. The instruction queue varies in size depending on the processor.

    ? This feature enables the BIU to look ahead and prefetch instructions so that there is always a queue of instruction ready to execute.

(4) HOW THE EU & BIU WORK TOGETHER?

    The EU and BIU work in parallel, with the BIU keeping one step ahead. The EU notifies the BIU when it needs access to data in memory or an I/O device. Also the EU requests machine instructions from the BIU instruction queue. The top instruction is currently executable one and, while the EU is occupied executing an instruction, the BIU fetches another instruction from memory. This fetching overlaps with execution and speeds up processing.

(5) Dynamic Execution

    A problem faced by designers is that because the processor runs considerably faster than does memory. The processor has to wait for memory to deliver instructions. In order to handle this problem, each advanced processor in turn has capability in dynamic execution, which consists of there elements: ? Multiple branch prediction , whereby the processor looks ahead a number

of steps to predict what to process next

    ? Dataflow analysis, which involves analyzing dependencies between instructions.

    ? Speculative execution, which uses the results of the first two elements to speculatively execute instructions.

2.2.2 The Software of Computer

    In this section, we describe the PC software environment

    (1) The functions of the operating system

    (2) The main components of the operating system

    (3) exam the boot process (how the system loads itself when you power up the

    computer)

    (4) consider how the system loads a program for execution

    (5) consider how the system uses the stack

    (6) consider how an instruction in the code segment address data in the data segment

The computer software includes System Software and Application software.

    (1)System Software: such as Device Driver, File Management, Input/Output

    Driver, Link Functions, Translation Functions and so on.

    (2)Application software: such as Text Editor, Language Translator and Linker

    and so on.

Concrete introduction

    (1) File Management. Dos maintains the directories and files on the

    system’s disks. Programs create and update files, but the system is

    responsible for managing their location on disk.

(2) Input/Output. Programs request input data from the system or deliver

    such data to the system by means of interrupts. The programmer is

    relieved of coding at the low I/O level.

    (3) Program loading. When a user or program requests execution of a

    program, the program loader handles the steps involved in accessing

    the program from disk, placing it in memory, and initializing it for execution. (4) Memory Management. When the program loader loads a program

     from disk into memory for execution, it allocates a large enough space in

    memory for the program code and its data. Programs can process data

    within their memory area, can release unwanted memory, and can request

    additional memory.

    (5) Interrupt Handling. The system allows users to install resident programs

    that attach themselves to the interrupt system to perform special functions.

3 Registers

(1) General register

(2) EIP (IP)

    ?IP/EIP addresses the next instruction to be fetched in a section of memory

    defined as a code segment.

     ?It points to the next instruction, but can be modified with a jump or a jump or call instruction.

     ?This register is IP(16 bits) in the real mode and EIP(32 bits) in the protected mode .

(3) FLAGS

     ?EFLAGS indicate the condition of the microprocessor and control its

    operation.

     ?The16-bit CPU only contain a 16-bit FLAG register, which has nine flags:

    FLAG REGISTER

    ?CF, PF, AF, ZF, SF and OF are called conditional flags. It indicate condition

     that resulted after an instruction was executed control the operation of

    instructions before they are executed.

    TF, DF, and IF are called control flags. It controls the Operation of Instructions

    before they are executed.

    OF (overflow) Indicates overflow of a high-order (leftmost) bit following

    arithmetic.

    DF (direction) Determines left or right direction for moving or comparing

    string (character) data.

    IF (interrupt): Indicates that all external interrupts, such as keyboard entry,

    are to be processed or ignored.

    TF (trap) Permits operation of the processor in signal-step mode, Debugger

    programs such as DEBUG set the trap flag so that you can step through

    execution a signal instruction at a time to examine the effect on registers

    and memory.

    SF (sign) Contains the resulting sign of an arithmetic operation (0 = positive

    and 1= negative).

    ZF (zero) Indicates the result of an arithmetic or comparison operation

    (0=nonzero and 1=zero result).

    AF (auxiliary carry) contains a carry out of bit 3 on 8-bit data, for specialized

    arithmetic.

    PF (parity) Indicates even or odd parity of a low-order (rightmost) 8-bit data

    operation.

    CF (carry) Contains carries from high-order (leftmost) bit following an

    arithmetic operation; also contains the contents of the last bit of a shift

    or rotate operation.

4 Memory

    The two types of internal memory on the PC are random access memory

    (RAM) and read only memory (ROM). Bytes in memory are

    numbered consecutively, beginning with 00, so that each location has a

    uniquely numbered address.

4.1 Surplus discussion

    Memory in an IBM PC or compatible microcomputer is logically a collection o

    slot, each of which can store one byte of instructions or data. The two types of internal memory on the PC are random access memory (RAM) and read

    only memory (ROM).

(1) Read-only memory (ROM)

    Permanently retain their contents and can be read from but not written to.

    ROM consists of special memory chips that can only be read. Because

    instructions and data are permanently “burned into” the chips, they can not

    be altered. The ROM Basic Input/Output System (BIOS) begins at address

    768K and handles I/O devices, such as hard disk controller. ROM

    beginning at 960K controls the computer’s basic functions, such as the

    power-on self-test, dot patterns for graphics, and the disk self-loader.

    When you switch on the power, ROM performs various check-outs and loads

    special system data from disk into RAM.

    (2) Random access memory (RAM)

    Can be written to read from by program instructions. The contents of RAM

     A programmer is chips are lost when the computers power is turned off.mainly concerned with RAM. RAM is available as a “worksheet” for temporary

    storage and execution of programs. Because the contents of RAM are lost

    when you turn off the power, you need separate, external storage for keeping

    programs and data.

    (3) In this subject, all further discussions of RAM use the general term

    “memory”.

4.2 The Addresses of Memory Unit

    (1) Byte is the basic unit of memory

    (2) Every byte has a unique address

    (3) Address was assigned by the unsigned integer

    (4) One world includes two consecutive bytes

    (5) The address of the word is described by the low byte’s address

    (6) Low byte is stored in low address and high byte is stored in high address

    (7) Machine access the (read/write) memory by even address

    Depending on the model, the processor can access one or more bytes of

    memory at a time.

Example: according to the above described:

    (1) For a byte: We can see the content in the 34560H is 34H; And the content

    in the 34561H is 12H

    (2) For a word: The content in the 34560H is 1234H

4.3 Memory models

    (1) 32-bit memory model: Flat memory model

    Segmented memory model (2) 16-bit memory model: Real address mode memory model

4.4 Segment :

    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. There may be

    any number of segments. Although a segment may be located almost

    anywhere in memory and in real mode may be up to 64K bytes, it requires only

    as much as the program requires for its execution. To address a particular

    segment, it is necessary only to change the address in an appropriate segment

    register. The three main segments are the code, data, and stack segments.

    The CPU may use many segments in the program. For instance, a typical

    assembly language program consists of at least three segments:

    (1) Code segment-holds the code, i.e. programs or procedures

    The code segment contains the machine instructions that are to execute.

    Typically, the first executable instruction is at the start of this segment, and the

    operating system links to that location to begin program execution. The code

    segment (CS) register address the code segment. If you code area requires

    more than 64K, you program may need to define more than one code

    segment.

    (2) Data segment-contains the most data used in a program

    The data segment contains a program’s defined data, constants, and work

    areas. The data segment (DS) register addresses the data segment. If you

    data area requires more than 64K, you program may need to define more than

    one data segment.

    (3) Stack segment-the area of memory used for the stack

    In simple terms, the stack contains any data and addresses that you need to

    have temporarily or for use by you own “called” subroutines. The stack

    segment (SS) register addresses the stack segment.

4.4.1 Segments and offsets

    A combination of a segment address and an offset address access a memory

    location in the real mode. With in a program, all memory locations are relative

    to a segment’s starting address. The distance in bytes from the segment

    address to another location within the segment is expressed as an offset.

    Normally, the offset is 16-bit. A 2-byte (16-bit) offset can range from 0000H

    through FFFFH, or 0 through 65,535. Thus the first byte of the segment is at

    offset 0000, the second byte is at offset 0001, and so fourth through to offset

    FFFFH.

    (1) Segment address: the beginning address of any 64K-byte memory

    segment

    (2) Offset address : the location within the 64K-byte segment range, the

    distance or displacement above the start of the segment

    In order to reference any memory location in a segment, the processor

    combines the segment address in a segment register with an offset value.

Report this document

For any questions or suggestions please email
cust-service@docsford.com