CO Assignment
CO Assignment
instructions are fetched from memory one at a time and in order (serially).
Ans: The von Neumann bottleneck is the idea that computer system throughput is
limited due to the relative ability of processors compared to top rates of data transfer.
According to this description of computer architecture, a processor is idle for a
certain amount of time while memory is accessed which causes suboptimal
performance.
The von Neumann bottleneck is named after John von Neumann, a 20th century
mathematician, scientist and computer science pioneer who was also involved in the
Manhattan Project.
Overflow can be detected using 2 Bit Comparator just by checking Carry-in(C-in) and
Carry-Out(C-out) from MSB’s or n-1th bit. Consider N-Bit Addition of 2’s Complement
CO Assignment 1
number.
Overflow will occur when the C-in and C-out are equals to each other. With the help
of below analysis, we can explain the above expression for an overflow.
In the first image, 0 shows the MSB of two numbers that indicate that they are
positive. If we get 1 as Carry-in, the result of MSB will also be 1, which means that
result is negative (Overflow). In this case, Carry-out will also be 0. It is proved that
the Carry-in and Carry-out are not equal to each other, hence overflow.
In the second image, 1 shows the MSB of two numbers that indicate that they are
negative. If we get 0 as Carry-in, the result of MSB will also be 0, which means that
result is positive (Overflow). In this case, Carry-out will also be 1. It is proved that the
Carry-in is not equal to Carry-out hence overflow.
CO Assignment 2
With the help of above explanation, we can say that the overflow can be detected by
the C-in and C-out at MSB (Most Significant Bit), which is described as follows:
With the help of above XOR gate, we can easily detect the overflow.
Y = C-in(MSB) ⊕ C-out(MSB)
Following IEEE 754 single precision method, 2nd digit to 9th digit signifies the
exponent of the number. While storing the value of the floating point number, a
constant 127 (27 − 1) is added. Thus the stored exponent value of the floating point
number is a biased exponent.
Ans : In floating point number representation, normalized numbers are those where
the implicit leading binary digit is a 1. To reduce the loss of precision when an
underflow occurs, IEEE 754 includes the ability to represent fractions smaller than
are possible in the normalized representation, by making the implicit leading digit a
0. Such numbers are called denormalized numbers.
CO Assignment 3
6. Write (15.625)10 into IEEE 64 bit format
Ans :
15 = (1111)2
2. Converting the fractional part to binary -
0.625 = (0.101)2
3. Positive number before normalization -
15.625 = (1111.101)2
4. Normalising the binary representation of the Number -
15.625 =
(1111.101)2 =
(1111.101)2 × 20 =
(1.111101)2 × 23
5. Up to this moment, there are the following elements that would feed into the 32
bit single precision IEEE 754 binary floating point representation:
Exponent(adjusted) =
Exponent(unadjusted) + (210 − 1)
3 + 1023 =
1026
7. Converting the adjusted exponent from decimal(base 10 ) to 11 bit binary-
1026 = (10000000010)2
CO Assignment 4
8. Normalizing the mantissa by removing the leading( left most) bit, Adjusting the
length to 52 bits by adding necessary zeroes to the right
Manitssa(normalized) =
1111 0100 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
The three elements that make up the number's 32 bit single precision IEEE 754
binary floating point representation:
Sign = 0
Exponent = 10000000010
Mantissa = 1111 0100 0000 0000 0000 0000 0000 0000 0000 0000 0000
0000 0000
9. Apply Booth’s to multiply two numbers (-12) and (-13). Assume the
multiplier and multiplicand to be of 5 bits
Ans :
CO Assignment 5
Multiplier(Q) = (−13)10 = (10011)2 (2’s complement method)
In the below diagram the procedure of booth’s algorithm is shown
A = 00000
Q = 10011
Q−1 = 0
CO Assignment 6
First Cycle : As Q0 is 1 and Q−1 is 0, we first do A = A − B and then do the
arithmetic shift of . A, Q, Q−1
A = 00011
Q = 00100
Q−1 = 1
n(count) = 3
Third Cycle : As Q0 is 0 and Q−1 is 1, we first do A = A + B and then do the
arithmetic shift of . A, Q, Q−1
After the end of the third cycle -
A = 11011
Q = 10010
Q−1 = 0
n(count) = 2
Fourth Cycle: As Q0 is 0 and Q−1 is 0, we do the arithmetic shift of . A, Q, Q−1
A = 00100
Q = 11100
CO Assignment 7
Q−1 = 1
n(count) = 0
As the count becomes 0 the algorithm finishes. The answer stands =
(0010011100)2 = (156)10 which was our desired result.
CO Assignment 8
CO Assignment 9
let’s pick the step involved:
N M A Q Action
10. The need for restoring step in the above algorithm was avoided to get the
non restoring
division algorithm.What is the logic behind that?
Ans: In restoring division, you generally do a test subtraction for each digit step; if
the result is positive or zero, you note down a 1 as next digit of your quotient. non-
restoring method: you don’t do that – you keep negative remainder and a digit 1, and
basically correct things by a supplementary addition afterwards. By doing so you
reduce the time required and you correct if needed at last.
CO Assignment 10
12. Explain the role of various registers, buses, accumulator etc. for
instruction fetch, decode and execute stages.
Ans: Roles of different registers, accumulators, and buses are explained in each
stage of fetch, decode, and execute cycle -
Program Counter(PC): It holds the address of the next instruction to be fetched and
executed. Program counter value is increased automatically in fetch phase.
Accumulator: It holds the data currently being worked on or the results of arithmetic
and logical operations .
System bus : It is used to read data from the memory or write data in the memory,
the data goes through system bus from processor to memory.
Internal Processor bus : It is used for transferring data within the processor
between different registers, accumulator, mdr, pc, etc.
13. Design a 4 bit carry look ahead Adder. Calculate the number of gate delays
to get outer most carry
CO Assignment 11
The new expressions for the output sum and the carryout are given by:
Si = Pi ⊕ Ci−1
Ci+1 = Gi + Pi Ci
These equations show that a carry signal will be generated in two cases:
The logic gate of the following designed 4 bit carry look ahead adder will be -
CO Assignment 12
Calculation of gate delay in 4 bit carry look ahead adder : As we know that once
C0 is available all the digits of Sum output will be found simultaneously. From the
above picture we can easily that at top sits Propagate generator, after that a carry
generator, and at last sum generator. So calculating maximum gate delay in each
level and adding them up will give us the desired delay for generting the sum .
At PG generator following two logics are executed
Pi = Ai ⊕ Bi
Gi = Ai Bi
The XOR gates takes 3 gate delay, AND gates take 2 gate delay
Si = Pi ⊕ Ci−1
Therefore, Maximum delay in Sum generator level = 3
So total delay in 4 bit carry look ahead adder = (3 + 2 + 2) = 8 level
Ans : Addressing modes are mechanism of specifying the location of the operands.
Various addressing modes are discussed below
Immediate Addressing : In this type of addressing, the operand data are the part of
instruction itself. No memory access is required.
CO Assignment 13
Register Addressing : In this type of addressing, the operand is held in the register,
and instruction specifies the registration number
Example - ADD R1, R2, R3 // R1 = R2 + R3
There are also other type of addressing modes, like stack addressing, base
addressing, auto-increment addressing, auto-decrement addressing.
16. Evaluate the arithmetic statement Y= (A+B) x C in zero, one, two and three
address
machines.
PUSH B TOS ← B
ADD TOS ← A + B
PUSH C TOS ←C
CO Assignment 14
for a second register. However, here we will neglect the second and assume that the
AC contains the result of tall operations. The program to evaluate Y = (A+B) * C
LOAD A ACC← M[A]
Two Address Instruction : This is the most common type of Instruction. The
program to evaluate as follows :
MOV R1, A R1← M[A]
17. How many 256 X 4 RAM chips are needed to provide a memory capacity of
2048 bytes?
Show the corresponding interconnection diagram.
CO Assignment 15
Here A11 .....A0 is the address of particular memory location
(I couldn’t find exact question, just replace 128 × 8 with 256 × 4, ignore the residual
above sentence and pretty obvious time stamp of youtube.)
CO Assignment 16
sets requires = 9 bits
tag requires = (32 -2 -9) = 21 bits
so the various fields of this cache organization will be -
19. Where in the cache is the word from memory location AB5CDE7F mapped
in the above
cache organization.
20. Given the following, determine size of the sub fields( in bits) in address for
direct mapping, associative and set associative cache mapping scheme.
We have 1 GB main memory and 16MB cache memory. The address space
of this processor is 1GB. The block size is 256Bytes. There are 8 blocks in
a cache set.
CO Assignment 17
tag(6 bits) Line Number(16 bits) block offset (8 bits)
Associative Mapping :
bits to represent tag = 30 -8 = 22
Ans:
Write Through : Write-through cache is a caching technique in which data is
simultaneously copied to higher level caches, backing storage or memory. It is
common in processor architectures that perform a write operation on cache and
backing stores at the same time.
Write-through cache helps increase read performance in memory access methods
because the requested data is already present in the cache and memory. In each
write-through operation, data that is brought into the cache is also written into the
backing store, which is the primary memory (RAM, in most cases).
Write-through cache also helps with data recovery, as the data in operation is written
to both cache and memory. It is nearly impossible to restore data from cache.
However, to an extent, modern operating systems (OS) have the ability to save an
instance of running memory.
Write Back : A caching method in which modifications to data in the cache aren’t
copied to the cache source until absolutely necessary. Write-back caching is
CO Assignment 18
available on many microprocessors, including all Intel processors since the 80486.
With these microprocessors, data modifications (e.g., write operations) to data
stored in the L1 cache aren’t copied to main memory until absolutely necessary.
Write-back cache is designed to improve or reduce write operations from and to a
cache and its data source (RAM, in most cases). It enables control of the time and
the frequency at which data is written or copied into the source backing store.
22. Why do we need memory hierarchy, show the memory hierarchy diagram
indicating the speed and cost
Ans : Here is diagram that shows the speed and cost diagram of typical memory
hierarchy -
As shows from the above that faster memory have high cost and not feasible for
packing densely.
The tradeoff between speed and cost is found in memory hierarchy due to two
special features of computer programs - 1) Temporal Locality and 2) Spatial Locality
Temporal Locality : Recently executed instructions are likely to be executed again
very soon .
CO Assignment 19
LOOP: MUL $t1,$t1,$t3
ADDI $t3,$t3,1
SGT $t4,$t3,$t2
BNEZ $t4,Loop
You can see that 4 lines of the loop are being repeatedly executed.
Spatial Locality : Instruction residing residing close to a recently executed
instruction are likely to be executed soon. For example to access the elements of
array sequentially
SUB $t1,$t1,$t1
ADDI $t2,$zero,N
ADDI $t3,$zero,1
ADDI $t5,$zero, 8
Loop: LW $t8,0,($t5)
ADD $t1,$t1,$t8
ADDI $t3,$t3,1
SGT $t4,$t3,$t2
BNEZ $t4,Loop
Looking at the assembly code, you can easily see that performance can be improved
by copying the array into cache memory.
Ans : let’s say that there are 4 8 bit registers that need to be connected using a 8 line
common bus .
CO Assignment 20
The below table shows how different register can be selected for putting their data
into the common bus
00 Register A
01 Register B
10 Register C
11 Register D
Ans : Dynamic RAM is the most common type of memory in use today. Inside a
DRAM chip, each memory cell holds one bit of information and is made up of two
parts: a transistor and a capacitor. A capacitor is like a small bucket that is able to
store electrons. To store a 1 in the memory cell, the bucket is filled with electrons. To
store a 0, it is emptied. The problem with the capacitor's bucket is that it has a leak.
In a matter of a few milliseconds, a full bucket becomes empty. Therefore, for
dynamic memory to work, either the CPU or the memory controller
has to come along and recharge all of the capacitors holding a 1 before they
discharge. To do this, the memory controller reads the memory and then writes it
right back. This is called dynamic refreshing of the memory. While this refreshing
occurs, no memory access can be done which causes delay.
Static RAM uses a completely different technology. In SRAM, a form of flip-flop holds
each bit of memory. A flip-flop for a memory cell takes four or six transistors along
CO Assignment 21
with some wiring, but never has to be refreshed. Therefore there is no delay while
accessing memory. This makes SRAM significantly faster than DRAM.
Ans : The comparison between RISC and CISC is shown in the following table -
- RISC CISC
RISC stands for Reduced Instruction CISC stands for Complex Instruction Set
1
Set Computer Computer
RISC has fewer addressing modes CISC has many different addressing modes
and most of the instructions in the and can thus be used to represent higher level
6
instruction set have register to register programming language statements more
addressing mode. efficiently.
CO Assignment 22
- RISC CISC
8 Multiple register sets are present Only has a single register set
28. What is interrupt? What are the differences between vectored and non-
vectored interrupt
A vectored interrupt is where the CPU actually knows the address of the interrupt
service routine in advance. All it needs is that the interrupting device sends its
unique vector through a data bus and through its I/O interface to the CPU. The CPU
takes this vector, checks an interrupt table in memory and then carries out the
correct ISR for that device. Therefore, the vectored interrupt allows the CPU to be
able to know that ISR to carry out in software (memory) .
A non–vectored interrupt is where the interrupting device never sends an interrupt
vector. An interrupt is received by the CPU and it jumps the program counter to a
fixed address in hardware. This is typically a hard coded ISR which is device
agnostic. The CPU crucially does not know which device caused the interrupt
without polling each O/I interface in a loop and checking the status register of each
I/O interface to find the one with status “interrupt created”.
29. Explain the basic DMA operation for transfer of data bytes between
memory and peripherals.
CO Assignment 23
Ans : DMA stands for Direct Memory Access. All the memory access operations to
the peripherals or I/O devices happens through DMA controller. Below we have the
diagram of DMA controller which will help to explain DMA operation for data transfer
between memory and peripherals.
1. Whenever an I/O device wants to transfer the data to or from memory, it sends
the DMA request (DRQ) to the DMA controller. DMA controller accepts this DRQ
and asks the CPU to hold for a few clock cycles by sending it the Hold request
(HLD).
2. CPU receives the Hold request (HLD) from DMA controller and relinquishes the
bus and sends the Hold acknowledgement (HLDA) to DMA controller.
4. When the data transfer is accomplished, the DMA raise an interrupt to let know
the processor that the task of data transfer is finished and the processor can
CO Assignment 24
take control over the bus again and start processing where it has left.
2. The device driver signals the I/O controller for the proper device, which initiates
the requested I/O.
3. The device signals the I/O controller that is ready to retrieve input, the output is
complete or that an error has been generated.
4. The CPU receives the interrupt signal on the interrupt-request line and transfer
control over the interrupt handler routine.
CO Assignment 25
5. The interrupt handler determines the cause of the interrupt, performs the
necessary processing and executes a “return from” interrupt instruction.
6. The CPU returns to the execution state prior to the interrupt being signaled.
CO Assignment 26