Lab3 Rev e
Lab3 Rev e
Lab3 Rev e
Introduction
This laboratory assignment is an introduction to digital hardware design using a state machine.
The system specifically uses a Richards Controller, a counter-based state machine implementation that
can be easily built from TTL chips or other common digital components.
Objectives
• Design of digital hardware using TTL logic
• Construction and debugging of digital hardware
• Use of a logic analyzer as a debugging tool
• Role and operation of state machines in digital design.
• Use of the Altera FPGA hardware and design tools.
Procedure
Design requirements
The pre-lab assignment for this lab is to design a Richards Controller suitable for controlling an
electronic stopwatch. The pre-lab must include, but is not limited to:
1. State Diagram
2. Logic Diagram
3. Description of internal controller operation
4. Timing Diagrams
5. Richards flowchart
Implementation
1. Use the TTL equivalent macros to implement your controller in a Altera FPGA.
Demonstrate that the full functionality has been reproduced.
2. Optionally, reimplement the controller with the high-level constructs available in the
design entry tools, such as an HDL or state machine capture.
Report Requirements
The final lab report must contain the following:
1. Revised logic diagram of the design built. Minor changes should be indicated in red on
the original diagram, however if a major redesign was required a completely new
diagram should be included
2. Description of the correct internal operation of the controller
3. A concise description of the debugging process
4. Description of the necessarily revisions to the original controller design
5. Timing diagrams for the final version
6. A copy of the pre-lab for the design use
Operating Scenario
The following example indicates the detailed operation of the RC stopwatch:
A runner wishes to find his/her lap times as he/she runs a track. A clock keeper has a Richards
Controller stopwatch. The keeper turns on the watch; it automatically resets itself, displaying "00000".
The runner starts while the timekeeper presses the START/STOP button and views the running time. At
the end of the first lap, the keeper hits ADDRESS SWITCH #1 which causes the runner's first lap time
to be saved in memory location 1. At the end of the second lap, the keeper hits ADDRESS SWITCH #2
and saves the runner's total time for the first and second laps ("the runners split timed") in memory
location 2. The runner stops at the end of the fourth lap and the timekeeper hits the START/STOP
switch to stop the clock.
The runner now wishes to see the time for the first lap, so the keeper presses the
COUNTER/SPLIT switch, and then presses the address switch of the split the runner wishes to see:
ADDRESS SWITCH #1. Then to show the runner the elapsed time after lap 2, the keeper presses
ADDRESS SWITCH #2.
The runner wants to run on the track again, but he wants to start the stopwatch with the time he
achieved for three laps. The keeper presses ADDRESS SWITCH #3, which was used to store the
cumulative elapsed time at lap three, to get the split on the LED display. Now, when the runner starts the
keeper will hit the START/STOP switch again and the clock will continue counting from the third lap
split.
Student Module
As shown in figure 1, the second part of the stopwatch is to be provided by the student as the
prelab design assignment. This part includes the Richards Controller that will make the stopwatch
s
function as described in the "Stopwatch Function Summary" section, the power
power-up
up reset logic, and the
START/STOP switch and COUNTER/SPLIT switch debouncing. A switch module available in the lab
provides two dual-pole
pole momentary contact switches and one single-pole
pole momentary switch. The power-
power
up reset must set the Richards Controller to a predetermined state with the stopwatch LED display
reading all zeros.
Design automation tool usage
Note: Not all details of the lab Xilinx setup have been finalized at present. Additional
documentation is planned describing the FPGA demonstration boards (including I/O specification),
design entry, and downloading. Much of the design work for this lab is independent of implementation,
and may be started without waiting for this additional documentation. Any delay in the availability of
this additional documentation will be accounted for in the grading of pre-lab reports, and students will
not be penalized for it.
Design entry
Electronic design automation tools such as the Altera Foundation series allow for several
different methods of design entry:
• Schematic capture: A graphical entry method where symbols for components are
“placed” on a schematic an wire are “drawn” connecting their pins. This offers an easy
upgrade path for designs built with discrete components, and often libraries are included
with the design tools that provide functional equivalents to TTL and other chips.
• HDL: Hardware Description Languages provide the means of building hardware like a
“program”. These languages provide special feature to account for the inherent
parallelism of the hardware that are not expressible in most software programming
languages.
• Truth table: Given that the compiler already performs minimization, design entry tools
can allow direct entry of truth table mapping inputs to output. The actually
implementation is left to the compiler
• State machine capture: Basic truth table entry can be scaled to allow entry of state
machine transistion/ouput tables. Furthermore, once that facility is established, it is a very
small step to allow graphical entry of state machine designs. This facilitated design at a
very high level.
Design entry paths are available at both high levels (HDL, state machine) and low levels
(schematic). High-level designs allow rapid development of complex designs, however they are much
more difficult to debug. A high-level design leaves a great deal of decision-making to the tool, and much
of this is hidden from the designer and difficult to access. Experience with debugging designs entered
with schematic capture is necessary to develop the skills to discover how to expose the necessary
information.
Special Notes
1. Before applying power to the board check for the following:
a. Shorts from the ground to the power supply.
b. Connections from the SA signal or the CLK to the ground or to the power supply.
Any problems of this type should be resolved before applying power to the board or damage to
the power supply or Richards Controller module could result.
2. Spend more time developing a good design and a means of building and testing that design than
revoking a haphazard design in the lab. A well thought-out design and test strategy will make the
debugging process easier.
3. Be careful of signal loading and driving capability when driving signal on the connector to the
stopwatch module, especially when embedding a controller in an FPGA. You may need circuitry
external to the FPGA for this or other reasons.
4. The stopwatch module draws a lot of current. Be sure that your power supply is not limiting its
output current.
5. The behavior of the controller may not be defined for all possible input cases. If this is the case,
the implemented behavior is left to the discretion of the designer. However, the design must
document this behavior and justify its selection.
Stopwatch Module Detailed Diagrams