Finite State Machines

$24.99 $18.99

Introduction In this lab you will learn how to describe finite state machines (FSMs) in VHDL. Specifically, you will design a special kind of a 4-bit counter using an FSM. This counter is not a regular up-counter. In addition to being bi-directional, i.e., it counts up and down, it goes through the following sequence of…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:

Description

5/5 – (2 votes)
  • Introduction

In this lab you will learn how to describe finite state machines (FSMs) in VHDL. Specifically, you will design a special kind of a 4-bit counter using an FSM. This counter is not a regular up-counter. In addition to being bi-directional, i.e., it counts up and down, it goes through the following sequence of numbers:

1$2$4$8$3$6$12$11$5$10$7$14$15$13$9($1$2$4…)

Note that the right-arrow (i.e., !) denotes the upward direction whereas the left-arrow (i.e., ) denotes the down-ward direction of the counter. See Section 8.7.5 of the textbook for a similar counter.

Pushbuttons, slide switches and 7-segment LEDs will be used during this lab to control the counters when running on the Altera DE1-SoC board.

  • Learning Outcomes

After completing this lab you should know how to:

Design an FSM for a counter

Perform functional simulation of the FSM using ModelSim Test the FSM on the Altera board

  • Finite State Machine

Similar to the previous lab, the FSM circuit works when the enable signal is high. The direction signal denotes the counting direction. Note that the counter should be initialized according to their direction when the asynchronous active-low reset signal is asserted. Use the leftmost value (1) in the counting sequence for the upward direction and the rightmost value (9) for the downward direction.

First, draw the state diagram for the counter. Then using the state diagram describe the counter in VHDL. Use the following entity declaration to describe a Moore-style FSM implementing the above counter:

l i b r a r y I E E E ;

u s e I E E E . S T D _ L O G I C _ 1 1 6 4 . ALL ;

u s e I E E E .NUMERIC_STD . ALL ;

e n t i t y gNN_FSM i s

P o r t ( enable

: i n

s t d _ l o g i c ;

d ir ec t io n : i n

s t d _ l o g i c ;

reset

: i n

s t d _ l o g i c ;

clk

: i n

s t d _ l o g i c ;

count

: o u t

s t d _ l o g i c _ v e c t o r (3 d o w n t o 0) ) ;

e n d gNN_FSM ;

See Section 8.4 of the textbook for a discussion on how to design FSMs using VHDL.

Once you have your circuit described in VHDL, you should simulate it. Write a testbench code and perform a func-tional simulation for your VHDL description of the FSM.

Lab Assignment #3

3

  • Deliverables and Grading

5.1 Demo

Once completed, you will demo your project to the TA. You will be expected to:

fully explain how the HDL code works,

perform functional simulation using ModelSim, and

demonstrate that the FSM circuit is functioning properly using the pushbuttons, slide switches and 7-segment LEDs on the DE1-SoC board.

5.2 Written report

You are also required to submit a written report and your code on myCourses. Your report must include:

The state diagram of your FSM. A description of the FSM circuit.

A discussion of how the FSM circuit was tested, showing representative simulation plots. How do you know that these circuits work correctly?

A description of the multi-mode counter circuit.

A discussion of how the multi-mode counter circuit was tested on the FPGA board.

A summary of the FPGA resource utilization (from the Compilation Report’s Flow Summary) and the RTL schematic diagram for the multi-mode counter circuit. Clearly specify which part of your code maps to which part of the schematic diagram.

Finally, when you prepare your report have in mind the following:

The title page must include the lab number, name and student ID of the students, as well as the group number. All figures and tables must be clearly visible.

The report should be submitted in PDF format. It should document every design choice clearly.

The grader should not have to struggle to understand your design. That is,

Everything should be organized for the grader to easily reproduce your results by running your code through the tools.

The code should be well-documented and easy to read.

McGill

Grading Sheet

University

Group Number:

Name 1:

Name 2:

Task

Grade

/Total

TA Signature

VHDL code for the FSM circuit

/40

Creating testbench code for the FSM circuit

/5

Functional simulation of the FSM circuit

/5

VHDL code for the multi-mode counter circuit

/10

Testing the multi-mode counter circuit on the DE1-SoC board

/40

Total

/100

ECSE 222 – Digital Logic (Winter 2019)

Lab Assignment #3

4

Finite State Machines
$24.99 $18.99