Beruflich Dokumente
Kultur Dokumente
Unit 1
sumit
Instruction set architecture
Programmers or a users view of mp.
Contains the set of all assembly language
instructions that it can execute.
Needs to know the accessible registers, their
sizes, and specific instructions which use these
registers.
Interrupts
Information necessary to interact with
memory.
Instruction Set Architecture
Defines any aspects of the processor that an assembly
language programmer needs to know, in order to write a
correct program
Specifies:
The registers accessible to the programmer, their size and the
instructions in the instructions set that can use each register
Information necessary to interact with the memory
Certain microprocessors require instructions to start only at specific
memory locations; this alignment of the instructions will be part of the
instruction architecture
How microprocessor reacts to interrupts
Some microprocessors have interrupts, that cause the processor to stop
what is doing and perform some other preprogrammed functions (interrupt
routines)
Levels of Programming languages
Machine level languages binary level lang
Assembly level languages platform
dependent, have to be assembled and it is
unique.
High Level languages have to be compiled
which is not unique
Instruction Types
Data transfer instructions data unchanged
1. Load data from mem 2.Store data into mem
3. Move data within mp 4. Input data 5. Output data
6. Movement of blocks of data
Data operation instructions
Arithmetic, floating point, logical and shift instructions
Program control instructions
Jumps, call, interrupts, halt
Instruction types (review)
Data Transfer Instructions
operations that move data from one place to another
These instructions dont actually modify the data, they just copy it
to the destination
Data Operation Instructions
Unlike the data transfer instructions, the data operation
instructions do modify their data values
They typically perform some operation using one or two data
values (operands) and store the result
Program Control Instructions
Jump or branch instructions used to go in another part of the
program; the jumps can be absolute (always taken) or conditional
(taken only if some condition is met)
Specific instructions that can generate interrupts (software
interrupts)
Data types (1)
A microprocessor has to operate with multiple data
types;
the designer has to include different instructions to
perform the same operation on different data types
Numeric data representation:
Integer representation
Unsigned representation: n bit value range from 2
n
-1 to 0
Signed representation: n bit value range from -2
n-1
to 2
n -1
-1
Floating point representation
A processor may have special registers and instructions for
floating point data
Data type (2)
Boolean data:
Non zero value is used to represent TRUE and zero
value is used to represent FALSE
Character data
Stored as binary value, encoded using ASCII,
UNICODE, etc
A microprocessor may have instructions to
concatenate strings of characters, replace certain
characters in a string, etc..
Some instruction sets do include instructions to
directly manipulate character data
Instruction formats (1)
An instruction is represented as a binary value with
specific format, called the instruction code
It is made out of different groups of bits, with
different significations:
Opcode represents the operation to be performed (it is
the instruction identifier)
Operands one, two or three represent the operands of
the operation to be performed
A microprocessor can have one format for all the
instructions or can have several different formats
An instruction is represented by a single instruction
code
Morris mano Computer Registers
Register Number Register Register
symbol of bits name Function-----------------------
DR 16 Data register Holds memory operands
AR 12 Address register Holds address for memory
AC 16 Accumulator Processor register
IR 16 Instruction register Holds instruction code
PC 12 Program counter Holds address of instruction
TR 16 Temporary register Holds temporary data
INPR 8 Input register Holds input character
OUTR 8 Output register Holds output character
5-2 Computer Registers
Data Register(DR) : hold the operand(Data) read from memory
Accumulator Register(AC) : general purpose processing register
Instruction Register(IR) : hold the instruction read from
memory
Temporary Register(TR) : hold a temporary data during
processing
Address Register(AR) : hold a memory address, 12 bit width
5-2 Computer Registers
Program Counter(PC) :
hold the address of the next instruction to be read from
memory after the current instruction is executed
Instruction words are read and executed in sequence
unless a branch instruction is encountered
A branch instruction calls for a transfer to a
nonconsecutive instruction in the program
The address part of a branch instruction is transferred to
PC to become the address of the next instruction
To read instruction, memory read cycle is initiated, and
PC is incremented by one(next instruction fetch)
PROCESSOR REGISTERS
Instruction codes
A processor has many registers to hold instructions,
addresses, data, etc
The processor has a register, the Program Counter (PC) that
holds the memory address of the next instruction to get
Since the memory in the Basic Computer only has 4096 locations, the PC
only needs 12 bits
In a direct or indirect addressing, the processor needs to keep
track of what locations in memory it is addressing: The
Address Register (AR) is used for this
The AR is a 12 bit register in the Basic Computer
When an operand is found, using either direct or indirect
addressing, it is placed in the Data Register (DR). The
processor then uses this value as data for its operation
The Basic Computer has a single general purpose register
the Accumulator (AC)
PROCESSOR REGISTERS
Instruction codes
The significance of a general purpose register is that it can be
referred to in instructions
e.g. load AC with the contents of a specific memory location; store the
contents of AC into a specified memory location
Often a processor will need a scratch register to store
intermediate results or other temporary data; in the Basic
Computer this is the Temporary Register (TR)
The Basic Computer uses a very simple model of input/output
(I/O) operations
Input devices are considered to send 8 bits of character data to the processor
The processor can send 8 bits of character data to output devices
The Input Register (INPR) holds an 8 bit character gotten from an
input device
The Output Register (OUTR) holds an 8 bit character to be send
to an output device
BASIC COMPUTER REGISTERS
List of BC Registers
DR 16 Data Register Holds memory operand
AR 12 Address Register Holds address for memory
AC 16 Accumulator Processor register
IR 16 Instruction Register Holds instruction code
PC 12 Program Counter Holds address of instruction
TR 16 Temporary Register Holds temporary data
INPR 8 Input Register Holds input character
OUTR 8 Output Register Holds output character
Registers
Registers in the Basic Computer
11 0
PC
15 0
IR
15 0
TR
7 0
OUTR
15 0
DR
15 0
AC
11 0
AR
INPR
0 7
Memory
4096 x 16
CPU
Instruction formats (2)
The most common fields in instruction formats are:
1. Mode field: Specifies the way the effective address is determined
2. Operation code: Specifies the operations to be performed.
3. Address field: Designates a memory address or a processor
register
Mode Opcode
Address
8.4 Instruction Formats
8.4 Instruction Formats
Zero address instruction: Stack is used. Arithmetic operation
pops two operands from the stack and pushes the result.
One address instructions: AC and memory. Since the
accumulator always provides one operand, only one memory
address needs to be specified.
Two address instructions: Two address registers or two
memory locations are specified, one for the final result.
Three address instructions: Three address registers or
memory locations are specified, one for the final result.
It is also called general address organization.
Zero address instructions
Instruction: ADD
Push and pop operations need to specify one address involved in
data transfer.
Instruction: POP X
Evaluate X = ( A + B ) * ( C + D )
Stack-organized computer does not use an address field for
the instructions ADD, and MUL
PUSH, and POP instructions need an address field to
specify the operand
Zero address instructions
PUSH A
PUSH B
ADD
PUSH C
PUSH D
ADD
MUL
POP X
TOS X
B A D C TOS
D C TOS
D TOS
C TOS
B A TOS
B TOS
A TOS
+ - +
+
) ( ) (
) (
) (
Advantages: No memory addresses needed during the operation.
Disadvantages: results in longer program codes.
One address instructions
One address can be a register name or memory
address.
SINGLE ACCUMULATOR ORGANIZATION
Since the accumulator always provides one operands,
only one memory address needs to be specified.
Instruction: ADD X
Microoperation: AC AC + M[X]
One address instructions
LOAD A
ADD B
STORE T AC T M
B M AC AC
A M AC
] [
] [
] [
All operations are done between the AC register and memory operand
Advantages: fewer bits are needed to specify the address.
Disadvantages: results in writing long programs.
Two address instructions
Assumes that the destination address
is the same as that of the first operand.
Can be a memory address or a register
name.
Instruction: ADD R1, R2
Microoperation: R1 R1 + R2
Two address instructions
MOV R1, A
MOV R2, B
ADD R1, R2
MOV X, R1
1 ] [
2 1 1
] [ 2
] [ 1
R x M
R R R
B M R
A M R