Exam2 Practice Solutions
Exam2 Practice Solutions
Exam2 Practice Solutions
Date:
1 . (10 pts) Using this sequential circuit, fill in the truth table.
0 0 0 0 0
0 0 1 1 0
0 1 0 0 1
0 1 1 1 1
1 0 0 1 0
1 0 1 0 0
1 1 0 1 1
1 1 1 0 1
Page 1/8
2. (10 pts)
a. Rewrite the expression below in the sum-of-products form.
F(x,y,z) = xy’ + x’y + xz + yz
b. The logic circuit shown in the diagram directly implements which of the Boolean
expressions given below?
A) F(x,y) = (x + y')z(xy')
B) F(x,y) = (xy')+ z(x + y')
C) F(x,y) = (x + y)'z(xy)'
D) F(x,y) = (xy') + (z(x + y))'
Page 2/8
3. (10 pts) Write a simplified expression for the Boolean function defined by each of the
following Kmaps.
a. b.
x \ yz 00 01 11 10
0 1 1 1 0
1 0 1 1 0
000 001
001 011
101
111
x’y’ + z
Page 3/8
4. (10 pts) Assuming a 228 bit memory.
a. What is the lowest and highest address if memory is word-addressable, assuming a 16-bit
word?
Lowest = 0, Highest = 224 - 1
b. What is the length x width notation? (220 is denotes by a M)
228 = 224 x 24 = 24220 x 24 = 24M x 24 = 16M x 16
c. How many addresses can be uniquely identified?
16M = 24220 = 224
d. Assuming this memory is built using 2M x 16 chips, and low order interleaving, on
which chip would address 0x1E be located?
16M x 16 / 2M x 16 = 24220 / 21220, 8 chips, and 1E is 30
0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
...
24 25 26 27 28 29 30 31 So, chip 6
OR
5. (10 pts) Write out the mnemonic code for these instructions:
100 A000 CLEAR
101 2109 STORE 109
102 5000 INPUT
103 210A STORE 10A
104 410B SUBTRACT 10B
105 8800 SKIPCOND 800
106 7000 HALT
107 2109 STORE 109
108 7000 HALT
109 0000 0
10A 0000 0
10B 0030 48
Page 4/8
6. (10 pts) Write the hexadecimal code for the following program ("hand assemble").
ORG is the origin, so there isn’t a hexadecimal translation for that line of code.
ORG 100
100 CLEAR A000
101 INPUT 5000
102 STORE c 2110
103 CLEAR A000
104 INPUT 5000
105 STORE b 210F
106 ADD c 3110
107 STORE a 210E
108 OUTPUT 6000
109 SUBT a 410E
10A SKIPCOND 400 8400
10B HALT 7000
10C OUTPUT 6000
10D HALT 7000
10E a, Dec 32 0020
10F b, Dec 1 0001
110 c, Dec 0 0000
7. (20 pts) Trace the following program as each instruction executes, updating the registers at
each step:
Code PC IR MAR MBR AC
A, DEC 20
B, DEC 10
C, DEC 5
ANS, DEC 0
Page 5/8
8. (20 pts) Write an assembly program which asks the user for three values, and then outputs the
least of those three values.
Page 6/8
Summary of the MARIE Assembly Language
Type of Mnemonic Hex Description
Instructions Opcode
Arithmetic ADD X 3 Add the contents of address X to AC
SUBT X 4 Subtract the contents of address X from the AC
ADDI X B Add Indirect: Use the value at X as the actual
address of the data operand to add to AC
CLEAR A Put all zeros in the AC
Data Transfer LOAD X 1 Load the contents of address X into AC
STORE X 2 Store the contents of AC at address X
I/O INPUT 5 Input a value from the keyboard into AC
OUTPUT 6 Output the value in AC to the display
Branch Unconditional branch to X by loading the value of X
JUMP X 9
into PC
SKIPCOND C 8 Skip the next instruction based on the condition, C:
C = 00016: skip if AC is negative(b11b10 = 002)
C = 40016: skip if the AC = 0(b11b10 = 012)
C = 80016: skip if the AC is positive(b11b10 = 102)
Page 7/8
RTL of MARIE Code
Load X
Store X
Add X
Subt X
MAR ← X
MBR ← M[MAR]
AC ← AC - MBR
Jump X Input
Jump X jumps to address X Stores the input register’s value into AC.
PC ← X AC ← InReg
Output Halt
Stores the AC’s value in the output register. Terminates the program
Page 8/8