0% found this document useful (0 votes)
42 views

Exam2 Practice

This document contains an exam on the MARIE assembly language. It includes questions on filling out truth tables, simplifying Boolean expressions, working with memory addressing and K-maps, assembling and tracing MARIE assembly code that performs tasks like input, output, arithmetic, and branching. The final section provides a high-level overview of common MARIE instruction types and their operation at the register transfer level.

Uploaded by

Devin Olasava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Exam2 Practice

This document contains an exam on the MARIE assembly language. It includes questions on filling out truth tables, simplifying Boolean expressions, working with memory addressing and K-maps, assembling and tracing MARIE assembly code that performs tasks like input, output, arithmetic, and branching. The final section provides a high-level overview of common MARIE instruction types and their operation at the register transfer level.

Uploaded by

Devin Olasava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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 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))'

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


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

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

a. b.

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

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?

b. What is the length x width notation? (2​20​ is denotes by a M)

c. How many addresses can be uniquely identified?

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

ORG 200 200

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(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