UNIVERSITI MALAYSIA PERLIS

Similar documents
Ring Counter. 4-bit Ring Counter using D FlipFlop. VHDL Code for 4-bit Ring Counter and Johnson Counter 1. Contents

Four-Way Traffic Light Controller Designing with VHDL

EASTERN MEDITERRANEAN UNIVERSITY COMPUTER ENGINEERING DEPARTMENT CMPE224 DIGITAL LOGIC SYSTEMS VHDL EXPERIMENT VII

Types of Control. Programmed Non-programmed. Program Counter Hardwired

Digital Circuits II Lecture 6. Lab Demonstration 3 Using Altera Quartus II to Determine Simplified Equations & Entering Truth Table into VHDL

CHAPTER FIVE - Flip-Flops and Related Devices

A-PDF Split DEMO : Purchase from to remove the watermark 114 FSM

Topics. FPGA Design EECE 277. Combinational Logic Blocks. From Last Time. Multiplication. Dr. William H. Robinson February 25, 2005

CS/EE Homework 9 Solutions

I hope you have completed Part 2 of the Experiment and is ready for Part 3.

Arria V Timing Optimization Guidelines

Written exam IE1204/5 Digital Design Friday 13/

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-378:

DIGITAL DESIGN WITH SM CHARTS

Daisy II. By: Steve Rothen EEL5666 Spring 2002

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700:

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700:

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 5

CSE 260 Digital Computers: Organization and Logical Design. Midterm Solutions

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700:

First Name: Last Name: Lab Cover Page. Teaching Assistant to whom you are submitting

Configuring CorePWM Using RTL Blocks

Chapter 9. sequential logic technologies

Lab #10: Finite State Machine Design

Chapter 9. sequential logic technologies

CSE 260 Digital Computers: Organization and Logical Design. Lab 4. Jon Turner Due 3/27/2012

6.111 Lecture # 19. Controlling Position. Some General Features of Servos: Servomechanisms are of this form:

Synthesis Minimizations and Mesh Algorithm Selection: An Extension of the Ultrasonic 3D Camera

Lab 1.1 PWM Hardware Design

Chapter 5 Sequential Logic Circuits Part II Hiroaki Kobayashi 7/11/2011

ISSN: ISO 9001:2008 Certified International Journal of Engineering and Innovative Technology (IJEIT) Volume 4, Issue 11, May 2015

ICS 151 Final. (Last Name) (First Name)

Solutions. ICS 151 Final. Q1 Q2 Q3 Q4 Total Credit Score. Instructions: Student ID. (Last Name) (First Name) Signature

Computer Architecture Laboratory

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY (AUTONOMOUS)

Method We follow- How to Get Entry Pass in SEMICODUCTOR Industries for 2 nd year engineering students

Finite State Machines CS 64: Computer Organization and Design Logic Lecture #16

HW D2: Sequential Logic, Counters, Debounce

Topic 1. Road safety rules. Projects: 1. Robo drives safely - page Robo is a traffic light - - page 6-10 Robo is a smart traffic light


Controller Implementation--Part I. Cascading Edge-triggered Flip-Flops

PE713 FPGA Based System Design

Hardware Design with VHDL Design Example: UART ECE 443

Learning Outcomes. Spiral 2 3. DeMorgan Equivalents NEGATIVE (ACTIVE LO) LOGIC. Negative Logic One hot State Assignment System Design Examples

The Audio Synthesizer

Rapid FPGA Modem Design Techniques For SDRs Using Altera DSP Builder

EXPERIMENT 1: INTRODUCTION TO THE NEXYS 2. ELEC 3004/7312: Signals Systems & Controls EXPERIMENT 1: INTRODUCTION TO THE NEXYS 2

CHAPTER 16 SEQUENTIAL CIRCUIT DESIGN. Click the mouse to move to the next page. Use the ESC key to exit this chapter.

ENGG1015: lab 3. Sequential Logic

Stage report Spark Generator Board & Path Finder Robot

Chapter # 1: Introduction

Exercise 3: Serial Interface (RS232)

Chapter 5 Sequential Logic Circuits Part II Hiroaki Kobayashi 6/30/2008

Module -18 Flip flops

Logic 0 Logic To provide an output load (or two) 5 Voltage Measurement Point V CC +5 74LS00 GND

EE 307 Project #1 Whac-A-Mole

ISSN Vol.05, Issue.07, July-2017, Pages:

Senior Capstone Project Proposal Reconfigurable FPGA Implementation Of Digital Communication System

MODULE-4 Memory and programmable logic

a) List HW and SW components of the device, and briefly discuss how those components are exploited in the embedded systems

Combinational logic functions can be represented, and defined, by truth tables.

Digital Systems Design

Clocking Schedule and Writing VHDL Programs for Synthesis

FPGA & Pulse Width Modulation. Digital Logic. Programing the FPGA 7/23/2015. Time Allotment During the First 14 Weeks of Our Advanced Lab Course

1 Q' 3. You are given a sequential circuit that has the following circuit to compute the next state:

Switching Circuits & Logic Design

Chapter # 1: Introduction

Bluetooth Transceiver Design with VHDL-AMS

CHAPTER 5 IMPLEMENTATION OF MULTIPLIERS USING VEDIC MATHEMATICS

TRANSPOSED FORM OF FOLDED FIR FILTER

EE307. Frogger. Project #2. Zach Miller & John Tooker. Lab Work: 11/11/ /23/2008 Report: 11/25/2008

Chapter 3 Describing Logic Circuits Dr. Xu

bus waveforms transport delta and simulation

Introduction to Simulation of Verilog Designs. 1 Introduction. For Quartus II 11.1

IMPROVEMENT OF THE ORTHOGONAL CODE CONVOLUTION CAPABILITIES USING FPGA IMPLEMENTATION

Implementing Multipliers with Actel FPGAs

E2 Framing / Deframing according ITU-T G.703 / G.742 : VHDL-Modules

Lecture 2 Exercise 1a. Lecture 2 Exercise 1b

HDL CODE TO REALIZE ALL THE LOGIC GATES

Chapter 4: FLIP FLOPS. (Sequential Circuits) By: Siti Sabariah Hj. Salihin ELECTRICAL ENGINEERING DEPARTMENT EE 202 : DIGITAL ELECTRONICS 1

Lab 1.2 Joystick Interface

DELD MODEL ANSWER DEC 2018

Course Overview. Course Overview

Code No: R Set No. 1

Efficient Parallel Real-Time Upsampling with Xilinx FPGAs

Chapter 4 Combinational Logic Circuits

Project Board Game Counter: Digital

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING SEMESTER TWO EXAMINATION 2017/2018

2014 Paper E2.1: Digital Electronics II

Lecture 3: Logic circuit. Combinational circuit and sequential circuit

Lecture 3, Handouts Page 1. Introduction. EECE 353: Digital Systems Design Lecture 3: Digital Design Flows, Simulation Techniques.

The counterpart to a DAC is the ADC, which is generally a more complicated circuit. One of the most popular ADC circuit is the successive

UNIT II: Clocked Synchronous Sequential Circuits. CpE 411 Advanced Logic Circuits Design 1

Introduction to Digital Signal Processing

FPGA Implementation of VHDL Based Traffic Light Controller System

Digital Logic Circuits

Sequential program, state machine, Concurrent process models

Development of FPGA Based System for Neutron Flux Monitoring in Fast Breeder Reactors

Embedded Systems 10 BF - ES - 1 -

Computer Architecture: Part II. First Semester 2013 Department of Computer Science Faculty of Science Chiang Mai University

Transcription:

UNIVERSITI MALAYSIA PERLIS SCHOOL OF COMPUTER & COMMUNICATIONS ENGINEERING EKT303/4 PRINCIPLES OF COMPUTER ARCHITECTURE LAB 5 : STATE MACHINE DESIGNS IN VHDL

LAB 5: Finite State Machine Design OUTCOME: 1) Ability to identify the sequential operation techniques 2) Ability to describe the operation of sequential synthesis 3) Ability to demonstrate the use of architecture types 4) Ability to develop a simple VHDL program in Altera Quartus II software INTRODUCTION Finite State Machines (FSMs) represent an important part of design of almost any more complex digital system. There are used to sequence specific operations, control other logic circuits and provide synchronization of different parts of more complex circuit. FSM is a circuit that is designed to sequence through specific patterns of states in a predetermined manner. The basic idea of an FSM is to store a sequence of different unique states and transition between them depending on the values of the inputs and the current state of the machine. A state is represented by a binary value held on a current state register and clock by a free source. There are two types of FSMs as listed below : 1. Moore machine where the output(s) of the system depend from the current state; and 2. Mealy machine where the output(s) of the system depend from the current state and the input(s) of the system The general structure of an FSM can be presented in Figure 5.1 below. ( Mealy Only ) clk Present State Output (Comb Logic) Output(s) Register Input(s) Next State (Comb Logic) Figure 5.1 : FSM building blocks 1

To describe an FSM in VHDL, the states must be enumerated and two processes or more must be involved inside the architecture. The most common behavioral statement used for an FSM to represent the states are the if-elsif-else statements inside a Case statement (sequential staements in a sequential staement). The assignment enumeration process for the states into binary values can basically be seen as the following example : Type states is std_logic_vector(1 downto 0); Constant red : states := 00 ; Constant yellow : states := 01 ; Constant green : states := 10 ; Signal present_state, next_state : states; But can replaced with Type states is (red,yellow,green); Signal present_state, next_state : state; An example of a Moore machine is shown in figure 5.2. An example of a Mealy machine is shown in figure 5.3. Write the following VHDL programs in Altera Quartus II and simulate the result and make comparisons. 2

-- Figure 5.2 -- Example of a simple Moore type FSM LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY moore_fsm IS PORT( Clk,P : IN STD_LOGIC; R : OUT STD_LOGIC); END moore_fsm; ARCHITECTURE beh OF moore_fsm IS SIGNAL State : STD_LOGIC_VECTOR (1 DownTo 0); CONSTANT A: STD_LOGIC_VECTOR (1 DownTo 0) := "00"; CONSTANT B: STD_LOGIC_VECTOR (1 DownTo 0) := "01"; CONSTANT C: STD_LOGIC_VECTOR (1 DownTo 0) := "10"; CONSTANT D: STD_LOGIC_VECTOR (1 DownTo 0) := "11"; PROCESS (Clk) IF Clk'EVENT AND Clk='1' THEN CASE State IS WHEN A => State <= B; ELSE State <= A; WHEN B => State <= C; WHEN C => State <= D; WHEN D=> State <= B; ELSE State <= A; END CASE; END PROCESS; END beh; R <= '1' WHEN State=D ELSE '0'; 3

-- Figure 5.3 -- Example of a simple Mealy type FSM LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY mealy_fsm IS PORT( Clk,P : IN STD_LOGIC; R : OUT STD_LOGIC); END mealy_fsm; ARCHITECTURE beh OF mealy_fsm IS SIGNAL State : STD_LOGIC_VECTOR (1 DownTo 0); CONSTANT A: STD_LOGIC_VECTOR (1 DownTo 0) := "00"; CONSTANT B: STD_LOGIC_VECTOR (1 DownTo 0) := "01"; CONSTANT C: STD_LOGIC_VECTOR (1 DownTo 0) := "10"; PROCESS (Clk, P) IF Clk'EVENT AND Clk='1' THEN CASE State IS WHEN A => State <= B; WHEN B => State <= C; WHEN C => State <= A; END CASE; END PROCESS; END beh; R <= '1' WHEN (State=C AND P='1') ELSE '0'; 4

EXERCISE Question 1 A certain control system will assert every time it detects the data value 1 twice in a row from a string of input data. Using the waveform in figure 5.4 below, design the 1. Moore state machine diagram and VHDL coding 2. Mealy state machine diagram and VHDL coding Figure 5.4 : Question 1 waveform parameter Use the given input waveforms to simulate both your state machines and compare. Question 2 A busy street in Kangar will soon be having a pedestrian crossing system to help overcome the crossing problem for pedestrians due to heavy traffic. This pedestrian crossing system will have 2 types of traffic light, one for the vehicles on the road and the other for the pedestrians. A counter will be allocated for the pedestrians to gauge the time given to cross the street. Figure 5.5 below briefly illustrates the system. RED-GREEN traffic light with counter for pedestrian lane. Traffic Light B Yellow push-button for pedestrians who wishes to cross. Traffic Light A RED-YELLOW-GREEN traffic light for vehicle lane. Figure 5.5 : Illustration of a pedestrian crossing system. 5

Operation Basically, the pedestrian crossing system will allow vehicles to pass through the street. Now, lets assume the traffic light for the vehicle lane as A-traffic-light, and the pedestrian traffic light as B-traffic-light. Thus, the primary function is to let the cars flow through when there are no people to cross by giving A-traffic-light the GREEN light (AG) while the pedestrian B-traffic-light is RED (BR). The system will change when someone pushes the yellow button and after a clock cycle, will force A-trafficlight to turn YELLOW (AY). The Yellow light will stay for another clock cycle before A-traffic-light goes RED (AR) and B-traffic-light goes GREEN (BG). At the same time, the pedestrian display will begin to display the countdown period to cross. This pedestrian crossing system is controlled by a sequential state mechanism system. Your task is to create a simple controller system that would operate this pedestrian system process. Construct your controller system using the Moore Modelling approach. Possible states required to control the sequence are as follows : State Output condition State Change Condition A traffic light = Green State A B traffic light = Red Change of state depends on Awaiting push button to be pressed before push button. moving to State B State B A traffic light = Yellow B traffic light = Red - State C Continue to State C A traffic light = Red B traffic light = Green Counter is on Awaiting counter to finish before moving to State A. Table 5.1 : State Transition Table Change of state depends on end of count. Important Note 1. Each state change is assumed to have a clock frequency of approximately 1.0Hz. 2. State transition between A B depends on a toggle switch. 3. State transition between B C is only one clock cycle. 4. State transition between C A occur after countdown reaches 0. Assume the countdown is 5 or 7 seconds. Display the countdown on the 7 segment LEDs. Generate and simulate the VHDL codes in Altera Quartus II for the above traffic light exercise. 6