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 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
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
Designation
Description
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.
Instruction Code
•Instruction Code
•An instruction code is a group of bits that instruct the computer to
perform a specific operation.
•Example
•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.
•Thenumber 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 2
n
(or
less) distinct operations.
ADD
1547
Unique Binary
code is assigned
to every OpCode
Stored Program Organization
Operand
(data)
Instructions
(program)
Memory
4096 x
16
Processor Register
(accumulator or
AC)
OpcodeAddress
0
12
1115
Instruction Format
Binary Operand
015
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 2
12
= 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
0
Instruction Format
12 11
IOpcodeAddress
15 14
0001010001010111
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
Operand457
AC
+
Operand1350
Memory Memory
220ADD 457351ADD 300
AC
+
1350300
Direct & Indirect Addressing of Memory
•One bit of the instruction code can be used to
distinguish between a direct and an indirect address.
•It consistsof a 3-bit operation code, a 12-bit
address, and an indirect address mode bit designated
by I.
•The mode bit is0for adirectaddress and1 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 findthe 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
PC
011
IR
015
AR
011
Program Counter(12)
Holds address of instruction
Address Register(12) Holds
address for memory
Instruction
Register(16) Holds
instruction code
TR
015
Temporary
Register(16) Holds
temporary data0
DR
15
Data Register(16)
Holds memory operand
Computer Registers
INPR
07
AC
15
0
OUTR
7
Input Register(8) Holds
input character
Output Register(8) Holds
output character
Accumulator(16)
Processor
Register0
Memory
4096 words
16 bits per word
Common bus system of basic computer
Computer
Instructions
Unit – 2: Basic Computer OrganizationDarshan Institute of Engineering & TechnologyDarshan Institute of Engineering &
Technology
Types of Computer Instructions
1.Memory Reference Instruction
012
11
IOpcodeAddress
15 14
0000 Address
Unit – 2: Basic Computer
Organization
2
2
34
0xxx8xxxANDAND the content of memory to
AC
1xxx9xxxADDAdd the content of memory to
AC
2xxxAxxxLDALoad memory word to AC
3xxxBxxxSTAStore content of AC in memory
4xxxCxxxBUNBranch unconditionally
5xxxDxxxBSABranch and save return address
6xxxExxxISZIncrement and skip if zero
Types of Computer Instructions
2.Register Reference Instruction
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
0000000
1514131211 0
0111 Register Operation
0111100000000000
Types of Computer Instructions
7010SPASkip next instruction if AC is
positive
7008SNASkip next instruction if AC is
negative
7004SZASkip next instruction if AC is zero
7002SZESkip next instruction if E is zero
7001HLTHalt computer
00000
0
2.Register Reference Instruction
151413
12 11
0111Register Operation
0111000000010000
Unit – 2: Basic Computer
Organization
2
2
Types of Computer Instructions
000000
0
3.Input – Output Instruction
151413
12 11
1111I/O Operation
1111100000000000
Unit – 2: Basic Computer
Organization
2
2
F800INPInput character to AC
F400OUTOutput character from
AC
F200SKISkip on input flag
F100SKOSkip on output flag
F080IONInterrupt on
F040IOFInterrupt off
Instruction Set Completeness
Unit – 2: Basic Computer
Organization
2
2
•Instructionsetissaidtobecompleteifitincludes
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
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
Instruction
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.