You are on page 1of 61

Module 1 :- Basics of Computer Organization and Design

Topics to be covered
• Computer Architecture & Organization
• Basic Components of Computer System
• Basic Computer Model (Van Neumann Model)
• Instruction codes
• Computer registers
• Computer instructions
• Timing and Control
• Instruction cycle
• Memory-Reference Instructions
Basic Computer Model

ENIAC

• On the ENIAC, all programming was done at the digital logic level
• Programming the computer involved moving plugs and wires
• Configuring the ENIAC to solve a “simple” problem required
many days labor by skilled technicians
• A different hardware configuration was needed to solve every
unique problem type
The von Neumann Model
• The invention of stored program computers has been ascribed
to a mathematician, John von Neumann
• Stored-program computers have become known as von
Neumann Architecture systems
Stored-program computers have the following characteristics:
• Three hardware systems:
• A central processing unit (CPU)
• A main memory system
• An I/O system
• Provides the capacity to carry out sequential instruction
processing
The von Neumann Model

Computers employ a fetch-decode-execute cycle to


run programs
Software/Program/Instructions
• Software - Software is a set of computer
programs used on a computer to help perform
tasks.
• Program - A computer program is a sequence
or set of instructions in a programming
language for a computer to execute.
• An instruction is a set of codes that the
computer processor can understand. The code
is usually in 1s and 0s, or machine language.
Instruction Codes
Program:
– A sequence of (machine) instructions
(Machine) Instruction:
– A group of bits that tell the computer to perform a specific operation (a
sequence of micro-operation)
Example: ADD,JUMP,LOAD
• The instructions of a program, along with any needed data are
stored in memory
• The CPU reads each instruction from memory
• It is placed in an Instruction Register (IR)
• Control circuitry in control unit then translates the instruction into
the sequence of micro operations necessary to implement it.
Computer Organization
• The organization of the computer is defined
by its internal registers, the timing and
control structure and the set of instructions
that it uses.
• The internal organization of a digital system
is defined by the sequence of
microoperations it performs on data stored in
its registers.
Register Transfer and
Microperations
• A digital system is an interconnection of digital hardware
modules that accomplish a specific information-
processing task.
• Digital modules are constructed from digital components
such as registers, decoders, arithmetic elements and
control logic.
• The operations executed on data stored in registers are
called microperations.
• Example of microperations are shift,count,clear and load.
Register Transfer Language
• The symbolic notation used to describe the
microoperation transfers among registers is
called a register transfer language.
• Information transfer from one register to
another register is designated in symbolic
means by means of a replacement operator.
R2  R1
Register
• Computer Registers are designated by Capital
Letters.
• For Example,
MAR – Memory Address Register
PC – Program Counter
IR – Instruction Register
R1 – Processor Register
Memory Transfer
• Memory read: Transfer of information from a
memory word to the outside environment
Read: DR  M[AR]
DR – Data Register
AR – Address Register
M – Memory Word
• Memory write: transfer of new information to be
stored into the memory.
Write: M[AR]  R1
Arithmetic Microoperations
Logic Microoperations
Logic Microoperations
Shift Microoperations
Symbolic Description
Designation

E shl R Shift-left register R

R shr R Shift-right register R

R  cil R Circular Shift-left register R

R  cir R Circular Shift-right register R

R  ashl R Arithmetic Shift-left register R

R  ashr R Arithmetic Shift-Right register R


Instruction Codes
Program:
– A sequence of (machine) instructions
(Machine) Instruction:
– A group of bits that tell the computer to perform a specific operation
(a sequence of micro-operation)
• The instructions of a program, along with any needed data are
stored in memory
• The CPU reads each instruction from memory
• It is placed in an Instruction Register (IR)
• Control circuitry in control unit then translates the instruction
into the sequence of micro operations necessary to implement
it.
Instructi on Code
• Instruction Code
• An instruction code is a group of bits that instruct the computer to
perform a specific operation.
Unique Binary
• Example code is assigned
ADD 1547 to every OpCode

• Operation Code (Opcode)


• The operation code of an instruction is a group of bits that define
such operations as add, subtract, multiply, shift, and complement.
• The number of bits required for the operation code of an
instruction depends on the total number of operations available in
the computer.
• The operation code must consist of at least n bits for a given 2n (or
less) distinct operations.
Stored Program Organization
Memory
4096 x
16
15 0
12 11
Opcode Address
Instruction
s
Instruction Format (program)
15 0 Operan
Binary Operand d
(data)

Processor Register
(accumulator or
AC)
Stored Program Organization

• The simplest way to organize a computer is to have one


processor register(AC) and an instruction code format with
two parts.
• The first part specifies the operation (opcode) to be
performed and the second specifies an address (operand).
• The memory address tells the control where to find an
operand in memory.
• This operand is read from memory and used as the data to be
operated on together with the data stored in the processor
register.
Stored Program Organization

• Instructions are stored in one section of memory


and data in another.
• For a memory unit with 4096 words, we need 12 bits
to specify an address since 212 = 4096.
• If we store each instruction code in one 16-bit
memory word, we have available four bits for
operation code (opcode) to specify one out of 16
possible operations, and 12 bits to specify the
address of an operand.
Stored Program Organization

• The control reads a 16-bit instruction from the


program portion of memory.
• It uses the 12-bit address part of the instruction to
read a 16-bit operand from the data portion of
memory.
• It then executes the operation specified by the
operation code.
Instruction format of basic
computer

Instruction Format
15 14 12 11 0
I Opcode Address

0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 1
Add Instruction – ADD 457
Direct & Indirect Addressing of Memory

• If the second part of an instruction format


specifies the address of an operand, the
instruction is said to have a direct address.
• In Indirect address, the bits in the second
part of the instruction designate an address
of a memory word in which the address of
the operand is found.
Direct & Indirect Addressing of Memory
Memory
Memory

22 0 ADD 457 35 1 ADD 300

300 1350

457 Operand
1350 Operand

+ +

AC AC
Direct & Indirect Addressing of Memory

• One bit of the instruction code can be used to


distinguish between a direct and an indirect
address.
• It consists of a 3-bit operation code, a 12-bit
address, and an indirect address mode bit
designated by I.
• The mode bit is 0 for a direct address and 1
for an indirect address.
Direct & Indirect Addressing of Memory

• A direct address instruction is placed at address 22 in memory.


• The I bit is 0, so the instruction is recognized as a direct address
instruction.
• The opcode specifies an ADD instruction, and the address part
is the binary equivalent of 457.
• The control finds the operand in memory at address 457 and
adds it to the content of AC.
Direct & Indirect Addressing of Memory

• The instruction in address 35 has a mode bit I = 1, recognized as


an indirect address instruction.
• The address part is the binary equivalent of 300.
• The control goesto address 300 to find the address of the
operand.
• The address of the operand in this case is 1350.
• The operand found in address 1350 is then added to the content
of AC.
Direct & Indirect Addressing of Memory

• The indirect address instruction needs two


references to memory to fetch an operand.
• The first reference is needed to read the address of
the operand.
• Second reference is for the operand itself.
• The memory word that holds the address of the
operand in an indirect address instruction is used as
a pointer to an array of data.
Computer Registers
11 0
Program Counter(12)
PC Holds address of instruction
11 0
Address Register(12) Holds
AR address for memory
15 0
Instruction Register(16)
IR Holds instruction code
15 0
Temporary Register(16)
TR Holds temporary data
15 0
Data Register(16)
DR Holds memory operand
Computer Registers
15 0 Accumulator(16)
AC Processor
7 0 Register
Output Register(8) Holds
OUTR output character
7 0
Input Register(8) Holds
INPR input character

Memory
4096 words
16 bits per word
Common bus system of basic computer
Computer
Instructions

Unit – 2: Basic Computer Organization Darshan


DarshanInstitute
InstituteofofEngineering
Engineering&&
Technology Technology
Types of Computer Instructions
1. Memory Reference Instruction
15 14 12 0
11
I Opcode Address

0 0 0 0 Address

0xxx 8xxx AND AND the content of memory to


AC
1xxx 9xxx ADD Add the content of memory to
AC
2xxx Axxx LDA Load memory word to AC
3xxx Bxxx STA Store content of AC in memory
4xxx Cxxx BUN Branch unconditionally
Unit5xxx Dxxx
– 2: Basic Computer BSA Branch
234 and save return address
Organization 2
6xxx Exxx ISZ Increment and skip if zero
Types of Computer Instructions
2. Register Reference Instruction
15 14 13 12 11 0
0 1 1 1 Register Operation

0 1 1 1 10 00 00 00 00 00 00 0 0 0 0 0

7800 CLA Clear AC


7400 CLE Clear E
7200 CMA Complement AC
7100 CME Complement E
7080 CIR Circulate right AC and E
7040 CIL Circulate left AC and E
7020 INC Increment AC
Types of Computer Instructions
2. Register Reference Instruction
15 14 13 12 11 0
0 1 1 1
Register Operation
0 1 1 1 0 0 0 0 0 0 0 01 00 00 00 00

7010 SPA Skip next instruction if AC is


positive
7008 SNA Skip next instruction if AC is
negative
7004 SZA Skip next instruction if AC is zero
7002 SZE Skip next instruction if E is zero
7001 HLT Halt computer
Unit – 2: Basic Computer 2
Organization 2
Types of Computer Instructions
3. Input – Output Instruction
15 14 13 12 11 0
1 1 1 1
I/O Operation
1 1 1 1 01 00 0
0 00 00 00 0 0 0 0 0 0

F800 INP Input character to AC


F400 OUT Output character from
AC
F200 SKI Skip on input flag
F100 SKO Skip on output flag
F080 ION Interrupt on
F040 IOF Interrupt off
Unit – 2: Basic Computer 2
Organization 2
Instruction Set Completeness
• Instruction set is said to be complete if it includes
sufficient number of instructions in each of the following
categories:
1. Arithmetic, logical and shift instructions
2. Instructions for moving information to and from memory and
processor registers
3. Program control instructions together with instructions that
check status conditions
4. Input and output instructions

Unit – 2: Basic Computer 2


Organization 2
Timing and Control
• The timing for all registers in the basic computer is controlled by a
master clock generator.
• The clock pulses are applied to all flip-flops and registers in the
system, including the flip-flops and registers in the control unit.
• 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 and provide
control inputs for the multiplexers in the common bus, control inputs
in processor registers, and microoperations for the accumulator.
• There are two major types of control organization: Hardwired control
and Microprogrammed control
Control Unit
Control Unit of Basic Computer
Example of control timing signals
Instruction Cycle
• A program residing in the memory unit of the
computer consists of a sequence of instructions.
In the basic computer each instruction cycle
consists of the following phases:
1. Fetch an instruction from memory
2. Decode the instruction
3. Read the effective address from memory if the
instruction has an indirect address.
4. Execute the instruction.
Instruction cycle
• Fetch & Decode
• PC is loaded with the address of the first
instruction in the program
• The microoperations for fetch and decode
phases are as follows:
Register Transfer
for Fetch Phase
Flowchart for
instruction cycle
Memory Reference Instructio

AND to AC

ADD to AC
Memory Reference Instruction
BSA
Register Reference Instruction
Input-Output of Basic Computer
Input-Output Instruction
Design of Accumulator
Design of Accumulator Logic
Design of Accumulator Logic
Design of Basic
Computer
Exercise 1
A computer uses a memory unit with 256K words of 32
bits each. The instruction has four parts: an indirect
bit, an operation code and a register code part to
specify one of 64 registers and an address part.
a. How many bits are there in the operation code, the
register code part and the address part?
b. Draw the instruction word format and indicate the
number of bits in each part.
c. How many bits are there in data and address inputs of
the memory?
Exercise 2
• What is difference between a direct and an
indirect address instruction?
• How many references to memory are needed
for each type of instruction to bring an
operand into a processor register?
Exercise 3
• What are the two instructions needed in the
basic computer in order to set the E flip flop to
1?
Exercise 4
• Consider the instruction format of the basic
computer and the list of instructions. For each
of the following 16-bit instruction, give the
equivalent four-digit hexadecimal code and
explain in your own words what it is that the
instruction is going to perform:
a. 0001 0000 0010 0100
b. 1011 0001 0010 0100
c. 0111 0000 0010 0000
Exercise 5
A computer use a memory of 65536 words with eight bits in each word.
It has the following registers: PC,AR,TR(16 bits each), and AC,DR,IR(8
bits each). A memory reference instruction consists of three words: an
8-bt operation-code(one word) and 16-bit address(in the next two
words).All operands are eight bits. There is no indirect bit.
a. Draw a block diagram of the computer showing the memory and
registers. (Slide-30,31) (Do not use a common bus)
b. Draw a block diagram showing the placement in memory of a typical
three-word instruction and the corresponding 8-bit operand.
c. List the sequence of micro operations for fetching a memory
reference instruction and then placing the operand in DR. Start from
timing signal T0.

You might also like