COM181 assignment 1

advertisement
COM181 assignment 1. 2013
Lecture 1 covered the conversion of binary , decimal and hex to and from each other. It also discussed
signed binary and twos complement way of representing negative and positive numbers.
You should also have read chapter 2 of the textbook by now.
Please answer the following questions
Exercise 2.7 taken from the textbook and those questions containing L1 taken from the lectures
Given the two numbers;
(a)
(b)
CW1:2.7.1
CW1:2.7.2
CW1:2.7.3
1010 1101 0001 0000 0000 0000 0000 0010two
1111 1111 1111 1111 1011 0011 0101 0011 two
What base 10 (decimal) number does (a) and (b) above represent assuming that they are
two’s complement integers?
What base 10 (decimal) number does (a) and (b) above represent assuming that they are
unsigned integers?
Give the hexadecimal representation of (a) and (b) above
Given
(c)
(d)
CW1:2.7.4
CW1:2.7.5
CW1:2.7.6
CW1:L1-1
CW1:L1-2
CW1:L1-3
2147483647 ten
1000ten
Convert the base ten numbers above to two’s complement binary
Convert the base ten numbers above to two’s complement hexadecimal
Convert the negated values of (c) and (d) to two’s complement hexadecimal.
Give the result in binary after performing an OR of (a) and (b) together
Give the result in binary after performing an AND of (a) and (b) together
Give the result in binary after performing an ADD of (a) and (b) together
The ASCII table is on page 122 of my edition of the text book, figure 2.15 or you can download one from
Wikipedia. For example uppercase ‘A’ has the decimal code of 65 (hex 0x41) and lowercase ‘a’ is 97ten or
0x61 in hex
CW1:L1-4
CW1:L1-5
What is the sequence of hex codes representing the ASCII codes for HELLO WORLD
What ASCII character is represented by the hex code 3F?
The bits below (e) and (f) represent a MIPs opcode. You should be able to translate these into
instructions, identify the different fields of the opcode and state what type of instruction it is.
(e)
(f)
CW1:2.10.1
CW1:2.10.2
(g)
(h)
CW1:2.11.1
CW1:2.11.3
1010 1110 0000 1011 0000 0000 0000 0100two
1000 1101 0000 1000 0000 0000 0100 0000 two
What instruction does (e) represent, what instruction does (f) represent?
What type (I-type, R-type) do these instructions represent
0xAE0BFFFFD
0x8D08FFC04
What binary number is (g)? What binary number is (h)?
What instruction does (e) represent? what instruction does (h) represent?
Please submit these answers to me by email by August 22nd. (2013) They will form one of 3 assessments
I will give you. Assignment 1 will be worth 20% of your total coursework mark.
Download