You are on page 1of 8

CSS3 - Exam 2 Name:

Date:

1 . (10 pts) Using this sequential circuit, fill in the truth table.

X A(t) B(t) A(t+1) B(t+1)

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

x y z xy’ x’y xz yz Ans


0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 1 0 0 1 0 0 1
0 1 1 0 1 0 1 1
1 0 0 1 0 0 0 1
1 0 1 1 0 1 0 1
1 1 0 0 0 0 0 0
1 1 1 0 0 1 1 1
F(x,y,z) = (x’yz’) + (x’yz) + (xy’z’) + (xy’z) + (xyz)

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))'

c. Using DeMorgan’s Law, write an expression for the complement of ​F​ if


F(x,y,z) = (x + y)(x’ + z’)
F(x,y,z’) = ((x + y)(x’ + z’))’
= x’y’ + xz

Page 2/8
3. (10 pts) Write a simplified expression for the Boolean function defined by each of the
following Kmaps.

a. b.

000 001 100 000 000


001 011 101 001 100
100 101 111 011
101 111 110 010
y’ z x x’ y’z’
x + y’ + z x’ + y’z’

c. Create a Kmap and then simplify the following function:


F(x,y,z) = x’y’z’ + x’yz + x’y’z + xy’z + xy​z

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 2​28​ bit memory.
a. What is the lowest and highest address if memory is word-addressable, assuming a 16-bit
word?
Lowest = 0, Highest = 2​24​ - 1
b. What is the length x width notation? (2​20​ is denotes by a M)
2​28 ​ = 2​24​ x 2​4​ = 2​4​2​20​ x 2​4 ​= 2​4​M x 2​4 ​= 16M x 16
c. How many addresses can be uniquely identified?
16M = 2​4​2​20 ​= 2​24
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 = 2​4​2​20 ​/ 2​1​2​20​, 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

ORG 200 200

LOAD A 201 1206 206 0014 0014

SUBT B 202 4207 207 000A 000A

SUBT C 203 4208 208 0005 0005

STORE ANS 204 2209 209 0005 0005

OUTPUT 205 6000 204 6000 0005

HALT 206 7000 205 7000 0005

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(b​11​b​10​ = 00​2​)
C = 400​16​: skip if the AC = 0(b​11​b​10​ = 01​2​)
C = 800​16​: skip if the AC is positive(b​11​b​10​ = 10​2​)

Subroutine call Jump-and-Store: Store the PC at address X and jump to


JNS X 0
and return X+1
JUMPI X C Use the value ​at ​X as the address to jump to
Indirect Load indirect: Use the value ​at​ X as the address of the
LOADI X D
Addressing value to load.
Store indirect: Use X the value ​at​ X as the address of
STOREI X E
where to store the value.
HALT 7 Terminate the program

Page 7/8
RTL of MARIE Code

Load X

Load X loads the value from address X into the AC

MAR ← X # load X (address) into MAR


MBR ← M[MAR] # load value stored at address into MBR
AC ← MBR # load value in MBR into AC

Store X

Store X stores the current value from the AC into address X

MAR ← X # load address into MAR


MBR ← AC # load AC value into MBR
M[MAR] ← MBR # write MBR value into the Memory of the address indicated by the MAR

Add X

Add X adds the value stored at address X into AC

MAR ← X # load X into MAR


MBR ← M[MAR] # load value stored at address X into MBR
AC ← AC + MBR # add value in AC with MBR value and store it back into AC

Subt X

Subt X subtracts the value in AC with the value stored at address 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

OutReg ← AC NADA, ONCE FETCH HAPPENS

Page 8/8

You might also like