0% found this document useful (0 votes)
18 views103 pages

Unit 1

Uploaded by

sashantnipate
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)
18 views103 pages

Unit 1

Uploaded by

sashantnipate
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/ 103

UNIT-1

Basic Functional units of Computers: Functional


units, basic Operational concepts, Bus structures,
ALU and Control unit.
Data Representation: Signed number
representation, fixed and floating-point
Representations, addition, and subtraction of signed
numbers, signed operand multiplication, booth's
algorithm
Functional units

A computer in its simplest form comprises five functional units namely


input unit
output unit
memory unit
arithmetic
logic unit
control unit.
Input Unit

Computer accepts the coded information through input unit , which reads the data.
It converts external world data to the binary format which can be understood by the
CPU.
for example:
❑ Keyboard
❑ Mouse
❑ Scanner
❑ Microphone
❑ Joystick
❑ trackballs etc

The function of input units are


✔ it except data from the user
✔ it convert data into a form that is acceptable to the computer
✔ it supplies converted data to CPU for further processing
Output
This is the process of producing results from the data for
getting useful information.
Output devices display and generate information that has been
held or generated within a computer.
Example: Moniter, printer, plotter, speakers,Projector
Functions:
It accepts the result produced by the computer
it converts result into form that understood by humans
it displays the result and results can be obtained.
CPU
The task of performing operations like arithmetic and logical
operations is called processing.
CPU, also known as a processor or microprocessor; is short for
Central Processing Unit.
It is responsible for handling all instructions and calculation it
receives from other hardware components in the computer and
software programs running on the computer
It consist of ALU, Control Unit and registers.
CONTROL UNIT
The control unit (CU) is a component of a computer's central
processing unit (CPU) that directs the operation of the
processor. It tells the computer's memory, arithmetic and logic
unit and input and output devices how to respond to the
instructions that have been sent to the processor.
It directs the operation of the other units by providing timing
and control signals. Most computer resources are managed by
the CU. It directs the flow of data between the CPU and the
other devices.
ALU
The purpose of the ALU is to perform mathematical operations
such as addition, subtraction, multiplication and
division. Additionally, the ALU processes basic logical
operations like AND/OR calculations. Also known as the
arithmetic logic unit, it serves as the computational hub of the
Central Processing Unit (CPU) for a computer system. An
ALU can be programmed to perform any series of complicated
arithmetic or logical calculations. It is the computational
capacity of the ALU that determines the power of a computer
system’s CPU. In more complex systems, the ALU is divided
into two units: the arithmetic unit (AU) and the logic unit (LU)
Register
A processor register (CPU register) is one of a small set of data
holding places that are part of the computer processor.
A register may hold an instruction, a storage address, or any
kind of data (such as a bit sequence or individual characters).
Some instructions specify registers as part of the instruction
Almost all computers, whether load/store architecture or not,
load data from a larger memory into registers where it
is used for arithmetic operations and is manipulated or tested
by machine instructions. ... Processor registers are normally at
the top of the memory hierarchy, and provide the fastest way
to access data.
Examples of processing unit

The first CPU was manufactured by INTEL in 1974.

Motherboard
It is a circuit that is the foundation of a computer and
allows the CPU, RAM, and all other computer
hardware components to function with each other.

Modem
It is a device that enables a computer to transmit and
receive information over telephone lines.
A memory is just like a human brain. It is used to store data
and instructions. Computer memory is the storage space in
computer where data is to be processed and instructions
required for processing are stored. The memory is divided into
large number of small parts called cells. Each location or cell
has a unique address which varies from zero to memory size
minus one. For example if computer has 64k words, then this
memory unit has 64 * 1024=65536 memory locations. The
address of these locations varies from 0 to 65535.
Memory Unit
• Primary Memory (Main Memory)
Primary memory holds only those data and instructions on which computer is
currently working. It has limited capacity and data is lost when power is switched
off. It is generally made up of semiconductor device. These memories are not as
fast as registers. The data and instruction required to be processed reside in main
memory. It is divided into two subcategories RAM and ROM.
• Characteristics of Main Memory
These are semiconductor memories
It is known as main memory.
Usually volatile memory.
Data is lost in case power is switched off.
It is working memory of the computer.
Faster than secondary memories.
A computer cannot run without primary memory.
Secondary Memory
This type of memory is also known as external memory or
non-volatile. It is slower than main memory. These are used for
storing data/Information permanently. CPU directly does not
access these memories instead they are accessed via input-output
routines. Contents of secondary memories are first transferred to
main memory, and then CPU can access it. For example : disk,
CD-ROM, DVD etc.
Characteristic of Secondary Memory
These are magnetic and optical memories.
It is known as backup memory.
It is non-volatile memory.
Data is permanently stored even if power is switched off.
It is used for storage of data in a computer.
Computer may run without secondary memory.
Slower than primary memories.
Examples of storage
RAM
It is short for Random Access Memory which is the main
memory of the system within a computer. RAM requires
power ; if power is lost, all data is also lost.

Hard Drive
It is a rigid circular disk located inside a computer. The
term hard disk is often used as an abbreviation to hard
disk drive.

Diskette
It can record data as magnetized spots on tracks on its
surface. Diskettes became popular along with the
personal computer mainly to transport data.

CD-R, CD-RW
CD-R is short for CD-Recordable and is a type of writable
disc capable of having information written on it only once
CD-R/W is a drive and/or media that is
capable of being written many times.
BASIC OPERATIONAL
CONCEPTS
The activity in a computer is governed by instructions.
To perform a given task, an appropriate program
consisting of a list of instructions is stored in the
memory. The PC (Program Counter) contains the
memory address of the instruction to be executed.
During execution, the contents of the PC are updated to
point to the next instruction. Every timethat an
instruction is to be executed, the program counter
releases its contents to the internal busand sends it to the
memory address register
The MAR (
Memory Address Register
) holds the address of the location to or from which dataare to be transferred. As
can be seen from the figure above, the connection of the MAR to themain
memory is one-way or unidirectional.The MDR (
Memory Data Register
) contains the data to be written or read out of the addressedlocation.During the
fetch operation, the MDR contains the instruction to be executed or data
neededduring execution. In write operation, MDR the data to be written into the
main memory.The IR (
Instruction Register
) contains the instruction that is being executed. Before the IR executes the
instruction it needs to be decoded first. As soon as the content of the MDR
istransferred to the IR, the decoding process commences. After decoding,
execution of theinstruction will take place
• Operating Steps
• 1. PC is set to point to the first instruction of the program
(the operating system loads thememory address of the first
instruction).2. The contents of the PC are transferred to the
MAR (which is automatically transmitted to theMM) and a
• Read
• signal is sent to the MM.3. The addressed word is read out
of MM and loaded into the MDR
• 4. The contents of MDR are transferred to the IR. The
instruction is ready to be decoded andexecuted.5. During
execution, the contents of the PC are incremented or
updated to point to the nextinstruction.
• CPU Instruction Execution Steps
• Instruction execution in a CPU can now be summarized by the
following steps:1. Fetching the instruction from the memory into
the instruction register.2. Incrementing the PC to point to the next
instruction to be executed.3.
• Determining the type of instruction fetched (
• instruction decoding
• ).4. Determining the location of data in the memory. If the
instruction uses data.5. Fetching the required data into internal
CPU registers.6. Executing the instruction.7. Storing the results in
the designated locations.8. Return to Step 1.This is commonly
referred to as the
• fetch-decode-execute
• cycle
BUS STRUCTURE
• A bus is a set of electrical wires (lines) that
connects the various hardware components of a
computer system.
• It works as a communication pathway through
which information flows from one hardware
component to the other hardware component.

• A bus that connects major components (CPU,
memory and I/O devices) of a computer system is
called as a System Bus.
• Why Do We Need Bus?

• A computer system is made of different components
such as memory, ALU, registers etc.
• Each component should be able to communicate with
other for proper execution of instructions and
information flow.
• If we try to implement a mesh topology among
different components, it would be really expensive.
• So, we use a common component to connect each
necessary component i.e. BUS.
Components Of A System Bus-
• 1) Data Bus-

• As the name suggests, data bus is used for transmitting the data / instruction from CPU to
memory/IO and vice-versa.
• It is bi-directional.
• Data Bus Width

• The width of a data bus refers to the number of bits (electrical wires) that the bus can carry at a
time.
• Each line carries 1 bit at a time. So, the number of lines in data bus determine how many bits can
be transferred parallely.
• The width of data bus is an important parameter because it determines how much data can be
transmitted at one time.
• The wider the bus width, faster would be the data flow on the data bus and thus better would be
the system performance.

• Examples-
• A 32-bit bus has thirty two (32) wires and thus can transmit 32 bits of data at a time.
• A 64-bit bus has sixty four (64) wires and thus can transmit 64 bits of data at a time.
• 2) Control Bus-

• As the name suggests, control bus is used to transfer the control
and timing signals from one component to the other component.
• The CPU uses control bus to communicate with the devices that
are connected to the computer system.
• The CPU transmits different types of control signals to the system
components.
• It is bi-directional.
• What Are Control & Timing Signals?

• Control signals are generated in the control unit of CPU.
• Timing signals are used to synchronize the memory and I/O
operations with a CPU clock.

Problem-1
• Which of the following system bus is used to
designate the source or destination of the
data on the bus itself?
ALU
• ALU stands for Arithmetic Logic Unit. It is a
combinational digital circuit which does
arithmetic and bitwise operations on integer
binary numbers. It is one of the main
components of the computer's Central
Processing Unit (CPU) that is designed to
perform arithmetic and logical tasks.
• The ALU results in an integer as it not only
performs the calculations concerned with
subtraction and addition but also calculates
the multiplication of two integers as they are
designed to execute integer calculations.
Hence, resulting in an integer. Signals are
received from the external circuits by the
Arithmetic Logic Unit input, and external
electronics get outputs signals from ALU as its
response.
• Signals
• An Arithmetic Logic Unit possesses a variety of input and output nets. The
nets or signals are nothing other than what are used to convey digital
signals between the Arithmetic Logic Unit and external circuitry,
i.e. electrical conductors. External circuits add signals to the Arithmetic
Logic Unit when an Arithmetic Logic Unit is operating. In response to these
signals sent, the Arithmetic Logic Unit then produces and conveys signals
via its outputs to the external circuitry.
• Data: - Three parallel data buses having two input operands and a result
output are the components of the basic Arithmetic Logic Unit.
• Opcode: - The message about an operation selection code is conveyed to
the Arithmetic Logic Unit through this parallel bus. The operation selection
code specifies the desired operation, arithmetic or logic, in an enumerated
value form, which is supposed to be performed by the Arithmetic Logic
Unit.

• Status:
– Outputs: Supplemental information concerning the result of the
current operation of the Arithmetic Logic Unit is part of various
individual signals that convey. The general Arithmetic Logic Unit
usually contains status signals like overflow, zero, carry out,
negative, and more. When an ALU completes each operation, the
external registers contain the status output signals. These signals
are made available for future ALU operations stored in the
external registers.
– Inputs: Status inputs allow to make any additional information
available to the Arithmetic Logic Unit while operating. When the
ALU operates, further access to information is permitted by the
status inputs to complete the operation successfully.
Circuit Operation
A simple four-bit Arithmetic Logic Unit is the
combinational logic circuitry. It is part of
the 74181 integrated circuits. An
asynchronous change will occur in an
Arithmetic Logic Unit as a response to the
input changes, as it is a combinational logic
circuit. Stable signals are included in the ALU
inputs in normal operation.
• Functions
• Commonly Arithmetic Logic Unit supports numerous bitwise
logic and basic arithmetic functions. These operations are
typically included in basic general-purpose ALUs
• Arithmetic operations
• Bitwise logical operations
• Bit shift operations
• Applications
• The application of the Arithmetic Logic Unit is as follows:-
• Multiple-precision arithmetic
• Complex operations
• History
• Mathematician John von Neumann was the one who, in 1945, proposed the concept of the
Arithmetic Logic Unit. It was contained in a report produced on the foundations for a new
computer called the EDVAC. It was in the early 1970s that microprocessors began to appear. Often
insufficient die space for a full-word-width ALU, despite smaller transistors, was present. Examples
include the popular Zilog Z80, which has performed the eight-bit additions with a four-bit
Arithmetic Logic Unit.
• Advantages of ALU
• Arithmetic Logic Unit has various advantages, which are as follows:
• Parallel architecture and applications with high performance are supported.
• It can combine integer and floating-point variables and get the desired output simultaneously.
• It can react to a very large set of instructions and has a higher accuracy range.
• The ALU can combine two arithmetic operations in the same code, like subtraction, addition and
multiplication, or any other two operands. For case, A+B*C.
• They remain uniform throughout the whole program and are spaced so they cannot interrupt
parts in between.
• It is very fast in general and hence provides results very quickly.
• No sensitivity issues or memory wastage issues are there with ALU.
• They minimize the logic gate requirements and are less expensive.
Disadvantages of ALU
The disadvantages of the Arithmetic Logic Unit
are discussed below:
Floating variables have more delays, and all
within the ALU do not easily understand the
designed controller.
If memory space were definite, the bugs would
come and interrupt our resulting output.
The Amateurs are hard to understand due to
their complex circuit, and also, it is hard to
understand the concept of pipelining.
The presence of irregularities in latencies is a
proven disadvantage of ALU.
Rounding off is another disadvantage, as it
impacts accuracy.
Control unit
• Structure of the Control Unit
• Control Memory:
– Stores microinstructions for control signals.
– These instructions define the actions needed to execute each instruction.
• Control Logic Circuits:
– Generates control signals based on microinstructions.
– Includes decoders, multiplexers, and other combinational and sequential logic circuits.
• Instruction Register:
– Holds the current instruction being executed.
– Decoded to determine which microinstructions to fetch from control memory.
• Program Counter:
– Keeps track of the address of the next instruction to be executed.
• Timing and Control Signals:
– Manages the timing of instruction cycles (fetch, decode, execute).
– Synchronizes operations within the CPU and with other system components.
• Working of the Control Unit
• Fetch Cycle:
– The control unit retrieves the next instruction from memory.
– The address of the instruction is held in the program counter.
– The instruction is loaded into the instruction register.
• Decode Cycle:
– The instruction in the instruction register is decoded to determine the operation to be
performed.
– The control unit interprets the opcode (operation code) and generates the appropriate
control signals.
• Execute Cycle:
– The control signals generated during the decode cycle direct other parts of the CPU to
execute the instruction.
– This may involve arithmetic or logical operations, data movement, or interaction with I/O
devices.
• Write Back:
– The results of the executed instruction are written back to memory or registers.
– The program counter is updated to point to the next instruction.
• Detailed Steps
• Instruction Fetch:
– Control Signal: READ (fetch from memory).
– The program counter provides the address to memory.
– The fetched instruction is placed into the instruction register.
• Instruction Decode:
– Control Signal: DECODE (interpret instruction).
– The opcode is decoded to understand the required operation.
– The control unit sets up the necessary control signals for the ALU (Arithmetic Logic Unit) and other components.
• Operand Fetch (if necessary):
– Control Signal: FETCH OPERAND (read operand).
– Fetches operands from registers or memory as specified by the instruction.
• Execution:
– Control Signal: EXECUTE (perform operation).
– The ALU performs the required operation (addition, subtraction, etc.).
– Data is moved or manipulated as required by the instruction.
• Result Write Back:
– Control Signal: WRITE BACK (store result).
– The result is written back to a register or memory location.
– The program counter is updated to the next instruction.
• Update Program Counter:
– Control Signal: INCREMENT PC (update address).
– The program counter increments to point to the next instruction.
• Types of Control Units
• Hardwired Control Unit:
– Uses fixed logic circuits to control signals.
– Fast but inflexible, as the control logic is hardwired into the system.
• Microprogrammed Control Unit:
– Uses a set of instructions (microinstructions) stored in control memory.
– More flexible, as it can be easily modified by changing
microinstructions.
• Conclusion
• The control unit is essential for the orderly execution of
instructions within the CPU. It fetches, decodes, and executes
instructions by generating and managing control signals, ensuring
that all components of the computer system work together
efficiently.
+-------------------------+
| Decoder |
+-------------------------+
|
v
+-------------------------+
| Control Address |
| Register (CAR) |
+-------------------------+
|
v
+-------------------------+
| Control Memory |
+-------------------------+
|
v
+-------------------------+
| Control Buffer |
| Register (CBR) |
+-------------------------+
|
v
+-------------------------+
| Control Logic Circuits |
+-------------------------+
v
+-------------------+ +------------------+
| ALU | | Registers |
+-------------------+ +------------------+
```

### Explanation of Diagram Components

1. **Instruction Register**: Holds the current instruction fetched from memory.


2. **Decoder**: Interprets the instruction and determines the sequence of
micro-operations needed to execute it.
3. **Control Address Register (CAR)**: Holds the address of the next
microinstruction to be executed.
4. **Control Memory**: Stores microinstructions that define the control signals for
various operations.
5. **Control Buffer Register (CBR)**: Temporarily holds the microinstruction read
from the control memory.
6. **Control Logic Circuits**: Generate the appropriate control signals based on the
current microinstruction.
7. **ALU (Arithmetic Logic Unit)**: Performs arithmetic and logic operations as
directed by the control unit.
8. **Registers**: Temporarily store data and intermediate results during instruction
execution.
1. **Fetching and Decoding**: The instruction
is fetched from memory and placed in the
instruction register. The decoder interprets the
instruction and provides the control address to
the CAR.
2. **Microinstruction Fetch**: The CAR reads
the address and fetches the corresponding
microinstruction from the control memory.
3. **Execution**: The microinstruction is
loaded into the CBR, which then directs the
control logic circuits to generate the necessary
control signals.
4. **Operation**: The control signals guide the
ALU and registers to perform the required
operations, completing the instruction
execution cycle.

This diagram and explanation represent a


simplified view of the control unit's operation
within a CPU, focusing on a microprogrammed
control unit. In practice, modern CPUs may
have more complex and optimized control
units, including features for pipelining, parallel
execution, and advanced branching
Signed number representation
• Signed number representation is a method used to encode both positive and
negative integers in binary form. There are three common ways to represent signed
numbers:
• Sign and Magnitude Representation
• One's Complement Representation
• Two's Complement Representation
• 1. Sign and Magnitude Representation
• In this method, the most significant bit (MSB) represents the sign of the number:
• 0 indicates a positive number.
• 1 indicates a negative number.
• The remaining bits represent the magnitude (absolute value) of the number.
• Example:
• 8-bit representation of +5: 00000101
• 8-bit representation of -5: 10000101
• . One's Complement Representation
• In one's complement representation, negative numbers are represented by inverting all the bits of
the corresponding positive number (flipping 0s to 1s and 1s to 0s).
• Example:
• 8-bit representation of +5: 00000101
• 8-bit representation of -5: 11111010 (invert all bits of +5)
• 3. Two's Complement Representation
• Two's complement is the most commonly used method for representing signed numbers. In this
method:
• Positive numbers are represented as usual.
• Negative numbers are obtained by inverting all the bits of the positive number and then adding 1
to the least significant bit (LSB).
• Example:
• 8-bit representation of +5: 00000101
• To find the 8-bit representation of -5:
– Start with +5: 00000101
– Invert all bits: 11111010
– Add 1 to the LSB: 11111010 + 1 = 11111011
• Range of Representations
• For an n-bit binary number:
• Sign and Magnitude: Range is from −
(2n−1−1)-(2^{n-1} - 1)−(2n−1−1) to
+(2n−1−1)+(2^{n-1} - 1)+(2n−1−1)
• One's Complement: Range is from −
(2n−1−1)-(2^{n-1} - 1)−(2n−1−1) to
+(2n−1−1)+(2^{n-1} - 1)+(2n−1−1)
• Two's Complement: Range is from −2n−1-2^{n-1}
−2n−1 to +(2n−1−1)+(2^{n-1} - 1)+(2n−1−1)
• 8-bit Examples:
• Sign and Magnitude: -127 to +127
• One's Complement: -127 to +127
• Two's Complement: -128 to +127
• Advantages and Disadvantages
• Sign and Magnitude
• Advantage: Simple to understand.
• Disadvantage: Two representations for zero (positive and negative zero).
• One's Complement
• Advantage: Easier to compute negative numbers (just invert bits).
• Disadvantage: Two representations for zero.
• Two's Complement
• Advantage: Unique representation for zero, simpler arithmetic operations.
• Disadvantage: Slightly more complex to understand initially.
• Fixed-Point Representation
• Definition: In fixed-point representation, a number is represented by an integer and a fixed
number of decimal (or binary) places. This means that the position of the decimal (or binary) point
is fixed and does not change.
• Structure:
• Integer part: Represents the whole number part.
• Fractional part: Represents the fractional part of the number.
• Example:
• A fixed-point representation with two decimal places for the number 123.45 would store it as
12345 with an implicit understanding that the last two digits are fractional.
• Advantages:
• Simplicity: Easier to implement and understand.
• Performance: Often faster than floating-point operations due to simpler hardware requirements.
• Predictability: Fixed precision which leads to consistent and predictable arithmetic.
• Disadvantages:
• Limited Range: The range of representable numbers is limited by the fixed decimal places.
• Precision: Precision is also limited, making it unsuitable for very small or very large numbers.
• Floating-Point Representation
• Definition: In floating-point representation, numbers are represented using scientific notation with a base (usually 2
for binary computers) and an exponent. This allows the decimal (or binary) point to "float," enabling a much wider
range of values.
• Structure:
• Sign bit (S): Indicates the sign of the number (0 for positive, 1 for negative).
• Exponent (E): Represents the exponent value in the scientific notation.
• Mantissa (M) (or significand): Represents the significant digits of the number.
• IEEE 754 Standard:
• Single precision (32-bit): 1 bit for the sign, 8 bits for the exponent, and 23 bits for the mantissa.
• Double precision (64-bit): 1 bit for the sign, 11 bits for the exponent, and 52 bits for the mantissa.
• Example:
• The number 123.45 in floating-point representation might be stored as 1.2345 × 10^2 in decimal or a similar format
in binary.
• Advantages:
• Wide Range: Can represent very large and very small numbers.
• Precision: More precision than fixed-point, especially for very small numbers.
• Disadvantages:
• Complexity: More complex to implement and understand.
• Performance: Generally slower than fixed-point operations due to more complex arithmetic.
• Precision Issues: Can suffer from rounding errors and precision loss in some operations.
• Comparison
• Range and Precision:
– Fixed-point: Limited range and precision; suitable for applications where numbers have a
known, fixed scale (e.g., financial calculations).
– Floating-point: Large range and better precision for very small and very large numbers;
suitable for scientific computations, graphics, and engineering.
• Performance:
– Fixed-point: Faster and simpler, especially on hardware without floating-point support.
– Floating-point: Slower but necessary for applications requiring a wide dynamic range.
• Hardware and Implementation:
– Fixed-point: Simpler hardware; often used in embedded systems and applications with
stringent performance requirements.
– Floating-point: More complex hardware; standard in general-purpose computing and
scientific applications.
• Use Cases
• Fixed-Point: Audio processing, financial calculations, embedded systems where
performance and predictability are crucial.
• Floating-Point: Scientific simulations, computer graphics, complex mathematical
computations where range and precision are necessary.
• Use Cases
• Fixed-Point: Audio processing, financial calculations, embedded
systems where performance and predictability are crucial.
• Floating-Point: Scientific simulations, computer graphics, complex
mathematical computations where range and precision are
necessary.
• Conclusion
• Choosing between fixed-point and floating-point representation
depends on the specific requirements of the application, including
the range and precision of numbers, performance constraints, and
hardware capabilities. Fixed-point is advantageous for simple,
predictable calculations, while floating-point is essential for
handling a wide range of values with greater precision.
• Fixed-Point Representation
• Definition: In fixed-point representation, a number is represented by an integer and a fixed
number of decimal (or binary) places. This means that the position of the decimal (or binary) point
is fixed and does not change.
• Structure:
• Integer part: Represents the whole number part.
• Fractional part: Represents the fractional part of the number.
• Example:
• A fixed-point representation with two decimal places for the number 123.45 would store it as
12345 with an implicit understanding that the last two digits are fractional.
• Advantages:
• Simplicity: Easier to implement and understand.
• Performance: Often faster than floating-point operations due to simpler hardware requirements.
• Predictability: Fixed precision which leads to consistent and predictable arithmetic.
• Disadvantages:
• Limited Range: The range of representable numbers is limited by the fixed decimal places.
• Precision: Precision is also limited, making it unsuitable for very small or very large numbers.
• Floating-Point Representation
• Definition: In floating-point representation, numbers are represented using scientific notation with a base (usually 2
for binary computers) and an exponent. This allows the decimal (or binary) point to "float," enabling a much wider
range of values.
• Structure:
• Sign bit (S): Indicates the sign of the number (0 for positive, 1 for negative).
• Exponent (E): Represents the exponent value in the scientific notation.
• Mantissa (M) (or significand): Represents the significant digits of the number.
• IEEE 754 Standard:
• Single precision (32-bit): 1 bit for the sign, 8 bits for the exponent, and 23 bits for the mantissa.
• Double precision (64-bit): 1 bit for the sign, 11 bits for the exponent, and 52 bits for the mantissa.
• Example:
• The number 123.45 in floating-point representation might be stored as 1.2345 × 10^2 in decimal or a similar format
in binary.
• Advantages:
• Wide Range: Can represent very large and very small numbers.
• Precision: More precision than fixed-point, especially for very small numbers.
• Disadvantages:
• Complexity: More complex to implement and understand.
• Performance: Generally slower than fixed-point operations due to more complex arithmetic.
• Precision Issues: Can suffer from rounding errors and precision loss in some operations.
• Comparison
• Range and Precision:
– Fixed-point: Limited range and precision; suitable for applications where numbers have a known, fixed scale (e.g., financial
calculations).
– Floating-point: Large range and better precision for very small and very large numbers; suitable for scientific computations,
graphics, and engineering.
• Performance:
– Fixed-point: Faster and simpler, especially on hardware without floating-point support.
– Floating-point: Slower but necessary for applications requiring a wide dynamic range.
• Hardware and Implementation:
– Fixed-point: Simpler hardware; often used in embedded systems and applications with stringent performance requirements.
– Floating-point: More complex hardware; standard in general-purpose computing and scientific applications.
• Use Cases
• Fixed-Point: Audio processing, financial calculations, embedded systems where performance and predictability are
crucial.
• Floating-Point: Scientific simulations, computer graphics, complex mathematical computations where range and
precision are necessary.
• Conclusion
• Choosing between fixed-point and floating-point representation depends on the specific requirements of the
application, including the range and precision of numbers, performance constraints, and hardware capabilities.
Fixed-point is advantageous for simple, predictable calculations, while floating-point is essential for handling a wide
range of values with greater precision.
• Addition and subtraction of signed numbers can be handled by representing these
numbers in a suitable format such as two's complement for binary operations. Here's
a detailed explanation of the process:
• Addition of Signed Numbers
• Decimal System
• When adding signed numbers in the decimal system, you follow these rules:
• Same Signs: If both numbers have the same sign, add their absolute values and keep
the sign.
– Example: 5+3=85 + 3 = 85+3=8
– Example: −5+(−3)=−(5+3)=−8-5 + (-3) = -(5 + 3) = -8−5+(−3)=−(5+3)=−8
• Different Signs: If the numbers have different signs, subtract the smaller absolute
value from the larger absolute value and take the sign of the number with the larger
absolute value.
– Example: 5+(−3)=5−3=25 + (-3) = 5 - 3 = 25+(−3)=5−3=2
– Example: −5+3=−(5−3)=−2-5 + 3 = -(5 - 3) = -2−5+3=−(5−3)=−2
• Binary System (Two's Complement Representation)
• In binary, signed numbers are often represented using two's complement. Here’s how to add two signed numbers in
two's complement:
• Convert to Two's Complement: Ensure both numbers are in two's complement form.
• Add the Numbers: Add the binary numbers, including the sign bit.
• Handle Overflow: Ignore the overflow if it occurs (i.e., the carry-out from the most significant bit).
• Example:
• Adding 555 and −3-3−3:
• Represent 555 in 8-bit binary: 00000101 Represent −3-3−3 in 8-bit two's complement:
– Find the binary for 333: 00000011
– Invert the bits: 11111100
– Add 1: 11111101
• Add 00000101 and 11111101:
• markdown
• Copy code
• 00000101
• + 11111101
• ----------
• 100000010 (ignore the overflow 1)
• Result: 00000010 (which is 2 in decimal)
• Subtraction of Signed Numbers
• Decimal System
• When subtracting signed numbers in the decimal system, you follow these rules:
• Same Signs: Subtract the smaller absolute value from the larger absolute value and keep the sign
of the number with the larger absolute value.
– Example: 5−3=25 - 3 = 25−3=2
– Example: −5−(−3)=−(5−3)=−2-5 - (-3) = -(5 - 3) = -2−5−(−3)=−(5−3)=−2
• Different Signs: If the numbers have different signs, add their absolute values and keep the sign of
the first number.
– Example: 5−(−3)=5+3=85 - (-3) = 5 + 3 = 85−(−3)=5+3=8
– Example: −5−3=−(5+3)=−8-5 - 3 = -(5 + 3) = -8−5−3=−(5+3)=−8
• Binary System (Two's Complement Representation)
• Subtraction can be handled as addition of the negative number (using two's complement):
• Convert to Two's Complement: Ensure both numbers are in two's complement form.
• Find Two's Complement of Subtrahend: To subtract bbb from aaa, convert bbb to its two's
complement.
• Add the Numbers: Add the first number and the two's complement of the second number.
• Handle Overflow: Ignore the overflow if it occurs.
• Example:
• Subtracting 555 and 333:
• Represent 555 in 8-bit binary: 00000101 Represent 333 in 8-bit two's complement:
– Find the binary for 333: 00000011
– Invert the bits: 11111100
– Add 1: 11111101
• Add 00000101 and 11111101:
• markdown
• Copy code
• 00000101
• + 11111101
• ----------
• 100000010 (ignore the overflow 1)
• Result: 00000010 (which is 2 in decimal)
• This approach can be extended to any bit-width, but for simplicity, examples are
usually shown with 8-bit representation.
• Multiplying signed numbers can be efficiently handled using binary arithmetic and sign handling. Here's a detailed
explanation of how signed operand multiplication works, particularly in the context of binary numbers using two's
complement representation.
• Multiplication of Signed Numbers
• Decimal System
• When multiplying signed numbers in the decimal system, the rules are:
• Same Signs: The result is positive.
– Example: 5×3=155 \times 3 = 155×3=15
– Example: −5×−3=15-5 \times -3 = 15−5×−3=15
• Different Signs: The result is negative.
– Example: 5×−3=−155 \times -3 = -155×−3=−15
– Example: −5×3=−15-5 \times 3 = -15−5×3=−15
• Binary System (Two's Complement Representation)
• For binary numbers in two's complement, the multiplication process involves a few steps:
• Determine the Sign of the Result:
– If the signs of the operands are the same, the result is positive.
– If the signs of the operands are different, the result is negative.
• Convert to Positive Values:
– If the number is negative, convert it to its positive equivalent using two's complement.
• Perform Binary Multiplication:
– Multiply the absolute values of the numbers using standard binary multiplication.
• Convert Back if Necessary:
– If the result should be negative, convert it to two's complement.
• Example: Multiplying −6-6−6 and 333
• Let's illustrate this with an 8-bit example.
• Represent the Numbers:
– −6-6−6 in 8-bit two's complement:
• Binary of 666: 00000110
• Invert the bits: 11111001
• Add 1: 11111010 (this is −6-6−6 in two's complement)
– 333 in 8-bit binary: 00000011
• Determine the Sign:
– The signs are different, so the result will be negative.
• Convert to Positive Values:
– −6-6−6 is already in two's complement, so use 11111010.
– 333 is positive, so use 00000011.
• Binary Multiplication: Perform binary multiplication of the absolute values. Ignore the sign for now:
• vbnet
• Copy code
• 11111010 (-6 in two's complement)
• × 00000011 (3)
• -----------------
• 11111010 (first partial product: 11111010 shifted 0 bits to the left)
• + 11111010 (second partial product: 11111010 shifted 1 bit to the left)
• -----------------
• 101110100 (add the partial products, note this is larger than 8-bits)
• Truncate to 8-bits and Handle Overflow:
– Since we are working with 8-bit registers, we truncate the result to the lower 8 bits: 01110100.
• Adjust Sign if Necessary:
– The product is negative, so convert 01110100 to its two's complement:
• Invert the bits: 10001011
• Add 1: 10001100
• Therefore, -6 × 3 = -18, and the 8-bit two's complement representation of −18-18−18 is
10001100.
• Conclusion
• Multiplying signed binary numbers involves the following steps:
• Determine the sign of the result.
• Convert negative operands to positive using two's complement.
• Multiply the absolute values using standard binary multiplication.
• Convert the result back to negative if required using two's complement.
• This ensures accurate handling of sign and magnitude, leveraging the properties of
two's complement arithmetic.
BOOTHS ALGORITHM
• Booth algorithm gives a procedure for multiplying
binary integers in signed 2’s complement
representation in efficient way, i.e., less number of
additions/subtractions required. It operates on the fact
that strings of 0’s in the multiplier require no addition
but just shifting and a string of 1’s in the multiplier
from bit weight 2^k to weight 2^m can be treated as
2^(k+1 ) to 2^m. As in all multiplication schemes,
booth algorithm requires examination of the
multiplier bits and shifting of the partial product. Prior
to the shifting, the multiplicand may be added to the
partial product, subtracted from the partial product, or
left unchanged according to following rules:
• The multiplicand is subtracted from the partial
product upon encountering the first least
significant 1 in a string of 1’s in the multiplier
• The multiplicand is added to the partial product
upon encountering the first 0 (provided that there
was a previous ‘1’) in a string of 0’s in the
multiplier.
• The partial product does not change when the
multiplier bit is identical to the previous multiplier
bit.
Booth’s Algorithm Flowchart –
• We name the register as A, B and Q, AC, BR
and QR respectively. Qn designates the least
significant bit of multiplier in the register QR.
An extra flip-flop Qn+1is appended to QR to
facilitate a double inspection of the
multiplier.The flowchart for the booth
algorithm is shown below.
• AC and the appended bit Qn+1 are initially cleared
to 0 and the sequence SC is set to a number n
equal to the number of bits in the multiplier. The
two bits of the multiplier in Qn and Qn+1are
inspected. If the two bits are equal to 10, it means
that the first 1 in a string has been encountered.
This requires subtraction of the multiplicand from
the partial product in AC. If the 2 bits are equal to
01, it means that the first 0 in a string of 0’s has
been encountered. This requires the addition of
the multiplicand to the partial product in AC.
• When the two bits are equal, the partial product does not change.
An overflow cannot occur because the addition and subtraction of
the multiplicand follow each other. As a consequence, the 2
numbers that are added always have a opposite signs, a condition
that excludes an overflow. The next step is to shift right the partial
product and the multiplier (including Qn+1). This is an arithmetic
shift right (ashr) operation which AC and QR to the right and
leaves the sign bit in AC unchanged. The sequence counter is
decremented and the computational loop is repeated n times.
Product of negative numbers is important, while multiplying
negative numbers we need to find 2’s complement of the number
to change its sign, because it’s easier to add instead of performing
binary subtraction. product of two negative number is
demonstrated below along with 2’s complement.
Example – A numerical example of booth’s algorithm is shown below for n = 4. It shows the step
by step multiplication of -5 and -7.
• Advantages:
• Faster than traditional multiplication: Booth’s algorithm is faster
than traditional multiplication methods, requiring fewer steps to
produce the same result.
• Efficient for signed numbers: The algorithm is designed
specifically for multiplying signed binary numbers, making it a
more efficient method for multiplication of signed numbers than
traditional methods.
• Lower hardware requirement: The algorithm requires fewer
hardware resources than traditional multiplication methods,
making it more suitable for applications with limited hardware
resources.
• Widely used in hardware: Booth’s algorithm is widely used in
hardware implementations of multiplication operations, including
digital signal processors, microprocessors, and FPGAs.
• Disadvantages:
• Complex to understand: The algorithm is more complex to
understand and implement than traditional multiplication
methods.
• Limited applicability: The algorithm is only applicable for
multiplication of signed binary numbers, and cannot be used for
multiplication of unsigned numbers or numbers in other formats
without additional modifications.
• Higher latency: The algorithm requires multiple iterations to
calculate the result of a single multiplication operation, which
increases the latency or delay in the calculation of the result.
• Higher power consumption: The algorithm consumes more power
compared to traditional multiplication methods, especially for
larger inputs.
• Application of Booth’s Algorithm:
• 1. Chip and computer processors: Corner’s Calculation
is utilized in the equipment execution of
number-crunching rationale units (ALUs) inside
microchips and computer chips. These parts are liable
for performing number juggling and coherent
procedure on twofold information. Proficient
duplication is fundamental in different applications,
including logical registering, designs handling, and
cryptography. Corner’s Calculation lessens the quantity
of piece movements and augmentations expected to
perform duplication, bringing about quicker execution
and better in general execution.
• 2. Digital Signal Processing (DSP): DSP applications
frequently include complex numerical tasks, for example,
sifting and convolution. Duplicating enormous twofold
numbers is a principal activity in these errands. Corner’s
Calculation permits DSP frameworks to perform
duplications all the more productively, empowering ongoing
handling of sound, video, and different sorts of signs.
• 3. Hardware Accelerators: Many particular equipment gas
pedals are intended to perform explicit assignments more
productively than broadly useful processors. Corner’s
Calculation can be integrated into these gas pedals to
accelerate augmentation activities in applications like
picture handling, brain organizations, and AI.
• 4. Cryptography: Cryptographic calculations, like those
utilized in encryption and computerized marks, frequently
include particular exponentiation, which requires proficient
duplication of huge numbers. Corner’s Calculation can be
utilized to speed up the measured augmentation step in
these calculations, working on the general proficiency of
cryptographic tasks.
• 5. High-Performance Computing (HPC): In logical
reenactments and mathematical calculations, enormous
scope augmentations are oftentimes experienced. Corner’s
Calculation can be carried out in equipment or
programming to advance these duplication tasks and
improve the general exhibition of HPC frameworks.
• 6. Implanted Frameworks: Inserted frameworks
frequently have restricted assets regarding handling
power and memory. By utilizing Corner’s Calculation,
fashioners can upgrade augmentation activities in
these frameworks, permitting them to perform all the
more proficiently while consuming less energy.
• 7. Network Parcel Handling: Organization gadgets and
switches frequently need to perform estimations on
bundle headers and payloads. Augmentation activities
are regularly utilized in these estimations, and Corner’s
Calculation can assist with diminishing handling
investment utilization in these gadgets.
8. Advanced Channels and
Balancers: Computerized channels and
adjusters in applications like sound handling
and correspondence frameworks require
productive augmentation of coefficients with
input tests. Stall’s Calculation can be utilized to
speed up these increases, prompting quicker
and more precise sifting activities.
Basically, Corner’s Calculation finds its
application any place productive paired
duplication is required, particularly in
situations where speed, power proficiency, and
equipment streamlining are significant
elements.

You might also like