The midterm is closed book, closed notes, no calculators or other electronics
permitted. A reference sheet is included with the
midterm, covering key Marie opcodes and boolean logic identities.
Part 1: data representation [16 marks]
If we are representing unsigned integers in hexadecimal,
what is the result of E9A + 375?
What is the equivalent value in decimal?
If we are representing signed integers in 8-bit binary using ones complement,
what is the result of 00001101 + 11110011?
What is the equivalent value in decimal?
If we are representing signed integers in 8-bit binary using twos complement,
what is the result of 00010101 + 11101010?
What is the equivalent value in decimal?
If we want to multiply a binary number by 16, how can we achieve this using
shift operations?
In terms of binary representations of numbers, why does the following C
code produce an infinite loop?
float x = 0.1;
float sum = 0;
while (sum != 1) {
sum = sum + x;
}
Part 2: digital logic [16 marks]
Complete the truth table and Karnaugh map below for the function
f = xy' + wxy + y'z'
w x y z
xy'
wxy
y'z'
f(wxyz)
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
 
yz
wx
00
01
11
10
00
01
11
10
Given the Karnaugh map shown below, provide a minimal sum-of-products
expression for the function. (Treat the empty cells as 0's.)
 
yz
wx
00
01
11
10
00
1
1
01
1
1
11
1
1
10
1
Sketch the logic circuit corresponding to the 3-input, 2-output function below,
using 2 NOT gates, 2 OR gates, one NOR gate, and 3 AND gates.
f = (x + y')(xy + z)' g = xy + y'z'
Part 3: architecture and assembly language [16 marks]
Architecture and the fetch-decode-execute cycle (8 marks)
Given the Marie code and program state shown below, briefly illustrate the
fetch-decode-execute cycle using the next three instructions to run as an example,
showing the output and the changing values of the acc, pc, and ir registers.
(See the reference sheet for the machine code
corresponding to each type of instruction.)
org 100
input
Top, skipcond 800
jump Done
output
subt decr
jump Top
Done, halt
decr, dec 1
ACC: 0003
IR: 6000
PC: 104
Write a Marie program (8 marks) that reads two integer values, x and y,
then keeps doubling the value of x until the result is larger than y. It then
outputs the value of x.