0% found this document useful (0 votes)
36 views12 pages

Assignment 4 Sol MB

Uploaded by

sahil shekh
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)
36 views12 pages

Assignment 4 Sol MB

Uploaded by

sahil shekh
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

‭Unit 5: Computer Arithmetic‬

‭ .1 Explain how addition and subtraction operation is performed with‬


Q
‭signed-magnitude data using block diagram.‬

‭ hen adding and subtracting signed-magnitude numbers, you need to consider both the‬
W
‭signs and the magnitudes of the numbers.‬
‭●‬ A
‭ ddition:‬‭If the signs of the two numbers are the‬‭same, you add their magnitudes and‬
‭keep the same sign‬‭1‬‭. If the signs are different, you‬‭subtract the smaller magnitude from‬
‭the larger one‬‭2‬‭. The sign of the result is the same‬‭as the number with the larger‬
‭magnitude‬‭3‬‭. If the magnitudes are equal, the result‬‭is zero‬‭4‭.‬ ‬

‭●‬ S
‭ ubtraction:‬‭To perform subtraction, you first change‬‭the sign of the subtrahend and‬
‭then follow the rules of addition‬‭5‭.‬ ‬

‭The hardware uses an‬

‭ dder/subtractor‬‭unit, a‬‭magnitude comparator‬‭to determine‬‭the larger number, and a‬‭sign‬


a
‭logic‬‭unit to handle the signs‬‭6‬‭.‬

‭ .2 Explain how addition and subtraction operation is performed with signed-2's‬


Q
‭complement data using block diagram.‬

‭ igned-2's complement representation simplifies arithmetic because both addition and‬


S
‭subtraction can be performed using only addition.‬
‭●‬ ‭Addition:‬‭The two numbers are added along with their‬‭sign bits‬‭7‬‭. Any carry-out from the‬
‭sign bit position is ignored‬‭8‭.‬ The result is in 2's‬‭complement form.‬

‭●‬ S
‭ ubtraction:‬‭To subtract a number, you take its‬‭2's‬‭complement‬‭and add it to the other‬
‭number‬‭9‬‭. Taking the 2's complement involves inverting all the bits and adding 1‬‭10‬‭.‬
‭The block diagram for this operation is relatively simple, as it mainly consists of an‬

‭adder‬‭and control logic for complementing the subtrahend‬‭during a subtraction operation‬‭11‬‭.‬

‭ .3 Explain how multiplication operation is performed using successive shift and‬


Q
‭add operations. Support your answer with block diagram for hardware for‬
‭multiply operation.‬

‭ inary multiplication can be performed by a series of shift and add operations, similar to long‬
B
‭multiplication. The process is as follows:‬
‭1.‬ I‭nitialize a‬‭product register (A)‬‭to zero and a‬‭sequence‬‭counter‬‭with the number of bits‬
‭in the multiplier.‬
‭2.‬ ‭Check the least significant bit (LSB) of the‬‭multiplier‬‭register (Q)‬‭.‬
‭3.‬ ‭If the LSB is 1, add the‬‭multiplicand register (B)‬‭to the product register (A).‬
‭4.‬ ‭If the LSB is 0, do nothing.‬
‭5.‬ ‭Right-shift the combined register AQ by one position.‬
‭6.‬ ‭Decrement the sequence counter.‬
‭7.‬ ‭Repeat the process until the sequence counter is zero.‬

‭The hardware includes registers for the‬

‭ ultiplicand (B)‬‭,‬‭multiplier (Q)‬‭, and‬‭product (A)‬‭,‬‭along with an‬‭adder‬‭and a‬‭sequence‬


m
‭counter‬‭12‬‭.‬

‭ .4 Explain Booth algorithm for multiplying binary integers in signed-2's‬


Q
‭complement representation. Support your answer with block diagram for‬
‭hardware implementation for Booth Algorithm.‬

‭ ooth's algorithm is an efficient method for multiplying signed-2's complement binary‬


B
‭numbers. It treats consecutive 1s and 0s in the multiplier differently to reduce the number of‬
‭additions required.‬
‭The algorithm works by examining pairs of bits in the multiplier, starting from the least‬
‭significant bit (LSB), and a bit to its right (Qn+1).‬
‭●‬ ‭If the pair is‬‭01‬‭, you add the multiplicand to the‬‭accumulator.‬
‭●‬ ‭If the pair is‬‭10‬‭, you subtract the multiplicand (i.e.,‬‭add its 2's complement).‬
‭●‬ ‭If the pair is 00 or 11, you don't perform any addition or subtraction.‬
‭After each step, you perform an arithmetic right shift on the accumulator and multiplier‬
‭registers. This process is repeated for all bits of the multiplier.‬

‭ he hardware uses registers for the multiplicand, a partial product accumulator, the multiplier,‬
T
‭and a single bit to the right of the multiplier for bit-pair checking‬‭13‬‭.‬

‭ .5 What is the advantage of array multiplier as compared to other multipliers?‬


Q
‭Draw logic circuit diagram for 2 bit by 2 bit array multiplier and explain its‬
‭working.‬

‭The main advantage of an‬

‭ rray multiplier‬‭is its‬‭high speed‬‭14‬‭. It performs‬‭multiplication in a single step using a‬


a
‭combinational logic circuit, unlike sequential multipliers that use a sequence of shifts and‬
‭adds. This parallel nature makes it much faster‬‭15‬‭.‬

‭A‬

‭ -bit by 2-bit array multiplier‬‭uses four‬‭AND gates‬‭and two‬‭half-adders‬‭16‬‭. Each AND gate‬
2
‭multiplies one bit from the multiplicand with one bit from the multiplier. The outputs of these‬
‭AND gates (partial products) are then summed up using half-adders to produce the final‬
‭product‬‭17‬‭.‬

‭ .6 With the help of a block diagram show register organization for floating-point‬
Q
‭arithmetic operations and explain the same.‬

‭ loating-point numbers are represented by a mantissa and an exponent. The register‬


F
‭organization for floating-point operations requires dedicated registers to handle these‬
‭components separately‬‭18‬‭.‬
‭The block diagram includes:‬
‭‬
● ‭ xponent Registers:‬‭To hold the exponents of the two‬‭numbers.‬
E
‭●‬ ‭Mantissa Registers:‬‭To hold the mantissas of the two‬‭numbers.‬
‭●‬ ‭Sign Bits:‬‭To hold the signs of the numbers.‬
‭●‬ ‭Specialized Hardware: Includes an exponent adder/subtractor and a mantissa‬
‭multiplier/divider.‬
‭The system also needs a separate‬
‭alignment stage‬‭to make the exponents equal before‬‭addition or subtraction‬‭19‬‭.‬

‭ .7 Discuss algorithm steps for addition and subtraction of floating-point‬


Q
‭numbers.‬

‭Floating-point addition and subtraction involve four main steps‬‭20‬‭:‬

‭ .‬ C
1 ‭ heck for Zero:‬‭Check if either operand is zero. If‬‭so, the result is the other operand.‬
‭2.‬ ‭Align the Mantissas:‬‭Shift the mantissa of the number‬‭with the smaller exponent to the‬
‭right and increment its exponent until both exponents are equal.‬
‭3.‬ ‭Add or Subtract the Mantissas:‬‭Perform the addition‬‭or subtraction on the aligned‬
‭mantissas.‬
‭4.‬ ‭Normalize the Result:‬‭Adjust the mantissa and exponent‬‭so that the mantissa is within‬
‭the standard range (e.g., 1≤mantissa<10). The exponent is adjusted accordingly. If there's‬
‭an overflow or underflow, handle it.‬

‭Q.8 Discuss algorithm steps for multiplication of floating-point numbers.‬

‭ loating-point multiplication is simpler than addition because you don't need to align the‬
F
‭mantissas‬‭21‬‭. The steps are:‬

‭1.‬ A ‭ dd the Exponents:‬‭The exponents of the two numbers‬‭are added. The base is then‬
‭subtracted from the sum to correct for the biased representation.‬
‭2.‬ ‭Multiply the Mantissas:‬‭The mantissas are multiplied.‬
‭3.‬ ‭Determine the Sign:‬‭The sign of the result is the‬‭XOR of the signs of the two numbers.‬
‭4.‬ ‭Normalize the Result:‬‭The mantissa and exponent are‬‭adjusted to fit the standard‬
‭format.‬
‭Q.9 Discuss algorithm steps for division of floating-point numbers.‬

‭Floating-point division also avoids the mantissa alignment step‬‭22‬‭. The steps are:‬

‭1.‬ S ‭ ubtract the Exponents:‬‭The exponent of the divisor‬‭is subtracted from the exponent of‬
‭the dividend.‬
‭2.‬ ‭Divide the Mantissas:‬‭The mantissa of the dividend‬‭is divided by the mantissa of the‬
‭divisor.‬
‭3.‬ ‭Determine the Sign:‬‭The sign of the result is the‬‭XOR of the signs of the two numbers.‬
‭4.‬ ‭Normalize the Result:‬‭The mantissa and exponent are‬‭adjusted to the correct format.‬

‭Q.10 What is Decimal Arithmetic Unit?‬

‭A‬

‭ ecimal Arithmetic Unit (DAU)‬‭is a part of a computer's‬‭central processing unit (CPU) that‬
D
‭is designed to perform arithmetic operations directly on‬‭decimal numbers‬‭23‬‭. Instead of‬
‭converting decimal numbers to binary for calculations, a DAU works with decimal‬
‭representations like‬

‭ CD (Binary-Coded Decimal)‬‭24‬‭. This is particularly‬‭useful in business and financial‬


B
‭applications where exact decimal representation is required and rounding errors from binary‬
‭conversion are unacceptable‬‭25‬‭.‬

‭ .11 How will you implement arithmetic operations of addition, subtraction,‬


Q
‭multiplication and division using decimal data?‬

‭Decimal arithmetic operations are implemented using BCD.‬


‭●‬ ‭Addition and Subtraction:‬‭BCD numbers are added or‬‭subtracted bit by bit‬‭26‬‭. The result‬
‭ f each 4-bit group is checked to see if it exceeds 9 or if there is a carry‬‭27‬‭. If it does, a‬
o
‭correction (adding or subtracting 6) is applied to ensure the result is in valid BCD format.‬
‭●‬ ‭Multiplication and Division:‬‭These operations are‬‭more complex‬‭28‬‭. They can be‬
‭performed using repeated decimal addition and subtraction, respectively‬‭29‬‭.‬

‭Unit 6: Pipeline & Vector Processing‬

‭Q.1 State advantage and disadvantage of parallel processing.‬

‭●‬ A
‭ dvantages:‬
‭○‬ ‭Increased Speed:‬‭Parallel processing significantly‬‭speeds up computation by‬
‭executing multiple instructions or processes simultaneously‬‭30‬‭.‬

‭○‬ P
‭ roblem Solving:‬‭It allows for solving larger and‬‭more complex problems that would‬
‭be too slow for a single processor‬‭31‬‭.‬

‭○‬ C ‭ ost Savings:‬‭It can be more cost-effective to use‬‭multiple smaller processors than‬
‭a single, very fast one.‬
‭ ‬ ‭Disadvantages:‬

‭○‬ ‭Increased Complexity:‬‭Writing parallel programs is‬‭more complex and difficult than‬
‭writing sequential programs‬‭32‬‭.‬

‭○‬ S
‭ ynchronization Overhead:‬‭The processors need to communicate‬‭and synchronize,‬
‭which adds overhead and can limit performance gains‬‭33‬‭.‬

‭○‬ ‭Hardware Cost:‬‭The initial cost of parallel processing‬‭hardware can be high.‬

‭Q.2 Discuss classification of Parallel Processing by M. J. Flynn.‬

‭ lynn's classification‬‭categorizes computer architectures‬‭based on how they handle‬


F
‭instruction streams and data streams‬‭34‬‭. There are‬‭four main types:‬
‭1.‬ S
‭ ISD (Single Instruction, Single Data):‬‭A conventional uniprocessor with a single‬
‭instruction stream operating on a single data stream‬‭35‬‭.‬

‭2.‬ S
‭ IMD (Single Instruction, Multiple Data):‬‭Multiple‬‭processors execute the same‬
‭instruction on different data simultaneously‬‭36‬‭. This‬‭is common in array processors.‬

‭3.‬ M
‭ ISD (Multiple Instruction, Single Data):‬‭Multiple‬‭processors execute different‬
‭instructions on the same data stream‬‭37‬‭. This architecture‬‭is not widely used.‬

‭4.‬ M
‭ IMD (Multiple Instruction, Multiple Data):‬‭Multiple‬‭processors execute different‬
‭instructions on different data streams simultaneously‬‭38‬‭.‬‭This is the most common form of‬
‭parallel processing, used in multicore processors and multiprocessor systems.‬

‭Q.3 What is pipeline processing? Explain with the help of an example.‬

‭ ipeline processing‬‭is a technique that breaks down‬‭a complex task into a series of smaller,‬
P
‭sequential subtasks, called segments, which are executed in a continuous, overlapping‬
‭fashion‬‭39‬‭. This allows multiple instructions to be‬‭in different stages of execution at the same‬
‭time, increasing the throughput of the processor‬‭40‬‭.‬

‭●‬ E
‭ xample:‬‭Consider a task with four stages: Fetch,‬‭Decode, Execute, and Write-back.‬
‭Without a pipeline, each instruction completes all four stages before the next one begins.‬
‭In a pipeline, while instruction 1 is in the Execute stage, instruction 2 can be in the‬
‭Decode stage, and instruction 3 can be in the Fetch stage. This creates an assembly-line‬
‭effect, completing one instruction per clock cycle once the pipeline is full‬‭41‬‭.‬

‭Q.4 Draw and explain block diagram for a 4-segment pipeline.‬

‭ 4-segment pipeline divides an instruction's execution into four stages. Each stage is‬
A
‭separated by a register to hold the output of the previous stage, acting as a buffer.‬
‭The segments are:‬
‭●‬ ‭S1:‬‭Instruction Fetch (FI)‬‭42‬
‭●‬ ‭S2:‬‭Instruction Decode and Operand Fetch (DA)‬‭43‬

‭●‬ ‭S3:‬‭Execution (EX)‬‭44‬

‭●‬ ‭S4:‬‭Write-back (WB)‬‭45‬

‭ he output of segment‬
T
‭Si​is stored in a register that becomes the input for segment Si+1​, allowing for a‬
‭continuous flow of instructions‬‭46‬‭.‬

‭Q.5 Differentiate between arithmetic pipeline and instruction pipeline.‬

‭●‬ A
‭ rithmetic Pipeline:‬‭This pipeline breaks down a complex‬‭arithmetic operation (like‬
‭floating-point addition or multiplication) into multiple stages. For example, floating-point‬
‭addition can be segmented into exponent comparison, mantissa alignment, addition, and‬
‭normalization‬‭47‬‭.‬

‭●‬ I‭ nstruction Pipeline:‬‭This pipeline divides the execution‬‭of an entire instruction into‬
‭stages, such as fetching, decoding, executing, and writing back the result. It's used to‬
‭increase the overall instruction throughput of the CPU‬‭48‬‭.‬

‭ .6 Draw and explain block diagram for pipeline for floating-point addition and‬
Q
‭subtraction.‬

‭A floating-point adder can be segmented into four pipeline stages to increase throughput‬‭49‬‭.‬

‭The four stages are:‬


‭1.‬ ‭Compare Exponents:‬‭Subtract the exponents to find‬‭their difference‬‭50‬‭.‬

‭2.‬ A
‭ lign Mantissas:‬‭Shift the mantissa of the number‬‭with the smaller exponent to match‬
‭the larger exponent‬‭51‬‭.‬

‭3.‬ ‭Add/Subtract Mantissas:‬‭Perform the addition or subtraction‬‭on the mantissas‬‭52‬‭.‬


‭4.‬ N
‭ ormalize Result:‬‭Adjust the mantissa and exponent‬‭to fit the standard floating-point‬
‭format‬‭53‬‭.‬

‭Q.7 Draw and explain flowchart for 4-segment CPU pipeline (instruction pipeline).‬

‭A 4-segment CPU pipeline breaks down instruction execution to improve throughput‬‭54‬‭.‬

‭The flowchart illustrates the four stages:‬


‭1.‬ ‭Fetch Instruction (FI):‬‭Read the instruction from‬‭memory‬‭55‬‭.‬

‭2.‬ D
‭ ecode Instruction (DA):‬‭Decode the instruction and‬‭fetch the operands from‬
‭registers‬‭56‬‭.‬

‭3.‬ ‭Execute Instruction (EX):‬‭Perform the operation specified‬‭by the instruction‬‭57‬‭.‬

‭4.‬ ‭Write Back (WB):‬‭Write the result to a register or‬‭memory‬‭58‬‭.‬

‭ he flowchart shows how each stage operates in parallel with the others, processing‬
T
‭different instructions at the same time‬‭59‬‭.‬

‭Q.8 Explain Vector Processing.‬

‭ ector processing‬‭is a form of parallel processing‬‭that involves operations on entire arrays or‬
V
‭"vectors" of data with a single instruction‬‭60‬‭. Instead‬‭of processing one element at a time, a‬
v‭ ector processor applies the same operation to many data elements simultaneously‬‭61‬‭. This is‬
‭highly efficient for tasks with repetitive calculations on large data sets, as it reduces the‬
‭overhead of instruction fetching and decoding‬‭62‬‭.‬
‭Q.9 Give examples of application areas which utilize vector processing.‬

‭Vector processing is used in applications that involve large, repetitive computations, such as:‬
‭●‬ S
‭ cientific and engineering calculations:‬‭Fluid dynamics,‬‭weather forecasting, and‬
‭molecular modeling‬‭63‬‭.‬

‭●‬ ‭Image and signal processing:‬‭Filtering, compression,‬‭and analysis of large data sets‬‭64‬‭.‬

‭●‬ M
‭ achine learning and artificial intelligence:‬‭Training‬‭neural networks and other‬
‭data-intensive algorithms.‬

‭Q.10 What is memory interleaving?‬

‭ emory interleaving‬‭is a technique used to improve‬‭memory access speed by dividing the‬


M
‭main memory into multiple independent modules‬‭65‬‭. Each‬‭module can be accessed‬
‭independently, so a CPU or a vector processor can access multiple memory locations‬
‭simultaneously. This is achieved by distributing the addresses sequentially across the‬
‭modules‬‭66‬‭. For example, address 0 would be in module‬‭0, address 1 in module 1, and so on.‬
‭This allows for faster data retrieval for sequential data streams, which is particularly beneficial‬
‭for pipelined and vector processors‬‭67‬‭.‬

‭Q.11 What is an array processor?‬

‭An‬

‭ rray processor‬‭is a processor that performs computations‬‭on large arrays of data‬‭68‬‭. There‬
a
‭are two main types:‬

‭●‬ A
‭ ttached Array Processor:‬‭A separate unit connected‬‭to a general-purpose host‬
‭computer‬‭69‬‭. The host computer handles the main program‬‭flow, while the array processor‬
‭handles the intensive array computations.‬

‭●‬ S
‭ IMD Array Processor:‬‭A system with multiple processing‬‭elements that execute the‬
‭same instruction on different data simultaneously‬‭70‬‭.‬

‭Q.12 Differentiate between attached array processor and SIMD array processor.‬

‭Feature‬ ‭Attached Array Processor‬ ‭SIMD Array Processor‬

‭Architecture‬ ‭ co-processor for a host‬


A ‭ stand-alone computer‬
A
‭computer.‬ ‭system.‬

‭Control‬ ‭ he host computer controls‬


T ‭ central control unit‬
A
‭the overall program flow.‬ ‭broadcasts the same‬
‭instruction to all processing‬
‭elements.‬

‭Data Flow‬ ‭ he host sends data to the‬


T ‭ ach processing element‬
E
‭array processor for‬ ‭has its own data memory.‬
‭computation.‬

‭Application‬ ‭ sed for speeding up‬


U ‭ sed for tasks that can be‬
U
‭specific, compute-intensive‬ ‭broken down into identical‬
‭tasks.‬ ‭operations on different‬
‭data, like image processing.‬

‭ .13 Draw and explain block diagram for attached array processor with host‬
Q
‭computer.‬

‭An‬

‭ ttached array processor‬‭is designed to enhance the‬‭performance of a host computer by‬


a
‭handling intensive numerical calculations‬‭71‬‭.‬
‭The system consists of:‬
‭●‬ ‭Host Computer:‬‭A general-purpose computer that manages‬‭the overall program and‬
‭I/O‬‭72‬‭.‬

‭●‬ A
‭ ttached Array Processor:‬‭A specialized processor‬‭with its own internal memory and a‬
‭dedicated arithmetic unit‬‭73‬‭.‬

‭ he host computer sends data and a program to the array processor, which performs the‬
T
‭calculations and sends the results back‬‭74‬‭. Communication‬‭is typically handled through a‬
‭dedicated bus‬‭75‬‭.‬

‭Q.14 Draw and explain block diagram for SIMD array processor.‬

‭A‬

‭ IMD (Single Instruction, Multiple Data) array processor‬‭is a system with a single control‬
S
‭unit and multiple processing elements‬‭76‬‭.‬

‭The key components are:‬


‭●‬ ‭Control Unit:‬‭Fetches instructions and broadcasts‬‭the same instruction to all processing‬
‭elements simultaneously‬‭77‬‭.‬

‭ rocessing Elements (PE):‬‭Each PE has its own local‬‭memory for data storage‬‭78‬‭. They all‬
‭●‬ P
‭perform the same operation as commanded by the control unit but on their own unique‬
‭data‬‭79‬‭.‬

‭●‬ I‭ nterconnection Network:‬‭Provides communication paths between the processing‬


‭elements for data exchange‬‭80‬‭. This architecture is‬‭highly efficient for tasks that involve‬
‭parallel operations on large data arrays‬‭81‬‭.‬

You might also like