






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 7 bits using unsigned binary representation?
From _______________ to _______________
iv) What is the result of the following bit-wise operation: NOT(x5C) AND NOT(xF0)? 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 5 bit mode. What is the output for the following calculation?
Problem 3 (10 pts): Memory Organization
i) What inputs should we supply to the memory shown below in order to store value 101 2 at address 1?
d 2 d 1 d 0
q 2 q 1 q 0
a 1 a 0 we
Answer: _a 1 a 0 =___________, _we=___________, d 2 d 1 d 0 =___________
ii) What is the addressability of the memory shown in part (i)?
Answer: ________________
Problem 4 ( 9 pts): FSM
i) The input "0101110101" is fed into the FSM shown below serially, one bit at a time, starting with the most significant bit. If the machine is initially in state S 1 S 0 =00, what series of state transitions does the state machine go through upon receiving the input?
Time State (S 1 S 0 ) Input (A)
0 00 0
1 1
2 0
3 1
4 1
5 1
6 0
7 1
8 0
9 1
ii) The FSM from part (i) represents a sequence recognizer which outputs 1 (Z=1) when it detects the sequence 101. The output Z is a function of the current state (S 1 S 0 ) only. Draw the output logic for this sequence recognizer. You can use no more than 2 gates.
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
and relevant memory locations are:
Write down (in hexadecimal notation) values in IR, PC, and general-purpose registers after executing three instructions:
Programming Problem 1 ( 25 pts): LC-3 Machine code
In this assignment you are asked to write a program in LC-3 machine (binary) codes that examines values at 10 consecutive memory locations starting at address x30A0 and stores the number of values larger than 5 in memory at address x30AA. For example, look at the following test case scenarios:
Memory Location Test Set 1 Test Set 2 x30A0 x0000 x x30A1 x0042 x x30A2 x0051 x x30A3 x0000 x x30A4 x0005 x00 04 x30A5 x0002 x x30A6 x0000 x x30A7 x0040 x x30A8 x0021 x x30A9 x0001 x Result at x30AA x000 4 x
i) 5 pts. Provide a systematic decomposition for the above problem.
Start
Stop
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/larger5.bin file. To receive full credit, it should correctly run in lc3sim (or lc3sim-tk).