{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

homework1_solution

# homework1_solution - unsigned int valid 1 bits bits.data0 =...

This preview shows pages 1–2. Sign up to view the full content.

2.2 By lookup using the table in Figure 2.5 on page 62, 7fff fffa hex = 0111 1111 1111 1111 1111 1111 1111 1010 two = 2,147,483,642 ten 2.3 By lookup using the table in Figure 2.5 on page 62, 1100 1010 1111 1110 1111 1010 1100 1110 two = cafe face hex 2.6 sll \$t0, \$t3, 9 # shift \$t3 left by 9, store in \$t0 srl \$t0, \$t0, 15 # shift \$t0 right by 15 2.9 [12] <§2.5> Implement the following lines of C code in MIPS: int a = 27; struct { unsigned int data0 : 8; unsigned int data1 : 8; unsigned int data2 : 8;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: unsigned int valid : 1; } bits; bits.data0 = a; bits.data1 = bits.data0; bits.data2 = ‘d’; bits.valid = 1; Assume that the struct bits is in \$s0 and the memory address of a is stored in \$s1 Solution: lb \$s0, 0(\$sl) # load the lower 8 bytes of a into bits sll \$t0, \$s0, 8 # \$t0 = bits << 8 or \$s0, \$s0, \$t0 # bits.data1 = bits.data0 lui \$s0, 0000 0000 0110 0100 # bits.data2 = ‘d’ lui \$t0, 0000 0001 0000 0000 # load a 1 into the upper bits of \$t0 or \$s0, \$s0, \$t0 # bits.valid = 1...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

homework1_solution - unsigned int valid 1 bits bits.data0 =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online