StudentCode 2021 S1 FIT1047 MA Tutorial Lab2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Name:

Student Code:

FIT1047 Tutorial/Lab 2
Topics
• 2’s complement, floating point
• Boolean logic, logic gates, logisim

Instructions
• Please use this google doc to answer all the questions in this tutorial/lab.
• The copy of google doc shared with you is only for viewing. Please make a copy into
your own google doc and start answering by editing the google doc. Go to ‘File’ and
then select ‘Make a copy’. Rename the file with your student code and lab group
number. For example, 01141088_2021_S1_FIT1047_MA_Tutorial/Lab2 where
01141088 is your student code. Please fill your name and student code in the header
of this google doc.
• Every student must submit this google doc individually
at the end of the tutorial session by converting this
google doc into PDF file. Please upload your PDF file into
Moodle → Assessment → Laboratory Submissions → Laboratory
2

Task 1: 2’s complement


1.a Assume you have 8 bits to represent binary numbers. What decimal value does the
binary number 10110101 have in the different notations?
(i) unsigned binary number
Answer:
Name:
Student Code:

(ii) sign-magnitude notation


Answer:

(iii) 1’s complement


Answer:

(iv) 2’s complement


Answer:

1.b Create a table with all possible 4-bit binary values in one column and the decimal
they represent in the different notations.
Answer:

4-bit binary unsigned int sign-magnitude 1’s complement 2’s complement


Name:
Student Code:

0000

0001

0010

0011

0100

0101

0110

0111

1000

1001

1010

1011

1100

1101

1110

1111

1.c Assume you want to use a bit-wise approach to add 2 n-bit 2’s complement
numbers x+y=z. You need to check for overflow.
Use the following notation:
x = xnxn−1xn−2...x1
y = ynyn−1yn−2...y1
z = znzn−1zn−2...z1
You can use a bit-wise + operator with one bit result and one bit for the carry:
0 + 0 = 0 with carry bit 0
Name:
Student Code:

0 + 1 = 1 with carry bit 0


1 + 0 = 1 with carry bit 0
1 + 1 = 0 with carry bit 1
For i = 1, .., n the carry bit is denoted by ci .

For the actual addition, what do you need to do in steps i = 1, ..., n?


Answer:

In which steps do you need to check for overflow conditions? What do you need to
check?
Answer:

Task 2: More on 2's Complement & Floating-Point


Representation

Represent the number −92 in


a) 8-bit signed magnitude
Answer:
Name:
Student Code:

b) 8-bit 2’s complement


Answer:

c) 8-bit excess-k
Answer:

Calculate, using binary arithmetic with 8-bit 2’s complement representation:


a) 33+92
Answer:

b) 33−92
Answer:

c) What happens if you try to calculate 92+92?


Answer:
Name:
Student Code:

Convert the following numbers to 6-bit 2’s complement notation and add
them:
a) −16+11
Answer:

b) 16−11
Answer:

c) 17+15
Answer:

d) −5−8
Answer:

Data Representation – Floating Point


Name:
Student Code:

a) Give the 23-bit mantissa and the 8-bit exponent of the IEEE 754 standard floating-
point representation of the decimal number 176. What is the sign bit of its IEEE
standard floating-point representation?
Answer:

b) Convert to scientific notation the following floating-point number stored


according to the IEEE standard. 1 00111001 01011100000000000000000
Answer:

c) Give the IEEE standard floating-point representation of the binary number


1.11101101 × 2−5 .
Answer:
Name:
Student Code:

Task 3: Boolean Logic, Logic Gates, Logisim

3.a • Download logisim evolution from Moodle


• Start logisim by clicking on the file or executing java -jar logisim-evolution.jar
3.b Make yourself familiar with logisim by doing a few very easy tasks:
• place one AND gate, 2 inputs and one output
• connect them
• poke the inputs to try simulation
• do the same with OR and NOT
• try some combinations of gates
3.c In addition to AND, OR and NOT, there are a number of other Boolean logic
operators.
Examples are XOR, the exclusive or, and NAND, a negated AND. Their truth
tables are shown in the tables.
Build XOR and NAND in logisim only using AND, OR, and NOT gates. Use
the simulation to test your result.
Name:
Student Code:

3.d (Additional advanced task:) Use logisim and only AND, OR and NOT to build a
circuit for the following function:

How many gates do you need? Simplify the function first, e.g. by using k-maps.
Answer:

You might also like