, , , ,

[SOLVED] Cs214 computer organization hw#1

$25

File Name: Cs214_computer_organization_hw_1.zip
File Size: 301.44 KB

5/5 - (1 vote)

Problem 1.
For the following C statement, what is the corresponding MIPS assembly code?
Assume that the variables f, g, h, and i are given and could be considered 32-bit
integers as declared in a C program. Use a minimal number of MIPS assembly
instructions.
f = g + ( h – 5 );
Problem 2.
For the following C statement, what is the corresponding MIPS assembly code?
Assume that the variables f, g, h, i, and j are 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.
B[8] = A[ i – j ];
Problem 3.
The table below shows 32-bit values of an array stored in memory.
Address Data
24 2
28 4
32 3
36 6
40 1
1) For the memory locations in the table above, write C code to sort the data from
lowest to highest, placing the lowest value in the smallest memory location shown in
the figure. Assume that the data shown represents the C variable called Array, which
is an array of type int, and that the first number in the array shown is the first element
in the array. Assume that this particular machine is a byte-addressable machine and a
word consists of four bytes.
2) For the memory locations in the table above, write MIPS code to sort the data from
lowest to highest, placing the lowest value in the smallest memory location. Use a
minimum number of MIPS instructions. Assume the base address of Array is stored in
register $s6.
Problem 4.
Provide the type, assembly language instruction, and binary representation of
instruction described by the following MIPS fields (all the numbers are in deximal):
op=0, rs=3, rt=2, rd=3, shamt=0, funct=34

Shopping Cart
[SOLVED] Cs214 computer organization hw#1
$25