Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume that we would like to expand the MIPS register file to 128 registers and

ID: 3668731 • Letter: A

Question

Assume that we would like to expand the MIPS register file to 128 registers and expand the instruction set to contain four times as many instructions

1. How this would affect the size of each of the bit fields in the R-type instructions

2. How this would affect the size of each of the bit fields in the I-type instructions

3. How could each of the two proposed changes decrease the size of an MIPS assembly program? On the other hand, how could the proposed change increase the size of an MIPS assembly program?

Explanation / Answer

Definition of MIPS:

The number of MIPS (million instructions per second) is a general measure of computing performance and, by implication, the amount of work a larger computer can do. For large servers or mainframes,
MIPS is a way to measure the cost of computing: the more MIPS delivered for the money, the better the value.

Assume that we would like to expand the MIPS register file to 128 registers and expand the instruction set to contain four times as many instructions:
For 128 registers, you'd need 7 bits number to identify one.There are three registers mentioned in an R-type instruction, so end up with 6 additional bits. The entire MIPS architecture is based around the fact that instructions are easy to decode and each instruction takes exactly one 32-bit machine word, which considerably simplifies lots of things: you always jump a multiple of 4 bytes, you always get to fit a round number of instructions on a cache line, etc. To have 38-bit instructionswould entirely ruin the elegant MIPS architecture.

The compromise chosen by the MIPS designers is to keep all instructions the same length, thereby requiring different kinds of instruction formats for different kinds of instructions. For example, the format above is called R-type (for register) or R-format. A second type of instruction format is called I-type (for immediate) or I-format and is used by the immediate and data transfer instructions. The fields of I-format are

Here is the meaning of each name of the fields in MIPS instructions:

op: Basic operation of the instruction, traditionally called the opcode.

rs: The first register source operand.

rt: The second register source operand.

rd: The register destination operand. It gets the result of the operation.

shamt: Shift amount, it will not be used until then, and hence the field contains zero in this section.

funct: Function. This field, often called the function code, selects the specific variant of the operation in the op field

1. How this would affect the size of each of the bit fields in the R-type instructions:
128 Registers,38 bits for each.
Register bits: log2(128) = 7   

R-type instructions use the opcode 0 and the funct to denote the operation. Using an unused opcode (there are many) and the same funct combinations, all instructions with base addressing can be added. The length of the immediate was unspecified -- 16 is a good choice since it is a half-word, and the size used in I-type instructions. However, no instruction that uses the shamt field can have base addressing as asked in the question, so it is possible to use the shamt field and allow only 5-bit offsets and retain the instruction length.

2. How this would affect the size of each of the bit fields in the I-type instructions:

      128 Registers 36 bits. Register bits: log2 (128) = 7

Two acceptable answers: 1. No change using the assumption that the definition of an immediate must be an integer constant.

2. 37 bits for an instruction of the form addi $a0, $s1, 0($t1). We will need to add another 5 bits to incorporate the register data.

3.How could each of the two proposed changes decrease the size of an MIPS assembly program:

128 Registers Longer instruction-encoding means longer programs that do the same operations. The instruction formats may be even larger than indicated above since the increases aren’t byte-aligned and addressing subsequent instructions is difficult. It also breaks the MIPS tenet of fixed-length instructions. Programs may decrease in size because more registers means you can ’hold’ onto more data in the processor without going out to memory, leading to fewer load/store instructions.

If the shamt field is used, the program will not grow larger with this addition, though it may grow smaller. However, adding base-addressing still adds complexity to the processor that may slow the program down. It is also less useful with just 5-bit offsets.

opcode(6) rs(7) rt(7) rd(7) shamt (5) funct(6)