0% found this document useful (0 votes)
3 views

Unit 1 Computer Architecture

The document provides an overview of fundamental concepts in computer architecture, focusing on arithmetic and logical operations, shift operations, and binary representation. It details the components and functions of the Arithmetic Logic Unit (ALU), including various types of circuits for addition, subtraction, and shifting, as well as the implementation of microoperations within the CPU. Additionally, it discusses the role of status flags and the operation of the ALU in executing instructions and performing computations.

Uploaded by

Gauri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Unit 1 Computer Architecture

The document provides an overview of fundamental concepts in computer architecture, focusing on arithmetic and logical operations, shift operations, and binary representation. It details the components and functions of the Arithmetic Logic Unit (ALU), including various types of circuits for addition, subtraction, and shifting, as well as the implementation of microoperations within the CPU. Additionally, it discusses the role of status flags and the operation of the ALU in executing instructions and performing computations.

Uploaded by

Gauri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

COMPUTER ARCHITECTURE…

UNIT 1

Arithmetic Operations
Arithmetic: This generally refers to the fundamental operations of addition,
subtraction, multiplication, and division. These operations are crucial for any kind
of numerical computation a computer performs, from simple calculations to
complex scientific simulations.
Logical Operations
Logic operations work on individual bits (0s and 1s) and are essential for
decision-making and data manipulation within a computer.
 Logic: These operations include AND, OR, NOT, XOR, NAND, and
NOR.
o AND: The output is 1 only if both inputs are 1.
o OR: The output is 1 if at least one input is 1.
o NOT: This is a unary operation that inverts the input (0 becomes 1,
and 1 becomes 0).
o XOR (Exclusive OR): The output is 1 if the inputs are different.
o NAND (Not AND): The output is 0 only if both inputs are 1 (it's the
inverse of AND).
o NOR (Not OR): The output is 1 only if both inputs are 0 (it's the
inverse of OR). These logic gates form the basis of more complex
digital circuits used for control flow, data filtering, and more.
Shift Operations
Shift operations move the bits within a binary number to the left or right. This is
a fast way to perform multiplication or division by powers of 2.
 Shift: These operations move the bits of a binary number.
o Left Shift: Shifts all bits to the left. Each left shift effectively
multiplies the number by 2 (assuming no overflow). Vacant positions
on the right are usually filled with 0s.
o Right Shift: Shifts all bits to the right. Each right shift effectively
divides the number by 2 (integer division). There are two main types
of right shifts:
 Logical Right Shift: Vacant positions on the left are filled
with 0s.
 Arithmetic Right Shift: The sign bit (the leftmost bit,
representing positive or negative in signed numbers) is copied
into the vacant positions on the left. This preserves the sign of
the number during division.
Binary Representation
Before any of these operations can be performed, data needs to be represented in
a binary format.
 Binary: This is a base-2 numeral system that uses only two digits: 0 and 1.
Computers use binary to represent all types of data, including numbers,
text, images, and instructions. Each 0 or 1 is called a bit (binary digit).
Groups of bits are often used together, such as bytes (8 bits) or words (the
typical size of data a processor can handle at once, e.g., 32 bits or 64 bits).
Basic Arithmetic Circuits
These are specific digital circuits designed to perform fundamental arithmetic
operations on binary numbers.
 Adder: A circuit that performs binary addition.
o Half Adder: Adds two single bits and produces a sum bit and a
carry-out bit.
o Full Adder: Adds three single bits (two operands and a carry-in
from a previous stage) and produces a sum bit and a carry-out bit.
Multiple full adders can be cascaded to add multi-bit binary
numbers, forming a ripple-carry adder. More sophisticated adder
designs like carry-lookahead adders are used in modern processors
for faster addition.
 Subtractor: A circuit that performs binary subtraction. Similar to adders,
subtractors can be implemented as:
o Half Subtractor: Subtracts two single bits and produces a
difference bit and a borrow-out bit.
o Full Subtractor: Subtracts three single bits (minuend bit,
subtrahend bit, and a borrow-in from a previous stage) and produces
a difference bit and a borrow-out bit. Multi-bit subtraction can be
implemented using cascaded full subtractors or by using the
principle of two's complement addition (where subtraction is
performed by adding the two's complement of the subtrahend).
 Incrementor: A circuit that increases the value of a binary number by one.
It can be implemented using a series of half adders and a full adder, with
one input fixed to 1.
 Decrementor: A circuit that decreases the value of a binary number by
one. It can be implemented using logic gates or by using the principle of
two's complement subtraction (adding the two's complement of 1).
Arithmetic Logic Unit (ALU)
The Arithmetic Circuit you mentioned is typically part of a larger and more
versatile component called the Arithmetic Logic Unit (ALU).
 Arithmetic Circuit (as part of ALU): The ALU is the core computational
engine of a central processing unit (CPU). It's a combinational digital
circuit that performs arithmetic and bitwise logical operations on integer
binary numbers. A typical ALU includes:
o Arithmetic circuits (adder, subtractor, and often circuits for
multiplication and division).
o Logic circuits (for AND, OR, NOT, XOR, etc.).
o Shift circuits (for left and right shifts).
o Multiplexers to select the desired operation. The ALU receives
operands from processor registers or memory, performs the
operation specified by the control unit, and stores the result in a
register or memory. Status flags (e.g., carry, zero, negative,
overflow) are also often generated by the ALU to indicate the
outcome of an operation, which can be used for conditional
branching in programs.
Microoperations and Hardware Implementation
Microoperations are the fundamental, low-level operations performed by the
central processing unit (CPU) during one clock cycle. These are the smallest steps
in executing a machine instruction. Examples include:
 Transferring data between registers.
 Performing arithmetic and logical operations on data in registers.
 Shifting or rotating data in registers.
Hardware Implementation: Each microoperation is implemented by specific
digital circuits within the CPU.
 Register Transfer: Moving data between registers typically involves
connecting the outputs of one register to the inputs of another through a
bus system. Control signals activate the loading mechanism of the
destination register at the appropriate time. Multiplexers can be used to
select the source register that places its data onto the bus.
 Arithmetic Microoperations: Operations like addition, subtraction,
increment, and decrement are implemented using circuits like adders,
subtractors, incrementers, and decrementers, which we discussed
earlier. These circuits are often part of the Arithmetic Logic Unit (ALU).
 Logic Microoperations: Logic operations (AND, OR, NOT, XOR, etc.)
are implemented using individual logic gates. For an n-bit register, n logic
gates of the required type are used to perform the operation bitwise. A
selection mechanism (like a multiplexer) can be used to choose which logic
operation to perform.
Shift Microoperations - Hardware Implementation
Shift Microoperations involve moving the bits within a register to the left or
right. They are used for various purposes, including:
 Serial data transfer.
 Multiplication and division by powers of 2.
 Bit manipulation.
Types of Shift Microoperations:
 Logical Shift:
o Logical Left Shift: Shifts bits to the left. The least significant bit
(LSB) is filled with a 0, and the most significant bit (MSB) is
discarded.
o Logical Right Shift: Shifts bits to the right. The MSB is filled with
a 0, and the LSB is discarded.
 Arithmetic Shift: Used for signed numbers to preserve the sign bit during
right shifts.
o Arithmetic Left Shift: Similar to logical left shift, with 0 filled in
the LSB. Overflow can occur if the sign bit changes.
o Arithmetic Right Shift: Shifts bits to the right. The MSB (sign bit)
is copied into the vacant positions on the left. The LSB is discarded.
 Circular Shift (Rotate): Bits shifted out at one end are wrapped around to
the other end.
o Circular Left Shift: Bits shift left, and the MSB wraps around to
become the LSB.
o Circular Right Shift: Bits shift right, and the LSB wraps around to
become the MSB.
Hardware Implementation of Shift Microoperations:
Shift microoperations are typically implemented using shift registers. A shift
register is a sequence of flip-flops connected in a chain, where the output of one
flip-flop is connected to the input of the next.
 Basic Shift Register: For a simple right or left shift, the data inputs of each
flip-flop are connected to the output of the flip-flop to its left (for right
shift) or right (for left shift). The serial input provides the bit shifted into
the empty position. The bit shifted out is available at the serial output.
 Bidirectional Shift Register: To perform both left and right shifts,
multiplexers are used at the input of each flip-flop. A control signal selects
whether the input comes from the left neighbor (for right shift) or the right
neighbor (for left shift).
 Shift Register with Parallel Load: In many applications, it's necessary to
load data into the shift register in parallel. This is achieved by providing
additional inputs to each flip-flop and using a load control signal to select
between the parallel data inputs and the serial shift path.
 Circular Shift: For circular shifts, the output of the last flip-flop is
connected to the input of the first flip-flop (for left rotate) or vice versa (for
right rotate), in addition to the regular shift paths. Multiplexers controlled
by the shift direction can implement this.
ALU Circuit in Computer Architecture
The Arithmetic Logic Unit (ALU) is a fundamental building block of the CPU.
It's a combinational digital circuit that performs arithmetic and bitwise logical
operations on integer binary numbers. The ALU is a versatile component that
carries out the computations required by the CPU.
Components of a Basic ALU:
A typical ALU consists of:
 Arithmetic Unit: Contains circuits for arithmetic operations like addition,
subtraction, multiplication (often implemented through repeated addition
and shifts), and division (often implemented through repeated subtraction
and shifts). The core of this unit is usually an adder circuit.
 Logic Unit: Contains logic gates that perform bitwise logical operations
such as AND, OR, NOT, XOR, NAND, and NOR.
 Shift Unit: Contains circuits that perform shift operations (logical,
arithmetic, and sometimes rotate shifts). This might involve a dedicated
shifter circuit or utilize the adder/subtractor in conjunction with control
logic.
 Multiplexers: Used to select the desired operation based on the control
signals from the CPU's control unit. Multiplexers also select the output of
the appropriate functional unit (arithmetic, logic, or shift) to be the final
output of the ALU.
 Status Flags: The ALU often generates status flags as a result of an
operation. These flags are stored in a status register and provide
information about the outcome of the operation, such as:
o Carry Flag (C): Indicates a carry-out from the most significant bit
during addition or a borrow during subtraction.
o Zero Flag (Z): Indicates that the result of the operation is zero.
o Negative Flag (N) or Sign Flag (S): Indicates that the result of the
operation is negative (the most significant bit is 1).
o Overflow Flag (V): Indicates that an arithmetic overflow has
occurred (the result is too large or too small to be represented in the
given number of bits).
Operation of the ALU:
1. Operands: The ALU receives the operands (data to be operated on) from
registers or memory.
2. Opcode: The control unit of the CPU sends a control signal (opcode) to
the ALU, specifying the operation to be performed.
3. Execution: Based on the opcode, the appropriate circuitry within the ALU
performs the selected arithmetic, logical, or shift operation on the input
operands.
4. Result: The ALU produces a result, which is then typically stored back
into a register or memory.
5. Status Flags: The ALU also generates status flags based on the result of
the operation.
More Complex ALUs:
Modern CPUs often have more complex ALUs that can perform a wider range of
operations, including:
 Floating-point arithmetic (in a dedicated Floating-Point Unit - FPU, which
may be integrated with the ALU or be a separate unit).
 More complex arithmetic operations like multiplication and division
performed directly in hardware.
 Specialized operations for graphics processing or other specific tasks.
 Multiple ALUs within a single CPU core to enable parallel execution of
instructions.
# Circuit Diagram Of ALU..

You might also like