The final exam will be broken into two components:
Part of the lab-based portion will require you to write assembly code on your laptops or lab machines, which is to be turned in via Canvas by the end of the class. The remainder of the lab-based portion will require you to draw circuits. You may NOT reference your previous submissions, and you may NOT access the Internet for any reason other than to submit your solution via Canvas. Violations of these rules will result in a 0 on the exam.
The written portion will consist of short-answer questions, and will require you to solve various problems.
You may bring the following materials into the exam:
Both the lab and the lecture-based exams are intended to be comprehensive. However, since there has not been an exam since after Lab 6, at least 65% of the exam will concern material from labs 7 through 11.
Overall, the exam may include material from the following sources:
I will not ask any questions which were not somehow covered by one of the above three sources.
It is also recommended to study your midterm exam, particularly any questions which you had difficulty with. I will occasionally repeat questions from the midterm exam on the final, especially if the class overall did poorly on a question (I want to make sure the concept is understood!).
Convert the following Java/C-like code into ARM assembly. The names of the variables reflect which registers must be used for the ARM assembly. Non-register variable names indicate a value that should be stored in memory.
int[] first = new int[]{0, 5, 27, 98}; int[] second = new int[]{1, 2, 8, 29, 42}; int[] result = new int[9]; int r0 = 0; int r1 = 0; while (r0 < 4) { result[r0] = first[r0]; r0++; } while (r1 < 5) { result[r0] = second[r1]; r0++; r1++; } for (r2 = 0; r2 < 9; r2++) { print_int(result[r2]); print_newline(); }
!A
refers to the negation of variable A
, and so on:
R = !A!B + AB
R = !ABC + ABC + A!B!C
Using the above equation, do the following:
A | B | C | D | U |
---|---|---|---|---|
0 | 0 | 0 | 0 | |
0 | 0 | 0 | 1 | |
0 | 0 | 1 | 0 | |
0 | 0 | 1 | 1 | |
0 | 1 | 0 | 0 | |
0 | 1 | 0 | 1 | |
0 | 1 | 1 | 0 | |
0 | 1 | 1 | 1 | |
1 | 0 | 0 | 0 | |
1 | 0 | 0 | 1 | |
1 | 0 | 1 | 0 | |
1 | 0 | 1 | 1 | |
1 | 1 | 0 | 0 | |
1 | 1 | 0 | 1 | |
1 | 1 | 1 | 0 | |
1 | 1 | 1 | 1 |
Using the above truth table, write out the following:
Design a two-bit arithmetic logic unit (ALU) that has the following operations:
AND
the two operands togetherOR
the two operands togetherNAND
the two operands together (that is, AND them and NOT the result)NOR
the two operands together (that is, OR them and NOT the result)Specifically, your ALU will have the following inputs:
Input Name | Input Description |
---|---|
A0 |
Bit 0 of the first operand |
A1 |
Bit 1 of the first operand |
B0 |
Bit 0 of the second operand |
B1 |
Bit 1 of the second operand |
S0 |
Select bit 0, used for specifying the operation to perform (see table below) |
S1 |
Select bit 1, used for specifying the operation to perform (see table below) |
Given the above inputs, your ALU will produce the following outputs:
Output Name | Output Description |
---|---|
U0 |
Bit 0 of the output |
U1 |
Bit 1 of the output |
As for which operation should be performed, this is based on the values of inputs S0
and S1
.
The table below described the values that correspond to the different operations:
Value for S1 |
Value for S0 |
Operation |
---|---|---|
0 |
0 |
AND |
0 |
1 |
OR |
1 |
0 |
NAND |
1 |
1 |
NOR |
For this task, you may use the following provided components, in unlimited supply:
S1
and S0
A
, B
, C
, and D
Z
.
They should be drawn using the symbol below:
Design a finite state machine (FSM) which will set a particular output U
to 1
each time 001
is encountered in a stream of inputs.
Inputs are specified one at a time, and are represented by the variable I
.
To illustrate, consider the following example, which shows different values of U
and I
over time, where each cell is separated by a clock tick:
I |
1 |
1 |
0 |
0 |
1 |
0 |
0 |
1 |
1 |
U |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
For this task, you should be able to: