Using Practical Examples in Teaching Digital Logic Design v5 PDF
Using Practical Examples in Teaching Digital Logic Design v5 PDF
c
American
Society for Engineering Education, 2014
Using K-maps, the excitation and output equations for D flip-flops can be found to be as follows:
D0 = q0 + S0q1'
D1 = q1 + S1q0'
Z0 = q0
Z1 = q1
In the circuit diagram shown below in Figure 1, Vcc is 9 Volts, and a 555 timer is used to
generate the clock signal with a frequency of about 100 kHz. The values of R2, R3, and C can
be changed to generate other clock frequencies (see the 555 datasheet for details). It is unlikely
that a tie will occur if the clock frequency is very high.
A breadboard with the circuit was passed around during the lecture so that students could see the
circuit in operation (see Figure 2).
Vcc
CD4013BE 14
6
S
q 1
5
D
D-FF
3
q 2
4
R
Vcc
Vcc
S0
q1'
q0'
3
7
4
CD4011BE
1k
1 14
Vcc
LED 0
q0
100 Ohms
q0'
Reset
1k
CD4013BE
8
Vcc
S1
1k
q0'
q1' 13
10
11
12
S
D
11
10
D-FF
q 13 q1
100 Ohms
q 12
q1'
Vcc
8
4
R2=1k
R3=1k
C=0.5nF
3
7
6
2
LM555
Timer
5
C1 = 0.01F
LED 1
12-Hour Clock
The 12-hour clock is a standard commercial product. It performs a useful function, yet it is
simple enough that it can be used as either an example in lecture, or can be designed by the
students as a series of homework problems or in project. In the author's course, part of the clock
is presented as an example in lecture, and the students design the rest of the clock in a group
project and homework problems.
Digital clocks are usually set up to start at 12:00, and they count 12:01, 12:02, 12:03, 12:04,
12:05, 12:06, 12:07, 12:08, 12:09, 12:10, and eventually the clock gets to 12:58, 12:59, 1:00, and
so on. The one's place of the minutes (the right-most digit) counts 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, and
then repeats, and a circuit that counts in this way is called a mod-10 counter. The ten's place of
the minutes (second digit from the right) counts 0, 1, 2, 3, 4, 5, and then repeats, which is called
a mod-6 counter. The hour counter counts 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, and repeats. One
way to design the clock is to break it up into smaller parts as shown in Figure 3 below.
Minutes
Ones Place
Mod-10
Counter
CLK
CLR
q0
q1
q2
q3
Z
z
y BCD-toSeven
x
Segment
w Decoder
a
b
c
d
e
f
g
Minutes
Tens Place
EN
Mod-6
Counter
CLR
q0
q1
q2
z
y BCD-toSeven
x
Segment
w Decoder
a
b
c
d
e
f
g
Hours
Ones Place
EN
12 Hour
Counter
CLR
A0
A1
A2
A3
B0
z
y BCD-toSeven
x
Segment
w Decoder
a
b
c
d
e
f
g
CLR_L
Hours
Tens Place
z
y
x
w
BCD-toSeven
Segment
Decoder
a
b
c
d
e
f
g
The output from each counter is a binary coded decimal (BCD) number that represents one of the
digits in the time, and BCD-to-Seven segment decoders are used to drive the seven segment
displays.
This circuit is a clocked synchronous circuit where all of the flip-flops have the same clock
signal. If the clock signal is set up to have one pulse per minute, the mod-10 counter will
increment every minute and needs to have an output Z that indicates when it is at the maximum
count (1001). Since the mod-6 counter only increments every 10 minutes, it needs to have an
enable input which is connected to the maximum count indicator from the mod-10 counter.
Furthermore, the mod-6 counter needs to have a maximum count indicator Z that is 1 when the
mod-6 counter is at the maximum count (0101) and it is enabled. The hour counter needs to
have an enable input which is connected to the maximum count indicator from the mod-6
counter.
The state table for the mod-10 counter is shown in Table 2. Don't care conditions (x's) were
placed in the unused states to help simplify the excitation equations.
Table 2: State Table for Mod-10 Counter
q3q2q1q0
q3*q2*q1*q0*
Z
0000
0001
0
0001
0010
0
0010
0011
0
0011
0100
0
0100
0101
0
0101
0110
0
0110
0111
0
0111
1000
0
1000
1001
0
1001
0000
1
1010
xxxx
x
1011
xxxx
x
1100
xxxx
x
1101
xxxx
x
1110
xxxx
x
1111
xxxx
x
The excitation equations for D flip-flops and the output equation for the mod-10 counter were
found using K-maps and are shown below.
D0 = q0'
D1 = q3'q1'q0 + q1q0'
D2 = q2'q1q0 + q2q0' + q2q1'
D3 = q3q0' + q2q1q0
Z = q3q0
The state table for the mod-6 counter is shown in Table 3, and the excitation and output
equations for the mod-6 counter are shown below.
D0 = q0'E + q0E' = q0 E
D1 = q2'q1'q0E + q1E' + q1q0'
D2 = q2E' + q2q0' + q1q0E
Z = q2q0E
Table 3: State Table for Mod-6 Counter
q2q1q0
q2*q1*q0*
Z
E=0 E=1
E=0 E=1
000
000 001
0
0
001
001 010
0
0
010
010 011
0
0
011
011 100
0
0
100
100 101
0
0
101
101 000
0
1
110
xxx xxx
x
x
111
xxx xxx
x
x
The hour counter has 12 states, and so it requires four flip-flops. Since the hour counter has four
flip-flops and one input, the excitation equations are functions of five variables. In order to
avoid requiring five-variable K-maps, the enable function was implemented separately by
designing a flip-flop with an enable input as shown in Figure 4. When EN = 0, the multiplexer
selects the current state q and applies it to the input of the flip-flop so that the next state will be
the same as the current state (q* = q). When EN = 1, the multiplexer selects the input D and
applies it to the input of the flip-flop so that the circuit behaves like a standard flip-flop.
EN
S0
2-to-1
D0 Multiplexer
D
D1
CLK
Car Alarm
A fairly simple circuit can be designed that could operate a car alarm. The circuit has one input
Y which would be connected to the car's door switch to determine if the car door is open or shut.
When the door is shut Y = 0, and when the door is open Y = 1. The circuit has one output Z
which is used to operate a relay that honks the horn by shorting the wires that go to the horn
switch in the steering wheel. When Z = 1, the relay is activated and the horn honks. The circuit
would be asynchronously reset by the accessories power line that is high when the ignition is
turned on or is in accessory-only mode, both of which require the key to the car.
The state table is shown in Table 5 below. While the ignition is on, the flip-flops are forced into
state 000 by the asynchronous reset. Then, when the ignition is turned off, the circuit stays in
state 000 while door is closed (Y = 0) to wait for the driver to get out of the car. When the driver
opens the door (Y = 1), the circuit goes to state 001. The circuit stays in state 001 while the
door is open (Y = 1), and when the driver closes the door (Y = 0) the circuit proceeds to state
010. At this point, the alarm is "armed" in the sense that it is waiting for the door to open and to
honk the horn. As long as the door is closed (Y=0), the circuit stays in state 010, but when the
door is opened (Y = 1), the circuit moves to state 011. Once in state 011, the circuit does not
honk the horn yet because usually it is the driver returning to the car. If the clock is set to have
one pulse for every 20 seconds, there will be at least a 20 second delay before the circuit moves
to state 100 and honks the horn. The driver would use this time to insert the key into the ignition
and to turn the ignition on, which asynchronously resets the circuit and prevents the horn from
honking. If the ignition is not turned on within 20 seconds, the circuit proceeds to state 100
regardless of whether the door is open or not, and the horn is honked (Z = 1). The circuit will
stay in state 100 and honk the horn until it is reset by the ignition or the battery dies.
Don't cares (x's) were placed in the unused states to help simplify the excitation and output
equations.
Table 5: State Table for Car Alarm Circuit
q2q1q0
q2*q1*q0*
Z
Y=0 Y=1
000
000 001
0
001
010 001
0
010
010 011
0
011
100 100
0
100
100 100
1
101
xxx xxx
x
110
xxx xxx
x
111
xxx xxx
x
The excitation and output equations were found using K-maps as follows.
D0 = q1'q0Y + q2'q0'Y
D1 = q1'q0Y' + q1q0'
D2 = q1q0 + q2
Z = q2
In order to be practical, this circuit would also need to latch the input so that the circuit will
notice if someone opens the door, jumps inside, and closes the door in less than 20 seconds. (It
would also be desirable to redesign the circuit so that it turns the horn on and off repeatedly
instead of just turning the horn on constantly, and to automatically reset the circuit after the horn
is honked for say five minutes, but these features require many more states and a more
complicated circuit.)
Assessment
In an attempt to measure how interesting and effective the students find these examples, a survey
was given after each example was completed. The survey asked "Did you find the example
circuit interesting?" and "Was the example circuit helpful?". The students scored each question
on a five point scale where 1 was not at all interesting/helpful, and 5 was very interesting/helpful.
The survey also asked for optional comments about each example circuit. The survey was also
given after two conventional examples: 4-bit binary adder and 3-to-8 binary decoder. For each
question, the average student rating and the number of responses (N) are shown below in Table
6.
Car Alarm:
Entertaining, practical example
It was really cool to see a relevant example used in real life
Very cool
I thought this was my favorite example.
I didn't realize you could do this with sequential logic. Good example.
The students rated the game show circuit, digital clock, and car alarm as slightly more interesting
than the conventional examples binary adder and binary decoder. However, those circuits may
not be directly comparable to the binary adder and binary decoder because the game show
circuit, digital clock, and car alarm are all sequential logic circuits whereas the binary adder and
binary decoder are combinational logic circuits.
The binary adder and the digital clock were rated as being slightly more helpful than the others.
This result may have occurred because the students designed a binary adder and parts of the
digital clock as homework assignments and in a group project, so these two examples were
directly related to problems that the students were required to solve. However, the students also
designed a large binary decoder in the homework, but that example was not rated as high in
helpfulness. This result might be explained by the fact that at the time of the survey, the students
were struggling with understanding the decoder, as is made clear in the comments.
Overall, the students rated the game show circuit, digital clock, and car alarm as being highly
interesting and helpful. These circuits were rated as slightly more interesting than the more
conventional circuits, but they were not necessarily rated as being more helpful to them.
Conclusion
Three example circuits were described for a digital logic design course. Although the examples
were relatively simple, they were complete systems that solve real-world problems. A survey
found that the students seemed to find the complete system examples slightly more interesting
than the more conventional circuits, but not necessarily more helpful.
References
1.
Show them NAND gates and they will come, Barrett, S.F.; Hamann, J.; Coon, D.; Crips, P.M.; Pierre, J.,
Computers in Education Journal, v 17, n 2, p 26-36, April/June 2007.
2.
A Builder and Simulator Program with Interactive Virtual Environments for the Discovery and Design of
Logic Digital Circuits, Miguel-de-Priego, Arturo, 2013 Frontiers in Education Conference (FIE2013),
Oklahoma City, Oklahoma, October 23-26, 2013.
3.
Visiboole: Transforming digital logic education, Devore, John J.; Soldan, David L., ASEE Annual
Conference and Exposition, ASEE2012, June 10, 2012 - June 13, 2012.
4.
Teaching digital logic design using the GOAL (Guided On-demand Adaptive Learning) system, Williams,
Ronald D.; Dugan, Joanne Bechta, ASEE Annual Conference and Exposition, June 26, 2011 - June 29,
2011.
5.
Toward an interactive environment for embedded systems design, Obeidat, Fadi; Alkhasawneh, Ruba;
Tucker, Jerry; Klenke, Robert, ASEE Annual Conference and Exposition, June 20, 2010 - June 23, 2010.
6.
The CPLD Provides a Third Option in the Introductory Circuits Course, Hill, Jonathan; Yu, Ying, ASEE
Annual Conference and Exposition, Conference Proceedings, June 10 - 13, 2012.
7.
Developing Undergraduate FPGA Curriculum using Altium Software and Hardware, Mayer, Erik A.,
Computers in Education Journal, v 23, n 1, p 35-42, January-March 2013.
8.
FPGArcade: Motivating the study of digital hardware, Neebel, Danial J.; Burek, Nicholas J.; Griebel,
Thomas, ASEE Annual Conference and Exposition, June 10 - 13, 2012.
9.
ARM/FPGA/I2C sensor network development and teaching platform, Mondragon, Antonio Francisco;
Purohit, Prafull, ASEE Annual Conference and Exposition, June 26 - 29, 2011.
10. Interdisciplinary laboratory projects integrating LabVIEW with VHDL models implemented in FPGA
hardware, Hayne, Ronald; McKinney, Mark, ASEE Annual Conference and Exposition, June 20 - 23, 2010.
11. A LabVIEW FPGA toolkit to teach digital logic design, Perales, Troy; Morgan, Joseph; Porter, Jay, ASEE
Annual Conference and Exposition, June 14 - 17, 2009.
12. Collaborative project-based learning to enhance freshman design experience in digital engineering, Dong,
Jianyu; Warter-Perez, Nancy, ASEE Annual Conference and Exposition, June 14 - 17, 2009.
13. Extensive use of advanced FPGA technology in digital design education, Radu, Mihaela; Cole, Clint;
Dabacan, Mircea Alexandru; Sexton, Shannon, ASEE Annual Conference and Exposition, June 22 - 24,
2008.
14. Introducing field-programmable gate arrays into sophomore digital circuits course, Sin, Ming Loo;
Planting, Arlen; Murdock, Matt, ASEE Annual Conference and Exposition, June 18 - 21, 2006.
15. Boole-WebLab-Deusto: Integration of a Remote Lab in a Tool for Digital Circuits Design, Garcia-Zubia,
Javier; Rodriguez-Gil, Luis; Ordua, Pablo; Angulo, Ignacio; Dziabenko, Olga, 2013 Frontiers in
Education Conference, October 23 - 26, 2013.
16. The MOSIS Service, www.mosis.com, accessed December 22, 2013.