Coa 5

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 37

Dr. B. R.

Ambedkar National Institute of Technology,


Jalandhar, Punjab

Branch : - CSE

Computer Organization & Architecture (CSPC- 208 & CSMI-202)


Lecture – 1

Introduction

Presenter – Dr. D. K. Meena


Basic Computer Organization and Design
Instruction Codes
A process is controlled by a program
A program is a set of instructions that specify the operations, data, and the control
sequence

An instruction is stored in binary code that specifies a sequence of


micro-operations

Instruction codes together with data are stored in memory (Stored Program
Concept)
Instruction Code Format
Instruction Code Format
Number of Operands per Instruction Instruction are read from memory as words
Instruction Code Format
Instruction Code Format
Direct Address
Occurs When the Operand Part Contains the Address of Needed Data.
1. Address part of IR is placed on the bus and loaded back into the AR
2. Address is selected in memory and its Data placed on the bus to be loaded into the
Data Register to be used for requested instructions
Indirect Address
Occurs When the Operand Contains the Address of the Address of Needed Data.
Address part of IR is placed on the bus and loaded back into the AR.
Address is selected in memory and placed on the bus to be loaded Back into the AR
New Address is selected in memory and placed on the bus to be loaded into the DR to
use later
Direct and Indirect addressing example
Computer Registers
Registers are a type of computer memory used to quickly accept, store, and
transfer data and instructions that are being used immediately by the CPU.

The registers used by the CPU are often termed as Processor registers.

A processor register may hold an instruction, a storage address, or any data


(such as bit sequence or individual characters).

The computer needs processor registers for manipulating data and a register for
holding a memory address.

The register holding the memory location is used to calculate the address of the
next instruction after the execution of the current instruction is completed.
List of some of the most common registers used in
a basic computer
Register Symbol Number of bits Function

Data register DR 16 Holds memory operand

Address register AR 12 Holds address for the memory

Accumulator AC 16 Processor register

Instruction register IR 16 Holds instruction code

Program counter PC 12 Holds address of the instruction

Temporary register TR 16 Holds temporary data

Input register INPR 8 Carries input character

Output register OUTR 8 Carries output character


Computer Registers
Computer Registers
The Memory unit has a capacity of 4096 words, and each word contains 16 bits.
The Data Register (DR) contains 16 bits which hold the operand read from the memory
location.
The Memory Address Register (MAR) contains 12 bits which hold the address for the
memory location.
The Program Counter (PC) also contains 12 bits which hold the address of the next
instruction to be read from memory after the current instruction is executed.
•The Accumulator (AC) register is a general purpose processing register.
•The instruction read from memory is placed in the Instruction register (IR).
•The Temporary Register (TR) is used for holding the temporary data during the processing.
•The Input Registers (IR) holds the input characters given by the user.
•The Output Registers (OR) holds the output after processing the input data.
Common Bus System
The basic computer has eight
registers, a memory unit, and a
control unit.
Paths must be provided to
transfer information from one
register to another and between
memory and registers
A more efficient scheme for
transferring information in a
system with many registers is to
use a common bus.
Common Bus System
Common Bus System
The connection of the registers and memory of the basic computer to a common
bus system :
The outputs of seven registers and memory are connected to the common bus
The specific output is selected by mux(S0, S1, S2) :
Memory(7), AR(1), PC(2), DR(3), AC(4), IR(5), TR(6)
When LD(Load Input) is enable, the particular register receives the data from the
bus
Control Input : LD, INC, CLR, Write, Read
Common Bus System
Selection variables: select a register or the memory whose output is used as an input to the
common bus.
To select one device out of 8, we need 3 select variables.
For example, if S2S1S0 = 011, the output of DR is selected as an output of the common bus.
Load input (LD): Enables the input of a register to download bits form the common bus.
When LD = 1 for a register, the data on the common bus is read into the register during the
next clock pulse transition.
Increment input (INR): Increments the content of a register. > Clear input (CLR): Clear the
content of a register to zero.
When the contents of AR or PC (12 bits) are applied to the 16-bit common bus, the four
most significant bits are set to zero. When AR or PC receives information from the bus, only
the 12 least significant bits are transferred to the register.
Common Bus System
Computer Instructions
Computer instructions are a set of machine language instructions that a particular processor
understands and executes.
A computer performs tasks on the basis of the instruction provided.
An instruction comprises of groups called fields. These fields include: Mode, Opcode and
Operand
The Operation code (Opcode) field which specifies the operation to be performed.
The Address field which contains the location of the operand, i.e., register or memory
location.
The Mode field which specifies how the operand will be located.
Computer Instructions
A basic computer has three instruction code formats which are:
Memory - reference instruction
Register - reference instruction
Input-Output instruction
Memory - reference instruction
In Memory-reference instruction, 12 bits of memory is used to specify an address and one
bit to specify the addressing mode 'I'.

The Operation code (Opcode) of an instruction refers to a group of bits that define
arithmetic and logic operations such as add, subtract, multiply, shift, and compliment.
Memory - Reference Instruction
15 14 12 11 0

I Opcode Address

1 1 1 0 Address
Register - Reference Instruction
Register - reference instruction
The Register-reference instructions are represented by the Opcode 111 with a 0 in
the leftmost bit (bit 15) of the instruction.
A Register-reference instruction specifies an operation on or a test of the AC
(Accumulator) register.

0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0
Input-Output instruction
Input-Output instruction
Just like the Register-reference instruction, an Input-Output instruction does not
need a reference to memory and is recognized by the operation code 111 with a 1
in the leftmost bit of the instruction.
The remaining 12 bits are used to specify the type of the input-output operation or
test performed.

1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0
Computer Instructions
The three operation code bits in positions 12 through 14 should be equal to 111.
Otherwise, the instruction is a memory-reference type, and the bit in position 15
is taken as the addressing mode I.
When the three operation code bits are equal to 111, control unit inspects the bit
in position 15.
If the bit is 0, the instruction is a register-reference type.
Otherwise, the instruction is an input-output type having bit 1 at position 15.
Instruction Set Completeness
A set of instructions is said to be complete if the computer includes a sufficient
number of instructions in each of the following categories:
1. Arithmetic, logical and shift instructions
2. A set of instructions for moving information to and from memory and
processor registers.
3. Instructions which controls the program together with instructions that
check status conditions.
4. Input and Output instructions
Arithmetic, logic and shift instructions provide computational capabilities for
processing the type of data the user may wish to employ.
Instruction Set Completeness
A huge amount of binary information is stored in the memory unit, but all
computations are done in processor registers.
Therefore, one must possess the capability of moving information between these
two units.
Program control instructions such as branch instructions are used change the
sequence in which the program is executed.
Input and Output instructions act as an interface between the computer and the
user.
Programs and data must be transferred into memory, and the results of
computations must be transferred back to the user.
Design of Control Unit
Control Unit is the part of the computer’s central processing unit (CPU), which directs the
operation of the processor.
It is the responsibility of the Control Unit to tell the computer’s memory, arithmetic/logic
unit and input and output devices how to respond to the instructions that have been sent
to the processor.
It fetches internal instructions of the programs from the main memory to the processor
instruction register, and based on this register contents, the control unit generates a
control signal that supervises the execution of these instructions.
A control unit works by receiving input information to which it converts into control
signals, which are then sent to the central processor.
The computer’s processor then tells the attached hardware what operations to perform.
Design of Control Unit
The functions that a control unit performs are dependent on the type of CPU because
the architecture of CPU varies from manufacturer to manufacturer.
Design of Control Unit
Functions of the Control Unit –
It coordinates the sequence of data movements into, out of, and between a
processor’s many sub-units.
It interprets instructions.
It controls data flow inside the processor.
It receives external instructions or commands to which it converts to sequence
of control signals.
It controls many execution units(i.e. ALU, data buffers and registers)
contained within a CPU.
It also handles multiple tasks, such as fetching, decoding, execution handling
and storing results.
Design of Control Unit
The Control Unit is classified into two major categories:
1. Hardwired Control
2. Micro-programmed Control
Hardwired Control
The Hardwired Control organization involves the control logic to be
implemented with gates, flip-flops, decoders, and other digital circuits.
A Hard-wired Control consists of two decoders, a sequence counter, and a
number of logic gates.
An instruction fetched from the memory unit is placed in the instruction
register (IR)
The component of an instruction register includes; I bit, the operation code,
and bits 0 through 11.
Design of Control Unit
Design of Control Unit
Generated by 4-bit sequence counter and 4×16 decoder
The SC can be incremented or cleared.
Example: T0, T1, T2, T3, T4, T0, T1, . . .
Assume: At time T4, SC is cleared to 0 if decoder output D3 is active.

D3T4: SC ← 0
Design of Control Unit
The operation code in bits 12 through 14 are coded with a 3 x 8 decoder.
The outputs of the decoder are designated by the symbols D 0 through D7.
The operation code at bit 15 is transferred to a flip-flop designated by the
symbol I.
The operation codes from Bits 0 through 11 are applied to the control logic
gates.
The Sequence counter (SC) can count in binary from 0 through 15.
Advantages:- Disadvantage
1. Faster then Micro-programmed Control 1. Control signal required by CPU which is more complex
2. Performance is high then 2. Modifications very difficult
Micro-programmed Control. 3. Difficult to correct mistakes or adding new features in existing
design of control unite
Micro-programmed Control
The Micro-programmed Control organization is implemented by using the
programming approach.
In Micro-programmed Control, the micro-operations are performed by
executing a program consisting of micro-instructions.
The following image shows the block diagram of a Micro-programmed Control
organization.
Micro-programmed Control
The Control memory address register specifies the address of the micro-instruction.
The Control memory is assumed to be a ROM, within which all control information is
permanently stored.
The control register holds the microinstruction fetched from the memory.
The micro-instruction contains a control word that specifies one or more
micro-operations for the data processor.
While the micro-operations are being executed, the next address is computed in the
next address generator circuit and then transferred into the control address register
to read the next microinstruction.
The next address generator is often referred to as a micro-program sequencer, as it
determines the address sequence that is read from control memory.
Micro-programmed Control
The Control memory address register specifies the address of the micro-instruction.
The Control memory is assumed to be a ROM, within which all control information is
permanently stored.
The control register holds the microinstruction fetched from the memory.
The micro-instruction contains a control word that specifies one or more
micro-operations for the data processor.
While the micro-operations are being executed, the next address is computed in the
next address generator circuit and then transferred into the control address register
to read the next microinstruction.
The next address generator is often referred to as a micro-program sequencer, as it
determines the address sequence that is read from control memory.

You might also like