SlideShare a Scribd company logo
1 of 59
Instruction Set: CISC and RISC
Instruction Set: CISC and RISC
 RISC and CISC are two different types of
computer architectures that are used to design
the microprocessors that are found in computers.
 The fundamental difference between RISC and
CISC is that RISC (Reduced Instruction Set
Computer) includes simple instructions and
takes one cycle, while the CISC (Complex
Instruction Set Computer) includes complex
instructions and takes multiple cycles.
RISC
 The RISC architecture uses comparatively a
simple instruction format that is easy to decode.
 The instruction length can be fixed and aligned to
word boundaries. RISC processors can execute
only one instruction per clock cycle.
 RISC architectures are characterized by a small,
simple instruction set and a highly efficient
execution pipeline.
 This allows RISC processors to execute
instructions quickly, but it also means that they
can only perform a limited number of tasks.
Characteristics of a RISC Processor
 A RISC processor has a few instructions.
 RISC processor has a few addressing modes.
 In the RISC processor, all operations are
performed within the registers of the CPU.
 RISC processor can be of fixed-length.
 RISC can be hardwired rather than micro-
programmed control.
 RISC is used for single-cycle instruction
execution.
 RISC processor has easily decodable instruction
format.
CISC
 The CISC architecture comprises a complex
instruction set.
 A CISC processor has a variable-length
instruction format. In this processor architecture,
the instructions that require register operands
can take only two bytes.
 In a CISC processor architecture, the instructions
which require two memory addresses can take
five bytes to comprise the complete instruction
code.
 Therefore, in a CISC processor, the execution of
instructions may take a varying number of clock
cycles.
CISC
 The primary objective of the CISC processor
architecture is to support a single machine
instruction for each statement that is written in a
high-level programming language.
 CISC architectures have a large, complex
instruction set and a less efficient execution
pipeline.
 This allows CISC processors to perform a wider
range of tasks, but they are not as fast as RISC
processors when executing instructions.
Characteristics of a CISC processor
 CISC can have variable-length instruction
formats.
 It supports a set of a large number of
instructions, typically from 100 to 250
instructions.
 It has a large variety of addressing modes,
typically from 5 to 20 different modes.
 CISC has some instructions which perform
specialized tasks and are used infrequently.
Difference between RISC and CISC
S.No RISC CISC
1.
It stands for Reduced Instruction
Set Computer.
It stands for Complex Instruction
Set Computer.
2.
It is a microprocessor architecture
that uses small instruction set of
uniform length.
This offers hundreds of
instructions of different sizes to the
users.
3.
These simple instructions are
executed in one clock cycle.
This architecture has a set of
special purpose circuits which help
execute the instructions at a high
speed.
4.
These chips are relatively simple to
design.
These chips are complex to design.
5. They are inexpensive. They are relatively expensive.
6.
Examples of RISC chips include
SPARC, POWER PC.
Examples of CISC include Intel
architecture, AMD.
Difference between RISC and CISC
S.No RISC CISC
7.
It has less number of instructions. It has more number of
instructions.
8.
It has fixed-length encodings for
instructions.
It has variable-length encodings of
instructions.
9.
Simple addressing formats are
supported.
The instructions interact with
memory using complex addressing
modes.
10.
It doesn't support arrays. It has a large number of
instructions. It supports arrays.
11. It doesn't use condition codes. Condition codes are used.
12.
Registers are used for procedure
arguments and return addresses.
The stack is used for procedure
arguments and return addresses.
Memory Locations, Addresses, and
Operations
Memory Location, Addresses, and
Operation
 Memory consists
of many millions of
storage cells, each
of which can store
1 bit.
 Data is usually
accessed in n-bit
groups. n is called
word length.
second word
first word
Figure 2.5. Memory words.
nbits
last word
i th word
•
•
•
•
•
•
Memory Location, Addresses, and
Operation
 32-bit word length example
(b) Four characters
character
character
character character
(a) A signed integer
Sign bit: for positive numbers
for negative numbers
ASCII
ASCII
ASCII
ASCII
32 bits
8 bits 8 bits 8 bits 8 bits
b31 b30 b1 b0
b31 0
=
b31 1
=
•
•
•
Memory Location, Addresses, and
Operation
 To retrieve information from memory, either for
one word or one byte (8-bit), addresses for each
location are needed.
 A k-bit address memory has 2k memory locations,
namely 0 – 2k-1, called memory space.
 24-bit memory: 224 = 16,777,216 = 16M (1M=220)
 32-bit memory: 232 = 4G (1G=230)
 1K(kilo)=210
 1T(tera)=240
Memory Location, Addresses, and
Operation
 It is impractical to assign distinct addresses to
individual bit locations in the memory.
 The most practical assignment is to have
successive addresses refer to successive byte
locations in the memory – byte-addressable
memory.
 Byte locations have addresses 0, 1, 2, … If word
length is 32 bits, they successive words are
located at addresses 0, 4, 8,…
Big-Endian and Little-Endian
Assignments
2
k
4
- 2
k
3
- 2
k
2
- 2
k
1
- 2
k
4
-
2
k
4
-
0 1 2 3
4 5 6 7
0
0
4
2
k
1
- 2
k
2
- 2
k
3
- 2
k
4
-
3 2 1 0
7 6 5 4
Byte address
Byte address
(a) Big-endian assignment (b) Little-endian assignment
4
Word
address
•
•
•
•
•
•
Figure 2.7. Byte and word addressing.
Big-Endian: lower byte addresses are used for the most significant bytes of the word
Little-Endian: opposite ordering. lower byte addresses are used for the less significant
bytes of the word
Memory Location, Addresses, and
Operation
 Address ordering of bytes
 Word alignment
 Words are said to be aligned in memory if they
begin at a byte addr. that is a multiple of the num of
bytes in a word.
 16-bit word: word addresses: 0, 2, 4,….
 32-bit word: word addresses: 0, 4, 8,….
 64-bit word: word addresses: 0, 8,16,….
 Access numbers, characters, and character
strings
Memory Operation
 Load (or Read or Fetch)
 Copy the content. The memory content doesn’t
change.
 Address – Load
 Registers can be used
 Store (or Write)
 Overwrite the content in memory
 Address and Data – Store
 Registers can be used
Instruction and Instruction
Sequencing
“Must-Perform” Operations
 Data transfers between the memory and the
processor registers
 Arithmetic and logic operations on data
 Program sequencing and control
 I/O transfers
Register Transfer Notation
 Identify a location by a symbolic name standing
for its hardware binary address (LOC, R0,…)
 Contents of a location are denoted by placing
square brackets around the name of the location
(R1←[LOC], R3 ←[R1]+[R2])
 Register Transfer Notation (RTN)
Assembly Language Notation
 Represent machine instructions and programs.
 Load R1,LOC = R1←[LOC]
 Add R3, R1, R2 = R3 ←[R1]+[R2]
CPU Organization
 Single Accumulator
 Result usually goes to the Accumulator
 Accumulator has to be saved to memory quite often
 General Register
 Registers hold operands thus reduce memory traffic
 Register bookkeeping
 Stack
 Operands and result are always in the stack
Instruction Formats
 Three-Address Instructions
 ADD R1, R2, R3 R1 ← R2 + R3
 Two-Address Instructions
 ADD R1, R2 R1 ← R1 + R2
 One-Address Instructions
 ADD M AC ← AC + M[AR]
 Zero-Address Instructions
 ADD TOS ← TOS + (TOS – 1)
 RISC Instructions
 Lots of registers. Memory is restricted to Load & Store
Opcode Operand(s) or Address(es)
Instruction Formats
Example: Evaluate (A+B)  (C+D)
 Three-Address
1. ADD R1, A, B ; R1 ← M[A] + M[B]
2. ADD R2, C, D ; R2 ← M[C] + M[D]
3. MUL X, R1, R2 ; M[X] ← R1  R2
Instruction Formats
Example: Evaluate (A+B)  (C+D)
 Two-Address
1. LOAD R1, A ; R1 ← M[A]
2. ADD R1, B ; R1 ← R1 + M[B]
3. LOAD R2, C ; R2 ← M[C]
4. ADD R2, D ; R2 ← R2 + M[D]
5. MUL R1, R2 ; R1 ← R1  R2
6. STORE R1,X ; M[X] ← R1
Instruction Formats
Example: Evaluate (A+B)  (C+D)
 One-Address
1. LOAD A ; AC ← M[A]
2. ADD B ; AC ← AC + M[B]
3. STORE T ; M[T] ← AC
4. LOAD C ; AC ← M[C]
5. ADD D ; AC ← AC + M[D]
6. MUL T ; AC ← AC  M[T]
7. STORE X ; M[X] ← AC
Instruction Formats
Example: Evaluate (A+B)  (C+D)
 Zero-Address
1. PUSH A ; TOS ← A
2. PUSH B ; TOS ← B
3. ADD ; TOS ← (A + B)
4. PUSH C ; TOS ← C
5. PUSH D ; TOS ← D
6. ADD ; TOS ← (C + D)
7. MUL ; TOS ← (C+D)(A+B)
8. POP X ; M[X] ← TOS
Instruction Formats
Example: Evaluate (A+B)  (C+D)
 RISC
1. LOAD R1, A ; R1 ← M[A]
2. LOAD R2, B ; R2 ← M[B]
3. LOAD R3, C ; R3 ← M[C]
4. LOAD R4, D ; R4 ← M[D]
5. ADD R1, R1, R2 ; R1 ← R1 + R2
6. ADD R3, R3, R4 ; R3 ← R3 + R4
7. MUL R1, R1, R3 ; R1 ← R1  R3
8. STORE R1,X ; M[X] ← R1
Using Registers
 Registers are faster
 Shorter instructions
 The number of registers is smaller (e.g. 32 registers
need 5 bits)
 Potential speedup
 Minimize the frequency with which data is moved
back and forth between the memory and
processor registers.
Instruction Execution and Straight-
Line Sequencing
Assumptions:
- One memory operand
per instruction
- 32-bit word length
- Memory is byte
addressable
- Full memory address
can be directly specified
in a single-word instruction
Two-phase procedure
-Instruction fetch
-Instruction execute
Page 43
Branching
A straight-line program for adding n numbers.
Branching
n
Figure 2.10. Using a loop to add n numbers.
Branch target
Conditional branch
Condition Codes
 Condition code flags
 Condition code register / status register
 N (negative)
 Z (zero)
 V (overflow)
 C (carry)
 Different instructions affect different flags
Conditional Branch Instructions
 Example:
 A: 1 1 1 1 0 0 0 0
 B: 0 0 0 1 0 1 0 0
A: 1 1 1 1 0 0 0 0
+(−B): 1 1 1 0 1 1 0 0
1 1 0 1 1 1 0 0
C = 1
S = 1
V = 0
Z = 0
Status Bits
ALU
V Z S C
Zero Check
Cn
Cn-1
Fn-1
A B
F
Addressing Modes
Generating Memory Addresses
 How to specify the address of branch target?
 Can we give the memory operand address
directly in a single Add instruction in the loop?
 Use a register to hold the address of NUM1; then
increment by 4 on each pass through the loop.
Addressing Modes
Addressing Modes
 Implied
 AC is implied in “ADD M[AR]” in “One-Address” instr.
 TOS is implied in “ADD” in “Zero-Address” instr.
 Immediate
 The use of a constant in “MOVE R1, #5”, i.e. R1 ← 5
Add R4,R6,#200
 Register
 Indicate which register holds the operand
Add R4,R2,R3
• Absolute Mode – Operand is in memory Location
Load R3, NUM1
Opcode Mode ...
Addressing Modes
 Register Indirect
 Indicate the register that holds the number of the
register that holds the operand
MOVE R1, (R2)
 Autoincrement / Autodecrement
 Access & update in 1 instr.
R1
R2 = 3
R3 = 5
Addressing Modes
 Indirect Address and Pointers
 Indicate the memory location that holds the address of
the memory location that holds the data
 The effective address of the operand is the contents of a
register that is specified in the instruction.
AR = 101
100
101
102
103
104
0 1 0 4
1 1 0 A
Addressing Modes
Pointers
 As another example of pointers, consider the C-
language statement
 A = *B;
 where B is a pointer variable and the ‘*’ symbol is the
operator for indirect accesses. This statement causes
the contents of the memory location pointed to by B to
be loaded into
 memory location A. The statement may be compiled
into
 Load R2, B
 Load R3, (R2)
 Store R3, A
 Indirect addressing through registers is used
100
101
102
103
104
0
1
2
Addressing Modes
 Relative Address
 EA = PC + Relative Addr
AR = 100
1 1 0 A
PC = 2
+
Could be Positive or
Negative
(2’s Complement)
Addressing Modes
 Indexed
 EA = Index Register + Relative Addr
100
101
102
103
104
AR = 100
1 1 0 A
XR = 2
+
Could be Positive or
Negative
(2’s Complement)
Useful with
“Autoincrement” or
“Autodecrement”
Addressing Modes
 Base Register
 EA = Base Register + Relative Addr
100
101
102
103
104
BR = 100
0 0 0 A
AR = 2
+
Could be Positive or
Negative
(2’s Complement)
Usually points to
the beginning of
an array
0 0 0 5
0 0 1 2
0 1 0 7
0 0 5 9
Addressing Modes
 The different
ways in which
the location of
an operand is
specified in an
instruction are
referred to as
addressing
modes.
Name Assembler syntax Addressingfunction
Immediate #Value Operand = Value
Register Ri EA = Ri
Absolute(Direct) LOC EA = LOC
Indirect (Ri ) EA = [Ri ]
(LOC) EA = [LOC]
Index X(Ri) EA = [Ri ] + X
Basewith index (Ri ,Rj ) EA = [Ri ] + [Rj ]
Basewith index X(Ri,Rj ) EA = [Ri ] + [Rj ] + X
and offset
Relative X(PC) EA = [PC] + X
Autoincrement (Ri )+ EA = [Ri ] ;
Increment Ri
Autodecrement (Ri ) Decrement Ri ;
EA = [Ri]

Indexing and Arrays
 Index mode – the effective address of the
operand is generated by adding a constant value
to the contents of a register.
 Index register
 X(Ri): EA = X + [Ri]
 The constant X may be given either as an explicit
number or as a symbolic name representing a
numerical value.
 If X is shorter than a word, sign-extension is
needed.
Indexing and Arrays
Indexing and Arrays
 In general, the Index mode facilitates access to
an operand whose location is defined relative to a
reference point within the data structure in which
the operand appears.
 Several variations:
(Ri, Rj): EA = [Ri] + [Rj]
X(Ri, Rj): EA = X + [Ri] + [Rj]
Relative Addressing
 Relative mode – the effective address is
determined by the Index mode using the program
counter in place of the general-purpose register.
 X(PC) – note that X is a signed number
 Branch>0 LOOP
 This location is computed by specifying it as an
offset from the current value of PC.
 Branch target may be either before or after the
branch instruction, the offset is given as a singed
num.
Additional Modes
 Autoincrement mode – the effective address of the operand is the
contents of a register specified in the instruction. After accessing
the operand, the contents of this register are automatically
incremented to point to the next item in a list.
 (Ri)+. The increment is 1 for byte-sized operands, 2 for 16-bit
operands, and 4 for 32-bit operands.
 Autodecrement mode: -(Ri) – decrement first
R0
Clear
R0,SUM
R1
(R2)+,R0
Figure 2.16. The Autoincrement addressing mode used in the program of Figure 2.12.
Initialization
Move
LOOP Add
Decrement
LOOP
#NUM1,R2
N,R1
Move
Move
Branch>0
Basic Input/Output Operations
I/O
 The data on which the instructions operate are
not necessarily already stored in memory.
 Data need to be transferred between processor
and outside world (disk, keyboard, etc.)
 I/O operations are essential, the way they are
performed can have a significant effect on the
performance of the computer.
Program-Controlled I/O Example
 Read in character input from a keyboard and
produce character output on a display screen.
 Rate of data transfer (keyboard, display, processor)
 Difference in speed between processor and I/O
device creates the need for mechanisms to
synchronize the transfer of data.
 A solution: on output, the processor sends the first
character and then waits for a signal from the display
that the character has been received. It then sends
the second character. Input is sent from the keyboard
in a similar way.
Program-Controlled I/O Example
DATAIN DATAOUT
SIN SOUT
Key board Display
Bus
Figure 2.19 Bus connection for processor
, keyboard, and display
.
Processor
- Registers
- Flags
- Device interface
Program-Controlled I/O Example
 Machine instructions that can check the state of
the status flags and transfer data:
READWAIT Branch to READWAIT if SIN = 0
Input from DATAIN to R1
WRITEWAIT Branch to WRITEWAIT if SOUT = 0
Output from R1 to DATAOUT
Program-Controlled I/O Example
 Memory-Mapped I/O – some memory address
values are used to refer to peripheral device
buffer registers. No special instructions are
needed. Also use device status registers.
READWAIT Testbit #3, INSTATUS
Branch=0 READWAIT
MoveByte DATAIN, R1
Program-Controlled I/O Example
 Assumption – the initial state of SIN is 0 and the initial
state of SOUT is 1.
 Any drawback of this mechanism in terms of efficiency?
 Two wait loopsprocessor execution time is wasted
 Alternate solution?
 Interrupt
THANK YOU

More Related Content

Similar to Instruction set.pptx

Session01_Intro.pdf
Session01_Intro.pdfSession01_Intro.pdf
Session01_Intro.pdfRahnerJames
 
Introduction to computer architecture .pptx
Introduction to computer architecture .pptxIntroduction to computer architecture .pptx
Introduction to computer architecture .pptxFatma Sayed Ibrahim
 
Introduction to Computer Architecture
Introduction to Computer ArchitectureIntroduction to Computer Architecture
Introduction to Computer ArchitectureKSundarAPIICSE
 
Introduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorIntroduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorDarling Jemima
 
CA_mod05_ISA.ppt
CA_mod05_ISA.pptCA_mod05_ISA.ppt
CA_mod05_ISA.pptomgbaldguy
 
other-architectures.ppt
other-architectures.pptother-architectures.ppt
other-architectures.pptJaya Chavan
 
Chapter 02 instructions language of the computer
Chapter 02   instructions language of the computerChapter 02   instructions language of the computer
Chapter 02 instructions language of the computerBảo Hoang
 
Arm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.pptArm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.pptManju Badiger
 
Computer organization basics
Computer organization  basicsComputer organization  basics
Computer organization basicsDeepak John
 
Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2Khaja Dileef
 
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Gaditek
 
Tema2_ArchitectureMIPS.pptx
Tema2_ArchitectureMIPS.pptxTema2_ArchitectureMIPS.pptx
Tema2_ArchitectureMIPS.pptxgopikahari7
 
05 instruction set design and architecture
05 instruction set design and architecture05 instruction set design and architecture
05 instruction set design and architectureWaqar Jamil
 

Similar to Instruction set.pptx (20)

Session01_Intro.pdf
Session01_Intro.pdfSession01_Intro.pdf
Session01_Intro.pdf
 
Introduction to computer architecture .pptx
Introduction to computer architecture .pptxIntroduction to computer architecture .pptx
Introduction to computer architecture .pptx
 
Introduction to Computer Architecture
Introduction to Computer ArchitectureIntroduction to Computer Architecture
Introduction to Computer Architecture
 
Instruction codes
Instruction codesInstruction codes
Instruction codes
 
Introduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorIntroduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM Processor
 
CO_Chapter2.ppt
CO_Chapter2.pptCO_Chapter2.ppt
CO_Chapter2.ppt
 
CA_mod05_ISA.ppt
CA_mod05_ISA.pptCA_mod05_ISA.ppt
CA_mod05_ISA.ppt
 
Lecture9
Lecture9Lecture9
Lecture9
 
Assembly.ppt
Assembly.pptAssembly.ppt
Assembly.ppt
 
other-architectures.ppt
other-architectures.pptother-architectures.ppt
other-architectures.ppt
 
Chapter 02 instructions language of the computer
Chapter 02   instructions language of the computerChapter 02   instructions language of the computer
Chapter 02 instructions language of the computer
 
Arm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.pptArm Cortex material Arm Cortex material3222886.ppt
Arm Cortex material Arm Cortex material3222886.ppt
 
Computer organization basics
Computer organization  basicsComputer organization  basics
Computer organization basics
 
Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2
 
ISA.pptx
ISA.pptxISA.pptx
ISA.pptx
 
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)
 
80x86_2.pdf
80x86_2.pdf80x86_2.pdf
80x86_2.pdf
 
Tema2_ArchitectureMIPS.pptx
Tema2_ArchitectureMIPS.pptxTema2_ArchitectureMIPS.pptx
Tema2_ArchitectureMIPS.pptx
 
05 instruction set design and architecture
05 instruction set design and architecture05 instruction set design and architecture
05 instruction set design and architecture
 
Kirby, Fabro
Kirby, FabroKirby, Fabro
Kirby, Fabro
 

Recently uploaded

Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 

Recently uploaded (20)

Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 

Instruction set.pptx

  • 2. Instruction Set: CISC and RISC  RISC and CISC are two different types of computer architectures that are used to design the microprocessors that are found in computers.  The fundamental difference between RISC and CISC is that RISC (Reduced Instruction Set Computer) includes simple instructions and takes one cycle, while the CISC (Complex Instruction Set Computer) includes complex instructions and takes multiple cycles.
  • 3. RISC  The RISC architecture uses comparatively a simple instruction format that is easy to decode.  The instruction length can be fixed and aligned to word boundaries. RISC processors can execute only one instruction per clock cycle.  RISC architectures are characterized by a small, simple instruction set and a highly efficient execution pipeline.  This allows RISC processors to execute instructions quickly, but it also means that they can only perform a limited number of tasks.
  • 4. Characteristics of a RISC Processor  A RISC processor has a few instructions.  RISC processor has a few addressing modes.  In the RISC processor, all operations are performed within the registers of the CPU.  RISC processor can be of fixed-length.  RISC can be hardwired rather than micro- programmed control.  RISC is used for single-cycle instruction execution.  RISC processor has easily decodable instruction format.
  • 5. CISC  The CISC architecture comprises a complex instruction set.  A CISC processor has a variable-length instruction format. In this processor architecture, the instructions that require register operands can take only two bytes.  In a CISC processor architecture, the instructions which require two memory addresses can take five bytes to comprise the complete instruction code.  Therefore, in a CISC processor, the execution of instructions may take a varying number of clock cycles.
  • 6. CISC  The primary objective of the CISC processor architecture is to support a single machine instruction for each statement that is written in a high-level programming language.  CISC architectures have a large, complex instruction set and a less efficient execution pipeline.  This allows CISC processors to perform a wider range of tasks, but they are not as fast as RISC processors when executing instructions.
  • 7. Characteristics of a CISC processor  CISC can have variable-length instruction formats.  It supports a set of a large number of instructions, typically from 100 to 250 instructions.  It has a large variety of addressing modes, typically from 5 to 20 different modes.  CISC has some instructions which perform specialized tasks and are used infrequently.
  • 8. Difference between RISC and CISC S.No RISC CISC 1. It stands for Reduced Instruction Set Computer. It stands for Complex Instruction Set Computer. 2. It is a microprocessor architecture that uses small instruction set of uniform length. This offers hundreds of instructions of different sizes to the users. 3. These simple instructions are executed in one clock cycle. This architecture has a set of special purpose circuits which help execute the instructions at a high speed. 4. These chips are relatively simple to design. These chips are complex to design. 5. They are inexpensive. They are relatively expensive. 6. Examples of RISC chips include SPARC, POWER PC. Examples of CISC include Intel architecture, AMD.
  • 9. Difference between RISC and CISC S.No RISC CISC 7. It has less number of instructions. It has more number of instructions. 8. It has fixed-length encodings for instructions. It has variable-length encodings of instructions. 9. Simple addressing formats are supported. The instructions interact with memory using complex addressing modes. 10. It doesn't support arrays. It has a large number of instructions. It supports arrays. 11. It doesn't use condition codes. Condition codes are used. 12. Registers are used for procedure arguments and return addresses. The stack is used for procedure arguments and return addresses.
  • 11. Memory Location, Addresses, and Operation  Memory consists of many millions of storage cells, each of which can store 1 bit.  Data is usually accessed in n-bit groups. n is called word length. second word first word Figure 2.5. Memory words. nbits last word i th word • • • • • •
  • 12. Memory Location, Addresses, and Operation  32-bit word length example (b) Four characters character character character character (a) A signed integer Sign bit: for positive numbers for negative numbers ASCII ASCII ASCII ASCII 32 bits 8 bits 8 bits 8 bits 8 bits b31 b30 b1 b0 b31 0 = b31 1 = • • •
  • 13. Memory Location, Addresses, and Operation  To retrieve information from memory, either for one word or one byte (8-bit), addresses for each location are needed.  A k-bit address memory has 2k memory locations, namely 0 – 2k-1, called memory space.  24-bit memory: 224 = 16,777,216 = 16M (1M=220)  32-bit memory: 232 = 4G (1G=230)  1K(kilo)=210  1T(tera)=240
  • 14. Memory Location, Addresses, and Operation  It is impractical to assign distinct addresses to individual bit locations in the memory.  The most practical assignment is to have successive addresses refer to successive byte locations in the memory – byte-addressable memory.  Byte locations have addresses 0, 1, 2, … If word length is 32 bits, they successive words are located at addresses 0, 4, 8,…
  • 15. Big-Endian and Little-Endian Assignments 2 k 4 - 2 k 3 - 2 k 2 - 2 k 1 - 2 k 4 - 2 k 4 - 0 1 2 3 4 5 6 7 0 0 4 2 k 1 - 2 k 2 - 2 k 3 - 2 k 4 - 3 2 1 0 7 6 5 4 Byte address Byte address (a) Big-endian assignment (b) Little-endian assignment 4 Word address • • • • • • Figure 2.7. Byte and word addressing. Big-Endian: lower byte addresses are used for the most significant bytes of the word Little-Endian: opposite ordering. lower byte addresses are used for the less significant bytes of the word
  • 16. Memory Location, Addresses, and Operation  Address ordering of bytes  Word alignment  Words are said to be aligned in memory if they begin at a byte addr. that is a multiple of the num of bytes in a word.  16-bit word: word addresses: 0, 2, 4,….  32-bit word: word addresses: 0, 4, 8,….  64-bit word: word addresses: 0, 8,16,….  Access numbers, characters, and character strings
  • 17. Memory Operation  Load (or Read or Fetch)  Copy the content. The memory content doesn’t change.  Address – Load  Registers can be used  Store (or Write)  Overwrite the content in memory  Address and Data – Store  Registers can be used
  • 19. “Must-Perform” Operations  Data transfers between the memory and the processor registers  Arithmetic and logic operations on data  Program sequencing and control  I/O transfers
  • 20. Register Transfer Notation  Identify a location by a symbolic name standing for its hardware binary address (LOC, R0,…)  Contents of a location are denoted by placing square brackets around the name of the location (R1←[LOC], R3 ←[R1]+[R2])  Register Transfer Notation (RTN)
  • 21. Assembly Language Notation  Represent machine instructions and programs.  Load R1,LOC = R1←[LOC]  Add R3, R1, R2 = R3 ←[R1]+[R2]
  • 22. CPU Organization  Single Accumulator  Result usually goes to the Accumulator  Accumulator has to be saved to memory quite often  General Register  Registers hold operands thus reduce memory traffic  Register bookkeeping  Stack  Operands and result are always in the stack
  • 23. Instruction Formats  Three-Address Instructions  ADD R1, R2, R3 R1 ← R2 + R3  Two-Address Instructions  ADD R1, R2 R1 ← R1 + R2  One-Address Instructions  ADD M AC ← AC + M[AR]  Zero-Address Instructions  ADD TOS ← TOS + (TOS – 1)  RISC Instructions  Lots of registers. Memory is restricted to Load & Store Opcode Operand(s) or Address(es)
  • 24. Instruction Formats Example: Evaluate (A+B)  (C+D)  Three-Address 1. ADD R1, A, B ; R1 ← M[A] + M[B] 2. ADD R2, C, D ; R2 ← M[C] + M[D] 3. MUL X, R1, R2 ; M[X] ← R1  R2
  • 25. Instruction Formats Example: Evaluate (A+B)  (C+D)  Two-Address 1. LOAD R1, A ; R1 ← M[A] 2. ADD R1, B ; R1 ← R1 + M[B] 3. LOAD R2, C ; R2 ← M[C] 4. ADD R2, D ; R2 ← R2 + M[D] 5. MUL R1, R2 ; R1 ← R1  R2 6. STORE R1,X ; M[X] ← R1
  • 26. Instruction Formats Example: Evaluate (A+B)  (C+D)  One-Address 1. LOAD A ; AC ← M[A] 2. ADD B ; AC ← AC + M[B] 3. STORE T ; M[T] ← AC 4. LOAD C ; AC ← M[C] 5. ADD D ; AC ← AC + M[D] 6. MUL T ; AC ← AC  M[T] 7. STORE X ; M[X] ← AC
  • 27. Instruction Formats Example: Evaluate (A+B)  (C+D)  Zero-Address 1. PUSH A ; TOS ← A 2. PUSH B ; TOS ← B 3. ADD ; TOS ← (A + B) 4. PUSH C ; TOS ← C 5. PUSH D ; TOS ← D 6. ADD ; TOS ← (C + D) 7. MUL ; TOS ← (C+D)(A+B) 8. POP X ; M[X] ← TOS
  • 28. Instruction Formats Example: Evaluate (A+B)  (C+D)  RISC 1. LOAD R1, A ; R1 ← M[A] 2. LOAD R2, B ; R2 ← M[B] 3. LOAD R3, C ; R3 ← M[C] 4. LOAD R4, D ; R4 ← M[D] 5. ADD R1, R1, R2 ; R1 ← R1 + R2 6. ADD R3, R3, R4 ; R3 ← R3 + R4 7. MUL R1, R1, R3 ; R1 ← R1  R3 8. STORE R1,X ; M[X] ← R1
  • 29. Using Registers  Registers are faster  Shorter instructions  The number of registers is smaller (e.g. 32 registers need 5 bits)  Potential speedup  Minimize the frequency with which data is moved back and forth between the memory and processor registers.
  • 30. Instruction Execution and Straight- Line Sequencing Assumptions: - One memory operand per instruction - 32-bit word length - Memory is byte addressable - Full memory address can be directly specified in a single-word instruction Two-phase procedure -Instruction fetch -Instruction execute Page 43
  • 31. Branching A straight-line program for adding n numbers.
  • 32. Branching n Figure 2.10. Using a loop to add n numbers. Branch target Conditional branch
  • 33. Condition Codes  Condition code flags  Condition code register / status register  N (negative)  Z (zero)  V (overflow)  C (carry)  Different instructions affect different flags
  • 34. Conditional Branch Instructions  Example:  A: 1 1 1 1 0 0 0 0  B: 0 0 0 1 0 1 0 0 A: 1 1 1 1 0 0 0 0 +(−B): 1 1 1 0 1 1 0 0 1 1 0 1 1 1 0 0 C = 1 S = 1 V = 0 Z = 0
  • 35. Status Bits ALU V Z S C Zero Check Cn Cn-1 Fn-1 A B F
  • 37. Generating Memory Addresses  How to specify the address of branch target?  Can we give the memory operand address directly in a single Add instruction in the loop?  Use a register to hold the address of NUM1; then increment by 4 on each pass through the loop.
  • 39. Addressing Modes  Implied  AC is implied in “ADD M[AR]” in “One-Address” instr.  TOS is implied in “ADD” in “Zero-Address” instr.  Immediate  The use of a constant in “MOVE R1, #5”, i.e. R1 ← 5 Add R4,R6,#200  Register  Indicate which register holds the operand Add R4,R2,R3 • Absolute Mode – Operand is in memory Location Load R3, NUM1 Opcode Mode ...
  • 40. Addressing Modes  Register Indirect  Indicate the register that holds the number of the register that holds the operand MOVE R1, (R2)  Autoincrement / Autodecrement  Access & update in 1 instr. R1 R2 = 3 R3 = 5
  • 41. Addressing Modes  Indirect Address and Pointers  Indicate the memory location that holds the address of the memory location that holds the data  The effective address of the operand is the contents of a register that is specified in the instruction. AR = 101 100 101 102 103 104 0 1 0 4 1 1 0 A
  • 42. Addressing Modes Pointers  As another example of pointers, consider the C- language statement  A = *B;  where B is a pointer variable and the ‘*’ symbol is the operator for indirect accesses. This statement causes the contents of the memory location pointed to by B to be loaded into  memory location A. The statement may be compiled into  Load R2, B  Load R3, (R2)  Store R3, A  Indirect addressing through registers is used
  • 43. 100 101 102 103 104 0 1 2 Addressing Modes  Relative Address  EA = PC + Relative Addr AR = 100 1 1 0 A PC = 2 + Could be Positive or Negative (2’s Complement)
  • 44. Addressing Modes  Indexed  EA = Index Register + Relative Addr 100 101 102 103 104 AR = 100 1 1 0 A XR = 2 + Could be Positive or Negative (2’s Complement) Useful with “Autoincrement” or “Autodecrement”
  • 45. Addressing Modes  Base Register  EA = Base Register + Relative Addr 100 101 102 103 104 BR = 100 0 0 0 A AR = 2 + Could be Positive or Negative (2’s Complement) Usually points to the beginning of an array 0 0 0 5 0 0 1 2 0 1 0 7 0 0 5 9
  • 46. Addressing Modes  The different ways in which the location of an operand is specified in an instruction are referred to as addressing modes. Name Assembler syntax Addressingfunction Immediate #Value Operand = Value Register Ri EA = Ri Absolute(Direct) LOC EA = LOC Indirect (Ri ) EA = [Ri ] (LOC) EA = [LOC] Index X(Ri) EA = [Ri ] + X Basewith index (Ri ,Rj ) EA = [Ri ] + [Rj ] Basewith index X(Ri,Rj ) EA = [Ri ] + [Rj ] + X and offset Relative X(PC) EA = [PC] + X Autoincrement (Ri )+ EA = [Ri ] ; Increment Ri Autodecrement (Ri ) Decrement Ri ; EA = [Ri] 
  • 47. Indexing and Arrays  Index mode – the effective address of the operand is generated by adding a constant value to the contents of a register.  Index register  X(Ri): EA = X + [Ri]  The constant X may be given either as an explicit number or as a symbolic name representing a numerical value.  If X is shorter than a word, sign-extension is needed.
  • 49. Indexing and Arrays  In general, the Index mode facilitates access to an operand whose location is defined relative to a reference point within the data structure in which the operand appears.  Several variations: (Ri, Rj): EA = [Ri] + [Rj] X(Ri, Rj): EA = X + [Ri] + [Rj]
  • 50. Relative Addressing  Relative mode – the effective address is determined by the Index mode using the program counter in place of the general-purpose register.  X(PC) – note that X is a signed number  Branch>0 LOOP  This location is computed by specifying it as an offset from the current value of PC.  Branch target may be either before or after the branch instruction, the offset is given as a singed num.
  • 51. Additional Modes  Autoincrement mode – the effective address of the operand is the contents of a register specified in the instruction. After accessing the operand, the contents of this register are automatically incremented to point to the next item in a list.  (Ri)+. The increment is 1 for byte-sized operands, 2 for 16-bit operands, and 4 for 32-bit operands.  Autodecrement mode: -(Ri) – decrement first R0 Clear R0,SUM R1 (R2)+,R0 Figure 2.16. The Autoincrement addressing mode used in the program of Figure 2.12. Initialization Move LOOP Add Decrement LOOP #NUM1,R2 N,R1 Move Move Branch>0
  • 53. I/O  The data on which the instructions operate are not necessarily already stored in memory.  Data need to be transferred between processor and outside world (disk, keyboard, etc.)  I/O operations are essential, the way they are performed can have a significant effect on the performance of the computer.
  • 54. Program-Controlled I/O Example  Read in character input from a keyboard and produce character output on a display screen.  Rate of data transfer (keyboard, display, processor)  Difference in speed between processor and I/O device creates the need for mechanisms to synchronize the transfer of data.  A solution: on output, the processor sends the first character and then waits for a signal from the display that the character has been received. It then sends the second character. Input is sent from the keyboard in a similar way.
  • 55. Program-Controlled I/O Example DATAIN DATAOUT SIN SOUT Key board Display Bus Figure 2.19 Bus connection for processor , keyboard, and display . Processor - Registers - Flags - Device interface
  • 56. Program-Controlled I/O Example  Machine instructions that can check the state of the status flags and transfer data: READWAIT Branch to READWAIT if SIN = 0 Input from DATAIN to R1 WRITEWAIT Branch to WRITEWAIT if SOUT = 0 Output from R1 to DATAOUT
  • 57. Program-Controlled I/O Example  Memory-Mapped I/O – some memory address values are used to refer to peripheral device buffer registers. No special instructions are needed. Also use device status registers. READWAIT Testbit #3, INSTATUS Branch=0 READWAIT MoveByte DATAIN, R1
  • 58. Program-Controlled I/O Example  Assumption – the initial state of SIN is 0 and the initial state of SOUT is 1.  Any drawback of this mechanism in terms of efficiency?  Two wait loopsprocessor execution time is wasted  Alternate solution?  Interrupt