Exam2 Practice
Exam2 Practice
Date:
1 . (10 pts) Using this sequential circuit, fill in the truth table.
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 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.
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?
d. Assuming this memory is built using 2M x 16 chips, and low order interleaving, on
which chip would address 0x1E be located?
5. (10 pts) Write out the mnemonic code for these instructions:
100 A000
101 2109
102 5000
103 210A
104 410B
105 8800
106 7000
107 2109
108 7000
109 0000
10A 0000
10B 0030
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
CLEAR
INPUT
STORE c
CLEAR
INPUT
STORE b
ADD c
STORE a
OUTPUT
SUBT a
SKIPCOND 400
HALT
OUTPUT
HALT
a, Dec 32
b, Dec 1
c, Dec 0
7. (20 pts) Trace the following program as each instruction executes, updating the registers at
each step:
Code PC IR MAR MBR AC
LOAD A
SUBT B
SUBT C
STORE ANS
OUTPUT
HALT
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