Module-01
Important Questions
Q.- What is CPU? Explain with a block diagram.
Ans. The full form of CPU is Central Processing Unit. It is a brain of the computer. All types
of data processing operations and all the important functions of a computer are performed by
the CPU. It helps input and output devices to communicate with each other and perform their
respective operations. It also stores data which is input, intermediate results in between
processing, and instructions.
A Central Processing Unit is the most important component of a computer system. A CPU is a
hardware that performs data input/output, processing and storage functions for a computer
system. A CPU can be installed into a CPU socket. These sockets are generally located on the
motherboard. CPU can perform various data processing operations. CPU can store data,
instructions, programs, and intermediate results.
Different Parts of CPU
Now, the CPU consists of 3 major units, which are:
1. Memory or Storage Unit
2. Control Unit
3. ALU(Arithmetic Logic Unit)
Let us now look at the block diagram of the computer:
Here, in this diagram, the three major components are also shown. So, let us discuss these
major components:
Memory or Storage Unit
As the name suggests this unit can store instructions, data, and intermediate results. The
memory unit is responsible for transferring information to other units of the computer when
needed. It is also known as an internal storage unit or the main memory or the primary storage
or Random Access Memory (RAM) as all these are storage devices.
Its size affects speed, power, and performance. There are two types of memory in the
computer, which are primary memory and secondary memory. Some main functions of
memory units are listed below:
Data and instructions are stored in memory units which are required for processing.
It also stores the intermediate results of any calculation or task when they are in process.
The final results of processing are stored in the memory units before these results are
released to an output device for giving the output to the user.
All sorts of inputs and outputs are transmitted through the memory unit.
Control Unit
As the name suggests, a control unit controls the operations of all parts of the computer but it
does not carry out any data processing operations. For executing already stored instructions, It
instructs the computer by using the electrical signals to instruct the computer system. It takes
instructions from the memory unit and then decodes the instructions after that it executes those
instructions. So, it controls the functioning of the computer. It’s main task is to maintain the
flow of information across the processor. Some main functions of the control unit are listed
below:
Controlling of data and transfer of data and instructions is done by the control unit among
other parts of the computer.
The control unit is responsible for managing all the units of the computer.
The main task of the control unit is to obtain the instructions or data which is input from
the memory unit, interprets them, and then directs the operation of the computer according
to that.
The control unit is responsible for communication with Input and output devices for the
transfer of data or results from memory.
The control unit is not responsible for the processing of data or storing data.
ALU (Arithmetic Logic Unit)
ALU (Arithmetic Logic Unit) is responsible for performing arithmetic and logical functions or
operations. It consists of two subsections, which are:
Arithmetic Section
Logic Section
Now, let us know about these subsections:
Arithmetic Section: By arithmetic operations, we mean operations like addition, subtraction,
multiplication, and division, and all these operation and functions are performed by ALU.
Also, all the complex operations are done by making repetitive use of the mentioned operations
by ALU.
Logic Section: By Logical operations, we mean operations or functions like selecting,
comparing, matching, and merging the data, and all these are performed by ALU.
Note: CPU may contain more than one ALU and it can be used for maintaining timers that help
run the computer system.
Q. What is the function of CPU also write down different types of CPU.
Ans.- The main function of a computer processor is to execute instruction and produce an
output. CPU work are Fetch, Decode and Execute are the fundamental functions of the
computer.
Fetch: the first CPU gets the instruction. That means binary numbers that are passed from
RAM to CPU.
Decode: When the instruction is entered into the CPU, it needs to decode the instructions.
with the help of ALU(Arithmetic Logic Unit) the process of decode begins.
Execute: After decode step the instructions are ready to execute
Store: After execute step the instructions are ready to store in the memory.
Types of CPU
We have three different types of CPU:
Single Core CPU: The oldest type of computer CPUs is single core CPU. These CPUs
were used in the 1970s. these CPUs only have a single core that preform different
operations. This means that the single core CPU can only process one operation at a single
time. single core CPU CPU is not suitable for multitasking.
Dual-Core CPU: Dual-Core CPUs contain a single Integrated Circuit with two cores. Each
core has its cache and controller. These controllers and cache are work as a single unit. dual
core CPUs can work faster than the single-core processors.
Quad-Core CPU: Quad-Core CPUs contain two dual-core processors present within a
single integrated circuit (IC) or chip. A quad-core processor contains a chip with four
independent cores. These cores read and execute various instructions provided by the CPU.
Quad Core CPU increases the overall speed for programs. Without even boosting the
overall clock speed it results in higher performance.
Q.- Explain RTL representation and different related operations.
Ans.- In symbolic notation, it is used to describe the micro-operations transfer among registers.
It is a kind of intermediate representation (IR) that is very close to assembly language, such as
that which is used in a compiler. The term “Register Transfer” can perform micro-operations
and transfer the result of operation to the same or other register.
Micro-operations:
The operation executed on the data store in registers are called micro-operations. They are
detailed low-level instructions used in some designs to implement complex machine
instructions.
Register Transfer:
The information transformed from one register to another register is represented in symbolic
form by replacement operator is called Register Transfer.
Replacement Operator:
In the statement, R2 <- R1, <- acts as a replacement operator. This statement defines the
transfer of content of register R1 into register R2.
There are various methods of RTL –
1. General way of representing a register is by the name of the register enclosed in a
rectangular box as shown in (a).
2. Register is numbered in a sequence of 0 to (n-1) as shown in (b).
3. The numbering of bits in a register can be marked on the top of the box as shown in (c).
4. A 16-bit register PC is divided into 2 parts- Bits (0 to 7) are assigned with lower byte of
16-bit address and bits (8 to 15) are assigned with higher bytes of 16-bit address as shown
in (d).
Basic symbols of RTL:
Symbol Description Example
Letters and MAR, R1,
Denotes a Register
Numbers R2
R1(8-bit)
() Denotes a part of register
R1(0-7)
<- Denotes a transfer of information R2 <- R1
R1 <- R2
Specify two micro-operations of
,
Register Transfer R2 <- R1
P : R2 <-
R1
: Denotes conditional operations
if P=1
Naming Denotes another name for an already
Ra := R1
Operator (:=) existing register/alias
Register Transfer Operations:
The operation performed on the data stored in the registers are referred to as register transfer
operations.
There are different types of register transfer operations:
1. Simple Transfer – R2 <- R1
The content of R1 are copied into R2 without affecting the content of R1. It is an
unconditional type of transfer operation.
2. Conditional Transfer –
It indicates that if P=1, then the content of R1 is transferred to R2. It is a unidirectional
operation.
3. Simultaneous Operations –
If 2 or more operations are to occur simultaneously then they are separated with comma (,).
If the control function P=1, then load the content of R1 into R2 and at the same clock load the
content of R2 into R1.
Q. Explain Booth's Multiplication Algorithm with an example.
Ans.- The booth algorithm is a multiplication algorithm that allows us to multiply the two signed
binary integers in 2's complement, respectively. It is also used to speed up the performance of the
multiplication process. It is very efficient too. It works on the string bits 0's in the multiplier that
requires no additional bit only shift the right-most string bits and a string of 1's in a multiplier bit
weight 2k to weight 2m that can be considered as 2k+ 1 - 2m.
Following is the pictorial representation of the Booth's Algorithm:
In the above flowchart, initially, AC and Qn + 1 bits are set to 0, and the SC is a sequence counter
that represents the total bits set n, which is equal to the number of bits in the multiplier. There
are BR that represent the multiplicand bits, and QR represents the multiplier bits. After that,
we encountered two bits of the multiplier as Q n and Qn + 1, where Qn represents the last bit of QR,
and Qn + 1 represents the incremented bit of Qn by 1. Suppose two bits of the multiplier is equal to
10; it means that we have to subtract the multiplier from the partial product in the accumulator
AC and then perform the arithmetic shift operation (ashr). If the two of the multipliers equal to
01, it means we need to perform the addition of the multiplicand to the partial product in
accumulator AC and then perform the arithmetic shift operation (ashr), including Qn + 1. The
arithmetic shift operation is used in Booth's algorithm to shift AC and QR bits to the right by one
and remains the sign bit in AC unchanged. And the sequence counter is continuously
decremented till the computational loop is repeated, equal to the number of bits (n).
Working on the Booth Algorithm
1. Set the Multiplicand and Multiplier binary bits as M and Q, respectively.
2. Initially, we set the AC and Qn + 1 registers value to 0.
3. SC represents the number of Multiplier bits (Q), and it is a sequence counter that is
continuously decremented till equal to the number of bits (n) or reached to 0.
4. A Qn represents the last bit of the Q, and the Qn+1 shows the incremented bit of Qn by 1.
5. On each cycle of the booth algorithm, Qn and Qn + 1 bits will be checked on the following
parameters as follows:
i. When two bits Qn and Qn + 1 are 00 or 11, we simply perform the arithmetic shift
right operation (ashr) to the partial product AC. And the bits of Qn and Q n + 1 is
incremented by 1 bit.
ii. If the bits of Qn and Qn + 1 is shows to 01, the multiplicand bits (M) will be added
to the AC (Accumulator register). After that, we perform the right shift operation
to the AC and QR bits by 1.
iii. If the bits of Qn and Qn + 1 is shows to 10, the multiplicand bits (M) will be
subtracted from the AC (Accumulator register). After that, we perform the right
shift operation to the AC and QR bits by 1.
6. The operation continuously works till we reached n - 1 bit in the booth algorithm.
7. Results of the Multiplication binary bits will be stored in the AC and QR registers.
There are two methods used in Booth's Algorithm:
1. RSC (Right Shift Circular)
It shifts the right-most bit of the binary number, and then it is added to the beginning of the
binary bits.
2. RSA (Right Shift Arithmetic)
It adds the two binary bits and then shift the result to the right by 1-bit position.
Example: 0100 + 0110 => 1010, after adding the binary number shift each bit by 1 to the right
and put the first bit of resultant to the beginning of the new bit.
Example: Multiply the two numbers 7 and 3 by using the Booth's multiplication algorithm.
Ans. Here we have two numbers, 7 and 3. First of all, we need to convert 7 and 3 into binary
numbers like 7 = (0111) and 3 = (0011). Now set 7 (in binary 0111) as multiplicand (M) and 3
(in binary 0011) as a multiplier (Q). And SC (Sequence Count) represents the number of bits,
and here we have 4 bits, so set the SC = 4. Also, it shows the number of iteration cycles of the
booth's algorithms and then cycles run SC = SC - 1 time.
Qn Qn + 1 M = (0111) AC Q Qn + 1 SC
M' + 1 = (1001) & Operation
1 0 Initial 0000 001 0 4
1
Subtract (M' + 1) 1001
1001
Perform Arithmetic Right Shift operations 1100 100 1 3
(ashr) 1
1 1 Perform Arithmetic Right Shift operations 1110 010 1 2
(ashr) 0
0 1 Addition (A + M) 0111
0101 010
0
Perform Arithmetic right shift operation 0010 101 0 1
0
0 0 Perform Arithmetic right shift operation 0001 010 0 0
1
The numerical example of the Booth's Multiplication Algorithm is 7 x 3 = 21 and the binary
representation of 21 is 10101. Here, we get the resultant in binary 00010101. Now we convert it
into decimal, as (000010101)10 = 2*4 + 2*3 + 2*2 + 2*1 + 2*0 => 21.
ADVERTISEMENT
ADVERTISEMENT
Example: Multiply the two numbers 23 and -9 by using the Booth's multiplication
algorithm.
Here, M = 23 = (010111) and Q = -9 = (110111)
Qn Qn + 1 M=010111 AC Q Qn + 1
M' + 1 = 1 0 1 0 0 1 SC
Initially 000000 11011 0 6
1
1 0 Subtract M 101001
101001
Perform Arithmetic right shift 110100 11101 1 5
operation 1
1 1 Perform Arithmetic right shift 111010 01110 1 4
operation 1
1 1 Perform Arithmetic right shift 111101 00111 1 3
operation 0
0 1 Addition (A + M) 010111
010100
Perform Arithmetic right shift 001010 00011 0 2
operation 1
1 0 Subtract M 101001
110011
Perform Arithmetic right shift 111001 10001 1 1
operation 1
1 1 Perform Arithmetic right shift 111100 11000 1 0
operation 1
Qn + 1 = 1, it means the output is negative.
Hence, 23 * -9 = 2's complement of 111100110001 => (00001100111)
Fixed-Point Representation −
This representation has fixed number of bits for integer part and for fractional part. For example,
if given fixed-point representation is IIII.FFFF, then you can store minimum value is 0000.0001
and maximum value is 9999.9999. There are three parts of a fixed-point number representation:
the sign field, integer field, and fractional field.
We can represent these numbers using:
Signed representation: range from -(2(k-1)-1) to (2(k-1)-1), for k bits.
1’s complement representation: range from -(2(k-1)-1) to (2(k-1)-1), for k bits.
2’s complementation representation: range from -(2(k-1)) to (2(k-1)-1), for k bits.
2’s complementation representation is preferred in computer system because of unambiguous
property and easier for arithmetic operations.
Example −Assume number is using 32-bit format which reserve 1 bit for the sign, 15 bits for the
integer part and 16 bits for the fractional part.
Then, -43.625 is represented as following:
Where, 0 is used to represent + and 1 is used to represent. 000000000101011 is 15 bit binary
value for decimal 43 and 1010000000000000 is 16 bit binary value for fractional 0.625.
The advantage of using a fixed-point representation is performance and disadvantage is
relatively limited range of values that they can represent. So, it is usually inadequate for
numerical analysis as it does not allow enough numbers and accuracy. A number whose
representation exceeds 32 bits would have to be stored inexactly.
These are above smallest positive number and largest positive number which can be store in 32-
bit representation as given above format. Therefore, the smallest positive number is 2 -16 ≈
0.000015 approximate and the largest positive number is (2 15-1)+(1-2-16)=215(1-2-16) =32768, and
gap between these numbers is 2-16.
We can move the radix point either left or right with the help of only integer field is 1.
Floating-Point Representation −
This representation does not reserve a specific number of bits for the integer part or the fractional
part. Instead it reserves a certain number of bits for the number (called the mantissa or
significand) and a certain number of bits to say where within that number the decimal place sits
(called the exponent).
The floating number representation of a number has two part: the first part represents a signed
fixed point number called mantissa. The second part of designates the position of the decimal (or
binary) point and is called the exponent. The fixed point mantissa may be fraction or an integer.
Floating -point is always interpreted to represent a number in the following form: Mxre.
Only the mantissa m and the exponent e are physically represented in the register (including their
sign). A floating-point binary number is represented in a similar manner except that is uses base
2 for the exponent. A floating-point number is said to be normalized if the most significant digit
of the mantissa is 1.
So, actual number is (-1)s(1+m)x2(e-Bias), where s is the sign bit, m is the mantissa, e is the
exponent value, and Bias is the bias number.
Note that signed integers and exponent are represented by either sign representation, or one’s
complement representation, or two’s complement representation.
The floating point representation is more flexible. Any non-zero number can be represented in
the normalized form of ±(1.b1b2b3 ...)2x2n This is normalized form of a number x.
Example −Suppose number is using 32-bit format: the 1 bit sign bit, 8 bits for signed exponent,
and 23 bits for the fractional part. The leading bit 1 is not stored (as it is always 1 for a
normalized number) and is referred to as a “hidden bit”.
Then −53.5 is normalized as -53.5=(-110101.1)2=(-1.101011)x25 , which is represented as
following below,
Where 00000101 is the 8-bit binary value of exponent value +5.
Note that 8-bit exponent field is used to store integer exponents -126 ≤ n ≤ 127.
The smallest normalized positive number that fits into 32 bits is
(1.00000000000000000000000)2x2-126=2-126≈1.18x10-38 , and largest normalized positive number
that fits into 32 bits is (1.11111111111111111111111)2x2127=(224-1)x2104 ≈ 3.40x1038 . These
numbers are represented as following below,
The precision of a floating-point format is the number of positions reserved for binary digits plus
one (for the hidden bit). In the examples considered here the precision is 23+1=24.
The gap between 1 and the next normalized floating-point number is known as machine epsilon.
the gap is (1+2-23)-1=2-23for above example, but this is same as the smallest positive floating-
point number because of non-uniform spacing unlike in the fixed-point scenario.
Note that non-terminating binary numbers can be represented in floating point representation,
e.g., 1/3 = (0.010101 ...)2 cannot be a floating-point number as its binary representation is non-
terminating.