Notes:
• For the written questions show all of your work and submit either a PDF or text file.
• When drawing circuits in a text file you do not have to draw the shapes of the gates. Instead, simply use the word NAND, NOR, AND, OR, or NOT.
e.g.
A—-NAND—C
B—-/
stands for C = A NAND B
• For programming questions hand in your source program (.asm file).
• Name you programs LastnameFirstnameAxQy.asm, replace x with the assignment number and y with the question number.
• Please comment appropriately for programming question. Please read the “programming standards” for COMP 2280. Marks are allocated for good documentation.
• Hand in your assignment through the UMLearn
Written Part
Question 1 [16 marks]
The MAR, MDR, and ALU are structures written (and read) in various phases of the instruction processing cycle, depending on the instruction being executed.
• In each table cell, below, enter the instructions that result in writes/loads to the corresponding structure (row) during the corresponding phase (column) of the instruction processing cycle.
• In the case of the ALU, also indicate the phases where it performs a calculation, on top of writes/loads to it.
• Ignore the reads or loads from the MAR/MDR/ALU onto the bus.
• For example, place ST in the MAR row of the FETCH column if ST causes the MAR to be written during the FETCH phase.
• To make this simpler, let us only consider the following instructions:
AND
LDR
ST
FETCH
DECODE
EVAL ADDR
FETCH OPR
EXECUTE
STORE
MAR
MDR
ALU
Question 2 [8 marks]
• Using 3 D flip-flops, design a finite state machine that will count out the sequence 0,2,6,3,4,7,5,1,0 … on each rising clock edge.
• Your FSM will have a clock input and 3 output bits Q2Q1Q0 which is the binary representation of the current number counted.
• Your solution must include the truth tables for the next state given the current state (state transition table)
• Your solution must include the state equations (in sum-of-products form) for the state variables Q2+, Q1+, and Q0+ based on the state transition table (see the two examples from the Module 9).
• Simplify the expressions in the equations where possible. Use a K-maps for this.
• Do NOT draw a circuit diagram or a state transition diagram.
Q2
Q1
Q0
Q2+
Q1+
Q0+
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
Q2 \ Q1 Q0
00
01
11
10
0
1
Q0+ =
Q2 \ Q1 Q0
00
01
11
10
0
1
Q1+ =
Q2 \ Q1 Q0
00
01
11
10
0
1
Q2+ =
Question 3 [8 marks]
a) Consider the following state machine.
• It has a one-bit input X and a one-bit output Y.
• Your solution must include the truth tables for the next state and the output given the current state and the current value of the input (state transition table)
• Your solution must include the equations for the state variables and the output based on the state transition table.
• Simplify the expressions in the equations where possible.
• Use the obvious assignment of the state variables, that is, the initial state A = 00, B = 01, etc., this will give the simplest equations.
• In the state diagram the value under the line is the value of the output Y.
INITIAL STATE
INITIAL STATE
1
0
1
0
A
1
A
1
1 0
1 0
0 1
0 1
0
1
0
1
D
1
D
1
C
0
C
0
B
1
B
1
In: X
Current State
Q1
Q0
Next State
Q1+
Q0+
Out: Y
X \ Q1 Q0
00
01
11
10
0
1
Q0+ =
X \ Q1 Q0
00
01
11
10
0
1
Q1+ =
X \ Q1 Q0
00
01
11
10
0
1
Y =
3.b) Design and Draw a circuit for the state machine from 3.a.