1.

a)
b)

Given the importance of registers, what is the rate
of increase in the number of registers in a chip
over time?
Very fast: They increase as fast as Moore’s law
Very slow: They only increase as the instruction
set changes

Ans: (b)
• Moore’s law projects the doubling of transistors every
couple of years and has nothing to do with registers.
• The number of registers will change only if instruction set
architecture is changed. Because machine code has
only 5 bits to represent each register, so it would require
a substantial change (a new ISA)

r2. r0 000000 00010 00000 00001 00000 100000 Rs. Define the R-format instruction: a) b) c) d) e) What are the various fields? What is the basic lay-out? What does each field represent? Are all of the bits used / needed for each field? Given an example of an R-format instruction in MIPS assembler and the corresponding machine code Fields • • • • • Example: Op-code: operation code add r1. Rt: source registers Rd: destination register SA: shift amount Funct-code: function specifier .2.

r2. 1 001000 00010 00001 0000000000000001 . Define the I-format instruction: a) b) c) d) e) What are the various fields? What is the basic lay-out? What does each field represent? Why this instruction format needed as opposed to the Rformat? Give an example of an I-format instruction in MIPS assembler and the corresponding machine code Fields • • • • Op-code: operation code Rs: source register Rt: destination register Immediate: 2’s complement constant Example: addi r1.3.

4. What is the range of addresses for conditional branches in the MIPS ISA? PC  4  4  2  address  PC  4  4  (2  1) 15 15 .

PC = PC+4 + 4 x 1 • F.r2. Unconditional branch • F. Answer the following questions as true or false: a) The beq instruction always modifies the program counter register b) The add instruction does not modify the PC c) The jal instruction always modifies the PC d) The instruction beq r1.1 will advance the PC by one word if [r1]=[r2] Ans: • T.r2.5.1 will advance the PC by one byte if [r1]=[r2] e) The instruction beq r1. PC = PC+4 • T. PC = PC+4 even if r1 <> r2 • F. PC = PC+4 + 4 x 1 .

nor. 2. etc… Move the value to r3 . in general. which can be done by multiplication.6. However. xor. There are several possible answers to this question. Find the shortest sequence of core MIPS instruction to determine the absolute value of a two’s complement integer. all involve the following two steps: 1. Please the result into r3. Convert the number to a positive value if it is negative.

the logic equation and draw the gates for the Sum bit of a 1-bit adder Cin Sum Sum bit is 1 if an odd number of the three inputs 1 →XOR the three inputs a Cout b half adder . Write out the truth table.7.