RISC and CISC Architecture
RISC is the way to make hardware simpler whereas CISC is the single
instruction that handles multiple work. In this article, we are going to discuss
RISC and CISC in detail as well as the Difference between RISC and CISC,
Let’s proceed with RISC first.
Reduced Instruction Set Architecture (RISC)
The main idea behind this is to simplify hardware by using an instruction set
composed of a few basic steps for loading, evaluating, and storing operations
just like a load command will load data, a store command will store the data.
Characteristics of RISC
Simpler instruction, hence simple instruction decoding.
Instruction comes undersize of one word.
Instruction takes a single clock cycle to get executed.
More general-purpose registers.
Simple Addressing Modes.
Fewer Data types.
A pipeline can be achieved.
Advantages of RISC
Simpler instructions: RISC processors use a smaller set of simple
instructions, which makes them easier to decode and execute quickly. This
results in faster processing times.
Faster execution: Because RISC processors have a simpler instruction set,
they can execute instructions faster than CISC processors.
Lower power consumption: RISC processors consume less power than
CISC processors, making them ideal for portable devices.
Disadvantages of RISC
More instructions required: RISC processors require more instructions to
perform complex tasks than CISC processors.
Increased memory usage: RISC processors require more memory to store
the additional instructions needed to perform complex tasks.
Higher cost: Developing and manufacturing RISC processors can be more
expensive than CISC processors.
Complex Instruction Set Architecture (CISC)
The main idea is that a single instruction will do all loading, evaluating, and
storing operations just like a multiplication command will do stuff like loading
data, evaluating, and storing it, hence it’s complex.
Characteristics of CISC
Complex instruction, hence complex instruction decoding.
Instructions are larger than one-word size.
Instruction may take more than a single clock cycle to get executed.
Less number of general-purpose registers as operations get performed in
memory itself.
Complex Addressing Modes.
More Data types.
Advantages of CISC
Reduced code size: CISC processors use complex instructions that can
perform multiple operations, reducing the amount of code needed to perform
a task.
More memory efficient: Because CISC instructions are more complex,
they require fewer instructions to perform complex tasks, which can result in
more memory-efficient code.
Widely used: CISC processors have been in use for a longer time than
RISC processors, so they have a larger user base and more available
software.
Disadvantages of CISC
Slower execution: CISC processors take longer to execute instructions
because they have more complex instructions and need more time to decode
them.
More complex design: CISC processors have more complex instruction
sets, which makes them more difficult to design and manufacture.
Higher power consumption: CISC processors consume more power than
RISC processors because of their more complex instruction sets.
CPU Performance
Both approaches try to increase the CPU performance
RISC: Reduce the cycles per instruction at the cost of the number of
instructions per program.
CPU Time
CISC: The CISC approach attempts to minimize the number of instructions
per program but at the cost of an increase in the number of cycles per
instruction.
Earlier when programming was done using assembly language, a need was felt
to make instruction do more tasks because programming in assembly was
tedious and error-prone due to which CISC architecture evolved but with the
uprise of high-level language dependency on assembly reduced RISC
architecture prevailed.
Example:
Suppose we have to add two 8-bit numbers:
CISC approach: There will be a single command or instruction for this like
ADD which will perform the task.
RISC approach: Here programmer will write the first load command to
load data in registers then it will use a suitable operator and then it will store
the result in the desired location.
So, add operation is divided into parts i.e. load, operate, store due to which
RISC programs are longer and require more memory to get stored but require
fewer transistors due to less complex command.
RISC vs CISC
RISC CISC
Focus on software Focus on hardware
Uses both hardwired and microprogrammed
Uses only Hardwired control unit
control unit
Transistors are used for storing complex
Transistors are used for more registers
Instructions
Fixed sized instructions Variable sized instructions
Can perform only Register to Register Can perform REG to REG or REG to MEM
Arithmetic operations or MEM to MEM
Requires more number of registers Requires less number of registers
Code size is large Code size is small
An instruction executed in a single
Instruction takes more than one clock cycle
clock cycle
Instructions are larger than the size of one
An instruction fit in one word.
word
Simple and limited addressing
Complex and more addressing modes.
modes.
RISC CISC
RISC is Reduced Instruction Cycle. CISC is Complex Instruction Cycle.
The number of instructions are less as The number of instructions are more as
compared to CISC. compared to RISC.
It consumes the low power. It consumes more/high power.
RISC is highly pipelined. CISC is less pipelined.
RISC required more RAM. CISC required less RAM.
Here, Addressing modes are less. Here, Addressing modes are more.
Instruction Formats (Zero, One, Two and
Three Address Instruction)
instruction
In
encoded
computer
andformats,
organization,
represented
including
ininstruction
machine
zero, one,
language.
formats
two, and
refer
There
three-address
to are
the several
way instructions
instructions.
types of are
Each type of instruction format has its own advantages and disadvantages in
terms of code size, execution time, and flexibility. Modern computer
architectures typically use a combination of these formats to provide a balance
between simplicity and power.
What are the Different Types of Instruction Fields?
A computer performs a task based on the instructions provided. Instructions in
computers are comprised of groups called fields. These fields contain different
information for computers which are all written in 0s and 1s. Each field has a
different significance or meaning, based on which a CPU decides what to
perform. The most common fields are:
The operation field specifies the operation to be performed, like addition.
Address field which contains the location of the operand, i.e., register or
memory location.
Mode field which specifies how operand is to be founded.
An instruction is of variable length depending upon the number of addresses it
contains. Generally, CPU organization is of three types based on the number of
address fields:
Single Accumulator organization
General register organization
Stack organization
In the first organization, the operation is performed using a special register
called the accumulator. In the second, multiple registers are used for the
computation purpose. In the third organization, the work on stack basis
operation due to which it does not contain any address field. We generally see a
blend of various organizations applied
Types of Instructions
Based on the number of addresses, instructions are classified as:
NOTE: We will use the X = (A+B)*(C+D) expression to showcase the
procedure.
Zero Address Instructions
These instructions do not specify any operands or addresses. Instead, they
operate on data stored in registers or memory locations implicitly defined by the
instruction. For example, a zero-address instruction might simply add the
contents of two registers together without specifying the register names.
Zero Address Instruction
A stack-based computer does not use the address field in the instruction. To
evaluate an expression, it is first converted to reverse Polish Notation i.e.
Postfix Notation.
Expression: X = (A+B)*(C+D)
Postfixed : X = AB+CD+*
TOP means top of stack
M[X] is any memory location
PUSH A TOP = A
PUSH B TOP = B
ADD TOP = A+B
PUSH A TOP = A
PUSH C TOP = C
PUSH D TOP = D
ADD TOP = C+D
MUL TOP = (C+D)*(A+B)
POP X M[X] = TOP
One Address Instructions
These instructions specify one operand or address, which typically refers to a
memory location or register. The instruction operates on the contents of that
operand, and the result may be stored in the same or a different location. For
example, a one-address instruction might load the contents of a memory
location into a register.
This uses an implied ACCUMULATOR register for data manipulation. One
operand is in the accumulator and the other is in the register or memory
location. Implied means that the CPU already knows that one operand is in the
accumulator so there is no need to specify it.
One Address Instruction
Expression: X = (A+B)*(C+D)
AC is accumulator
M[] is any memory location
M[T] is temporary location
LOAD A AC = M[A]
LOAD A AC = M[A]
ADD B AC = AC + M[B]
STORE T M[T] = AC
LOAD C AC = M[C]
ADD D AC = AC + M[D]
MUL T AC = AC * M[T]
STORE X M[X] = AC
Two Address Instructions
These instructions specify two operands or addresses, which may be memory
locations or registers. The instruction operates on the contents of both operands,
and the result may be stored in the same or a different location. For example, a
two-address instruction might add the contents of two registers together and
store the result in one of the registers.
This is common in commercial computers. Here two addresses can be specified
in the instruction. Unlike earlier in one address instruction, the result was stored
in the accumulator, here the result can be stored at different locations rather
than just accumulators, but require more number of bit to represent the address.
Two Address Instruction
Here destination address can also contain an operand.
Expression: X = (A+B)*(C+D)
R1, R2 are registers
M[] is any memory location
MOV R1, A R1 = M[A]
ADD R1, B R1 = R1 + M[B]
MOV R2, C R2 = M[C]
ADD R2, D R2 = R2 + M[D]
MUL R1, R2 R1 = R1 * R2
MOV X, R1 M[X] = R1
Three Address Instructions
These instructions specify three operands or addresses, which may be memory
locations or registers. The instruction operates on the contents of all three
operands, and the result may be stored in the same or a different location. For
example, a three-address instruction might multiply the contents of two
registers together and add the contents of a third register, storing the result in a
fourth register.
This has three address fields to specify a register or a memory location.
Programs created are much short in size but number of bits per instruction
increases. These instructions make the creation of the program much easier but
it does not mean that program will run much faster because now instructions
only contain more information but each micro-operation (changing the content
of the register, loading address in the address bus etc.) will be performed in one
cycle only.
Three Address Instruction
Expression: X = (A+B)*(C+D)
R1, R2 are registers
M[] is any memory location
ADD R1, A, B R1 = M[A] + M[B]
ADD R2, C, D R2 = M[C] + M[D]
MUL X, R1, R2 M[X] = R1 * R2
Advantages of Zero-Address, One-Address, Two-
Address and Three-Address Instructions
Zero-address instructions
They are simple and can be executed quickly since they do not require any
operand fetching or addressing. They also take up less memory space.
One-address instructions
They allow for a wide range of addressing modes, making them more
flexible than zero-address instructions. They also require less memory space
than two or three-address instructions.
Two-address instructions
They allow for more complex operations and can be more efficient than one-
address instructions since they allow for two operands to be processed in a
single instruction. They also allow for a wide range of addressing modes.
Three-address instructions
They allow for even more complex operations and can be more efficient
than two-address instructions since they allow for three operands to be
processed in a single instruction. They also allow for a wide range of
addressing modes.
Disadvantages of Zero-Address, One-Address, Two-
Address and Three-Address Instructions
Zero-address instructions
They can be limited in their functionality and do not allow for much
flexibility in terms of addressing modes or operand types.
One-address instructions
They can be slower to execute since they require operand fetching and
addressing.
Two-address instructions
They require more memory space than one-address instructions and can be
slower to execute since they require operand fetching and addressing.
Three-address instructions
They require even more memory space than two-address instructions and
can be slower to execute since they require operand fetching and addressing.
Basic Computer Instructions
Introduction :
Computer organization refers to the way in which the components of a
computer system are organized and interconnected to perform specific tasks.
One of the most fundamental aspects of computer organization is the set of
basic computer instructions that the system can execute.
Basic computer instructions are the elementary operations that a computer
system can perform. These instructions are typically divided into three
categories: data movement instructions, arithmetic and logic instructions, and
control instructions.
Data movement instructions are used to move data between different parts of
the computer system. These instructions include load and store instructions,
which move data between memory and the CPU, and input/output (I/O)
instructions, which move data between the CPU and external devices.
Arithmetic and logic instructions are used to perform mathematical operations
and logical operations on data stored in the system. These instructions include
add, subtract, multiply, and divide instructions, as well as logic instructions
such as AND, OR, and NOT.
Control instructions are used to control the flow of instructions within the
computer system. These instructions include branch instructions, which transfer
control to different parts of the program based on specified conditions, and
jump instructions, which transfer control to a specified memory location.
The basic computer has 16-bit instruction register (IR) which can denote either
memory reference or register reference or input-output instruction.
1. Memory Reference – These instructions refer to memory address as an
operand. The other operand is always accumulator. Specifies 12-bit address,
3-bit opcode (other than 111) and 1-bit addressing mode for direct and
indirect addressing.
Example –
IR register contains = 0001XXXXXXXXXXXX, i.e. ADD after fetching
and decoding of instruction we find out that it is a memory reference
instruction for ADD operation.
Hence, DR ← M[AR]
AC ← AC + DR, SC ← 0
1. Register Reference – These instructions perform operations on registers
rather than memory addresses. The IR(14 – 12) is 111 (differentiates it from
memory reference) and IR(15) is 0 (differentiates it from input/output
instructions). The rest 12 bits specify register operation.
Example –
IR register contains = 0111001000000000, i.e. CMA after fetch and decode
cycle we find out that it is a register reference instruction for complement
accumulator.
Hence, AC ← ~AC
1. Input/Output – These instructions are for communication between
computer and outside environment. The IR(14 – 12) is 111 (differentiates it
from memory reference) and IR(15) is 1 (differentiates it from register
reference instructions). The rest 12 bits specify I/O operation.
Example –
IR register contains = 1111100000000000, i.e. INP after fetch and decode
cycle we find out that it is an input/output instruction for inputing character.
Hence, INPUT character from peripheral device.
Essential PC directions are the principal tasks that a PC can perform. These
directions are executed by the focal handling unit (central processor) of a PC,
and they structure the reason for additional perplexing tasks. A few instances of
essential PC directions include:
1.Load: This guidance moves information from the memory to a computer
processor register.
2.Store: This guidance moves information from a computer chip register to the
memory.
3.Add: This guidance adds two qualities and stores the outcome in a register.
4.Subtract: This guidance deducts two qualities and stores the outcome in a
register.
5.Multiply: This guidance duplicates two qualities and stores the outcome in a
register.
6.Divide: This guidance isolates two qualities and stores the outcome in a
register.
7.Branch: This guidance changes the program counter to a predefined address,
which is utilized to execute restrictive and genuine leaps.
8.Jump: This guidance changes the program counter to a predefined address.
9.Compare: This guidance looks at two qualities and sets a banner
demonstrating the consequence of the examination.
10.Increment: This guidance adds 1 to a worth in a register or memory area.
The set of instructions incorporated in16 bit IR register are:
1. Arithmetic, logical and shift instructions (and, add, complement, circulate
left, right, etc)
2. To move information to and from memory (store the accumulator, load the
accumulator)
3. Program control instructions with status conditions (branch, skip)
4. Input output instructions (input character, output character)
Uses of Basic Computer Instructions :
Some of the key uses of basic computer instructions include:
1. Data manipulation: Basic computer instructions are used to manipulate data
stored in the computer system, including moving data between memory and
the CPU, performing mathematical operations, and performing logical
operations.
2. Control flow: Basic computer instructions are used to control the flow of
instructions within the computer system. This includes branching to
different parts of the program based on specified conditions and jumping to
a specific memory location.
3. Input/output operations: Basic computer instructions are used to transfer
data between the computer system and external devices, such as input
devices (e.g. keyboard, mouse) and output devices (e.g. display screen,
printer).
4. Program execution: Basic computer instructions are used to execute
computer programs and run software applications. These instructions are
used to load programs into memory, move data into and out of the program,
and control the execution of the program.
5. System maintenance: Basic computer instructions are used to perform
system maintenance tasks, such as memory allocation and deallocation,
interrupt handling, and error detection and correction.
Issues of Basic Computer Instructions :
1. Complexity: Basic computer instructions can be complex and difficult to
understand, particularly for novice programmers. This can make it
challenging to write efficient and effective code.
2. Limited functionality: While basic computer instructions are versatile and
can perform a wide range of tasks, they are still limited in their
functionality. This can make it challenging to perform more complex
operations and can require programmers to write additional code to
accomplish their goals.
3. Compatibility: Basic computer instructions can be specific to a particular
computer system or architecture, which can make it challenging to write
code that is compatible with different systems. This can require
programmers to write separate code for each system, which can be time-
consuming and inefficient.
4. Security: Basic computer instructions can be vulnerable to security threats,
such as buffer overflows and code injection attacks. This can make it
challenging to write secure code and can require additional measures to be
taken to protect the system.
5. Maintenance: Basic computer instructions can be difficult to maintain,
particularly as systems become more complex and code becomes more
extensive. This can require significant resources to maintain and update the
code, which can be challenging for organizations with limited resources.