0% found this document useful (0 votes)
13 views32 pages

CH 04

Chapter 4 discusses the basic organization and design of computers, focusing on instruction set architecture (ISA) as the interface between hardware and software. It covers the types of instructions, the fetch-decode-execute cycle, and the role of interrupts in improving CPU efficiency. Additionally, it explains the function of assemblers in translating human-readable mnemonics into machine code.

Uploaded by

Efeson Uliso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views32 pages

CH 04

Chapter 4 discusses the basic organization and design of computers, focusing on instruction set architecture (ISA) as the interface between hardware and software. It covers the types of instructions, the fetch-decode-execute cycle, and the role of interrupts in improving CPU efficiency. Additionally, it explains the function of assemblers in translating human-readable mnemonics into machine code.

Uploaded by

Efeson Uliso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 32

Chapter 4

Basic Computer Organization and Design

1
Instruction set architecture

Computer’s instruction set architecture (ISA) specifies the


format of its instructions and the primitive operations that the
machine can perform.
•The ISA is an interface between a computer’s hardware and
its software.
•Some ISAs include hundreds of different instructions for
processing data and controlling program execution.

2
Cont….

• The organization of a computer is defined by its internal


register, the timing, and control structure, and the set of
instructions.
 The user of a computer can control the process by means of a
program.
What is program ?
 A program is a set of instructions that specify the
operations, operands, and the sequence by which
processing has to occur.
 A Computer instruction is a binary code that specifies a
sequence of micro-operations for the computer.

3
Instruction Codes
 Instruction codes together with data are stored in
memory(=Stored Program Concept)
 The computer reads each instruction from memory and places it

in a instruction register. The control then interprets the binary


code of the instruction and proceeds to execute it by issuing a
sequence of microoperations. Instruction
 Instruction Code :
Cycle

• A group of bits that instruct the computer to perform a


specific operation.
• It is usually divided into two parts.
Instruction Format
15 12 11 0
Op. Code Address

4
Cont….

• Opcode-specifies the instruction to be executed (which allows


for a total of 16 instructions).
• The most basic part of an instruction code
• A group of bits that define such operations as add,
subtract, multiply, shift, and complement(bit 12-15 : 24
= 16 distinct operations)
• The least significant 12 bits, bits 0–11, form an address, which
allows for a maximum memory size of 212–1.
• It specifies the address of an operand

5
Cont….

• The fundamental MARIE instructions are:

6
Cont….

• This is a bit pattern for a LOAD instruction as it would


appear in the IR:

• We see that the opcode is 1 and the address from which to


load the data is 3.

7
Computer Instructions
The basic computer has three instruction code formats. The Operation code (opcode) part
of the instruction contains 3 bits and remaining 13 bits depends upon the operation code
encountered.

There are three types of formats:


1. Memory Reference Instruction
It uses 12 bits to specify the address and 1 bit to specify the addressing mode (I). I is
equal to 0 for direct address and 1 for indirect address.

8
Cont…
2. Register Reference Instruction
These instructions are recognized by the opcode 111 with a 0 in the left most bit of
instruction. The other 12 bits specify the operation to be executed.

3. Input-Output Instruction
These instructions are recognized by the operation code 111 with a 1 in the left most bit
of instruction. The remaining 12 bits are used to specify the input-output operation

9
Timing and control
• A master clock generator controls the timing for all registers in
the basic computer
• The clock pulses are applied to all flip-flops and registers in
system.
• The clock pulses do not change the state of a register unless the
register is enabled by a control signal
• The control signals are generated in the control unit.
• The function of control unit is to generate relevant timing and
control signals to all operations in the computer.
• The control unit co-ordinates activities of the other two
units(ALU and main memory) as well as all peripherals and
auxiliary storage devices linked to the computer.
10
Cont….

• Two major types of control organization


• Hardwired Control :
 The control logic is implemented with gates, flip-flops, decoders,
and other digital circuits.
 + Fast operation, - Wiring change(if the design has to be modified)

• Microprogrammed Control :
 The control information is stored in a control memory, and the control
memory is programmed to initiate the required sequence of
microoperations.
 Control logic is implemented with microprogram.
 + Any required change can be done by updating the microprogram in
control memory.
 - Slow operation b/c time taken to fetch microinstruction from memory
11
Cont…
Block diagram of Hardwired Control :

12
Cont…
As an example, consider the case where SC is incremented to provide timing signals T0, T1,

T2, T3, and T4 in sequence. At time T4, SC is cleared to 0 if decoder output D3 is active. This

is expressed symbolically by the statement

D3T4: SC <- 0

The following diagram shows of control timing signals for this example.

13
Cont…

Block diagram of Microprogrammed Control :

14
Instruction Processing
• The fetch-decode-execute cycle is the series of steps that a
computer carries out when it runs a program.
• We first have to fetch an instruction from memory, and
place it into the IR.
• Once in the IR, it is decoded to determine what needs to be
done next.
• If a memory value (operand) is involved in the operation, it
is retrieved and placed into the MBR.
• With everything in place, the instruction is executed.

The next slide shows a flowchart of this process.


Cont….

16
A Simple Program

• Consider the simple MARIE program given below. We


show a set of mnemonic instructions stored at addresses
100 - 106 (hex):

17
Cont….

• Let’s look at what happens inside the computer when our


program runs.
• This is the LOAD 104 instruction:

18
Cont….

• Our second instruction is ADD 105:

19
Cont….

20
Interrupt

•All computers provide a way of interrupting the fetch-decode-


execute cycle.
•Interrupt is a signal to the processor generated by the
software/hardware indicating an immediate attention needed by
an event.
Why we require Interrupt?
External devices are comparatively slower than CPU.
•So if there is no interrupt CPU would waste a lot of time waiting
for external devices to match its speed with that of CPU.
•This decreases the efficiency of CPU. Hence, interrupt is
required to eliminate these limitations.
21
Cont….

• Typically, the input or output device sends an interrupt by


using a special register, the status or flag register.
• A special bit is set to indicate an interrupt has occurred. For
example, as soon as input is entered from the keyboard, this
bit is set. The CPU checks this bit at the beginning of every
machine cycle.

• When it is set, the CPU processes an interrupt. When it is


not set, the CPU performs a normal fetch-decode-execute
cycle, processing instructions in the program it is currently
executing.

22
Cont…
• Interrupts can be : hardware interrupts and software
interrupts.
• Hardware interrupts: The interrupt signal generated from
external devices like i/o devices
– Example − In a keyboard if we press a key to do some action this
pressing of the keyboard generates a signal that is given to the
processor to do action
• software interrupt is caused either by an exceptional
condition in the processor itself, or a special instruction in
the instruction set which causes an interrupt when it is
executed.
Example - divide-by-zero exception
23
Cont….

• Interrupt processing involves adding another step to the


fetch-decode-execute cycle as shown below.

24
Cont….

• For general-purpose systems, it is common to disable all


interrupts during the time in which an interrupt is being
processed.
– Typically, this is achieved by setting a bit in the flags
register.
• Interrupts that are ignored in this case are called
maskable.
• Nonmaskable interrupts are those interrupts that must be
processed in order to keep the system in a stable
condition.(e.g. types memory corruption problems,
parity errors)
25
Cont….

• Interrupts are very useful in processing I/O.


• MARIE, being the simplest of simple systems, uses a
modified form of programmed I/O.
• All output is placed in an output register, OutREG, and
the CPU polls the input register, InREG, until input is
sensed, at which time the value is copied into the
accumulator.

26
A Discussion on Assemblers

• Mnemonic instructions, such as LOAD 104, are easy for


humans to write and understand.
• They are impossible for computers to understand.
• Assemblers translate instructions that are comprehensible to
humans into the machine language that is comprehensible to
computers
– We note the distinction between an assembler and a
compiler: In assembly language, there is a one-to-one
correspondence between a mnemonic instruction and its
machine code. With compilers, this is not usually the case.

27
Cont….

•An assembler is a program that accepts a symbolic language


program and produces its binary machine language equivalent.
The input symbolic program is called the source program and
the resulting binary program is called the object program .
•Assemblers create an object program file (the machine code)
from mnemonic source code(assembly program) in two passes.
•The translation of the symbolic program into an equivalent binary
code may be done by scanning the program and replacing the
symbols by their machine code binary equivalent.

28
Cont….

• No translation is done during the first scan. we will assign a


memory location to each machine instruction and operand.
The location assignment will define the address value of
labels and facilitate the translation process during the second
scan.
• During the first pass, the assembler assembles as much of
the program is it can, while it builds a symbol table that
contains memory references for all symbols in the program.
• During the second pass, the instructions are completed using
the values from the symbol table.

29
Cont….

• Consider our example program


(top).
– Note that we have included two
directives HEX and DEC that
specify the radix of the constants.
• During the first pass, we have a
symbol table and the partial
instructions shown at the
bottom.

30
Cont….

• After the second pass, the


assembly is complete.

31
Cont….

• Assembly language puts the programmer closer to the


architecture.

• As a programmer, the closest you can come to the processor of a


machine is by using assembly language. Here, you can write
code to access the registers and even deal with memory
addresses directly for retrieving values and pointers.

32

You might also like