Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Computer Arithmetics

1. Differentiate Sign Magnitude, One’s complement, and Two’s complement


numbers.
Ans: Sign Magnitude: In the signed magnitude method number is divided into
two parts: Sign bit and magnitude. Sign bit is 1 for negative number and 0 for positive
number. Magnitude of number is represented with the binary form of the number.

One’s complement: There is a simple algorithm to convert a binary number into


1’s complement. To get 1’s complement of a binary number, simply invert the
given number.

Two’s complement: There is a simple algorithm to convert a binary number into 2’s
complement. To get 2’s complement of a binary number, simply invert the given
number and add 1 to the least significant bit (LSB) of given result.

2. Which number representation is the best?


Ans: Two’s complement representation is the best. Because, Two's complement allows
negative and positive numbers to be added together without any special logic. The same
is true for subtraction. ... Sign-magnitude generally inspect the sign bit and use different
logic.

3. What is balance and non-ambiguous zero?


Ans: The balance can be interpreted as the number of FP operation that can
be performed during the time for an average memory access.
Non- ambiguous zero:

4. Signed and unsigned number? What are the 4 bits lowest sign number and
highest unsigned number?
Ans: For signed
Highest 4 bits number 0111
Lowest 4 bits number 1000
Highest unsigned 4 bits number 1111

5. Differentiate between the slt and the sltu instruction.


Ans: : sltperforms comparisons of two registers, assuming they store 32-bit 2C
representations.

sltuperforms comparisons of two registers, assuming they store 32-bit UB


representations.
6. What is negation? How do you do a negation of a two’s complement
number?
Ans: Negation is the conversion of a binary digit or bits into its opposite. For
e.g. a 1 is converted into a 0 is consider a negation.
We can negate two’s complement no. by inverting all bits and add one to the
result. This system is useful in simplifying the implementation of arithmetic
in computer hardware.

7. What is sign extension? How to do sign extended a 4bits 2’s complement


positive 0101 number and 2’s complement negative 1111 number to an 8
bits sign extension.
Ans: Sign extension is the operation, in computer arithmetic, of increasing the
number of bits of a binary number while preserving the number's sign
(positive/negative) and value. 

8. What is an Overflow error? How to check the overflow error? What is the
logic to check to generate the overflow bit?
Ans: Overflow occurs when the magnitude of a number exceeds the range
allowed by the size of the bit field. The sum of two identically-
signed numbers may very well exceed the range of the bit field of those
two numbers, and so in this case overflow is a possibility.
addition – same sign overflow occur . example : (+a)+(+a)= - a (-a)+(-a)=+a
Subtraction _ different sign overflow occur . example : (+a)-(-a)=-a (-a)-
(+a)=+a

9. Why do you need a Binvert signal in ALU?


Ans: The Binvert signal is asserted when a sub or an slt instruction is to be
performed. This signal has the effect of complimenting the b signal, which
results in (a + not(b)) being added.

10.How to store set bit? What is the logic to set Less?


Ans:
11.What does the ALU do with signals 010, 000, 110, and 111?
Ans: 010 (add functions)
000 (AND functions)
110 (subtract functions)
111 (set on less than)
12.Why do you need a zero flag? When zero flag will be 1?
Ans: Because it indicates whether the execution of the last instruction that
affect the zero flag has produced a zero result.
A zero flag will be 1 or true when the arithmetic is zero.
13.How to check that BEQ register values are the same?
Ans:

14.Represent a number 11/7 into a Scientific form.


Ans: : 1.5142851 × 100
15.What is a normalized number? Represent (-1)1 x 1011.011 x 23 to
normalized form.
Ans:  a number is normalized when it is written in scientific notation with one
non-zero decimal digit before the decimal point. (-1)1 x 1011.011 x 23 to normalized
form:
16.Explain IEEE floating-point standard – Single precision and Double
precision?
Ans: 32 and 64.

17.How to represent 1011.0011110001 in 23 bits significand?


Ans: 1.01100111100010000000000

18.Why do you need to add biased value with exponent?


Ans: Biasing is done because exponents have to be signed values in order to
be able to represent both tiny and huge values, but two's complement, the
usual representation for signed values, would make comparison harder.

19.How do you represent 0 in normalized form?


Ans:

20.How do you represent 127 in normalized form?


Ans: 127 to binary 1111111 . normalized form= 1.111111x10^6

Datapath and Control

1. What is Datapath?
Ans: A datapath is a collection of functional units such as arithmetic logic units or
multipliers that perform data processing operations, registers, communication buses
and ALU.

2. What is control?
Ans: Datapath for each step is set up by control signals that set up dataflow directions on
communication buses and select ALU and memory functions. Control signals are generated by a
control unit. OR
A control unit or CU is circuitry that directs operations within a computer's processor. It lets the
computer's logic unit, memory, and both input and output devices know how to respond to
instructions received from a program. Examples of devices that utilize control units include
CPUs and GPUs.

3. What is the five (5) steps of an instruction execution?


Ans: Instruction fetch.
 Instruction decode.
 Execute.
 Memory access.
 Writeback.

4. How many cycles are required to run one instruction in a single cycle
datapath?
Ans: 1clock cycles are required to run one instruction in a single cycle
datapath.

5. What is the CPI in a single cycle datapath?


Ans: Cycles Per Instruction (full form). The CPI can be >1 due to memory stalls and slow
instructions. — The CPI can be <1 on machines that execute more than 1 instruction
per cycle (superscalar). One cyclel is the minimum time it takes the CPU to do any work.

Important note: in a single-cycle implementation data cannot be stored


during an instruction – it only moves through combinational logic

6. What is the disadvantage of single-cycle datapath?


Ans: disadvantage of single cycle cpu's: the machine must operate at the speed of
the slowest instruction. And long cycle time.

7. What are combinational elements? Provide one example.


Ans: A combinational logic circuit performs an operation assigned logically by a
Boolean expression or truth table. Examples of common combinational logic circuits
include: half adders, full adders, multiplexers, AND ,OR gate.

8. What are state elements? Provide one example?


Ans:
9. What is the task in the IF stage?
Ans: In this stage the CPU reads instructions from the address in the memory whose
value is present in the program counter.

10. What is the task in the ID stage?


Ans: In this stage, instruction is decoded and the register file is accessed to get the
values from the registers used in the instruction.

11. What is the task in the EXE state?


Ans: In this stage, ALU operations are performed.

12. What is the task in the MEM state?


Ans: In this stage, memory operands are read and written from/to the memory that is present in
the instruction.

13. What is the task in WB state?


Ans: In this stage, computed/fetched value is written back to the register present in the
instructions.

14. What are the stages need in R-type instruction?


Ans: Read instruction
♦ Read source registers rs and rt
♦ ALU performs the desired operation
♦ Store result in the destination register rd.

15. What are the stages need in I-Type Instruction?


Ans:

16. What are the stages need in J-Type instruction?


Ans:

17. What is the register file?


Ans: A register file is an array of processor registers in a central processing unit
(CPU). ... The instruction set architecture of a CPU will almost always define a set
of registers which are used to stage data between memory and the functional units on
the chip.
18. How many input and output ports are in Registerfile?
Ans: two read ports
one write port

19. How data read from the register file?


Ans:

20. How data write-in register file?


Ans:

21. What is the task of the main control unit?


Ans: .. A control unit works by receiving input information that it converts
into control signals, which are then sent to the central processor. The computer's
processor then tells the attached hardware what operations to carry out.

22. What is the task of the ALU control unit?


Ans: An arithmetic logic unit (ALU) is a digital circuit used to perform arithmetic and
logic operations. ... The control unit tells the ALU what operation to perform on that
data, and the ALU stores the result in an output register. The control unit moves the
data between these registers, the ALU, and memory.

23. How does ALU control unit generate the 3 bits input signal for ALU?
Ans:

24. How many signals are generated by the Main control unit?
Ans:

25. Which signals are asserted in R-type instruction?


Ans:

26. Which signals are asserted in Branch instruction?


Ans:

27. Which signals are asserted in J-type instruction?


Ans:
28. Which signals are asserted in lw instruction?
Ans:

29. Which signals are asserted in sw instruction?


Ans:

30. All signals value during R-type instruction?


Ans:

31. All signals value during Brach-type instruction?


Ans:

32. All signals value during lw-type instruction?


Ans:

33. All signals value during sw-type instruction?


Ans:

Pipeline datapath, control signal and hazards

1. What is a pipeline?
Ans: Pipelining is a technique where multiple instructions are overlapped during
execution. Pipeline is divided into stages and these stages are connected with one
another to form a pipe like structure.

2. How pipeline works and improve the throughput?


Ans: Pipelining is a technique where multiple instructions are overlapped during
execution. Pipeline is divided into stages and these stages are connected with one another to
form a pipe like structure. Instructions enter from one end and exit from another end. Pipelining
increases the overall instruction throughput.

3. Does pipeline improve the response time?


Ans:

4. What can be the maximum speedup in an X-Stages pipeline?


Ans:
5. What is a Hazard?
Ans:

6. What are the type of Hazards?


Ans:

7. What is a load-use hazard?


Ans:

8. What is a control hazard?


Ans:

9. How to solve R-type and R-type instruction data hazards?


Ans:

10. What is forwarding?


Ans:

11. Forwarding can solve the data hazard problem?


Ans:

12. What is a structural hazard?


Ans:

13. How to solve the structural hazard?


Ans:

14. How to solve the control hazard?


Ans:

15. How control signals work in pipeline datapath?


Ans:

16. What is the task of the Hazard detection unit? How does it detect control
hazards?
Ans:

17. What is the task of the Forwarding unit? How does it solve the data hazard
problem?
Ans:
18. What is for IF.Flush signal?
Ans:

19. How to create stall by Hazard detection unit?


Ans:

20. How to create NOP by Hazard detection unit?


Ans:

21. During Forwarding if hazard occurs in both EX/MEM and MEM/WB registers
rd, which one value will be forwarded?
Ans:

22. How does Brach instruction reduce the number of stalls?


Ans:

23. What is a comparator? How does it take an equal decision?


Ans:

24. How does control hazard detect and make pipeline workable using NOP
instruction?
Ans:

25. What is NOP instruction?


Ans:

26. Why does in the pipeline all instruction must have 5 stages? What is the
problem if anyone does not maintain all 5 stages?
Ans:

You might also like