L O G I S I M - E V O L U T I O N L A B M A N U A L
george self
July 2019 Edition 4.0
George Self: Logisim-Evolution Lab Manual
This work is licensed under a Creative
Commons “CC0 1.0 Universal” license.
P R E FA C E
I have taught CIS 221, Digital Logic, for Cochise College since about
2003 and enjoy working with students on this topic. From the start,
I wanted students to work with labs as part of our studies and ac-
tually design circuits to complement our theoretical instruction. As I
evaluated circuit design software I had three criteria:
Open Educational Resource (OER). It is important to me that
students use software that is available free of charge and is sup-
ported by the entire web community.
Platform. While most of my students use a Windows-based
system, some use Macintosh and it was important to me to
use software that is available for both of those platforms. As
a bonus, most OER software is also available for the Linux sys-
tem, though I’m not aware of any of my students who are using
Linux.
Simplicity. I wanted to use software that was easy to master
so students could spend their time understanding digital logic
rather than learning the arcane structures of a simulation lan-
guage.
I originally wrote a number of lab exercises using Logisim, but the
creator of that software, Carl Burch, announced that he would quit
developing it in 2014. Because it was published as an open source
project, a group of Swiss institutes started with the Logisim software
and developed a new version that integrated several new tools, like a
chronogram, and released it under the name Logisim-Evolution .
It is my hope that students will find these labs instructive and the
labs enhance their learning of digital logic. This lab manual is written
with L
A
T
E
X and published under a Creative Commons Zero license
with a goal that other instructors can modify it to meet their own
needs. The source code can be found at my personal GITHUB page
and I always welcome comments that will help me improve this man-
ual.
—George Self
iii
B R I E F C O N T E N T S
List of Figures xi
List of Tables xiii
Listings xiv
i introduction to logisim-evolution 1
1 introduction to logisim-evolution 3
ii foundations 9
2 boolean logic 11
3 priority encoder 21
iii combinational circuits 29
4 arithmetic logic unit (alu) 31
5 vending machine 37
iv sequential circuits 45
6 counters 47
7 timer 61
8 reaction timer 65
9 rom 67
10 ram 75
v simulation 81
11 processor 83
12 elevator 95
vi appendix 97
a ttl reference 99
v
C O N T E N T S
List of Figures xi
List of Tables xiii
Listings xiv
i introduction to logisim-evolution 1
1 introduction to logisim-evolution 3
1.1 Purpose 3
1.2 Procedure 3
1.2.1 Installation 3
1.2.2 Beginner’s Tutorial 3
1.2.3 Logisim-evolution Workspace 4
1.2.4 Simple Multiplexer 5
1.2.5 Identifying Information 8
1.3 Deliverable 8
ii foundations 9
2 boolean logic 11
2.1 Purpose 11
2.2 Procedure 11
2.2.1 Subcircuit: Equation 1 11
2.2.2 Subcircuit: Equation 2 13
2.2.3 Main Circuit 14
2.2.4 Testing the Circuit 15
2.3 Deliverable 20
3 priority encoder 21
3.1 Purpose 21
3.2 Procedure 21
3.2.1 Testing the Circuit 27
3.3 Deliverable 27
iii combinational circuits 29
4 arithmetic logic unit (alu) 31
4.1 Purpose 31
4.2 Procedure 32
4.2.1 main 32
4.2.2 ALU 32
4.2.3 Arithmetic 33
4.2.4 Challenge 34
4.2.5 Testing the Circuit 35
4.3 Deliverable 35
5 vending machine 37
5.1 Purpose 37
vii
viii contents
5.2 Procedure 37
5.2.1 Testing the Circuit 38
5.2.2 Subcircuit Descriptions 39
5.3 Challenge 43
5.4 Deliverable 44
iv sequential circuits 45
6 counters 47
6.1 Purpose 47
6.2 Procedure 47
6.2.1 Asynchronous Up Counter 47
6.2.2 Asynchronous Down Counter 49
6.2.3 Asynchronous Decade Counter 50
6.2.4 Synchronous Ring Counter 52
6.2.5 Synchronous Johnson Counter 54
6.2.6 Main 55
6.2.7 Chronogram 55
6.3 Challenge 60
6.4 Deliverable 60
7 timer 61
7.1 Purpose 61
7.2 Procedure 61
7.2.1 Timer_V3 61
7.2.2 Testing the Circuit 62
7.3 Challenge 63
7.4 Deliverable 63
8 reaction timer 65
8.1 Purpose 65
8.2 Procedure 65
8.3 Deliverable 66
9 rom 67
9.1 Purpose 67
9.2 Procedure 67
9.2.1 Testing the Circuit 73
9.3 Deliverable 74
10 ram 75
10.1 Purpose 75
10.2 Procedure 75
10.2.1 Testing the Circuit 79
10.3 Challenge 79
10.4 Deliverable 79
v simulation 81
11 processor 83
11.1 Purpose 83
11.1.1 A Definition 83
contents ix
11.2 Procedure 83
11.2.1 Arithmetic-Logic Unit 83
11.2.2 General Registers 86
11.2.3 Control 87
11.2.4 Main 88
11.2.5 Testing the Circuit 88
11.3 About Programming Languages 91
11.4 Challenge 93
11.5 Deliverable 94
12 elevator 95
12.1 Purpose 95
12.2 Challenge 95
12.3 Deliverable 96
vi appendix 97
a ttl reference 99
a.1 7400: Quad 2-Input NAND Gate 99
a.2 7402: Quad 2-Input NOR Gate 100
a.3 7404: Hex Inverter 101
a.4 7408: Quad 2-Input AND Gate 102
a.5 7410: Triple 3-Input NAND Gate 103
a.6 7411: Triple 3-Input AND Gate 104
a.7 7413: Dual 4-Input NAND Gate (Schmitt-Trigger) 105
a.8 7414: Hex Inverter (Schmitt-Trigger) 106
a.9 7418: Dual 4-Input NAND Gate (Schmitt-Trigger In-
puts) 107
a.10 7419: Hex Inverter (Schmitt-Trigger) 108
a.11 7420: Dual 4-Input NAND Gate 109
a.12 7421: Dual 4-Input AND Gate 110
a.13 7424: Quad 2-Input NAND Gate (Schmitt-Trigger) 111
a.14 7427: Triple 3-Input NOR Gate 112
a.15 7430: Single 8-Input NAND Gate 113
a.16 7432: Quad 2-Input OR Gate 114
a.17 7436: Quad 2-Input NOR Gate 115
a.18 7442: BCD to Decimal Decoder 116
a.19 7443: Excess-3 to Decimal Decoder 117
a.20 7444: Gray to Decimal Decoder 119
a.21 7447: BCD to 7-Segment Decoder 121
a.22 7451: Dual AND-OR-INVERT Gate 123
a.23 7454: Four Wide AND-OR-INVERT Gate 124
a.24 7458: Dual AND-OR Gate 125
a.25 7464: 4-2-3-2 AND-OR-INVERT Gate 126
a.26 7474: Dual D-Flipflops with Preset and Clear 127
a.27 7485: 4-Bit Magnitude Comparator 128
a.28 7486: Quad 2-Input XOR Gate 128
a.29 74125: Quad Bus Buffer, 3-State Gate 129
x contents
a.30 74165: 8-Bit Parallel-to-Serial Shift Register 130
a.31 74175: Quad D-Flipflops with Sync Reset 131
a.32 74266: Quad 2-Input XNOR Gate 131
a.33 74273: Octal D-Flipflop with Clear 132
a.34 74283: 4-Bit Binary Full Adder 133
a.35 74377: Octal D-Flipflop with Enable 134
L I S T O F F I G U R E S
Figure 1.1 Logisim-evolution Initial Screen 4
Figure 1.2 Two AND Gates 5
Figure 1.3 AND Gate Properties 6
Figure 1.4 OR Gate Added to Circuit 6
Figure 1.5 Two NOT Gates Added to Circuit 7
Figure 1.6 Inputs and Output Added 7
Figure 1.7 Circuit Wiring Added 7
Figure 1.8 Simple multiplexer 8
Figure 2.1 Equation 1 Inputs-Outputs 12
Figure 2.2 Equation 1 And-Or Gates 12
Figure 2.3 Equation 1 And Gate Inputs Set 13
Figure 2.4 Equation 1 Circuit Completed 13
Figure 2.5 Main Circuit 15
Figure 2.6 Test Vector Window 18
Figure 2.7 Test Completed 19
Figure 2.8 Test Failure 20
Figure 3.1 AND Gates 22
Figure 3.2 OR Gates Added 23
Figure 3.3 Inputs Added 24
Figure 3.4 Wiring the Encoder 25
Figure 3.5 Nine-line Priority Encoder 26
Figure 3.6 Main Circuit 27
Figure 4.1 ALU main 32
Figure 4.2 ALU Subcircuit 33
Figure 4.3 Arithmetic Subcircuit 34
Figure 4.4 Logic Subcircuit 34
Figure 5.1 Vending Machine Main Circuit 39
Figure 5.2 Activator Subcircuit 40
Figure 5.3 Bank Subcircuit 40
Figure 5.4 Dispenser Subcircuit 41
Figure 5.5 Product Subcircuit 42
Figure 5.6 Vending Subcircuit 43
Figure 6.1 Asynchronous Up Counter 48
Figure 6.2 Asynchronous Down Counter 49
Figure 6.3 Asynchronous Decade Counter 51
Figure 6.4 Synchronous Ring Counter 53
Figure 6.5 Synchronous Johnson Counter 54
Figure 6.6 Main Circuit 55
Figure 6.7 Timing Diagram for Up Counter 56
Figure 6.8 Set Up Chronogram 57
Figure 6.9 Chronogram Ready 58
xi
xii List of Figures
Figure 6.10 Chronogram Starting 58
Figure 6.11 Chronogram At Zero Time 59
Figure 6.12 Chronogram Controls 59
Figure 7.1 Completed Timer 62
Figure 7.2 Timer Main Circuit 62
Figure 8.1 Reaction Timer 65
Figure 9.1 Placing ROM 67
Figure 9.2 ROM With Counter 68
Figure 9.3 ROM Filter Mux 69
Figure 9.4 Random Generator Added 70
Figure 9.5 Completed Magic 8-Ball Circuit 70
Figure 9.6 Counter Inputs 71
Figure 9.7 Counter Control Generation and Distribution 72
Figure 9.8 ROM Output 73
Figure 9.9 Magic 8-Ball Main Circuit 73
Figure 10.1 RAM Basics 75
Figure 10.2 RAM With Control Signals 76
Figure 10.3 Data Bus 77
Figure 10.4 RAM With Input/Output Devices 78
Figure 10.5 RAM With Input/Output Devices 78
Figure 11.1 Simple ALU 84
Figure 11.2 Left Side of ALU 85
Figure 11.3 Full ALU 85
Figure 11.4 General Registers 86
Figure 11.5 Control Subcircuit 87
Figure 11.6 Main Circuit 88
Figure 12.1 Example Elevator Simulator 96
Figure A.1 Three Surface-Mounted Integrated Circuits 99
Figure A.2 7400: Single NAND Gate Circuit 99
Figure A.3 7402: Single NOR Gate Circuit 100
Figure A.4 7404: Single Inverter Circuit 101
Figure A.5 7408: Single AND Gate Circuit 102
Figure A.6 7410: Single 3-Input NAND Gate Circuit 103
Figure A.7 7411: Single 3-Input AND Gate Circuit 104
Figure A.8 7413: Single 4-Input NAND Gate Circuit 105
Figure A.9 7414: Single Inverter Circuit 106
Figure A.10 7418: Single 4-Input NAND Gate Circuit 107
Figure A.11 7419: Single Inverter Circuit 108
Figure A.12 7420: Single 4-Input NAND Gate Circuit 109
Figure A.13 7421: Single 4-Input AND Gate Circuit 110
Figure A.14 7424: Single NAND Gate Circuit 111
Figure A.15 7411: Single 3-Input NOR Gate Circuit 112
Figure A.16 7430: Single 8-Input NAND Gate 113
Figure A.17 7432: Single OR Gate Circuit 114
Figure A.18 7436: Single NOR Gate Circuit 115
Figure A.19 7442: BCD to Decimal Decoder 116
Figure A.20 7447: BCD to 7-Segment Decoder 121
Figure A.21 7451: Single AND-OR-INVERT Gate Circuit 123
Figure A.22 7454: Four Wide AND-OR-INVERT Gate Cir-
cuit 124
Figure A.23 7458: Dual AND-OR Gate Circuit 125
Figure A.24 7464: 4-2-3-2 AND-OR-INVERT Gate Circuit 126
Figure A.25 7486: Single XOR Gate Circuit 128
Figure A.26 74125: Single Buffer Circuit 129
Figure A.27 74266: Single XNOR Gate Circuit 131
L I S T O F TA B L E S
Table 4.1 Function Table for 74181 ALU 31
Table 6.1 Up Counter Output 49
Table 6.2 Down Counter Output 50
Table 6.3 Decade Counter Output 52
Table 6.4 Ring Counter Output 53
Table 6.5 Johnson Counter Output 55
Table 11.1 R0 <- LdImm 88
Table 11.2 R1 <- LdImm 89
Table 11.3 ALU <- LdImm 89
Table 11.4 R0 <- Inc(R0) 89
Table 11.5 R0 <- R0 + R1 90
Table 11.6 R0 <- R0 - R1 90
Table 11.7 R1 <- R0 90
Table 11.8 R0 <-> R1 91
Table A.1 Pinout For 7400 100
Table A.2 Pinout For 7402 101
Table A.3 Pinout For 7404 102
Table A.4 Pinout For 7408 103
Table A.5 Pinout For 7410 104
Table A.6 Pinout For 7411 105
Table A.7 Pinout For 7413 106
Table A.8 Pinout For 7414 107
Table A.9 Pinout For 7418 108
Table A.10 Pinout For 7419 109
Table A.11 Pinout For 7420 110
Table A.12 Pinout For 7421 111
Table A.13 Pinout For 7424 112
Table A.14 Pinout For 7427 113
Table A.15 Pinout For 7430 114
Table A.16 Pinout For 7432 115
Table A.17 Pinout For 7436 116
xiii
Table A.18 Truth Table For The 7442 Circuit 117
Table A.19 Pinout For 7442 117
Table A.20 Truth Table For The 7443 Circuit 118
Table A.21 Pinout For 7443 119
Table A.22 Truth Table For The 7444 Circuit 120
Table A.23 Pinout For 7444 120
Table A.24 Truth Table For The 7447 Circuit 122
Table A.25 Pinout For 7447 123
Table A.26 Pinout For 7451 124
Table A.27 Pinout For 7454 125
Table A.28 Pinout For 7458 126
Table A.29 Pinout For 7464 127
Table A.30 Pinout For 7474 127
Table A.31 Pinout For 7485 128
Table A.32 Pinout For 7486 129
Table A.33 Pinout For 74125 130
Table A.34 Pinout For 74165 130
Table A.35 Pinout For 74175 131
Table A.36 Pinout For 74266 132
Table A.37 Pinout For 74273 133
Table A.38 Pinout For 74283 134
Table A.39 Pinout For 74377 135
L I S T I N G S
A C R O N Y M S
ALU Arithmetic Logic Unit
BCD Binary Coded Decimal
CPU Central Processing Unit
IC Integrated Circuit
OER Open Educational Resource
RAM Random Access Memory
ROM Read Only Memory
xiv
acronyms xv
TTL Transistor-Transistor Logic
Part I
I N T R O D U C T I O N T O L O G I S I M - E V O L U T I O N
Logisim-Evolution is used to create and test simulations of
digital circuits. This part of the lab manual includes only
one lab designed to introduce Logisim-Evolution and teach
the fundamentals of using this application.
1
I N T R O D U C T I O N T O L O G I S I M - E V O L U T I O N
1.1 purpose
This lab introduces the Logisim-Evolution logic simulator, which is
used for all lab exercises in this manual.
1.2 procedure
1.2.1 Installation
Logisim-Evolution is a Java application, so a Java runtime environment
will need to be installed before using the application. Many students
who are taking a digital logic class already have a Java runtime on
their computer and can skip this step, but those who do not will need
to install the Java runtime. That process is not covered in this man-
ual but information about installing the Java runtime environment
is available at http://www.oracle.com/technetwork/java/javase/d
ownloads/index.html. It can be confusing to know which version of
Java to download but students working on the labs in this manual
only need the runtime, called JRE on the website. Students who are
also in programming classes will likely already have the runtime as
part of the Java Developer’s Kit (JDK). It can be tricky testing the
Java installation since the Chrome, Firefox, and Edge browsers will
not run Java apps, but students can open a command prompt and
enter java -version to see what version of Java their computers are
running, if any.
Logisim-Evolution (https://github.com/reds-heig/logisim-evolu
tion) is available as a free download. Visit the website and about
halfway down the page find a section named “Running logisim-evolution.”
Click the “here” link at the end of the first sentence in that section.
Since the Logisim-Evolution file is a Java application, it does not need
to be installed like most software. To start Logisim-Evolution , double-
click the Logisim-Evolution shortcut. That will start Java and then run
the Logisim-Evolution application. Also, Logisim-Evolution will not need
to be uninstalled when it is no longer needed since it is not actually
installed, the Logisim-Evolution file can simply be deleted.
1.2.2 Beginners Tutorial
Logisim-Evolution comes with a beginner’s tutorial available in Help
-> Tutorial. That tutorial only takes a few minutes and introduces
3
4 introduction to logisim-evolution
students to the major components of the application. Students should
complete that tutorial before starting this lab.
1.2.3 Logisim-evolution Workspace
Start Logisim-Evolution by double-clicking its icon. The initial Logisim-
Evolution window will be similar to Figure 1.1.
Figure 1.1: Logisim-evolution Initial Screen
The Logisim-Evolution space is divided into several areas. Along the
top is a text menu that includes the types of selections found in most
programs. For example, the “File” menu includes items like “Save”
and “Exit.” The “Edit” menu includes an “Undo” option that is useful.
In later labs, the various options under “Project” and “Simulate” will
be described and used. Items in the “FPGAMenu” are beyond the
scope of this class and will not be used. Of particular importance
at this point is “Library Reference” in the “Help” menu. It contains
information about every logical device available in Logisim-Evolution
and is very useful while using those components in new circuits.
Under the menu bar is the Toolbar, which is a row of eight buttons
that are the most commonly used tools in Logisim-Evolution :
Pointing Finger: Used to “poke” and change input values while
the simulator is running.
1.2 procedure 5
Arrow: Used to select components or wires in order to modify,
move, or delete them.
A: Activates the Text tool so text information can be added to
the circuit.
Green Input Port: Creates an input port for a circuit.
White Output Port: Creates an output port for a circuit.
NOT Gate: Creates a NOT gate.
AND Gate: Creates an AND gate.
OR Gate: Creates an OR gate.
The Explorer Pane is on the left side of the workspace and contains
a folder list. The folders contain “libraries” of components organized
in a logical manner. For example, the “Gates” folder contains vari-
ous gates (AND, OR, XOR, etc.) that can be used in a circuit. The
four icons across the top of the Explorer Pane are used for advanced
operations and will be covered as they are needed.
The Properties panel on the lower left side of the screen is where
the properties for any selected component can be read and set. For ex-
ample, the number of inputs for an AND gate can be set to a specific
number.
The drawing canvas is the largest part of the screen. It is where
circuits are constructed and simulated.
1.2.4 Simple Multiplexer
Do not be concerned
with the exact
placement of
components on the
drawing canvas.
They can be
rearranged as the
build progresses.
A multiplexer is used to select which of two or more inputs will be
connected to a single output. For this lab, a simple two-input, one-
bit multiplexer will be built. It is understood that students will not
know the significance of a multiplexer at this point in the class, but
the purpose of this lab is to use Logisim-Evolution to build a simple
circuit and a multiplexer serves that purpose well.
Start by clicking the And button on the toolbar and placing two AND
gates on the canvas. The canvas should resemble Figure 1.2
Figure 1.2: Two AND Gates
6 introduction to logisim-evolution
Click one of the AND gates to select it and observe the various
properties available for that gate, as seen in Figure 1.3. The default
values do not need to be changed for this circuit; however, all circuits
in this manual use the “Narrow” gate size in order to make the circuit
fit the screen better. The other properties will be explained as they are
needed.
Figure 1.3: AND Gate Properties
The outputs of the two AND gates need to be combined with an OR
gate. Add an OR gate as illustrated in Figure 1.4.
Figure 1.4: OR Gate Added to Circuit
The top input for the first AND gate needs two NOT gates (inverters)
so the two AND gates can function as on/off switches. This is a rather
common digital logic construct and when the circuit is complete it
will become clear how the switching function works.
1.2 procedure 7
Figure 1.5: Two NOT Gates Added to Circuit
All inputs and outputs need to be added as in Figure 1.6. Note:
inputs are square and outputs are round. The Label property for each
input and output should be specified as in the figure. The pins are
labeled according to their function in the circuit. Pin Sel carries a
signal that selects which input to connect to the output, pins In1 and
In2 are the two inputs, and pin Out1 is the output. Note: output pins
display a blue-colored until they are actually wired to some device
like the OR gate in the illustration.
Figure 1.6: Inputs and Output Added
Finally, connect each device with a wire by clicking on the various
ports and dragging a wire to the next port. To start the wire in the
middle of the two NOT gates click the wire connecting those gates
and drag downward. Wires will automatically “bend” one time but
to get two bends, like between the output of an AND gate and the input
of the OR gate, click-and-drag the wire from the output of the AND gate
to a spot a short distance in front of that same gate, then release the
mouse button and then immediately click again to start a new wire
that will “bend” to the input of the OR gate. Only a little practice is
needed to master this wiring technique.
Figure 1.7: Circuit Wiring Added
8 introduction to logisim-evolution
To operate the circuit in a simulator, click the Pointing Finger and
“poke” the various inputs. If it is working properly, when the Sel in-
put is high then the value of In2 should be transmitted to the output,
but when Sel is low then the value of In1 should be transmitted to the
output. This circuit is used to select one of two inputs to be transmit-
ted to the output.
1.2.5 Identifying Information
Before finishing, add standard identification information near the top
left corner of the circuit using the text tool (the A button on the tool-
bar). That information should include the designer’s name, the lab
number and circuit name, and the date. Standard identification infor-
mation for this lab would look like this:
George Self
Lab 01: 2-Way, 1-Bit multiplexer
February 13, 2018
The font properties
in Figure 1.8 have
been set to bold and
a large size to make
the text easier to
read.
Note that Logisim-evolution will automatically center text in a new
box, so text boxes will need to be aligned after they have been created.
To align the text boxes, click the Arrow tool and use it to drag the
boxes to their desired location. The completed circuit should look
like Figure 1.8.
Figure 1.8: Simple multiplexer
1.3 deliverable
The purpose of this lab is to install and test the Logisim-evolution sys-
tem and become comfortable creating a digital logic circuit.
To receive a grade for this lab, create the Simple Multiplexer as
defined in this lab, be sure the standard identifying information is
at the top left of the circuit, and then save the file with this name:
Lab01
_
Mux21 (that stands for multiplexer, 2-way, 1-bit). Submit that
circuit file for grading.
Part II
F O U N D AT I O N S
Foundational Exercises are designed to provide prac-
tice with simple logic circuits in order to both develop
skill with Logisim-Evolution and illustrate the foundations
of digital logic.
2
B O O L E A N L O G I C
2.1 purpose
This lab has three goals:
Design circuits when given a Boolean expression.
Create subcircuits.
Create and exercise a test of the subcircuits.
Logisim-Evolution permits designers to work with a main circuit and
any number of subcircuits. Students who have studied programming
languages are familiar with “functions” or “classes” that can be de-
signed and built one time and then reused many times whenever they
are needed. Logisim-Evolution permits that same type of modular de-
sign by using subcircuits.
The Logisim-Evolution starter for this lab includes a main circuit and
one subcircuit, named Equation
_
1. The starter subcircuit is used to
practice creating a circuit from a Boolean expression and then a new
subcircuit is added and a second Boolean expression is used to build
that circuit.
2.2 procedure
2.2.1 Subcircuit: Equation 1
A magnifying glass
icon is used to
indicate which
circuit is active on
the drawing canvas.
The starter circuit includes a subcircuit named Equation
_
1. Double-
click that circuit in the Explorer Pane to activate it. The drawing can-
vas for this subcircuit is mostly blank except for a Boolean expression:
(A
0
BC
0
) + (AB
0
C
0
) + (ABC). Before starting to design a circuit, it is
helpful to take a minute to analyze the expression.
There are only three variables used in the entire expression: A,
B, and C. Therefore, there would be three inputs into the circuit.
There are three groups of variables and within each group the
variables are joined with an AND. Therefore, the circuit must in-
clude three AND gates with three inputs for each gate.
The three groups of variables are joined with an OR. Therefore,
the circuit must include an OR gate with three inputs.
11
12 boolean logic
While the expression does not name an output variable, it is
reasonable to assume that the circuit would output a logic 1 or
0. Therefore, a one-bit output variable must be specified.
Do not be concerned
with the exact
placement of
components on the
drawing canvas.
They can be
rearranged as the
build progresses.
Start by placing three inputs and an output on the drawing canvas.
Inputs are indicated by a green icon with I-> on the tool bar above
the drawing canvas. Click that tool and place three input pins named
In1A, In1B, and In1C —that means “Input for Equation One, variable
A and so forth.
Outputs are indicated by a white icon with ->O found on the tool
bar above the drawing canvas. Click that tool and place an output
named Out1. The circuit should look like Figure 2.1.
Figure 2.1: Equation 1 Inputs-Outputs
The gates in this
manual are all
“narrow” size. The
size does not change
the gate behavior but
makes it easier to
wire the complex
circuits in later labs.
Next, the gates should be added. The AND gate tool can be found
on the tool bar. Click that tool and place three AND gates on the circuit.
Click each gate and in its properties panel set the Number of Inputs to
3.
The OR gate tool can be found on the tool bar. Click that tool and
place one OR gate on the circuit. Click that gate and in its properties
panel set the Number of Inputs to 3.
The circuit should look like Figure 2.2.
Figure 2.2: Equation 1 And-Or Gates
2.2 procedure 13
Next, the inputs for the AND gates should be set to match the Boolean
expression. The top AND gate will match the first group of inputs,
(A
0
BC
0
), so inputs A and C should be negated. To negate those two
inputs, click the AND gate and in the properties panel set the Negate
item for the top and bottom input to “Yes.” When that is done, the
two inputs on the AND gate should include a small “negate” circle.
In the same way, the middle and bottom input for the second AND
gate should also be negated. The circuit should look like Figure 2.3.
Figure 2.3: Equation 1 And Gate Inputs Set
Finally, connect all gates with wires, like Figure 2.4.
Figure 2.4: Equation 1 Circuit Completed
Test the circuit by selecting the poke tool in the tool bar (it looks like
a pointing finger) and setting various combinations of 1 and 0 on the
three inputs. The output pin should go high only when the inputs are
set to (A
0
BC
0
), (AB
0
C
0
), or (ABC).
2.2.2 Subcircuit: Equation 2
A new subcircuit can be added to a circuit by clicking Project -> Add
Circuit. Name the new circuit Equation
_
2. Open the new subcircuit
by double-clicking its name in the Explorer Pane.
14 boolean logic
Because this is a new subcircuit, the drawing canvas is blank. To
start this subcircuit, write the equation for the circuit near the top of
the drawing canvas by clicking the “A button on the Toolbar and
then clicking near the top of the drawing canvas and typing the fol-
lowing:
(A
0
B
0
CD
0
) + (A
0
BCD) + (AB
0
CD
0
) + (ABCD
0
)
It will save time to take a few minutes and analyze the expression.
There are only four variables used in the entire expression: A, B,
C, and D. Therefore, there would be four inputs into the circuit.
There are four groups of variables and within each group the
variables are joined with an AND. Therefore, the circuit must in-
clude four AND gates with four inputs for each gate.
The four groups of variables are joined with an OR. Therefore,
the circuit must include an OR gate with four inputs.
While the expression does not name an output variable, it is
reasonable to assume that the circuit would output a logic 1 or
0. Therefore, a one-bit output variable must be specified.
Design the subcircuit using these names for the inputs: In2A, In2B,
In2C, and In2D. Also include an output named Out2. Set the AND gates
so the their inputs are negated properly and then wire the entire
subcircuit. Finally, test the circuit to ensure the output goes high only
when the four specified combinations of inputs are present.
2.2.3 Main Circuit
Make the main circuit active by double-clicking its name in the Ex-
plorer Panel. Click once on the Equation
_
1 circuit and the cursor will
change into an image of that circuit as it will appear on the draw-
ing canvas. Click on the drawing canvas to drop that subcircuit. The
circuit can later be moved by clicking it and dragging it to a new loca-
tion. Wire the three inputs and output as shown in Figure 2.5. Notice
that the input/output pins do not need to be named the same as in
the subcircuit; for example, the output for Equation
_
1 is labeled Out1
but it is connected to an output pin labeled True1.
2.2 procedure 15
Figure 2.5: Main Circuit
Add the Equation
_
2 circuit in the same way and wire four inputs
and one output to that circuit. The inputs should be labeled A2, B2,
C2, and D2 and the output labeled True2.
2.2.4 Testing the Circuit
One way to test this circuit is to use the poke tool and click various
input combinations for both subcircuits. If the subcircuits are correct
then the output will only go high when the correct combination is set
on the inputs. However, as digital logic circuits become more complex
it is important to automate the testing process so no input combina-
tions are overlooked. Logisim-Evolution includes a Simulate -> Test
Vector feature that is used for automating circuit testing.
The first step in using automatic testing is to create a Test Vector file.
This is a simple .txt file that can be created in any text processor, like
Notepad. The format for a test vector is fairly simple. Do not use a word
processor to create
the Test Vector since
that would add
unneeded codes for
things like fonts and
margins.
Every line is a single test of the circuit, except the first line.
The first line defines the various inputs and outputs being tested.
Any line that starts with a hash mark (#) is a comment and is
ignored.
Following is the test vector file used to test the Equation
_
1 subcir-
cuit.
1 # Test vector for Lab 2
2 # Equation 1
3 A1 B1 C1 True1
4 0 0 0 0
5 0 0 1 0
6 0 1 0 1
7 0 1 1 0
8 1 0 0 1
9 1 0 1 0
10 1 1 0 0
11 1 1 1 1
16 boolean logic
Following is an explanation for the Test vector for Lab 2 file.
line 1 This is just the title of the file. Because this line starts with a
hash (#) it is a comment and will be ignored by Logisim-Evolution
.
line 2 This is another descriptor line and is ignored by Logisim-
Evolution .
line 3 This line lists all of the inputs and outputs in the circuit under
test. In this case, there are three inputs, A1, B1, and C1, along
with one output, True1. Logisim-Evolution is able to determine
whether the pin is an input or output from its properties. NOTE:
each of the inputs and outputs in this circuit are single bits. If
an input or output has more than one bit then that must be
specified on this line. For example, if True1 was actually a four-
bit output then that pin would be listed as True1[4].
line 4 This line contains the first test for the circuit. This line spec-
ifies that Logisim-Evolution make A1, B1, and C1 equal to zero
and then check to be certain that True1 is also zero.
other lines All other lines set the three input bits and specify the
expected response in the output bit.
The test vector for Equation 2 would look like this:
1 # Test vector for Lab 2
2 # Equation 2
3 A2 B2 C2 D2 True2
4 0 0 0 0 0
5 0 0 0 1 0
6 0 0 1 0 1
7 0 0 1 1 0
8 0 1 0 0 0
9 0 1 0 1 0
10 0 1 1 0 0
11 0 1 1 1 1
12 1 0 0 0 0
13 1 0 0 1 0
14 1 0 1 0 1
15 1 0 1 1 0
16 1 1 0 0 0
17 1 1 0 1 0
18 1 1 1 0 1
19 1 1 1 1 0
2.2 procedure 17
In practice, a circuit designer would usually not create two different
test vectors but would, instead, create just one file to test all parts of
the circuit. Combining the Equation 1 test and the Equation 2 test is
not quite as easy as appending one after the other since all input
and output pins for both circuits must be specified at the top of the
file. Following is the test vector for a circuit that combines Equation
1 and Equation 2. Notice that all input and output pins are defined
on line three then each line beginning with line four tests both of the
equation circuits. Because only eight tests are needed to fully exercise
Equation 1 but 16 are needed for Equation 2, the Equation 1 tests are
repeated starting on Line 12.
1 # Test vector for Lab 2
2 # Equation 1 - Equation 2
3 A1 B1 C1 True1 A2 B2 C2 D2 True2
4 0 0 0 0 0 0 0 0 0
5 0 0 1 0 0 0 0 1 0
6 0 1 0 1 0 0 1 0 1
7 0 1 1 0 0 0 1 1 0
8 1 0 0 1 0 1 0 0 0
9 1 0 1 0 0 1 0 1 0
10 1 1 0 0 0 1 1 0 0
11 1 1 1 1 0 1 1 1 1
12 0 0 0 0 1 0 0 0 0
13 0 0 1 0 1 0 0 1 0
14 0 1 0 1 1 0 1 0 1
15 0 1 1 0 1 0 1 1 0
16 1 0 0 1 1 1 0 0 0
17 1 0 1 0 1 1 0 1 0
18 1 1 0 0 1 1 1 0 1
19 1 1 1 1 1 1 1 1 0
To start a test, click Simulate -> Test Vector. The window illus-
trated in Figure 2.6 opens.
18 boolean logic
Figure 2.6: Test Vector Window
Click the Load Vector button at the bottom of the window and load
the test vector file. The test will automatically start and Logisim-
evolution will report the results, like in Figure 2.7.
2.2 procedure 19
Figure 2.7: Test Completed
The test indicates all 16 lines passed and zero failed so it could
be reasonably concluded that the circuits are functioning properly.
Figure 2.8 illustrates a failed test. The circuit designer would then
need to troubleshoot to determine what went wrong with the circuit.
20 boolean logic
Figure 2.8: Test Failure
2.3 deliverable
It is important to
name all inputs and
outputs as specified
in the lab since they
are checked with a
Test Vector file that
depends on those
names.
To receive a grade for this lab, complete the main circuit and both
subcircuits. Be sure the standard identifying information is at the top
left of the main circuit, similar to:
George Self
Lab 02: Boolean Equations
February 18, 2018
Save the file with this name: Lab02
_
Bool and submit that file for
grading.
3
P R I O R I T Y E N C O D E R
3.1 purpose
Often a circuit will receive data from several sources at one time and
there must be a way to prioritize those inputs. This circuit creates
a simple priority encoder for nine different inputs. This is a fairly
simple circuit but is best explained by building and “playing around”
with it rather than attempting to understand a printed text; thus, the
explanation for this lab is somewhat limited.
3.2 procedure
Start Logisim-Evolution and create a subcircuit named Encoder. Open
that subcircuit and place 12 AND gates as illustrated in Figure 3.1.
21
22 priority encoder
Figure 3.1: AND Gates
The gates have one data bit and these properties:
U1: Five inputs, numbers two, three, and four negated.
U2: Four inputs, numbers two and three negated.
U3: Three inputs, number two negated.
U4: Two inputs, none negated.
U5: Four inputs, numbers two and three negated.
U6: Four inputs, numbers one and two negated.
U7-U12: Two inputs, none negated.
3.2 procedure 23
Many of the output signals need to be combined with OR gates and
those should be added next, as in Figure 3.2. Note: U16 is a NOR (Gates
library) gate.
Figure 3.2: OR Gates Added
This encoder is designed to prioritize nine input lines so nine in-
puts must be added, as illustrated in Figure 3.3.
24 priority encoder
Figure 3.3: Inputs Added
Wiring this circuit is the most challenging part of the build. As
illustrated in Figure 3.4, the inputs are wired to several different AND
gates.
3.2 procedure 25
Figure 3.4: Wiring the Encoder
Finally, four output ports are added, as illustrated in Figure 3.5.
26 priority encoder
Figure 3.5: Nine-line Priority Encoder
This circuit is designed to output a Binary Coded Decimal (BCD)
number, so no further conversion is needed to be able to read the
highest priority input line. At this point, the circuit is complete and
the poke tool can be used to change the inputs and observe how that
high input bit drives the outputs.
To finish the project, open the main circuit and drop the Encoder
on the drawing canvas. Add nine inputs and label them In1 through
In9. Place a four-bit output labeled PriOut and wire the four outputs
through a splitter to that output port. To make it easier to read the
BCD number, connect a Hex Digit Display (Input/Output library) to
3.3 deliverable 27
the four-bit bus between the splitter and output port. The completed
main circuit is illustrated in Figure 3.6.
Figure 3.6: Main Circuit
In Figure 3.6, notice that two inputs are selected, In4 and In6. Since
In6 is a higher priority (it is a larger number), the output is set for six
and In4 is ignored.
3.2.1 Testing the Circuit
The circuit is now complete. It should be tested by entering various
combinations of inputs and observing that the output always displays
the highest numbered input.
3.3 deliverable
To receive a grade for this lab, create the Nine-line Priority Encoder
circuit as defined in this lab. Be sure the standard identifying infor-
mation is at the top left of the circuit, similar to this:
George Self
Lab 03: Nine-line Priority Encoder
February 18, 2018
Save the file with this name: Lab03
_
Encoder and submit that file for
grading.
Part III
C O M B I N AT I O N A L C I R C U I T S
Combinational Logic is the bedrock for all digital logic
circuits. A combinational circuit’s output is determined
only by the status of the various inputs and an external
clock signal is not necessary as in sequential circuits. All
of the circuits completed so far in this manual have been
combinational and the two labs in this part of the manual
are designed to further develop the concepts of combina-
tional digital logic with two relatively complex examples.
4
A R I T H M E T I C L O G I C U N I T ( A L U )
4.1 purpose
In this lab you will build an Arithmetic Logic Unit (ALU). An ALU is an
important digital logic device used to perform all sorts of arithmetic
and logic functions in a circuit. The commercial 74181 ALU has two
four-bit data inputs along with a one-bit mode (M) and a four-bit
select input. Depending on those settings, the device will complete
one of the functions listed in Table 4.1.
Table 4.1: Function Table for 74181 ALU
Notes: in the “Arithmetic” column, the + sign indicates logic OR
while the words plus and minus indicate arithmetic add and subtract
operations. The value of A plus A is the same as shifting the bits left
to the next most significant position.
The ALU built in this lab is not as complex as a 74181 Integrated
Circuit (IC), however it demonstrates the basic functions of an ALU.
31
32 arithmetic logic unit (alu)
4.2 procedure
This is a rather
complex circuit so
several completed
subcircuits are
provided.
Load the ALU starter circuit in Logisim-evolution. That starter circuit
already has the main, ALU, and Arithmetic subcircuits completed.
4.2.1 main
The main circuit does nothing more than provide a human-friendly
interface for the rest of the ALU. That interface include two four-bit
inputs (labeled InA and InB), a three-bit select, a one-bit mode, a
carry-in and carry-out bit (so the ALU could be chained to another
to create an eight-bit device), a compare output (TRUE if the two in-
puts are equal), and a four-bit output (labeled ALUOut). In operation,
numbers are entered on InA and InB, the mode and select are set, and
then the result is read on ALUOut.
Figure 4.1: ALU main
4.2.2 ALU
The ALU subcircuit contains the logic that routes InA, InB, and Sel to
two other subcircuits, Arithmetic or Logic. It then uses a multiplexer
to route the output of one of those subcircuits to an output port de-
pending on the setting of the Mode bit. Note that the inputs are sent to
both subcircuits but only the output specified by the Mode is returned
to the user. This type of logic is also used in the Arithmetic circuit.
4.2 procedure 33
Figure 4.2: ALU Subcircuit
4.2.3 Arithmetic
This subcircuit contains numerous devices from the Arithmetic library
and they are all wired appropriately for whatever operation is se-
lected. The concept for this subcircuit is rather simple but routing the
wiring to all of the devices is challenging.
Notice that two multiplexers are necessary since the circuit pro-
vides two different outputs. The top multiplexer routes the four-bit
solution and the bottom multiplexer routes the carry-out bit. The com-
pare output is always active since it is comparing the input signals and
does not rely on the function that is selected.
34 arithmetic logic unit (alu)
Figure 4.3: Arithmetic Subcircuit
4.2.4 Challenge
In the starter circuit, the Logic subcircuit is only a shell with three
inputs and one output.
Figure 4.4: Logic Subcircuit
Complete that subcircuit by adding the necessary logic gates and
wiring, similar to the Arithmetic subcircuit. This subcircuit is much
4.3 deliverable 35
simpler than the Arithmetic subcircuit since there are no carry-in,
carry-out, or compare bits. When completed, the subcircuit only needs
eight logic gates and a multiplexer added to the starter.
4.2.5 Testing the Circuit
The ALU should be tested by entering several values on InA and InB
and then select all possible arithmetic and logic operations. The out-
puts for each check should be accurate.
4.3 deliverable
To receive a grade for this lab, complete the Challenge. Be sure the
standard identifying information is at the top left of the main circuit,
similar to this:
George Self
Lab 04: ALU
February 18, 2018
Save the file with this name: Lab04
_
ALU and submit that file for
grading.
5
V E N D I N G M A C H I N E
5.1 purpose
One of the important benefits of working with Logisim-Evolution is
being able to simulate real-world circuits before they are physically
built. This lab simulates a vending machine that meets these require-
ments:
1. The customer can input the following coins: 5-cent, 10-cent, 25-
cent.
2. When 75 cents is input, the machine will activate the dispenser
and permit the customer to select a product.
3. When at least 75 cents is input no more coins will be accepted.
4. Change will be returned to the customer if more than 75 cents
is deposited.
5. A reset button will return the customer’s money.
6. When a product is dispensed, 75 cents will be added to the
machine’s “Total Money Collected” register.
7. No product is dispensed if less than 75 cents is deposited.
8. The current number of items available for each product is stored
in a counter.
9. When a service technician restocks the machine the item count
for each product is set to 15, which is the maximum number of
items that can be stocked.
10. If the number of products available is zero for any one product
the machine will light a “sold out” light and no action will be
taken if that product is selected.
This circuit uses only combinational logic and is an example of a
reasonably complex system.
5.2 procedure
The starter circuit for this lab is almost complete, but three of the
requirements have not been met.
37
38 vending machine
Requirement three is that the coin input will stop once 75 cents
is reached but this is not working so customers can continue
depositing coins into the machine.
When a product is dispensed, the coins deposited and change
returned is not reset back to zero. This means that a customer
could deposit 75 cents and then keep selecting products until
the machine is empty.
Requirement six is that the machine totals all of the money col-
lected but that is not functional.
5.2.1 Testing the Circuit
To test the circuit:
1. Ensure simulation is enabled at Simulate -> Simulation En-
abled.
2. Poke the Ena input pin to enable the vending machine simula-
tor.
3. Notice that the SoldOut1, SoldOut2, and SoldOut3 LEDs are lit,
indicating that those products are sold out.
4. Restock products by poking the Restock1 and Restock2 buttons.
For this test, do not poke Restock3 to keep that product empty.
As a product is restocked the “SoldOut” LED for that product
goes out and the Prod01 and Prod02 counts change to 15.
5. Poke the In5, In10, and In25 buttons to deposit coins. The total
deposited is displayed and any amount over 75 cents is shown
as change. Notice that the deposit circuit is not disabled after 75
cents is reached so customers can continue depositing coins.
6. Once at least 75 cents is deposited, poke Vend1 to vend that
product. When the button is poked the Dispense1 LED momen-
tarily lights to indicate that a product was sold. The number of
items available for that product decreases. Notice that once a
product is dispensed the amount of money deposited is not re-
set and the machine can dispense additional products without
additional money being deposited.
7. Poke Vend3 and notice that nothing happens since that product
is sold out.
8. Poke Reset to reset the amount of money deposited.
5.2 procedure 39
5.2.2 Subcircuit Descriptions
This simulator contains five subcircuits in addition to the main circuit
and this section describes all of those components.
5.2.2.1 main
The main circuit is the interface between a human customer and the
simulator, as shown in Figure 5.1.
Figure 5.1: Vending Machine Main Circuit
The main circuit includes the following components.
Numeric displays for the amount deposited, the change returned,
and the number of items available for each of three products.
An Ena (Enable) input so a technician can disable the machine
for servicing.
Buttons to simulate depositing coins, vending products, and re-
stocking the machine.
LEDs to indicate when products are sold out and dispensed.
5.2.2.2 Activator
The Activator subcircuit receives a signal from the Bank subcircuit
that indicates how much money has been collected. The Activator
returns the BCD Total and Change values and sets a signal to activate
the Dispenser subcircuit once 75 cents has been deposited. Figure 5.2
illustrates the Activator subcircuit.
40 vending machine
Figure 5.2: Activator Subcircuit
The Activator subcircuit has only one input, InCash. That input is
connected to the Bank subcircuit output and contains the total amount
of cash deposited. That input is connected to a Bin2BCD (BFH mega
functions library) device and is then output as a BCD number on the
DepositedBCD output pin.
The InCash input is also sent to a comparator where the amount is
compared to 75. If the amount in the bank is equal to or greater than
75 then the Activate output goes high.
Finally, the InCash input is sent to a mux that outputs 75 until the
comparator indicates that more than 75 is in the bank, then the mux
passes the InCash amount to a subtractor where 75 is subtracted from
it and the result sent to the ChangeBCD output.
5.2.2.3 Bank
The Bank subcircuit keeps a running total of the amount deposited
and sends that total to the Activator subcircuit. Figure 5.3 illustrates
the Bank subcircuit.
Figure 5.3: Bank Subcircuit
The Bank subcircuit has five inputs. In5, In10, and In25 indicate the
value of the coin dropped into the machine. When high, the Ena input
enables the Bank. When high, the Rst input resets the total to zero.
The Bank subcircuit has only one output, OutAcc, that makes the
total cash accumulated available to the Activator subcircuit.
For this description, imagine that a 5-cent coin is deposited. In5
goes high which changes the output of the priority encoder from zero
5.2 procedure 41
to one. That output is sent to a mux control where the number five,
on mux input one, is passed to an adder. The output of the adder is
sent to a register where it is remembered. The output of the register
is sent to the OutAcc pin but is also looped back to the adder so each
new coin is added to the previous total. Thus, the register keeps a
running total of the money deposited.
The final logic function in this subcircuit is a three-input OR gate
where each of the coin input pins are sent to the clock input of the
register. As coins are dropped into the machine the register is clocked
in order to capture each new deposit. It is important to note that the
register is set to activate on a falling edge in order to give the input
signal enough time to propagate through the priority encoder, mux,
and adder.
5.2.2.4 Dispenser
The Dispenser subcircuit dispenses the three products available in
the machine. Figure 5.4 illustrates the Dispenser subcircuit.
Figure 5.4: Dispenser Subcircuit
The Dispenser subcircuit has seven inputs and nine outputs.
Inputs:
Activate. A high input on this pin permits a product to be dis-
pensed. This signal is generated in the Activator subcircuit.
Vend. These inputs cause one of three products to be dispensed.
Restock. This resets the product count to 15, simulating a ser-
vice technician restocking the machine.
Outputs:
Avail. This is an 8-bit number (not BCD) that shows how many
items each of the products have available for sale.
Empty. This pin goes high when any product is sold out.
42 vending machine
Disp. This pin goes high when an item is dispensed.
Overall, this is a rather simple subcircuit. When one of the Vend
inputs goes high the priority encoder sends the number for that input
to the demux control port. Thus, if a customer selects product one
then the priority encoder transmits a one to the demux.
The demux will transmit the value present on the Activate input to
one of three Product subcircuits. When Activate is low then a zero is
transmitted to the Product subcircuit which effectively disables the
dispenser function. However, if Activate is high then a one is transmit-
ted to one of the Product subcircuits and that will cause a product to
be dispensed.
5.2.2.5 Product
The Product subcircuit keeps count of the number of items available
for a product. There are two inputs and three outputs.
Inputs:
Restock. This resets the count of the item to 15. It is designed
to simulate a service technician restocking the machine.
Vend. When this goes high a single item is dispensed.
Outputs:
AvailBCD. This is a count, in BCD, of the number of items avail-
able for sale.
Empty. This goes high when there are no items available for
sale.
Dispensed. This goes high when an item is dispensed. It rep-
resents an item physically dropping out of the machine for the
customer to retrieve.
Figure 5.5: Product Subcircuit
5.3 challenge 43
This subcircuit is nothing more than a counter with a few control-
ling signals. The counter has a constant zero input on the M3 port.
That sets the counter to decrement the count on each clock pulse.
The Restock input is wired to the counter’s reset port and a high
input will reset the counter to 15. Note, the counter’s properties are
pre-set for a maximum count of 15.
The Vend input is wired to the counter’s clock port so when an
item is sold the count will decrease. This input is also wired to the
Dispensed output to indicate that an item was sold.
The counter has two outputs. The 3CT=0xF output goes high when
the count reaches zero (the item is sold out). That signal is used to
disable the counter so no further sales are made. The second counter
output is the count it contains and that is wired to a Bin2BCD (BFH
mega functions library) device. The output of that device is sent to the
AvailBCD port for other subcircuits to use.
5.2.2.6 Vending
The Vending subcircuit consolidates the other subcircuits into an IC
that is used in the main circuit. Figure 5.6 illustrates the Vending sub-
circuit.
Figure 5.6: Vending Subcircuit
No further explanation is given for this subcircuit since it only
wires the other subcircuits together and introduces no new logic.
5.3 challenge
The Vending Machine simulator has three vital flaws that must be
corrected.
Requirement three is that the coin input will stop once 75 cents
is reached but this is not working so customers can continue
depositing coins into the machine.
44 vending machine
When a product is dispensed, the coins deposited and change
returned is not reset back to zero. This means that a customer
could deposit 75 cents and then keep selecting products until
the machine is empty.
Requirement six is that the machine totals all of the money col-
lected but that is not functional.
5.4 deliverable
To receive a grade for this lab, correct all three flaws identified in the
Challenge. Be sure the standard identifying information is at the top
left of the main circuit, similar to:
George Self
Lab 05: Vending Machine
February 16, 2018
Save the file with this name: Lab05
_
Vend and submit that file for
grading.
Part IV
S E Q U E N T I A L C I R C U I T S
Sequential Logic circuits develop the concepts of clock-
driven logic while creating several practical counters and
memory circuits. These labs also introduce the Logisim-
Evolution Chronogram, which builds timing diagrams for
sequential logic circuits.
6
C O U N T E R S
Counters are perhaps the most commonly-used circuits in electronic
devices. They are found in virtually all electronics systems, from the
simplest embedded computers to massive mainframes. Counters are
designed to cycle through a specific predefined sequence of binary
numbers when an input pulse is applied. Typically, counters simply
count up or down from given start and end numbers, but they can be
designed to produce unique output patterns for special uses.
Counters, though, are used for more than simple counting. They
can measure time so devices like alarm clocks and watches include
counters. They are used as frequency dividers so a fast input fre-
quency can be output at a slower rate. In devices with memory they
are used to increment memory addresses as a program steps through
some process. They can activate a series of subcircuits in sequence as
part of a complex process. They are, in short, one of the most impor-
tant workhorses of the digital logic world.
6.1 purpose
This lab has two goals:
1. Develop several different common counters using D flip-flops.
Because there are two main families of counters, asynchronous
and synchronous, this lab includes examples of both.
2. Introduce the Logisim-Evolution chronogram feature that gener-
ates a timing diagram as a sequential circuit functions.
6.2 procedure
6.2.1 Asynchronous Up Counter
A counter is built from a series of flip-flops and where the output
from each flip-flop is combined to create the counter output, trigger
the next flip-flop, or both. Each flip-flop is considered a “stage” of
the counter. A counter is triggered by a clock signal that is typically
supplied by a timer with a regularly-recurring pattern of high/low
levels, but it can also be triggered by an event of some sort, like the
press of a button or the completion of a process. In all Counter
circuits in this
manual flip-flop U0
provides the Least
Significant Bit to the
output and U3
provides the Most
Significant Bit.
One of the simplest counters is illustrated in Figure 6.1. This is
an asynchronous four-stage up counter. A counter is is considered
“asynchronous” if the input clock signal is applied to only the first
47
48 counters
stage and then that signal ripples through each flip-flop in turn. Thus,
an asynchronous counter is frequently called a “ripple” counter.
Figure 6.1: Asynchronous Up Counter
The following list describes the operation of the counter in Figure
6.1. Students should open the counter circuit with Logisim-Evolution
then use the “poke” tool to set the clock high then low (one complete
clock cycle) as they follow the description below.
reset is activated All flip-flops are reset so Q is low and Q’ is
high.
tick 1 U0 clocked: Q0 Q’0
tick 2 U0 clocked: Q0 Q’0
U1 clocked: Q1 Q’1
tick 3 U0 clocked: Q0 Q’0
tick 4 U0 clocked: Q0 Q’0
U1 clocked: Q1 Q’1
U2 clocked: Q2 Q’2
tick 5 U0 clocked: Q0 Q’0
tick 6 U0 clocked: Q0 Q’0
U1 clocked: Q1 Q’1
tick 7 U0 clocked: Q0 Q’0
tick 8 U0 clocked: Q0 Q’0
U1 clocked: Q1 Q’1
U2 clocked: Q2 Q’2
U3 clocked: Q3 Q’3
As the clock continues the counter would cycle through the binary
values 1001 - 1111. The following table lists the Up counter output as
indicated by the Q values at each tick listed above.
6.2 procedure 49
Table 6.1: Up Counter Output
6.2.2 Asynchronous Down Counter
The asynchronous down counter illustrated in Figure 6.2 is very sim-
ilar to the up counter in Figure 6.1 except the stages are triggered
from the Q output of the preceding stage rather than Q’ and the Reset
signal is applied to the flip-flop S input rather than R.
Figure 6.2: Asynchronous Down Counter
The following list describes the operation of the counter in Figure
6.2. Students should open the counter circuit with Logisim-Evolution
then use the “poke” tool to set the clock high then low (one complete
clock cycle) as they follow the description below.
reset is activated All flip-flops are set so Q is high and Q’ is low.
tick 1 U0 clocked: Q0 Q’0
tick 2 U0 clocked: Q0 Q’0
U1 clocked: Q1 Q’1
tick 3 U0 clocked: Q0 Q’0
tick 4 U0 clocked: Q0 Q’0
50 counters
U1 clocked: Q1 Q’1
U2 clocked: Q2 Q’2
tick 5 U0 clocked: Q0 Q’0
tick 6 U0 clocked: Q0 Q’0
U1 clocked: Q1 Q’1
tick 7 U0 clocked: Q0 Q’0
tick 8 U0 clocked: Q0 Q’0
U1 clocked: Q1 Q’1
U2 clocked: Q2 Q’2
U3 clocked: Q3 Q’3
As the clock continues the counter would cycle through the binary
values 0110 - 0000. The following table lists the Down counter output
as indicated by the Q values at each tick listed above.
Table 6.2: Down Counter Output
6.2.3 Asynchronous Decade Counter
Binary counters, like those considered in Figure 6.1 and Figure 6.2
are only able to count to a value that is a power of two but it is often
necessary to build a counter that stops at some other value. These
types of counters are called “mod” counters (short for “modulus”)
since they count up to a preset value then reset and start over, like
modulus math. One of the most common mod counters is one that
has ten states (it counts from zero to nine) and then resets, and that
type of counter is generally referred to as a decade counter. Decade
counters are found in any application that has to count in decimal for
easy human interpretation.
6.2 procedure 51
The logic of a mod counter is to add an AND gate on the flip-flop
outputs such that the output of the AND gate is high when the flip-
flop outputs equal the mod number. For example, the AND gate for a
decade counter would go high when the count reaches ten and that
signal would immediately reset the counter back to zero.
Figure 6.3: Asynchronous Decade Counter
The following list describes the operation of the counter in Figure
6.3:
reset is activated All flip-flops are reset so Q is low and Q’ is
high.
tick 1 U0 clocked: Q0 Q’0
tick 2 U0 clocked: Q0 Q’0
U1 clocked: Q1 Q’1
tick 3 U0 clocked: Q0 Q’0
tick 4 U0 clocked: Q0 Q’0
U1 clocked: Q1 Q’1
U2 clocked: Q2 Q’2
tick 5 U0 clocked: Q0 Q’0
tick 6 U0 clocked: Q0 Q’0
U1 clocked: Q1 Q’1
tick 7 U0 clocked: Q0 Q’0
tick 8 U0 clocked: Q0 Q’0
U1 clocked: Q1 Q’1
U2 clocked: Q2 Q’2
U3 clocked: Q3 Q’3
tick 9 U0 clocked: Q0 Q’0
52 counters
tick 10 U1 clocked: Q0 Q’0
Both inputs for the AND gate are momentarily high and that
sends a reset signal that causes all outputs to go low.
As the clock continues the counter would cycle through the binary
values 0000 - 1001. The following table lists the Decade counter output
as indicated by the Q values at each tick listed above.
Table 6.3: Decade Counter Output
6.2.4 Synchronous Ring Counter
In a ring counter the high bit is shifted through all of the bits one at
a time. This counter is very useful in controlling subcircuits since the
high bit in the counter can activate the next subcircuit in the sequence.
The ring counter presented here is also a synchronous circuit; that
is, each clock pulse is applied to all of the flip-flops instead of just
the first stage. The Q output from each flip-flop is used but Q’ is
not needed at all. Also, there is a feedback line from U3 to the data
input port of U0 so when the Q output of U3 goes high that is made
available to U0 and loop that value back through the circuit.
6.2 procedure 53
Figure 6.4: Synchronous Ring Counter
The following list describes the operation of the counter in Figure
6.4. Students should open the counter circuit with Logisim-Evolution
then use the “poke” tool to set the clock high then low (one complete
clock cycle) as they follow the description below.
reset is activated U0 is set and U1-U3 are reset so the counter is
seeded with a single high bit to shift.
tick 1 Q0 Q1
tick 2 Q1 Q2
tick 3 Q2 Q3
tick 4 Q3 Q1
As the clock continues the counter would cycle through the binary
values 0001 - 1000. The following table lists the ring counter output
as indicated by the Q values at each tick listed above.
Table 6.4: Ring Counter Output
54 counters
6.2.5 Synchronous Johnson Counter
A Johnson Counter is similar to a ring counter in that a high bit value
is shifted through the entire binary word. The difference is that the
feedback loop comes from the Q’ output of the last stage rather than
the Q output. This type of counter is sometimes called a “twisted tail”
counter since the Q’ output is fedback.
Figure 6.5: Synchronous Johnson Counter
The following list describes the operation of the counter in Figure
6.5. Students should open the counter circuit with Logisim-Evolution
then use the “poke” tool to set the clock high then low (one complete
clock cycle) as they follow the description below.
reset is activated U0 is set and U1-U3 are reset so the counter is
seeded with a single high bit to shift.
tick 1 Q1
tick 2 Q2
tick 3 Q3
tick 4 Q0
tick 5 Q1
tick 6 Q2
tick 7 Q3
tick 8 Q0
As the clock continues the counter would cycle through the binary
values 0000 - 1111. The following table lists the Johnson counter output
as indicated by the Q values at each tick listed above.
6.2 procedure 55
Table 6.5: Johnson Counter Output
6.2.6 Main
The main circuit provides a human interface to try out each of the
counters by dropping them in place of the Up counter.
Figure 6.6: Main Circuit
Notice that there are two clocks in the main circuit. Clk is linked
to the counter being tested and is used within the counter circuit to
advance the count. Sysclk is used by the Logisim-Evolution chronogram
as described in the next section of this document.
6.2.7 Chronogram
Logisim-Evolution can generate a timing diagram, called a chronogram,
for a sequential circuit. That is a representation of the various signals
in a circuit and how those signals change over time. Figure 6.7 is the
timing diagram for an Up counter.
56 counters
Figure 6.7: Timing Diagram for Up Counter
At the top of Figure 6.7 is a scale that indicates the number of
seconds that the counter has been operating. The first trace is the
input clk signal. The clock goes high at the start of each second and
then goes low at the half-second mark. Under the clock is the “Probe1
signal. Because that is a four-bit number Logisim-Evolution displays
the number, but under that number is a breakout of the four bits
that make up that number. Thus, at time zero “Probe1 is 0001 and
“Probe1_s_0 (that stands for “Probe 1, Signal 0”) is high while the
other bits are low. The Logisim-Evolution chronogram includes a cursor
indicated by a red line (found just before the five second tick in Figure
6.7) that can be placed anywhere along the diagram. The cursor sets
the values of each signal in the area on the left edge of the diagram,
so the cursor in Figure 6.7 is pointing to a spot where the clk is low,
Probe1 is at 0101, and so forth.
Follow the next steps to use the chronogram. Notes: the chrono-
gram will only check subcircuits that are found on the main subcircuit.
Therefore, in order to create a timing diagram all subcircuits need to
be combined on main. The labs completed in this manual have been
designed to use the main subcircuit as the human interface so the
chronogram feature will work well with these circuits.
1. In the main subcircuit, add a “sampling clock” labeled sysclk
(this name is important, do not change it to something else).
The sampling clock is only used by the chronogram and will not
show up in the timing diagram. It should not be connected to
any other components and can be placed anywhere on main. Set
the properties for sysclk to a 1 Tick high duration and a 1 Tick
low duration (this is the default).
2. Add a circuit master clock labeled clk. This is the clock that
will be used to trigger all components in the circuit. Set the
properties for clk to a 4 Tick high duration and a 4 Tick low
duration.
3. Set Simulate -> Tick Frequency to 4 Hertz. This will simulate
a clock that ticks once per second, as in Figure 6.7. While the
6.2 procedure 57
actual tick frequency can be changed later to “speed up” the cir-
cuit, a one-second tick is useful for learning how the chronogram
works.
4. Click Simulate -> Chronogram to set up the chronogram. Fig-
ure 6.8 illustrates the initial setup screen for the chronogram.
Figure 6.8: Set Up Chronogram
5. Click sysclk in the left panel and then click Add » to add that
signal to the chronogram. The “-2 following the sysclk name in
the right panel indicates that it is a binary signal. It is probably NOTE: sysclk must
be added to the
chronogram or it
will not sample the
circuit; however, the
sysclk signal will not
actually show up in
the timing diagram.
best to add the sysclk signal first so it is not overlooked.
6. Click clk in the left panel and then click Add » to add that signal
to the chronogram.
7. Click Probe1 in the left panel and then click Add » to add that
signal to the chronogram.
8. Click “Enable time selection” and chose clk as the clock with a
frequency of 1 Hertz.
9. The chronogram setup should look like Figure 6.9.
58 counters
Figure 6.9: Chronogram Ready
10. Click Start Chronogram and the screen illustrated in Figure 6.10
pops up.
Figure 6.10: Chronogram Starting
11. Right-click on the Probe1 signal and set the format for binary.
The format can be set for any radix but to match this lab binary
numbers should be specified.
12. Right-click on the Probe1 signal and enable Expand to see all four
signals that create Probe1.
13. At this point, the chronogram should look like Figure 6.11.
6.2 procedure 59
Figure 6.11: Chronogram At Zero Time
14. The chronogram has five buttons that control the simulator.
Figure 6.12: Chronogram Controls
Button One: Start/Stop the simulation.
Button Two: Simulate one step.
Button Three: Start/Stop sysclk. This will “turn on” the
chronogram and begin creating a timing diagram.
Button Four: Step one sysclk tick. This will tick the sysclk
one time. Since this lab set up the sysclk for four ticks per
second this button would need to be clicked four times to
extend the timing diagram one second.
Button Five: Step one clk tick. This extends the timing di-
agram by one complete clock tick, or one second in this
circuit.
15. Click button three to start the chronogram and watch the timing
diagram unfold. After a few seconds click that button a second
time to stop the chronogram.
16. The following can be done once the timing diagram is complete.
Click on the timing diagram to set the cursor (indicated by
a red line). Once the cursor is set the values for each signal
at the cursor’s location are printed next to the signal’s label
on the left edge of the timing diagram.
Hover the mouse over the timing diagram and roll the
mouse wheel to zoom the timing diagram appearance.
60 counters
Click “Export” to save the timing diagram signal levels in
a text file. That file can later be loaded to reevaluate the
timing diagram.
Click “Export as image” to save the timing diagram as a
PNG file.
6.3 challenge
This lab includes several different timers. Place all of them on a single
subcircuit named Universal that includes an output mux so a user
can select the type of counter output desired. Place the Universal
circuit on main and wire appropriate inputs and outputs.
Set up the chronogram for the ring counter and create a ten-second
timing diagram for that counter. Save the timing diagram as a PNG
image named “RingCounter.”
6.4 deliverable
To receive a grade for this lab, complete the Challenge. Be sure the
standard identifying information is at the top left of the main circuit:
George Self
Lab 06: Counters
March 17, 2018
Save the circuit with this name: Lab07_counter and submit that along
with RingCounter.PNG for grading.
7
T I M E R
7.1 purpose
A timer is used to time events. This lab creates a timer where the
minimum and maximum counts can be set and counts both up and
down. The timer assumes an input clock pulse at 1 Hz (or 60 pulses
per minute) but for testing, the clock can be set to any value.
7.2 procedure
The lab starter circuit includes several versions of the timer as an
illustration of the thought process used to develop the final product.
Timer_V1. This is little more than a test of the Counter (Memory
library) component. The various inputs were wired so both the
Load and Up input pins could be tested. Instead of a clock pulse,
a Button (Input/Output library) was used for better control over
the device. A Bin2BCD (BFH mega functions library) device was
used for easier interpretation of the output.
Timer_V2. The first circuit was expanded such that both the
minimum and maximum counts could be specified. Note that
the multiplexer (Plexers library) selects whether the minimum
or maximum number is loaded depending on whether the count
is Up or Down.
Timer_V3. This is the version of the timer that will be com-
pleted for this lab.
7.2.1 Timer_V3
Complete the circuit to match Figure 7.1.
61
62 timer
Figure 7.1: Completed Timer
In the timer circuit, the key is the comparator in the lower left cor-
ner. That device compares the binary output of the counter to either
the minimum or maximum requested value and if they are equal the
comparator sends a reset signal to start the count over.
There are two multiplexers with a subtle, but important, difference.
The Maximum input value is wired to the top input of the top mul-
tiplexer but the bottom input of the bottom multiplexer. The result
is the when the count is “Up” the Minimum input is loaded into
the counter but the Maximum input is used in the compare, so the
counter starts at the minimum and counts up to the maximum. The
opposite is true for a “Down” count.
Finally, the BCD output is combined by a splitter (Wiring library)
into a 12-bit bus for transmission.
7.2.2 Testing the Circuit
The Timer
_
V3 subcircuit should be added to the main circuit and
wired as in Figure 7.2.
Figure 7.2: Timer Main Circuit
To test the circuit:
1. Enter binary four for a minimum value and eight for a maxi-
mum value. (Actually, any values can be entered but four and
eight are enough to test the circuit.)
7.3 challenge 63
2. Poke Up_Down to change its value to one so the circuit counts
up.
3. Poke the Reset button and observe that the BCD out changes to
004.
4. Activate the clock Simulate -> Ticks Enabled and observe that
it counts up from four to eight and then resets to four. If the
speed of the timer is not reasonable then the Simulate -> Tick
Frequency can be adjusted.
5. Poke Up_Down to change the count to down and observe that
the timer now counts from eight to four and resets.
7.3 challenge
As designed, the output of this circuit is an integer count. If it were
set for counting seconds then the count of seconds would increase
from 59 to 60 then 61 rather than going 0:59, 1:00, 1:01 as expected.
Rewrite the Timer
_
V3 subcircuit so the output is two BCD numbers:
minutes and seconds. As a hint, the Divider (Arithmetic library) de-
vice products an integer (“modulus”) division along with a remain-
der. It should help to divide the count by 60, use the whole number
as “minutes” and the remainder as the “seconds.”
7.4 deliverable
To receive a grade for this lab, complete the Challenge. Be sure the
standard identifying information is at the top left of the main circuit,
similar to:
George Self
Lab 07: Timer
March 1, 2018
Save the file with this name: Lab07
_
Timer and submit that file for
grading.
8
R E A C T I O N T I M E R
8.1 purpose
This lab continues the exploration of timing circuits and is intended to
provide additional practice with sequential circuit design. The project
is to build a circuit that times a user’s reaction speed. When complete,
the main circuit should look something like Figure 8.1.
Figure 8.1: Reaction Timer
In operation:
1. The user clicks start.
2. An unseen timer begins and counts down a random length of
time while the “Waiting” LED is lit. The countdown should be
less than 10 seconds so use a 4-bit counter for this part of the
circuit.
3. When the unseen timer reaches zero the “Waiting” LED turns
off and the numbers on the two hex displays begin to increase.
4. The user clicks the Stop button to stop the timer.
5. The reaction time is displayed on the two hex displays.
8.2 procedure
The design of this circuit is left to the student, but the timer built in
Lab 7 would be a good starter for this lab. As a tip, Logisim-Evolution
includes a Random Generator (Memory library) that can be used to
create a random countdown for the “Waiting” subcircuit. Finally, the
65
66 reaction timer
Simulate -> Tick Frequency can be set to a low number (maybe 4
Hz) to build and troubleshoot the circuit for convenience but it should
then be set somewhat faster to actually measure a user’s reaction
time.
8.3 deliverable
To receive a grade for this lab, complete the circuit. Be sure the stan-
dard identifying information is at the top left of the main circuit, sim-
ilar to:
George Self
Lab 08: React
March 11, 2018
Save the file with this name: Lab08
_
React and submit that file for
grading.
9
R O M
9.1 purpose
This lab introduces students to Read Only Memory
(ROM) and builds a fun application: The Magic 8-Ball.
This was a toy that was developed in the 1950s and
was popular throughout the 1960s. It was a small plas-
tic sphere with the markings of an 8-ball. If the user
“asked it a question” and then turned the toy upside
down the answer would magically appear in a small
window on the bottom of the ball.
9.2 procedure
Start a new Logisim-Evolution project and create a subcircuit named
Magic
_
8
_
Ball. Open that circuit and place a ROM (Memory library)
device near the center of the drawing canvas. Set the ROM properties
for an Address Bit Width of 12 and a Data Bit Width of 8
1
.
Figure 9.1: Placing ROM
A ROM stores data that is accessed by setting an address on the in-
puts at the top left of the device and then reading the contents of that
address on the 8-bit bus on the right side of the device. By attaching
a counter to the ROM address port several consecutive addresses can
be “stepped through” to output a message. Attach a Counter (Mem-
1 The provided starter circuit already contains the Magic
_
8
_
Ball subcircuit along with
two devices needed in the early part of the build.
67
68 rom
ory library) with 12 Data Bits to the address port of the ROM, as in
Figure 9.2.
Figure 9.2: ROM With Counter
According to Wikipedia
2
, the Magic 8-Ball featured 20 sayings:
1 001 It is certain
2 00f It is decidedly so
3 022 Without a doubt
4 032 Yes definitely
5 041 You may rely on it
6 054 As I see it yes
7 064 Most likely
8 070 Outlook good
9 07d Yes
10 081 Signs point to yes
11 094 Reply hazy try again
12 0a9 Ask again later
13 0b8 Better not tell you now
14 0d1 Cannot predict now
15 0e4 Concentrate and ask again
16 0fe Do not count on it
17 111 My reply is no
18 120 My sources say no
19 132 Outlook not so good
20 146 Very doubtful
2 https://en.wikipedia.org/wiki/Magic
_
8-Ball
9.2 procedure 69
The Magic 8-Ball simulator built in this lab uses those same 20 say-
ing. In the above chart, each saying is numbered and the start point
in ROM (using hexadecimal notation) for each saying is also noted.
Thus, saying one starts on ROM byte 001, saying two starts on ROM
byte 00f, saying three starts on ROM byte 022, and so forth.
The content of the ROM device must be loaded before it can be
used and that content is provided in Lab09
_
ROM.txt accompanying
this lab. To load the ROM device, click it one time and then click
the “(click to edit)” link in its properties panel. In the ROM editor
window that pops up, click the “open” button and navigate to the
ROM memory file. Click “close window” to load the ROM device
and make it ready for service
3
.
The start point for each saying, as indicated on the above table,
is stored in a Constant (Wiring library) then a Mux (Plexers library)
with five select bits is used to transmit a message start location to the
counter so it can be read from the ROM device. Figure 9.3 illustrates
the circuit at this point
4
.
Figure 9.3: ROM Filter Mux
A five-bit Random Generator (Memory library) is used to select a
random message. Figure 9.4 illustrates the placement of the random
generator.
3 The ROM device provided with the starter circuit is pre-loaded so it will not be
necessary to load it again. However, this information is left here for students who
may want to load the ROM for practice.
4 The multiplexer provided with the starter circuit already has the various constants
attached. Students who wish to do so can create their own multiplexer by using the
start addresses in the “Sayings” listing above.
70 rom
Figure 9.4: Random Generator Added
To complete the circuit, a few odds-and-ends were added. Figure
9.5 shows the completed circuit, but details from that figure are used
below to describe how to complete the circuit.
Figure 9.5: Completed Magic 8-Ball Circuit
To set up the counter, four signals are needed. These are all from
tunnels (Wiring library) connected to other spots on the circuit. (See
Figure 9.6.)
load. The load signal goes high when the counter should be
loaded with a new number from the multiplexer. The number
loaded is the location in ROM for the start of a message. Notice
that the load signal is used on two pins. The top pin places the
counter in load mode while the bottom pin uses the load signal
as a clock pulse.
ena. The enable signal turns the counter on/off. When enable
is high then the counter functions normally and when it is low
the counter is disabled.
ctrclk.The counter clock provides the clock signal for the counter.
Connect the random number generator as follows. (See Figure 9.6.)
The clock input pin is connected to a “rngclk” tunnel.
9.2 procedure 71
The generator output is wired to the select port of the multi-
plexer.
Figure 9.6: Counter Inputs
The counter control signals are generated and distributed from a
small group located under the ROM device. The purpose of this tiny
group is to transmit a high signal through the AND gate when the
reset pin goes high while enable is low. This generates the signals
needed to select a new random message and put the starting address
of that message in the counter. (See Figure 9.7.)
rst. The reset pin is an external signal that originates from the
main circuit.
ena’. Enable Not originates from the ROM output group.
load. This signal is used to load a message starting address into
the counter. When it goes high it activates the “load” function
and also becomes a single clock pulse for the counter.
rngclk. The random number generator clock signal activates
that device so it generates a random number. That number is
then used to select a single line from the multiplexer so a mes-
sage starting address can be loaded.
72 rom
ttyClr. This sends a high signal to the TTY “clear pin on the
main circuit. That signal is used to clear the TTY device.
Figure 9.7: Counter Control Generation and Distribution
There are two functions found at the ROM device output. (See Fig-
ure 9.8.)
The output of the ROM device is connected to the ttyOut pin in
order to drive the teletype device on the main circuit.
5
The Bit Finder (Arithmetic library) attached to the output of the
ROM device is used to find the lowest-order one in the ROM
byte output. If the ROM byte includes at least one one then the
south port of the finder is high. If the ROM output is all zeros
then the Finder output it goes low and that is used as the ena
signal for the counter and random number generator. When the
enable signal is low it also permits a rst signal (generated on the
main circuit when the user “asks another question”) to create a
new answer.
Near the output of the ROM device a clock signal is split to two
outputs. One is the ctrclk tunnel that is used by the counter and
the other is the ttyClk pin, which is used on the main circuit to
clock the teletype device. It is important to note that the clock
properties are set for a 1 tick high duration and 5 ticks low
duration (a 1/5 clock).
5 Note that at the output of the ROM device is a splitter. ASCII letters are only seven
bits wide so this splitter passes bits 0-6 to the ttyOut port but bit 7 (the most signifi-
cant bit) is simply discarded. The provided starter circuit includes the splitter.
9.2 procedure 73
Figure 9.8: ROM Output
The only remaining step is to create the main circuit. As in all labs
in this manual, the main circuit does nothing more than provide a
user interface for the Magic 8-Ball Circuit. Figure 9.9 illustrates the
main circuit.
Figure 9.9: Magic 8-Ball Main Circuit
9.2.1 Testing the Circuit
Before the circuit can be tested the ROM device must be loaded. The
ROM was loaded earlier in the lab but in case it does not have any con-
tent (it is filled with zeros), then load it with Lab09
_
ROM.txt, which
was provided with the lab. To load the ROM device, click it one time
and then click the “(click to edit)” link in its properties panel. In the
ROM editor window that pops up, click the “open” button and find
the ROM memory file. Click “close window” to load the ROM device
and make it ready for service.
74 rom
The circuit should be tested by enabling the simulator clock at a
frequency of 32 Hertz. Every time the Ask button is pressed a new
random message will be displayed on the teletype screen
6
.
9.3 deliverable
To receive a grade for this lab, build this circuit. Be sure the standard
identifying information is at the top left of the main circuit, similar to:
George Self
Lab 09: ROM
September 13, 2019
Save the file with this name: Lab09_ROM and submit that file for
grading.
6 Due to the way this circuit is constructed one out of six button presses will fail and
no message will be displayed. The failures are random events so the circuit may fail
several times in a row but then not fail for the next 20 or more presses. Students may
want to investigate this bug but that is not required.
10
R A M
10.1 purpose
This lab is used to demonstrate how a Random Access Memory (RAM)
device operates.
10.2 procedure
A RAM (Memory library) device is similar to a ROM device as used
in Lab 9, rom. A RAM device has an address input port, a data port,
and several control ports. An address is loaded in the Address Port
then on the next clock signal the device either reads the data at that
address and outputs it on the data port or inputs whatever is on
the data port and writes it to that address. Figure 10.1 illustrates a
counter connected to a RAM address port so as the counter outputs
an increasing value the RAM will “step through” memory locations.
Figure 10.1: RAM Basics
In operation, a high signal on RAM port M1 enables the write func-
tion and the RAM device will store whatever is present on the data
ports into the address pointed to on the address port. A high signal
on port M2 enables the output function (a “read” function) and the
RAM device will send whatever is present in the address pointed to
on the address port to the data ports.
75
76 ram
Notice that the data ports have both an in and out pointing arrow
to indicate that those ports are designed for both input and output,
depending on the setting of M1 and M2.
Figure 10.2 shows a RAM device with the various control signals.
(Note: to show more detail, the right edge of the RAM device was cut
from the figure.)
Figure 10.2: RAM With Control Signals
To simplify the
circuit wiring,
tunnels are used to
transport various
signals around the
circuit.
At the top left of the subcircuit a button is used to generate a clock
pulse. By using a button students can pulse the circuit slowly and
observe how the RAM device operates. In an actual circuit that button
would be replaced by a Clock (Wiring library).
At the top of the circuit is a T Flip-Flop (Memory library) that is
used to control whether the RAM device is reading or writing data.
Because it is important that M1 and M2, the two control ports on the
RAM device, are never both high at one time a flip-flop is the per-
fect controller. The T input on the flip-flop is tied to a constant high
so whenever the rd_wrt button is pressed the RAM device toggles
between read and write functions.
The Counter has a Reset button attached that will reset its count
to zero so the RAM device will always either read or write from its
lowest memory location. In actual practice the counter would need a
much more complex circuit to set a specific start point for the RAM
device to read or write but for this simple demonstration circuit it is
enough to always start read/write operations from the lowest mem-
ory location.
10.2 procedure 77
The next step is to set up the data bus on the east side of the RAM
device. It is important that the bus does not attempt to carry data out
of the RAM device at the same time that data are being sent to the
RAM device. Thus, control buffers are used to determine the direction
of data flow between the RAM device and the data bus. Figure 10.3
shows the data bus with the control buffers. (Note: to show more
detail, the counter was cut from the left edge of the figure.)
Figure 10.3: Data Bus
Notice that the outputs of the read/write flip-flop are being used
to control the direction of the data flow for the RAM device.
To complete the demonstration circuit, a Keyboard (Input/Output
library) device is added to write ASCII characters into RAM mem-
ory and a TTY (Input/Output library) device is used to display ASCII
characters read from RAM memory. Figure 10.4 shows the input/out-
put devices. (Note: to show more detail, part of the RAM and TTY
devices were cut from the edges of the figure.)
78 ram
Figure 10.4: RAM With Input/Output Devices
For reference, the entire circuit is in Figure 10.5.
Figure 10.5: RAM With Input/Output Devices
To operate the keyboard device, click it and enter some text from
the computer’s keyboard. Then as that device is clocked one ASCII
character at a time will be sent to the output port at its south-east
corner. As in ASCII devices used in earlier labs, a splitter is used for
both the keyboard and TTY display to strip the most significant bit
from the data bus since the bus is eight bits wide but ASCII is only a
seven-bit code.
10.3 challenge 79
Finally, two indicator LEDS have been added to make it clear whether
data are being written to RAM or read from RAM.
10.2.1 Testing the Circuit
To test the complete circuit:
1. Click Reset to set the counter to zero.
2. Click the “rd_wrt” button until the “Write_to_RAM” LED is on.
3. Click the keyboard device and enter some text.
4. Click the “clk” button to stream the text from the keyboard into
RAM. Notice how the RAM device display changes to indicate
the ASCII codes that have been stored.
5. Click Reset to set the counter to zero.
6. Click the “clr button on the TTY device to clear that display.
7. Click the “rd_wrt” button until the “Read_from_RAM” LED is
on.
8. Click the “clk” button to stream text from RAM to the TTY
device. Notice that this does not remove the text from RAM so
it is still available for another reading if desired.
10.3 challenge
Build the circuit as described in this Lab and ensure that it operates
as expected.
10.4 deliverable
To receive a grade for this lab, complete the Challenge. Be sure the
standard identifying information is at the top left of the main circuit,
similar to:
George Self
Lab 10: RAM
February 16, 2018
Save the file with this name: Lab10_RAM and submit that file for
grading.
Part V
S I M U L AT I O N
Simulation is the most complex topic covered in this lab
manual. Included in this manual are a simple processor,
designed to teach the foundations of a Central Processing
Unit, and an elevator simulator, designed to be a capstone
project.
11
P R O C E S S O R
11.1 purpose
A Central Processing Unit (CPU) is arguably one of the most impor-
tant digital logic devices. CPUs are found in all computers and many
other embedded logic devices. They are versatile circuits that can be
used to control many processes and peripheral devices. The purpose
of this lab is to lay the foundation of CPU operation.
11.1.1 A Definition
When asked to define CPU many students offer poetic definitions
like “it is the brain of the computer.” This may be somewhat artistic
but is not very helpful in defining CPU for digital logic purposes. Here
is a much better definition:
A Central Processing Unit (CPU) is a hardware device that
is designed to translate binary codes stored in software
into signals that control hardware. Thus, a CPU is the in-
terface between software and hardware.
The purpose of this lab is to demonstrate how binary codes can
be used to manipulate hardware devices, like registers and adders,
to move data through a circuit and accomplish a purpose. While the
circuit developed in this lab is not a practical start for a CPU is does
serve as an introduction to the concept of hardware manipulation by
software codes.
11.2 procedure
This processor contains only three subcircuits connected by several
bus lines and each of the three subcircuits are reasonably simple to
understand.
11.2.1 Arithmetic-Logic Unit
This processor starts with a simple ALU, as in Figure 11.1.
83
84 processor
Figure 11.1: Simple ALU
To be sure, this ALU is not very complex but uses the same prin-
ciples developed in Lab 4, arithmetic logic unit (alu). It con-
tains only three arithmetic functions, increment, add, and negate; four
logic functions, AND, OR, XOR, NOT; and one constant zero output. There
are two data input ports but note that some of the functions only use
the lower input, and one output port. The multiplexer determines
which of the functions will be connected to the output and that is
controlled by a signal named ALUCtl.
The ALU is then expanded somewhat to make it usable in a CPU.
For simplicity, Figure 11.2 shows only the left side of the ALU.
11.2 procedure 85
Figure 11.2: Left Side of ALU
Figure 11.3 shows the right side of the ALU.
Figure 11.3: Full ALU
The simple ALU functions are found in the center of Figure 11.2.
However, what started as DataInA has been replaced by a register
86 processor
named ALUBuffer.
1
The ALUBuffers inputs are from Tunnels (Wiring
library) because those inputs are used in more than one location in
the subcircuit.
2
The ALU output is routed through a register named Acc, for Accu-
mulator, which is the commonly-used name for the ALU output in a
CPU circuit.
On the left side of the subcircuit are the three input ports. DataIn is
an eight-bit number that is sent to both the ALUBuffer and the lower
DataIn bus. The ALUCtl signal is split into two components. Bits 0-2
are sent to the multiplexer to select which of the eight functions will
be output. Bit 3 of the ALUCtl signal is sent to the AccEna tunnel
and when that is high the Acc register will be enabled but when that
signal is low then the ALUBuffer register will be enabled. Finally, the
clock input is sent to both registers.
11.2.2 General Registers
A CPU must have several general registers available to hold data tem-
porarily while an instruction is being carried out. For example, it may
be necessary to hold the Acc output until it is needed in a later step
so that value can be stored in a register and then recovered when
needed.
The processor circuit being built in this lab has four general regis-
ters. Figure 11.4 illustrates the GenReg subcircuit.
Figure 11.4: General Registers
The GenReg subcircuit does not require any novel digital logic con-
cepts. Starting on the left side of the circuit:
DataIn is connected to the data bus and is the main input port
for the registers. Note that DataIn is connected to the Data port
on all four registers.
1 IMPORTANT NOTE: All registers in this Processor circuit are triggered on the
Falling Edge of the clock. The reason for this will become evident when the circuit
is tested.
2 Tunnels are used extensively in this circuit to simplify the diagrams and aid in trac-
ing signals.
11.2 procedure 87
The register that actually stores the input data is determined by
the Decoder (Plexers library) in the lower left corner of the sub-
circuit. The two low-order bits from the RegSel signal activate
one of the output lines from the Decoder and that line is tied
to the Write Enable port of the register. On the next clock pulse
that register will lock in the data present on the DataIn port.
The outputs from all of the registers are wired to a Multiplexer
(Plexers library). The select bits from the Decoder that are used
to select the storage register are also used to select the register
output line which is, in turn, wired to the DataOut port.
The high-order bit from the RegSel control signal is used to de-
termine if data are stored to or read from a register. When that
bit is high the decoder is active and will select a storage register
but when that bit is low the output multiplexer will be activated
and send a register’s stored value to the output port.
11.2.3 Control
The Control subcircuit in this device is very simple and could, in all
actuality, be eliminated. However, in a true CPU the Control subcir-
cuit is rather complex and critical to the operation of the circuit so a
Control subcircuit is included in this lab as an example. Figure 11.5
illustrates the Control subcircuit.
Figure 11.5: Control Subcircuit
The Control subcircuit includes a nine-bit input named mCode (for
“Microcode”). That input is latched by a register
3
and the output of
that register is split into three components.
bits 0-3 These are the ALU control bits and they are sent to the ALU
subcircuit.
bits 4-6 These are the register control bits and are sent to that sub-
circuit.
3 Note, as an exception to the other registers in the Processor circuit, the register in
the control subcircuit must be set to trigger on the leading edge of the clock rather
than the falling edge.
88 processor
bits 7-8 These are the dBus (“Data Bus”) control bits. The data bus
is found in the main circuit and carries the data to each of the
subcircuits. The dBus control is just a multiplexer that controls
which subcircuit’s output has control of the data bus.
11.2.4 Main
The main circuit ties the three subcircuits together with three control
busses and one data bus. Figure 11.6 illustrates the main circuit.
Figure 11.6: Main Circuit
There are no novel digital logic functions used in this circuit. The
first input is mCode which is the microcode used to control the flow
of data in the dBus (“data bus”). the other input, LdImm (“Load Im-
mediate”) can contain an eight-bit number that is to be loaded into
one of the registers for processing. In a full CPU that input would be
wired to a RAM device.
11.2.5 Testing the Circuit
The circuit should be tested by inputting these signals and observing
the output.
11.2.5.1 Copy LdImm To R0
Enter some value in the LdImm input port, set the mCode input to
101000000 (the first three values in the table below), and then pulse
the clk. When completed, the dBus and R0 should both contain the
value of the LdImm port.
Table 11.1: R0 <- LdImm
11.2 procedure 89
11.2.5.2 Copy LdImm To R1
Enter some value in the LdImm input port, set the mCode input to
101010000 (the first three values in the table below), and then pulse
the clk. When completed, the dBus and R1 should both contain the
value of the LdImm port.
Table 11.2: R1 <- LdImm
11.2.5.3 Copy LdImm To ALUbuf
Enter some value in the LdImm input port, set the mCode input to
100000000 (the first three values in the table below), and then pulse
the clk. When completed, the dBus and ALUbuf should both contain
the value of the LdImm port.
Table 11.3: ALU <- LdImm
11.2.5.4 Increment R0
Use the LdImm
function to initialize
R0.
Incrementing the value in R0 requires two steps. Set the mCode input
to the first three values in the table below and pulse the clk for each
of the steps. When completed, R0 will contain the original value of
the R0+1.
Table 11.4: R0 <- Inc(R0)
11.2.5.5 Add R0 And R1, Store In R0
Use the LdImm
function to initialize
R0 and R1.
Adding the values of R0 and R1 and storing the result in R0 requires
three steps. Set the mCode input to the first three values in the table
below and pulse the clk for each of the steps. When completed, the
sum of the original values of R0 and R1 will be stored in R0.
90 processor
Table 11.5: R0 <- R0 + R1
11.2.5.6 Subtract R1 From R0, Store In R0
Use the LdImm
function to initialize
R0 and R1.
Subtracting the value of R1 from R0 and storing the result in R0 re-
quires four steps. Set the mCode input to the first three values in the
table below and pulse the clk for each of the steps. When completed,
the difference of the original values of R0 and R1 will be stored in R0.
Table 11.6: R0 <- R0 - R1
11.2.5.7 Copy R0 to R1
Use the LdImm
function to initialize
R0.
Copying the value of R0 to R1 requires four steps. Set the mCode input
to the first three values in the table below and pulse the clk for each
of the steps. When completed, the value of R0 will be stored in R1.
Table 11.7: R1 <- R0
11.2.5.8 Swap R0 And R1
Use the LdImm
function to initialize
R0 and R1.
Swapping the values of R0 and R1 requires 12 steps. Set the mCode
input to the first three values in the table below and pulse the clk
for each of the steps. When completed, the values of R0 and R1 will
exchanged.
11.3 about programming languages 91
Table 11.8: R0 <-> R1
11.3 about programming languages
The codes that were input for the last example (swap R0 and R1)
would create the following program.
000001111
000000100
010001100
001100111
000001111
000000100
010011100
001000111
000001111
000000100
010101100
001010111
This group of instructions would be considered “CPU Microcode,”
which is a very highly specialized form of programming. It is the
code that is built into a CPU circuit and it determines what gates, reg-
isters, and other devices are active for each step of the code. When
Intel, AMD, Motorola, or other manufacturers create a new CPU, one
of their main challenges is creating the microcode that will, for exam-
92 processor
ple, “add the contents of register one to the contents of register two
and store the result in register zero.” The microcode must be able to
activate and deactivate various devices within the CPU so data appear
on the appropriate bus at the right time in order to achieve the objec-
tive. Normally, microcode steps must be executed over several clock
cycles in order to do a single job. For example, in one clock cycle the
contents of register one may be placed on the data bus, the next clock
cycle will load that data into the ALU register, and so forth until the
entire process is complete.
Microcode is usually stored in ROM that is built into the CPU. This
is typically called “firmware” since it is a string of ones and zeros,
like software, but it cannot be changed, like hardware.
It is important to keep in mind the difference between instructions
contained in a software program (like Word) and those contained in
microcode. A single instruction in software is interpreted and exe-
cuted by the CPU using, perhaps, dozens of microcode steps. As an
example, the software may want to move a single byte from RAM to
the video card. The CPU may process that instruction by first moving
the byte from RAM to register one and then moving it from there to
the video card’s input register and then activating the video card in-
put function. Those moves may require several clock cycles as various
multiplexers and other devices are activated in the correct sequence
to move the data to its destination.
A software program, like Word, is nothing more than a series of
ones and zeros, organized into groups, commonly 64 in modern com-
puters. Each group of bits forms a single “word” of information; or
a single instruction which would then be used by the CPU to trigger
a microcode sequence. When viewed at the level of ones and zeros,
a software program is said to be in “machine code,” and could look
something like the following (note, only the first 32 bits of each word
are shown).
10010100101100101001101011001010
01101001101011000111101011101011
00011011110010000111010111100101
If a programmer could master machine code, then those programs
would be as concise and efficient as possible since they would be
written in machine code the CPU can execute directly. Of course, as
it is easy to imagine, no one actually writes machine code due to its
complexity.
The next level higher than machine code is called “Assembly” code.
Assembly uses easy-to-remember abbreviations to represent the vari-
ous CPU instructions available; and it looks something like this:
11.4 challenge 93
INP
STA FIRST
INP
STA SECOND
LDA FIRST
SUB SECOND
OUT
HLT
FIRST DAT
SECOND DAT
Once the program has been written in Assembly, it must be “assem-
bled” into machine code before it can be executed. An assembler is a
fairly simply program that converts a file containing assembly codes
into machine codes that can be executed by the CPU.
Many programming languages have been developed that are con-
sidered “higher than Assembly; for example, C++, Java, and Visual
Basic. These languages tend to be easy to master and can enable
a programmer to quickly create very complex programs. Programs
written in each of these languages must be compiled, or changed into
machine code, before they can be executed. Here is an example Java
program:
public class HelloWorldExample{
public static void main(String args[]){
System.out.println("Hello World !");
}
}
In the end, while there are dozens of different programming lan-
guages, they are all designed to be reduced into a series of machine
codes which the CPU can then execute.
11.4 challenge
Using the examples in the “Testing the Circuit” section, create the
microcode necessary to carry out these functions:
1. Store the value contained in LdImm in R2 (R2 <- LdImm). (As-
sume that LdImm is pre-loaded with the value to store.)
2. Store the value contained in LdImm in R3 (R3 <- LdImm). (As-
sume that LdImm is pre-loaded with the value to store.)
3. Store the 2s complement of the value in R0 back into R0 (R0 <-
~R0). The subtraction example will help with this function.
4. Store the bitwise NOT of the value in R0 back into R0 (R0 <-
R0).
94 processor
11.5 deliverable
To receive a grade for this lab, build the Processor circuit and then
complete the Challenge. Be sure the standard identifying information
is at the top left of the Processor main circuit, similar to:
George Self
Lab 11: Processor
April 5, 2018
Save the Processor circuit in a file with this name: Lab11_Processor.
Complete the code required in the Challenge and store that in a text
file with the name Lab11_Code.txt. Submit both files for grading.
12
E L E VAT O R
12.1 purpose
This final lab is used as a capstone digital logic project.
12.2 challenge
For this lab, build a circuit that simulates an elevator. This lab does
not include step-by-step directions; instead, this document only spec-
ifies the requirement and students are on their own to design and
build the circuit.
Here are the specifications:
1. The elevator should be in a 3-story building and stop on each
floor.
2. There should be a call button on each floor so a guest can re-
quest the elevator. When a guest presses the call button, if the
elevator is not busy, then it should proceed to the requested
floor. If the elevator is busy, it should return to the called floor
as soon as it finishes the current trip.
3. The elevator car must have a button for each floor (for this lab,
ignore buttons like “Open Door”). When one of the buttons is
pressed, the elevator will move to the requested floor. If the
elevator is already on the requested floor (for example, some
guest on the second floor presses the “Floor 2 button), then
the elevator will do nothing.
4. The simulator must have some way to indicate where the el-
evator is located (its current floor). That could be done with
a numeric display (a 7-segment display) or with some sort of
light system (an LED on each floor that will light up when the
elevator is present). There may be other ways to indicate the
elevator’s location, so creativity is encouraged.
5. The simulator must have some way to indicate the “door open”
and “door close” process. For example, a row of LEDs could
light in sequence to show the door opening and a few seconds
later closing again.
Figure 12.1 is one student’s concept from an earlier class.
95
96 elevator
Figure 12.1: Example Elevator Simulator
12.3 deliverable
To receive a grade for this lab, complete the elevator simulator. Be
sure the standard identifying information is at the top left of the main
circuit:
George Self
Lab 12: Elevator
April 30, 2018
Save the file with this name: Lab12_elevator and submit that file for
grading.
Part VI
A P P E N D I X
A
T T L R E F E R E N C E
Logisim-Evolution includes a number of Transistor-Transistor Logic
(TTL) ICs. These are pre-packaged digital logic circuits that perform
specific, well-defined functions. There are, literally, hundreds of TTL
ICs available for purchase from electronics warehouses but Logisim-
Evolution includes only 35 of the most commonly-used devices. Fig-
ure A.1 shows three surface-mounted ICs on a circuit board.
Figure A.1: Three Surface-Mounted Integrated Circuits
a.1 7400: quad 2-input nand gate
This device contains four independent 2-input NAND gates. Figure
A.2 is a logic diagram of one of the four circuits.
Figure A.2: 7400: Single NAND Gate Circuit
The 7400 device in Logisim-Evolution uses the wiring connections
indicated in Table A.1.
99
100 ttl reference
Table A.1: Pinout For 7400
a.2 7402: quad 2-input nor gate
This device contains four independent 2-input NOR gates. Figure A.3
is a logic diagram of one of the four circuits.
Figure A.3: 7402: Single NOR Gate Circuit
The 7402 device in Logisim-Evolution uses the wiring connections
indicated in Table A.2.
A.3 7404: hex inverter 101
Table A.2: Pinout For 7402
a.3 7404: hex inverter
This device contains six independent inverters. Figure A.4 is a logic
diagram of one of the six circuits.
Figure A.4: 7404: Single Inverter Circuit
The 7404 device in Logisim-Evolution uses the wiring connections
indicated in Table A.3.
102 ttl reference
Table A.3: Pinout For 7404
a.4 7408: quad 2-input and gate
This device contains four independent 2-input AND gates. Figure A.5
is a logic diagram of one of the four circuits.
Figure A.5: 7408: Single AND Gate Circuit
The 7408 device in Logisim-Evolution uses the wiring connections
indicated in Table A.4.
A.5 7410: triple 3-input nand gate 103
Table A.4: Pinout For 7408
a.5 7410: triple 3-input nand gate
This device contains three independent 3-input NAND gates. Figure
A.6 is a logic diagram of one of the three circuits.
Figure A.6: 7410: Single 3-Input NAND Gate Circuit
The 7410 device in Logisim-Evolution uses the wiring connections
indicated in Table A.5.
104 ttl reference
Table A.5: Pinout For 7410
a.6 7411: triple 3-input and gate
This device contains three independent 3-input AND gates. Figure
A.7 is a logic diagram of one of the three circuits.
Figure A.7: 7411: Single 3-Input AND Gate Circuit
The 7411 device in Logisim-Evolution uses the wiring connections
indicated in Table A.6.
A.7 7413: dual 4-input nand gate (schmitt-trigger) 105
Table A.6: Pinout For 7411
a.7 7413: du al 4-input nand gate (schmitt-trigger)
This device contains two independent 4-input NAND gates. Schmitt-
triggers are a special type of device that are used to filter out spurious
noise on a circuit. They are designed to change from low-to-high or
high-to-low only when the input voltage reaches a preset level but
not if the voltage randomly fluctuates without crossing the set-points.
This device is essentially the same as the 7418. Figure A.8 is a logic
diagram of one of the two circuits.
Figure A.8: 7413: Single 4-Input NAND Gate Circuit
The 7413 device in Logisim-Evolution uses the wiring connections
indicated in Table A.7.
106 ttl reference
Table A.7: Pinout For 7413
a.8 7414: hex inverter (schmitt-trigger)
This device contains six independent inverters. Schmitt-triggers are a
special type of device that are used to filter out spurious noise on a
circuit. They are designed to change from low-to-high or high-to-low
only when the input voltage reaches a preset level but not if the volt-
age randomly fluctuates without crossing the set-points. This device
is essentially the same as the 7419. Figure A.9 is a logic diagram of
one of the six circuits.
Figure A.9: 7414: Single Inverter Circuit
The 7414 device in Logisim-Evolution uses the wiring connections
indicated in Table A.8.
A.9 7418: dual 4-input nand gate (schmitt-trigger inputs) 107
Table A.8: Pinout For 7414
a.9 7418: dual 4-input nand gate (schmitt-trigger in-
puts)
This device contains two independent 4-input NAND gates. Schmitt-
triggers are a special type of device that are used to filter out spurious
noise on a circuit. They are designed to change from low-to-high or
high-to-low only when the input voltage reaches a preset level but
not if the voltage randomly fluctuates without crossing the set-points.
This device is essentially the same as the 7413. Figure A.10 is a logic
diagram of one of the two circuits.
Figure A.10: 7418: Single 4-Input NAND Gate Circuit
The 7418 device in Logisim-Evolution uses the wiring connections
indicated in Table A.9.
108 ttl reference
Table A.9: Pinout For 7418
a.10 7419: hex inverter (schmitt-trigger)
This device contains six independent inverters. Schmitt-triggers are a
special type of device that are used to filter out spurious noise on a
circuit. They are designed to change from low-to-high or high-to-low
only when the input voltage reaches a preset level but not if the volt-
age randomly fluctuates without crossing the set-points. This device
is essentially the same as the 7414. Figure A.11 is a logic diagram of
one of the six circuits.
Figure A.11: 7419: Single Inverter Circuit
The 7419 device in Logisim-Evolution uses the wiring connections
indicated in Table A.10.
A.11 7420: dual 4-input nand gate 109
Table A.10: Pinout For 7419
a.11 7420: du al 4-input nand gate
This device contains two independent 4-input NAND gates. Figure
A.12 is a logic diagram of one of the two circuits.
Figure A.12: 7420: Single 4-Input NAND Gate Circuit
The 7420 device in Logisim-Evolution uses the wiring connections
indicated in Table A.11.
110 ttl reference
Table A.11: Pinout For 7420
a.12 7421: du al 4-input and gate
This device contains two independent 4-input AND gates. Figure
A.13 is a logic diagram of one of the two circuits.
Figure A.13: 7421: Single 4-Input AND Gate Circuit
The 7421 device in Logisim-Evolution uses the wiring connections
indicated in Table A.12.
A.13 7424: quad 2-input nand gate (schmitt-trigger) 111
Table A.12: Pinout For 7421
a.13 7424: quad 2-input nand gate (schmitt-trigger)
This device contains four independent 2-input NAND gates. Schmitt-
triggers are a special type of device that are used to filter out spurious
noise on a circuit. They are designed to change from low-to-high or
high-to-low only when the input voltage reaches a preset level but
not if the voltage randomly fluctuates without crossing the set-points.
This device is essentially the same as the 7400. Figure A.14 is a logic
diagram of one of the four circuits.
Figure A.14: 7424: Single NAND Gate Circuit
The 7424 device in Logisim-Evolution uses the wiring connections
indicated in Table A.13.
112 ttl reference
Table A.13: Pinout For 7424
a.14 7427: triple 3-input nor gate
This device contains three independent 3-input NOR gates. Figure
A.15 is a logic diagram of one of the three circuits.
Figure A.15: 7411: Single 3-Input NOR Gate Circuit
The 7427 device in Logisim-Evolution uses the wiring connections
indicated in Table A.14.
A.15 7430: single 8-input nand gate 113
Table A.14: Pinout For 7427
a.15 7430: single 8-input nand gate
This device contains a single 8-input NAND gate. The logic for this
gate is Y = A · B · C · D · E · F · G · H. Figure A.16 is a logic diagram of
the circuit.
Figure A.16: 7430: Single 8-Input NAND Gate
The 7430 device in Logisim-Evolution uses the wiring connections
indicated in Table A.15.
114 ttl reference
Table A.15: Pinout For 7430
a.16 7432: quad 2-input or gate
This device contains four independent 2-input OR gates. Figure A.17
is a logic diagram of one of the four circuits.
Figure A.17: 7432: Single OR Gate Circuit
The 7432 device in Logisim-Evolution uses the wiring connections
indicated in Table A.16.
A.17 7436: quad 2-input nor gate 115
Table A.16: Pinout For 7432
a.17 7436: quad 2-input nor gate
This device contains four independent 2-input NOR gates. This de-
vice is essentially the same as the 7402. Figure A.18 is a logic diagram
of one of the four circuits.
Figure A.18: 7436: Single NOR Gate Circuit
The 7436 device in Logisim-Evolution uses the wiring connections
indicated in Table A.17.
116 ttl reference
Table A.17: Pinout For 7436
a.18 7442: bcd to decimal decoder
This device takes a BDC input and deactivates a single line corre-
sponding to the input number. It is often called a “One-Of-Ten” de-
coder. As an example, if 0111
BCD
is input then line 7-of-10 will go
low while all other outputs will remain high. Figure A.19 illustrates
a 7442 IC in a very simple circuit.
Figure A.19: 7442: BCD to Decimal Decoder
Table A.18 is the truth table for this device. Any BCD input greater
than 1001 is ignored and all outputs will be high for those inputs.
A.19 7443: excess-3 to decimal decoder 117
Table A.18: Truth Table For The 7442 Circuit
The 7442 device in Logisim-Evolution uses the wiring connections
indicated in Table A.19.
Table A.19: Pinout For 7442
a.19 7443: excess-3 to decimal decoder
This device takes an Excess-3 input and deactivates a single line cor-
responding to the input number. It is often called a “One-Of-Ten”
118 ttl reference
decoder. As an example, if 0011
Ex3
is input then line 0-of-10 will go
low while all other outputs will remain high. This is wired in exactly
the same way as the 7442 IC illustrated in Figure A.19.
Table A.20 is the truth table for this device. Any input numbers
other than those found in the truth table are ignored and all outputs
will be high for those inputs.
Table A.20: Truth Table For The 7443 Circuit
The 7443 device in Logisim-Evolution uses the wiring connections
indicated in Table A.21.
A.20 7444: gray to decimal decoder 119
Table A.21: Pinout For 7443
a.20 7444: gray to decimal decoder
This device takes a Gray Excess Code, which is a combination of Gray
and Excess-3 Codes, input and deactivates a single line corresponding
to the input number. It is often called a “One-Of-Ten” decoder. As an
example, if 1100
GrayEx3
is input then line 5-of-10 will go low while
all other outputs will remain high. This is wired in exactly the same
way as the 7442 IC illustrated in Figure A.19.
Table A.22 is the truth table for this device. Any input numbers
other than those found in the truth table are ignored and all outputs
will be high for those inputs.
120 ttl reference
Table A.22: Truth Table For The 7444 Circuit
The 7443 device in Logisim-Evolution uses the wiring connections
indicated in Table A.23.
Table A.23: Pinout For 7444
A.21 7447: bcd to 7-segment decoder 121
a.21 7447: bcd to 7-segment decoder
This device takes a BCD Code input and activates a combination of
outputs such that a 7-segment display will correctly indicate the input
number. Figure A.20 illustrates a 7447 IC in a very simple circuit.
Figure A.20: 7447: BCD to 7-Segment Decoder
Table A.24 is the truth table for this device.
122 ttl reference
Table A.24: Truth Table For The 7447 Circuit
The 7447 device in Logisim-Evolution uses the wiring connections
indicated in Table A.25.
A.22 7451: dual and-or-invert gate 123
Table A.25: Pinout For 7447
a.22 7451: du al and-or-invert gate
This device contains two independent AND-OR-INVERT gates. Fig-
ure A.21 is a logic diagram of one of the two circuits.
Figure A.21: 7451: Single AND-OR-INVERT Gate Circuit
The 7451 device in Logisim-Evolution uses the wiring connections
indicated in Table A.26.
124 ttl reference
Table A.26: Pinout For 7451
a.23 7454: four wide and-or-invert gate
This device contains a single four-wide AND-OR-INVERT gate. Fig-
ure A.22 is a logic diagram of the circuit.
Figure A.22: 7454: Four Wide AND-OR-INVERT Gate Circuit
The 7454 device in Logisim-Evolution uses the wiring connections
indicated in Table A.27.
A.24 7458: dual and-or gate 125
Table A.27: Pinout For 7454
a.24 7458: du al and-or gate
This device contains a two AND-OR gates. One has three-input AND
gates and the other has two-input AND gates. Figure A.23 is a logic
diagram of the circuit.
Figure A.23: 7458: Dual AND-OR Gate Circuit
The 7458 device in Logisim-Evolution uses the wiring connections
indicated in Table A.28.
126 ttl reference
Table A.28: Pinout For 7458
a.25 7464: 4-2-3-2 and-or-invert gate
This device contains four AND gates of different input sizes that feed
a NOR gate. Figure A.24 is a logic diagram of the circuit.
Figure A.24: 7464: 4-2-3-2 AND-OR-INVERT Gate Circuit
The 7464 device in Logisim-Evolution uses the wiring connections
indicated in Table A.29.
A.26 7474: dual d-flipflops with preset and clear 127
Table A.29: Pinout For 7464
a.26 7474: du al d-flipflops with preset and clear
This device contains two D-Flipflops, each with its own preset and
clear. The 7474 device in Logisim-Evolution uses the wiring connec-
tions indicated in Table A.30.
Table A.30: Pinout For 7474
128 ttl reference
a.27 7485: 4-bit magnitude comparator
This device compares two 4-bit numbers and outputs one of three
values: A > B, A = B, or A < B. It is also designed to be cascaded by
including an input port for each of the three values. The 7485 device
in Logisim-Evolution uses the wiring connections indicated in Table
A.31.
Table A.31: Pinout For 7485
a.28 7486: quad 2-input xor gate
This device contains four independent 2-input XOR gates. Figure
A.25 is a logic diagram of one of the four circuits.
Figure A.25: 7486: Single XOR Gate Circuit
The 7486 device in Logisim-Evolution uses the wiring connections
indicated in Table A.32.
A.29 74125: quad bus buffer, 3-state gate 129
Table A.32: Pinout For 7486
a.29 74125: quad bus buffer, 3-state gate
This device contains four independent buffers. When each is enabled
with a low on the enable line then the input is passed to the out-
put, when not enabled then the output floats. Figure A.26 is a logic
diagram of one of the four circuits.
Figure A.26: 74125: Single Buffer Circuit
The 74125 device in Logisim-Evolution uses the wiring connections
indicated in Table A.33.
130 ttl reference
Table A.33: Pinout For 74125
a.30 74165: 8-bit parallel-to-serial shift register
This device can accept data in either parallel or serial form and shift
it out in serial form. The 74165 device in Logisim-Evolution uses the
wiring connections indicated in Table A.34.
Table A.34: Pinout For 74165
A.31 74175: quad d-flipflops with sync reset 131
a.31 74175: quad d-flipflops with sync reset
This device contains four D-Flipflops with a single clock and master
reset. The 74175 device in Logisim-Evolution uses the wiring connec-
tions indicated in Table A.35.
Table A.35: Pinout For 74175
a.32 74266: quad 2-input xnor gate
This device contains four independent 2-input XNOR gates. Figure
A.27 is a logic diagram of one of the four circuits.
Figure A.27: 74266: Single XNOR Gate Circuit
The 74266 device in Logisim-Evolution uses the wiring connections
indicated in Table A.36.
132 ttl reference
Table A.36: Pinout For 74266
a.33 74273: octal d-flipflop with clear
This device contains a single 8-bit D-Flipflop with a single clock and
master clear. The 74273 device in Logisim-Evolution uses the wiring
connections indicated in Table A.37.
A.34 74283: 4-bit binary full adder 133
Table A.37: Pinout For 74273
a.34 74283: 4-bit binary full adder
This device contains a 4-bit adder with carry-in and carry-out bits.
The 74283 device in Logisim-Evolution uses the wiring connections in-
dicated in Table A.38.
134 ttl reference
P
P
P
P
Table A.38: Pinout For 74283
a.35 74377: octal d-flipflop with enable
This device contains a single 8-bit D-Flipflop with a single clock and
enable. The 74377 device in Logisim-Evolution uses the wiring connec-
tions indicated in Table A.39.
A.35 74377: octal d-flipflop with enable 135
Table A.39: Pinout For 74377
colophon
This book was typeset using the typographical look-and-feel classicthesis
developed by André Miede. The style was inspired by Robert Bringhurst’s
seminal book on typography “The Elements of Typographic Style”. classicthesis
is available for both L
A
T
E
X and L
Y
X:
https://bitbucket.org/amiede/classicthesis/
Happy users of classicthesis usually send a real postcard to the
author, a collection of postcards received so far is featured here:
http://postcards.miede.de/
Final Version as of September 15, 2019 (classicthesis Edition 4.0).
Hermann Zapf’s Palatino and Euler type faces (Type 1 PostScript
fonts URW Palladio L and FPL) are used. The “typewriter text is
typeset in Bera Mono, originally developed by Bitstream, Inc. as “Bit-
stream Vera”. (Type 1 PostScript fonts were made available by Malte
Rosenau and Ulrich Dirr.)