






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Name: NetID:
Lab Section: DCL 440 DCL 520 9:00 AM [ ] AD 4 [ ] AD 11:00 AM [ ] AD 12:00 PM [ ] AD 5 [ ] AD 6 2:00 PM [ ] AD 7 [ ] AD 8 3:00 PM [ ] AD 1 [ ] AD 2
Be sure your exam booklet has 10 pages. Do not tear the exam booklet apart; you can only detach the last page. Use backs of pages for scratch work if needed. Be sure to write your name and lab section on each exam page. This is a closed book exam. You may not use a calculator. You are allowed one handwritten 8.5 x 11" sheet of notes. Absolutely no interaction between students is allowed. Be sure to clearly indicate any assumptions that you make. The questions are not weighted equally. Budget your time accordingly. You can start on Programming Problems only after finishing Problems 1-6. Page 9 contains additional instructions for Programming Problems. Don’t panic, and good luck!
Problem 1 10 points: ___________
Problem 2 13 points: ___________
Problem 3 10 points: ___________
Problem 4 9 points: ___________
Problem 5 11 points: ___________
Problem 6 12 points: ___________
Programming Problem 1 25 points: ___________
Programming Problem 2 10 points: ___________
Total 100 points: ___________
Problem 1 ( 10 pts): Binary Representation
i) Compute the addition and write your answer in decimal:
ii) Convert the following floating point number to decimal:
iii) What is the range of numbers you can represent with 5 bits using 1's complement representation?
From _______________ to _______________
iv) What is the result of the following bit-wise operation: NOT(x36 AND x7A)? Write your answer in hexadecimal.
Answer: ____________________
v) Perform the following calculation by first converting the two decimal numbers to two’s complement notation using 6 bits. Write results in both two’s complement binary representation and decimal, indicate if overflow occurs.
Overflow: yes ______, no _____
vi) A computer runs in an unsigned 4 bit mode. What is the output for the following calculation?
Problem 3 (10 pts): Memory Organization
i) What is the memory output q 3 q 2 q 1 q 0 when A[1:0]=10 and WE=1?
D Q
we
1
D Q
we
0
D Q
we
0
D Q
we
1
D Q
we
0
D Q
we
1
D Q
we
1
D Q
we
0
D Q
we
1
D Q
we
0
D Q
we
0
D Q
we
1
D Q
we
1
D Q
we
1
D Q
we
0
D Q
we
0
Address decoder
0
1
2 3
Answer: ________________
ii) What is the address space of the memory shown in part (i)?
Answer: ________________
Problem 4 ( 9 pts): FSM
i) Given the finite state machine below, derive the truth table for the next state transition (S 1 t+1S 0 t+1) based on the current state (S 1 t S 0 t ) and the input (A).
S 1 t^ S 0 t^ A S 1 t+1^ S 0 t+
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
ii) The FSM is observed to transition through the following series of states:
00 → 01 → 10 → 10 → 00 → 01 → 01
What is the series of inputs (A) that caused this series of transitions?
Answer: ____________________________________
Problem 6 ( 12 pts): LC-3 ISA
LC-3 computer is about to perform a FETCH. The current IR, PC, and general-purpose registers contain the following values:
IR PC R0 R1 R2 R3 R4 R5 R6 R
x1261 x3002 x0008 xFFFD x0000 x0000 x0000 x0000 x0000 x
and relevant memory locations are:
x3000 1001001001111111
x3001 0001001001100001
x3002 0001000000000001
x3003 0000100000000010
x3004 0001101101100001
x3005 0000111111111100
x3006 1001001001111111
x3007 0001001001100001
x3008 0001110000000001
x3009 1111000000101000
Write down (in hexadecimal notation) values in IR, PC, and general-purpose registers after executing two instructions:
Programming Problem 1 ( 25 pts): LC-3 Machine code
In this assignment you are asked to write a program in LC-3 machine codes that examines values at 8 consecutive memory locations starting at address x3100 and stores a 1 in R 4 if any of those 8 locations contain the number x 5. The program should store a 0 in R 4 if none of the locations contain the number x 5. For example, look at the following test case scenarios:
Memory address Test Set 1 Test Set 2 x3100 x0041 x x3101 x0042 x x3102 x0051 x x3103 x0055 x x3104 x0 505 x x3105 x0002 x x3106 x0001 x000 5 x3107 x0040 x Result in R0 0 1
i) 5 pts. Provide a systematic decomposition for the above problem.
ii) 20 pts. Implement your algorithm on the computer. Your program should start at memory address x3000. Your code should be saved in exam1/project1/find5.bin file. To receive full credit, it should correctly run in lc3sim (or lc3sim-tk).