CS61C Fall 2013 HW4

TAs: Kevin Yeun & Winston Hsu

Due Sunday, Oct 6, 2013 @ 23:59:59

Goals

This assignment is designed to give you some practice with IEEE 754 numbers and MIPS

Obtaining the Assignment

To copy the hw4 files into your homework directory, go to your hw directory (type git init if it's not already in a git repository) and then type:

$ git pull ~cs61c/hw/04 master

Place your answers in hw4.txt and don't change the format of the file as the assignment will be autograded.

If you are having issues with this, please consult Lab 1: Git and Additional Git Notes.

Problem 1

What floating point numbers are represented by the following bit patterns? Give answer in decimal system, not scientific notation.

a) 0xFFF00B9E

b) 0x00000000

c) 0xBFC00000

d) 0x42420000

How would the following integers be represented in single precision floating point numbers? Please give your answers in hex (including the preceding 0x)

e) 42

f) 1337

Problem 2

What MIPS instructions are represented by the following bit patterns? (The first one has been done for you)

a) 0x20020000 = addi $v0, $0, 0

b) 0x00082100

c) 0x3C1d0007

d) 0x8F19FFFC

e) 0x020B102A

Problem 3

Encode the following instructions into MIPS machine code. Please give your answers in hex (including the preceding 0x)

Address   Machine code           Instruction

                     (fill in)        

 

0x400000                                   jal quadruple

 

0x401000                 quadruple: sll $v0, $a0, 2

0x401004                                   srl $t0, $v0, 2

0x401008                                   beq $v0, $t0, warning

0x40100c                                   jr $ra

0x401010                   warning: #stuff

Submission

In the directory containing your hw4.txt file, run:

$ submit hw4