CSE 3666 Homework 2
CSE 3666 Homework 2
Little-edian:
Address Data
12 ab
8 cd
4 ef
0 12
Big-edian:
Address Data
12 12
8 ef
4 cd
0 ab
assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base
address of the arrays A and B are in registers $s6 and $s7, respectively. Assume that
the elements of the arrays A and B are 4-byte words:
2.12.1 [5]<2.4> What is the value of $t0 for the following assembly code?
$s0 = 0x80000000 = 1000 0000 0000 0000 0000 0000 0000 0000
$s1 = 0 xD0000000 = 1101 0000 0000 0000 0000 0000 0000 0000
An overflow occurs because the result is greater than 32 bits so the value of
$t0 is 50000000.
2.12.2 [5]<2.4>Is the result in $t0 the desired result, or has there been overflow?
Patricia Alfonso
2.12.3 [5] <2.4> For the contents of registers $s0 and $s1 as specified above, what
is the value of $t0 for the following assembly code?
$s0 = 0x80000000 = 1000 0000 0000 0000 0000 0000 0000 0000
$s1 = 0 xD0000000 = 1101 0000 0000 0000 0000 0000 0000 0000
invert $s1 => 0010 1111 1111 1111 1111 1111 1111 1111
add 1 => 0011 0000 0000 0000 0000 0000 0000 0000
2.12.4 [5]<2.4>Is the result in $t0 the desired result, or has there been overflow?
2.12.5 [5] <2.4> For the contents of registers $s0 and $s1 as specified above, what
is the value of $t0 for the following assembly code?
$s1 = 0 xD0000000 = 1101 0000 0000 0000 0000 0000 0000 0000
$t0 = 1 1101 0000 0000 0000 0000 0000 0000 0000 =1D0000000hex
An overflow occurs because the result is greater than 32 bits so the value of $t0 is
D0000000hex
2.12.6 [5] <2.4> Is the result in $t0 the desired result, or has there been overflow?
This describes add instruction of assembly language. For the values in the registers
as above, the instruction is add $s0, $s0, $s0.
Binary representation:
1010 1101 0100 1001 0000 0000 0010 0000two
lw $v0, 4($at)
I-Type Instruction
Opcode RS RT Constant
Assume that we would like to expand the MIPS register le to 128 registers and expand the
instruction set to contain four times as many instructions.
2.18.1 [5] <2.5> How this would this affect the size of each of the bit fields in the R-type
instructions?
Log2(128) = 7
2.18.2 [5] <2.5> How this would this affect the size of each of the bit fields in the I-type
instructions?
Opcode RS RT Immediate
2.18.3 [5] <2.5, 2.10> 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?
It would decrease the size of a MIPS assembly program since there are more registers, it
means they can hold more information so it would make less calls to lw and sw.
The increase in registers would mean more bits are required to represent the registers in
the instructions and that would increase the size of a MIPS assembly program.