16
Basic Machine Architecture Lecture Code: CIT 210 Bowen University, Iwo Nigeria

Basic Machine Architecture

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Basic Machine Architecture

Basic Machine Architecture

Lecture Code: CIT 210

Bowen University, Iwo Nigeria

Page 2: Basic Machine Architecture

Learning Objectives: Students’ will learn the basic architecture of a simple

computer, and component of CPU in code execution

Targeted Students: 200 Level

Course Title: Foundation of Sequential Programming

Page 3: Basic Machine Architecture

A computer is an electronic device that manipulates information, or data. It has the ability to store, retrieve, and process data.

A computer is a programmable device that stores, retrieves, and processes data

In programming or to understand how to program a computer, it is necessary to

understand a bit about how computers are structured internally

While a program is a set of instruction given to the computer to

perform specific task, in computer, the CPU executes each instruction

provided to it, in a series of steps, this series of steps is called Machine

Cycle, and is repeated for each instruction.

Basic Computer System

Page 4: Basic Machine Architecture

Structure of a Computer System

1.Input Unit

2.Output Unit

3.Storage Unit

4.Arithmetic Logic Unit

5.Control Unit

Computer system has five basic units that help the computer to perform operations, which are given below:

The main components in a typical computer system are the processor, memory, input/output devices, and the

communication channels that connect them.

Page 5: Basic Machine Architecture

Everything that a computer does, from typing a word

document, to web browsing, printing, involves moving and

processing numbers. The electronics of a computer is

nothing more than a system designed to hold, move, and

change numbers.

The computer manipulates the data by performing operations on the numbers. No doubt, the CPU executes the programs the computer runs

As computer continues to process, store, and retrieve data. Data may be numbers in a spreadsheet, characters of

text in a document among others.

All data is stored in the computer as numbers.

Page 6: Basic Machine Architecture

Overview of a Processor

The processor is the most important part of a computer, the component around which everything else

is centered. In essence, the processor is the computing part of the computer.

The instructions are also known as opcodes or machine code

A sequence of instructions is what constitutes a program.

Instructions in a computer are numbers, just like data.

A processor is an electronic device capable of manipulating data (information)

in a way specified by a sequence of instructions.

Page 7: Basic Machine Architecture

• A machine-code program is a sequence of machine-code instructions.

• To be executed, a machine-code program must be stored in main memory.

• Code execution takes place within the CPU.

• The Code Execution Process follows ‘Fetch-Decode-Execute’ cycle

Program Execution Sequence

A sequence of instructions is a machine-code program. Each type of processor has a different instruction set,

meaning that the functionality of the instructions (and the bit patterns that activate them) varies

The instruction set provides commands to the processor, to tell it what it needs to do. The instruction set consists of

addressing modes, instructions, native data types, registers, memory architecture, interrupt, and exception

handling, and external I/O.

Page 8: Basic Machine Architecture

.

Central Processing Unit

The central processing unit (CPU) of a computer is a piece of

hardware that carries out the instructions of a computer

program. It performs the basic arithmetical, logical, and

input/output operations of a computer system.

The CPU is like the brains of the computer - every instruction,

no matter how simple, has to go through the CPU.

•CPU performs all types of data processing operations.

•It stores data, intermediate results, and instructions (program).

•It controls the operation of all parts of the computer.

Page 9: Basic Machine Architecture

CPU – Control Unit

The control unit Performs the following Operations :

1. Fetch from memory the next instruction to be executed

2. Decode it, that is, determine what should be done

3. Execute it by issuing the appropriate command to the ALU,

memory, and I/O Controllers

These steps are repeated over and over again until we reach the last instruction of a

program (usually HALT, STOP, or QUIT).

Page 10: Basic Machine Architecture

Arithmetic Logic Unit

ALU takes the data from Memory registers; ALU contains the

logical circuit to perform mathematical operations like

subtraction, addition, multiplication, division, logical operations

and logical shifts on the values held in the processors registers

or its accumulator

All information in a computer is stored and manipulated in the

form of binary numbers, i.e. 0 and 1. Transistor switches are

used to manipulate binary numbers since there are only two

possible states of a switch: open or closed. An open transistor,

through which there is no current, represents a 0. A closed

transistor, through which there is a current, represents a 1

Other logic gates are NOR, XOR , NOT

Page 11: Basic Machine Architecture

CPU- Main Memory

Main memory is where programs and data are kept when the

processor is actively using them. When programs and data

become active, they are copied from secondary memory into

main memory where the processor can interact with them

Computer memory is the storage space in the computer, where

data is to be processed and instructions required for processing

are stored.

Also, Cache memory is a very high speed semiconductor

memory which can speed up the CPU. It acts as a buffer

between the CPU and the main memory

Page 12: Basic Machine Architecture

System BUS

A bus is a common pathway through which information

flows from one computer component to another. This

pathway is used for communication purpose and it is

established between two or more computer components.

System bus:- This is the bus that connects the CPU to the

main memory on the motherboard. The system bus is also

called the front-side bus, memory bus, local bus, or host

bus.

Data sharing, Addressing, Timing, and Power are basic functional components of a computer Bus

Page 13: Basic Machine Architecture

Program Execution in the CPU

1. A sequence of instructions is stored in memory.

2. The memory address where the first instruction is located is copied to the program counter.

3. The CPU sends the address in the program counter to memory via the address bus.

4. Memory responds by sending a copy of the state of the bits at that memory location on the data bus, which the CPU then copies into its instruction register.

5. The instruction pointer is automatically incremented to contain the address of the next instruction in memory.

6. The CPU executes the instruction in the instruction register.

7. Go to step 3

Steps 3,4 & 5 are called an instruction fetch. Steps 3 -7 make up a cycle, the instruction execution cycle

Page 14: Basic Machine Architecture

A program counter (PC) is a CPU register in the

computer processor which has the address of the next

instruction to be executed from memory. A program

counter is also known as an instruction counter,

instruction pointer, instruction address register or

sequence control register.

An instruction register holds a machine instruction that is currently being executed. Generally, a

register sits at the top of the memory hierarchy. A variety of registers serve different functions

in a central processing unit (CPU) – the function of the instruction register is to hold that

currently queued instruction for use.

Program counter VS Instruction Register

Page 15: Basic Machine Architecture

1. Digital Design and Computer Architecture by David Money Harris and sarah L. Harris

2. Computer Organization and Architecture by Alka Vishwa

3. Computer Architecture and Organization by John Hayes

4. Computer Organization and Architecture: Designing for Performance, 8/e (Old Edition) by Stallings William

References

Page 16: Basic Machine Architecture