Laboratory 4 and Homework 4
Introduction to Digital Design using Field Programmable Gate Arrays
Included are laboratory and homework assignments covering key methods
and techniques for developing and implementing digital designs using FPGA
(field programmable gate array). The laboratory portion will be
performed during class time and cover the skills and concepts necessary
for completing the homework assignment.
Laboratory 4
Purpose
The laboratory follows each step normally used in the
design and implementation of a combinational circuit using a FPGA. More
complex designs can be implemented with FPGA versus individual devices
since either VHDL or graphical designs can be programmed directly into
a FPGA with internal connections formed automatically through software,
only inputs and outputs must be connected.
Digital Design
Methods
Digital design and implementation has been examined for a number of methods,
with the following detailing the solution to a problem using gate logic,
graphical design, and hardware description language (HDL). The
initial steps of each of the design methods are common to both as indicated
in the design flowchart below. The implementation methods, however, differ
due to the significantly different technologies used in each. The design
and implementation steps of each are listed in flowchart fashion.
-

1. State Problem - Implement the logic to turn ON the
d
segment of a 7-segment display.
2. Describe switching function - Recall the 7-segment display
is used to display the digits from 0-9 on calculators and many other displays.
The 7-segment display appears as:
where each segment is ON or OFF dependent upon the digit to be displayed.
For example, to display the digit 0 would require segments a, b, c, d,
e, and f to be ON with segment g OFF. To display the digit 2 would require
segments a, b, g, e, and d to be ON and f and c segments OFF as above at
right. The definition for lighting segment d can be given in the
following truth table or switching function d(x3,x2,x1,x0):
x3x2x1x0 | d(x3,x2,x1,x0)
___________|______________
0 0000 | 1
1 0001 | 0
2 0010 | 1
3 0011 | 1
4 0100 | 0
5 0101 | 1
6 0110 | 1
7 0111 | 0
8 1000 | 1
9 1001 | 1
10 1010 | don't care
11 1011 | don't care
12 1100 | don't care
13 1101 | don't care
14 1110 | don't care
15 1111 | don't care
3. Simplify function - Use Karnaugh mappings and/or algebraic methods.
x1x0
x3x2 \ 00 01 11 10
00 | 1 | 0 | 1 | 1 |
01 | 0 | 1 | 0 | 1 |
11 | d | d | d | d | d(x3,x2,x1,x0)=x3+x2x1'x0+x2'x1+x1x0'+x2'x0'
10 | 1 | 1 | d | d |
4. Graphical design and VHDL description - Implement the simplified
function. Note that in practice, an LED segment is ON when connected
to a logic 0 and OFF when connected to a logic 1.
When implementing a sum of products expression
the
outputs
of the design should be complemented by NOT. See example VHDL code
below.
| Gate Network corresponding to d(x3,x2,x1,x0) |
 |
| Specification using VHDL corresponding to d(x3,x2,x1,x0) |
| USE WORK.ALL;
ENTITY d_segment IS
PORT( x3, x2, x1, x0 : IN BIT;
d
: OUT BIT);
END d_segment;
ARCHITECTURE behavioral of d_segment IS
BEGIN
PROCESS (x3, x2, x1, x0)
BEGIN
d <= NOT (x3 OR (x2 AND NOT x1 AND x0) OR (NOT
x2 AND x1)
OR (x1 AND NOT x0) OR (NOT x2 AND NOT x0));
END PROCESS;
END behavioral; |
Implementation
using FPGA
Implementation using a FPGA requires the following steps after the graphical
or HDL design has been verified using simulation:
-
Determine necessary equipment.
-
Familiarization with the equipment.
-
Assign the FPGA device to
be used for the implementation.
-
Assign FPGA device pins to
the input/output pins specified in the design.
-
Program the FPGA.
-
Make wire connections from FPGA input/output
pins to switches, lights, display, or other input/output devices.
-
Test the FPGA implementation outputs for all possible
inputs.
EQUIPMENT
-
ByteBlaster Cable
-
UP 1 Education Board
-
22 gauge wire
-
wire stripper

UP1 EQUIPMENT FAMILIARIZATION
The UP1 Education Board will be used to implement significant designs such
as serial ports and simple CPUs. It has two FPGA devices and associated
input
and
output areas for each. Each FPGA device can be programmed with a
graphical or VHDL design of a combinational circuit. Programming the FPGA
performs the same function as wiring individual logic gates as in Homework
2. Once programmed, the FPGA behaves as a set of connected logic gates
forming a combinational circuit where only inputs and
outputs
must be physically wired externally. The FPGA used in this assignment is
the EPM7128S or MAX device on the left of the UP1. The areas
used in the laboratory and homework are:
P1, P2, P3, P4 - Connections to the input/output of the FPGA
MAX
device
are similar to connecting to an AND or other gate input/output, simply
by connecting a wire from the device to a pushbutton, switch, light, display
or other input/output device.
The possible connections are listed in the above table. Some pins have
a predefined use, such as connection to the 7-segment LED, while others
are unconnected until the device is programmed. The FPGA pins defined when
the program is compiled can be assigned manually as described in the following.
MAX_DIGIT - There are two 7-segment LED displays and a
decimal point. The homework assignment uses the left display or Digit
1
which is connected to the MAX device as described in Table 4 at right.
A Display Segment can be illuminated by driving the connected pin
with a logic 0. For example, the d segment of the left LED is connected
to pin 63 (from Table 4), so the output of the design must be connected
to FPGA pin 63 in order to control the d segment of Digit 1.
MAX_SW1 - Switches are inputs and supply a logic 1 when open
and logic 0 when closed. A switch can be wired to an EPM7128S input
pin (see P1, P2, P3, or P4 block) using a 22 gauge wire. Which pin is an
input is defined by you (see below).
JAG IN - Connection for the ByteBlaster cable to
the computer for programming the FPGA.
DC-IN - Connection for Direct Current power supply.
Assigning FPGA Device and
Pins
-
Select the graphical or VHDL file and make it the project
file
by File, Project, Set Project to Current file menu.

-
Compile the project.
-
The FPGA device to be used can now be selected by Assign, Pin/Location/Chip...
menu entry.
-
Click the
button and select the EPM7128SLC84-7 FPGA device, click OK to complete
the device assignment.
-
To assign pins, enter the name of the input/output parameter
for the design, for example:
ENTITY d_segment IS
PORT( x3, x2, x1, x0 : IN BIT;
d
: OUT BIT);
END d_segment;
has inputs of x3,x2,x1,x0
and output of d. These can be assigned to pins by entering
the Node Name (x3,x2,x1,x0,
or d) and selecting the corresponding Pin for that node from
the list. Then click Add to add the pin assignment. Assign all the
nodes then click OK. The figure at right has assigned Node Name d
to Output pin 63.
-
With pin assignments complete, compile the project again to include the
pin assignments (yes, there are two compiles necessary).
Programming
Programming the FPGA requires:
-
Make sure that the UP1 programming jumpers (the small, black header plugs
just below the JAG IN labeled TD1, TD0,
DEVICE, and BOARD, see figure at right) are in correct position
to program the EPM7128SLC84-7 device. The jumpers should connect the pins
in the top two rows of each of the four columns (labeled TD1, TD0, DEVICE,
and BOARD).
-
Connect the ByteBlaster cable to the parallel or printer port
of the computer and the UP1 JAG IN.
-
Connect the power plug from the power adapter to the UP1 DC IN.
-
Open the graphical or VHDL design file, use File, Project,
Set Project to Current File menu entry.
-
Make any device or pin assignments as described in Assigning
FPGA Device and Pins.
-
Compile the project.
-
Use MAX+plus II, Programmer menu or click on
.
If an error message appears, examine the JTAG and FLEX
menus,
uncheck any Multi-device Chains. For example, the JTag should
all be unchecked as at right.
-
Click Program. The programming window should show programming progress
and indicate when programming of the FPGA is completed.
Wire Connections
WARNING: Turn UP1 power OFF
whenever wiring. This will help prevent electrical damage to the UP1 while
making wire connections. Unplug the power transformer from the 110 volt
power strip.
To prevent physical damage to the UP1, use only the 22 gauge wire supplied
in PS100. There are many colors on the spools, allowing signals to be color-coded
(e.g. inputs green, outputs yellow). It may be challenging to fit the the
wire into the connections, especially if the wire has been bent. Try using
a new, straight wire.
As noted already, pin 63 of the FPGA is connected to the d segment
and the output of the function has been assigned to that pin. The
inputs for (x3,x2,x1,x0)
were
assigned to pins (34, 33, 36, 35) in area P3 respectively in Assigning
FPGA Device and Pins, these pins must now be connected by wire to an
external inputs, such as the switches of MAX_SW1. Connect the leftmost
MAX_SW1 switch to
x3, the next to x2, and
so forth for each of the four inputs. This will allow 4 bit binary numbers
to be more easily entered on the switches.
Testing
Since only the d segment is being controlled, it should be OFF
when a 1, 4, or 7 (0001, 0100, and 0111) is entered on the MAX_SW1 and
ON
for all other switch inputs. The other segments are normally
ON
when no wire connection exists. To test, enter each digit from 0-9 in binary
(0000-1001) on the MAX_SW1 switch to verify that the design is functioning
correctly.
Homework 4
EQUIPMENT
-
ByteBlaster Cable
-
UP 1 Education Board
-
22 gauge wire
-
wire stripper
ASSIGNMENT
Design and implement all functions (a, b, c, d, e, f, g) for
a 7-segment display hexadecimal digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a,
b, c, d, E, and F).
TURN IN
-
Cover Page - Your name, date, and Homework 4. Staple all
pages together.
-
State Problem - Already completed.
-
Describe switching functions for a, b, c, d, e, f, g using truth table,
one-set, etc. Combine all functions, a-g, into a single design so that
the entire segment will show the correct output for inputs on the MAX_SW1.
-
Simplify using Karnaugh maps.
-
VHDL (recommended) or graphical design listing. The VHDL input/output
definition would be similar to:
ENTITY segment7 IS
PORT( x3, x2, x1, x0 : IN BIT;
a, b, c, d, e, f, g : OUT BIT);
END segment7;
-
Verify by demonstrating operation to instructor. All team members should
be present. Demonstration can be performed before or after assignment due
date as scheduling permits.
Document last modified: