Milestone1 - Group 6
Milestone1 - Group 6
Milestone1 - Group 6
Laboratory Report
Milestone 1
Student
Group 6
Ta ̣ Quố c Khánh — 2013465
Nguyễn Hoàng Nguyên — 1911721
Huỳnh Tấn Luân — 2012515
Supervisor
Dr. Linh Tran
March 2024
EE3043: Computer Architecture
Table of Contents
1. Objectives 2
1.2. Review of State Machine Diagram Drawing and Sequential Circuit Design 3
2. Analyses 6
3. Design 7
4. Results 9
5. Discussion 14
1
EE3043: Computer Architecture
3
EE3043: Computer Architecture
5. Optimize: Simplify the state diagram and logic to reduce the number of
necessary elements.
Notes on Design
Avoid asynchronous circuits: Ensure that all transitions are synchronized
with the clock pulse.
Handle undefined states: Clearly define the behavior for any undefined or
undesirable states.
4
EE3043: Computer Architecture
Moore FSM: This type generates outputs that do not directly depend on the
inputs of the FSM. The outputs are determined solely by the current state.
Mealy FSM: This type generates outputs that directly depend on the inputs of
the FSM as well as the current state. This can result in faster response times
since the outputs can change immediately with input changes.
5
EE3043: Computer Architecture
2. Analyses
2. When the deposited amount exceeds ¢20, it should dispense a soda and
calculate the correct change.
6
EE3043: Computer Architecture
2. Based on the above states, draw the state diagram of a Mealy or Moore
machine.
3. The team will choose the design method based on the Moore state diagram
because the output signal in the Moore state machine does not depend on the
input and the current state, so the result will return to the next cycle.
4. After completing the state diagram, divide the design of this automatic
vending machine into three main parts: combinational input system, sequential
system, and combinational output system. The specific details of this three-
part diagram will be presented in section 3.
3. Design
nickel_i Input 1 1 if the coin type is used, 0 if the coin type is not
used
dime_i Input 1 1 if the coin type is used, 0 if the coin type is not
used
quarter_i Input 1 1 if the coin type is used, 0 if the coin type is not
used
7
EE3043: Computer Architecture
8
EE3043: Computer Architecture
4. Results
9
EE3043: Computer Architecture
To test the output functionality of the design, we divide it into different cases and
write a testbench for each corresponding case.
→ In Case 1, we insert 1 quarter (¢25) into the machine, resulting in a total amount of
¢25. Therefore, since the total amount is greater than ¢20, the machine will dispense a
soda can, and the soda_o signal will be activated to level 1, returning ¢5 in change,
corresponding to the change_o value of 001. The testbench code for Case 1 is written
as follows:
10
EE3043: Computer Architecture
→ In Case 4, we do not insert any coins into the machine, resulting in a total amount
of ¢0. Therefore, since the total amount is less than ¢20, the machine will not dispense
a soda can, the soda_o signal will not be activated to level 1, and no change will be
11
EE3043: Computer Architecture
returned, corresponding to the change_o value of 000. The testbench code for Case 4
is written as follows :
→ In Case 5, as marked in the image, we sequentially insert 2 dimes (¢10) into the
machine, resulting in a total amount of ¢20. Therefore, initially, since the total amount
is still less than ¢20, the machine will not dispense a soda can; instead, it will go into
a waiting position. As a result, the waveform for soda_o will remain at level 0, and no
change will be returned. However, after inserting an additional ¢10, the total amount
will now be ¢20. Thus, since the total amount is sufficient, the machine will dispense
a soda can, the soda_o signal will be activated to level 1, and since the amount is
exact (with no surplus), the system will not return any change, corresponding to the
change_o value of 000. The testbench code for Case 5 is written as follows:
→ In Case 6, we sequentially insert 3 coins: 1 dime (¢10), 1 nickel (¢5), and 1 dime
(¢10), resulting in a total amount of ¢25. Therefore, initially, since the total amount is
still less than ¢20, the machine will not dispense a soda can; instead, it will go into a
waiting position. As a result, the soda_o signal will remain at level 0, and no change
will be returned. However, after inserting an additional ¢10, the total amount will now
12
EE3043: Computer Architecture
be ¢25. Thus, since the total amount is sufficient, the machine will dispense a soda
can, the soda_o signal will be activated to level 1, and it will return ¢5 in change,
corresponding to the change_o value of 001. The testbench code for Case 6 is written
as follows:
13
EE3043: Computer Architecture
After running the testbench code above, the cases listed above are shown. “TEST
PASSED” indicates that the designs are correct for the cases we have specified.
In addition, to verify the design, we can use waveforms. Below is the waveform
image of the design for the 7 cases listed above. It can be seen that the waveform
accurately and fully describes the cases mentioned above.
Conclusion: By writing the testbench program and checking the output waveform, we
can see that the design is correct in many cases.
5. Discussion
14
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: