Lecture8_CompOrg&Design_IntrCodes_CompRegs_Instructions_Fall2022
Lecture8_CompOrg&Design_IntrCodes_CompRegs_Instructions_Fall2022
Organization and
Assembly Language
Basic Computer Organization and Design
1
Outlines
• Instruction Codes
• Computer Registers
• Computer Instructions
2
References
• Chapter 5, Morris Mano, “Computer System
Architecture”
3
Introduction
• This chapter describes a basic computer and shows
how the register transfer statements can specify its
operation
• Basic computer organization defined by its internal
registers, timing and control structure and its
instruction set
• We consider a very basic computer here but it
allows a simple demonstration of the design
process without much complications
4
Instruction Codes
5
Program
• General purpose computer capable of performing
various microoperations whose sequence can be
controlled by the user using a program
• A program is a set of instructions specifying the
operations, the operands and the sequence in
which the processing has to occur
• The processing task may be altered by changing the
instructions or specifying the same instructions on
different data
6
Program (Contd)
• Computer instruction
o Binary code stored together with data in memory
• Each instruction read from the memory and placed
in control register thereby interpreting the
corresponding code and issuing a microoperation
sequence to execute it
• The ability to store and execute instructions is the
most important property of a general purpose
computer
7
Instruction Code
• A group of bits instructing computer to perform a
specific operation
• Usually divided in parts each with a specific meaning
o Most important part is the operation part
o Another part is the operand i.e. some data stored in
memory (address specified) or processor registers (register
specified)
• # of bits required for instruction code depends on the
# of operations available in a computer
o n-bits required for a computer having distinct operations
8
Operation vs.
Microoperation
• Operation is part of instruction stored in memory
• Control unit receives the instruction from memory
and interprets the operation code bits
• It then issues a sequence of control signals to
initiate microoperations in internal computer
registers
• For every operation code, microoperation sequence
issued by control that is needed for HW
implementation of the specified operation
• Thus, operation is sometimes termed
macrooperation 9
Stored Program
Organization
• Simplest instruction code consists of two parts
o 1st part specifies the operation – opcode
o 2nd part specifies the address of the operand
• Instructions stored in one part of memory and data in
another
• For a memory with 4096 words, 12 bits needed for address
• For a 16-bit memory word, 4 bits used for the operation i.e.
16 distinct operations
• 16-bit instruction from program portion read by control and
12-bit address part used to read 16-bit operand from the
data part
o The operation specified by opcode used to process the data
10
Stored Program Organization
(Contd)
11
Addressing Modes
• The address part of the instruction code may
contain different data, each constituting a different
address mode
o If it specifies an operand – immediate operand
o If its specifies the address of an operand – direct
addressing
o If it specifies the address of a memory word carrying the
address of an operand – indirect addressing
• One bit of the instruction code can be used in this
case to distinguish between direct and indirect
addressing mode
12
Direct vs Indirect
Addressing
• Bit 15 used to indicate direct (0) or indirect
addressing (1)
• Indirect address instruction needs two
references to the memory, one for address
of the operand and 2nd for the operand itself
• Effective address: Operand address in
computation-type instruction (b) or the
target address in branch-type instruction (c)
• Effective address is 457 in (b) and 1350 in (c)
• The memory word holding address in
indirect addressing used as a pointer to an
array of data which could be placed in
processor register instead of memory as
done in commercial computers
13
Computer Registers
14
Need for Computer
Registers
• Computer instructions normally stored in
consecutive memory locations and executed
sequentially
o The control unit reads an instruction from memory,
executes it, increments to calculate the next instruction
address after present instruction executed
• A register in control unit is needed for storing
instruction code after it is read from memory
• Processing registers needed for manipulating data
besides a register for holding a memory address
15
Registers in a basic
computer
• 4096 words in memory and each word has 16 bits
• 12 bits for the address and 1 for direct/indirect instruction indication
and hence 3 bits for opcode
• Program counter:
• holds address of the next instruction and thus, has a counting mechanism
• Instructions read in sequence unless a branching instruction calls for a transfer
to a nonconsecutive instruction in the program
• The address part of branch instruction transferred to PC in this case
16
Basic Computer Registers and
Memory
17
Common Bus System
• The basic computer has 8 registers, a memory unit
and a control unit
• Paths must be provided for data transfer from one
register to another or b/w registers and memory
• Bus system described before can be used to do this
in an efficient manner
• A typical common bus system for a basic computer
under our discussion is described here
18
Common
Bus
Connection
19
Memory Address
20
Parallel Read/Write
DR to bus transfer not required as AC reads from Adder and Logic circuit
21
𝐴𝐶←𝐷𝑅
22
Computer Instructions
23
Instruction Format
• The basic computer has three instruction formats
o Memory – reference instruction: 12 bits for the address,
3 bits for the opcode and one bit I for addressing mode
(0:direct, 1:indirect)
o Register – reference instruction: recognized by 111
opcode and 0 in leftmost bit while the 12 bits used for
register operation
o I/O instruction: 111 opcode and 1 in leftmost bit while
12 bits for I/O operation
• 25 basic instructions in the basic computer
24
Basic Computer Instruction
Formats
• Type of instruction
identified by bits in
positions 12-15
25
Hexadecimal Code
Memory – Reference
x’s for 12 address bits
Register – Reference
I/O – Reference
26
Instruction Set
Completeness
• Instruction set complete if user can construct
machine language code for any function known to
be computable
• Instruction set is complete if there are sufficient #
of instructions in each of the categories:
o Arithmetic, Logic and Shift operations
o Instructions for moving info between memory and
processor registers
o Program control instructions and those to check status
conditions
o Input and Output Instructions
27
Summary: Computer
Instructions
28
Next Time
• Basic Computer Organization and Design
o Timing and Control
o Instruction Cycle
o Memory-Reference Instructions
29