Advanced Digital Circuits ECET 146 Week 6 Professor Iskandar Hack ET 221G, 481-5733 Me as I typed this slides.

Slides:



Advertisements
Similar presentations
VHDL 5 FINITE STATE MACHINES (FSM) Some pictures are obtained from FPGA Express VHDL Reference Manual, it is accessible from the machines in the lab at.
Advertisements

10/2/0810/2/2008ECE 561 -ECE Lecture 51 State Machine Implementation 10/2/20081ECE Lecture 5.
CS1Q Computer Systems Lecture 12 Simon Gay. Lecture 12CS1Q Computer Systems - Simon Gay 2 Design of Sequential Circuits The systematic design of sequential.
Lab7: Introduction to Arduino
Counters. In class excercise How to implement a “counter”, which will count as 0,3,1,4,5,7,0,3,1,…… Q2Q1Q0D2D1D
8085 processor. Bus system in microprocessor.
1 Lecture 20 Sequential Circuits: Latches. 2 Overview °Circuits require memory to store intermediate data °Sequential circuits use a periodic signal to.
Circuits require memory to store intermediate data
Advanced Digital Circuits ECET 146 Week 9 Professor Iskandar Hack ET 221B,
ECE 353 Computer Systems Lab II VHDL AND LABORATORY TOOLS TUTORIAL Professors Maciej Ciesielski & T. Baird Soules.
Sequential Circuit Design
ECE 331 – Digital System Design
How to use the VHDL and schematic design entry tools.
1 COMP541 Sequencing and Control Montek Singh Mar 29, 2007.
Latches Section 4-2 Mano & Kime. Sequential Logic Combinational Logic –Output depends only on current input Sequential Logic –Output depends not only.
Exercise Q3.17 Design an FSM to keep track of the mood of four students working in the digital design lab. Each Student is either: 1. Happy (the circuit.
4/10/20081 Lab 9 RT methodology introduction Register operations Data Path Control Path ASM Example TA: Jorge Crichigno.
ECE Department: University of Massachusetts, Amherst Lab 1: Introduction to NIOS II Hardware Development.
9/15/09 - L25 Registers & Load Enable Copyright Joanne DeGroat, ECE, OSU1 Registers & Load Enable.
Introduction to FPGA Design Illustrating the FPGA design process using Quartus II design software and the Cyclone II FPGA Starter Board. Physics 536 –
Advanced Digital Circuits ECET 146 Week 1 Professor Iskandar Hack ET 205B,
Advanced FPGA Based System Design Lecture-9 & 10 VHDL Sequential Code By: Dr Imtiaz Hussain 1.
Advanced Digital Circuits ECET 146 Week 3 Professor Iskandar Hack ET 221B,
1 COMP541 State Machines Montek Singh Feb 8, 2012.
8254 Counter/Timer Counter Each of the three counter has 3 pins associated CLK: input clock frequency- 8 MHz OUT GATE: Enable (high) or disable.
Advanced Digital Circuits ECET 146 Week 7 Professor Iskandar Hack ET 221B,
Rabie A. Ramadan Lecture 3
Mentor Tools tutorial Bold Browser Design Manager Design Architect Library Components Quicksim Creating and Compiling the VHDL Model.
Introduction to Chapter 6  Digital circuits are frequently used for arithmetic operations  Fundamental arithmetic operations on binary numbers and digital.
Advanced Digital Circuits ECET 146 Week 5 Professor Iskandar Hack ET 221G, Me as I typed this slides.
Advanced Digital Circuits ECET 146 Week 4 Professor Iskandar Hack ET 221G,
Advanced Digital Circuits ECET 146 Week 5 Professor Iskandar Hack ET 221B,
Advanced Digital Circuits ECET 146 Week 2 Professor Iskandar Hack ET 221B,
L10 – State Machine Design Topics. States Machine Design  Other topics on state machine design Equivalent sequential machines Incompletely specified.
Chapter 10 State Machine Design. 2 State Machine Definitions State Machine: A synchronous sequential circuit consisting of a sequential logic section.
Implementing software in IEC Languages in IEC IEC uses the following languages Instruction List – Assembly level programming using.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Introduction to State Machine
Advanced Digital Circuits ECET 146 Week 9 Professor Iskandar Hack ET 221G,
Copyright © 1997 Altera Corporation 6/5/2016 P.1 AHDL Training Class Danny Mok Altera HK FAE
Counters. In class excercise How to implement a “counter”, which will count as 0,3,1,4,5,7,0,3,1,…… Q2Q1Q0D2D1D
Computer Organization & Programming Chapter 5 Synchronous Components.
Copyright © 1997 Altera Corporation 11/20/2015 P.1 Beginner VHDL Training Class Danny Mok Altera HK FAE
FINITE STATE MACHINES (FSMs)
Copyright © 1997 Altera Corporation & 提供 Beginner VHDL Training Class Danny Mok Altera HK FAE
ECE 353 Lab 2 Pipeline Simulator Additional Material.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL State Machines Anselmo Lastra.
1Sequential circuit design Acknowledgement: Most of the following slides are adapted from Prof. Kale's slides at UIUC, USA by Erol Sahin and Ruken Cakici.
Teaching Digital Logic courses with Altera Technology
1 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
Chapter 1_0 Registers & Register Transfer. Chapter 1- Registers & Register Transfer  Chapter 7 in textbook.
1 Sequential Logic The Forbidden Zone Ellen Spertus MCS 111 September 10 and 12, 2002.
Sequential Circuit Design 05 Acknowledgement: Most of the following slides are adapted from Prof. Kale's slides at UIUC, USA.
Pusat Pengajian Kejuruteraan Mikroelektronik EMT 351/4 DIGITAL IC DESIGN Verilog Behavioural Modeling (Part 4) Week #
1 COMP541 Sequential Logic – 2: Finite State Machines Montek Singh Feb 29, 2016.
EECE6017C Lab 1 Introduction to Altera tools and Circuit Simulation
ECE 353 Lab 3 Pipeline Simulator
COMP541 Sequential Logic – 2: Finite State Machines
Lecture 13: Sequential Circuits, FSM
Introduction to Sequential Circuits
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Advanced FPGA Based System Design
Finite State Machines.
ECE 353 Lab 3 Pipeline Simulator
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
Counters.
Lecture 4: Continuation of SystemVerilog
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
EGR 2131 Unit 12 Synchronous Sequential Circuits
Finite State Machine Continued
Presentation transcript:

Advanced Digital Circuits ECET 146 Week 6 Professor Iskandar Hack ET 221G, Me as I typed this slides

This Week’s Goals Adding a Time Delay to a Simple Finite State Machine Designing a Simple Control System using AHDL with a FSM

Time Delay Function This is a separate project that allows the designer to specify a particular amount of time (in clock cycles) that the main project will remain in a particular state This project has as it’s inputs clk, reset, nsec (the number of clock cycles to remain in that state) and start The only output of this project is te (time expired)

SubDesign for timedelay Can be scaled up or Down depending on Number clock cycles needed

Variable Section for timedelay Note: we are specifying that we want to keep track of Count using d-ff’s In this case we’re using 5 dff’s for count We have 3 states, one waiting to start counting, one to start the counter, and another where we are decrementing count until it reaches zero

Set up for the FF’s used in timedelay Sets up the clk and reset signal for the state machine ff’s Sets up the clk and reset signal for the count d-ff’s (note that a dff has a input clrn not that we use !reset (the ! Symbol inverts the reset signal

The Case Statement This is similar to programming languages in that you can look a particular signal and determine what you want the logic do based on the contents of that signal The syntax is shown on the next slide for the logic in the timedelay function This case statement is the heart of timedelay

Case Statement in timedelay CASE ss IS WHEN idle => te = vcc; if start then ss = startstate; else ss = idle; end if; WHEN startstate => te = gnd; count[].d = nsec[]; if start then ss = startstate; else ss = counting; end if; WHEN counting => if start then ss = startstate; else count[].d = count[].q - 1; if count[].q == b"00000" then ss = idle; te = vcc; else ss = counting; te = gnd; end if; END CASE; Waiting for start to go High before counting Start has gone high, so save the number of clock cycles to delay on the count dff’s and wait for start to go low In case we want to start counting again Subtract 1 from the output (q) of the ff’s and place them on the inputs (d) of the ff’s Check if we’re done, if so take te high otherwise keep counting

Complete TimeDelay Function (cut and paste) SUBDESIGN timedelay ( clk : INPUT; reset : INPUT; start : INPUT; nsec[4..0] : INPUT; te : OUTPUT; ) VARIABLE ss: MACHINE WITH STATES (idle, startstate, counting ); count[4..0] :dff; BEGIN count[].clk = clk; count[].clrn = !reset; ss.clk = clk; ss.reset = reset; CASE ss IS WHEN idle => te = vcc; if start then ss = startstate; else ss = idle; end if; WHEN startstate => te = gnd; count[].d = nsec[]; if start then ss = startstate; else ss = counting; end if; WHEN counting => if start then ss = startstate; else count[].d = count[].q - 1; if count[].q == b"00000" then ss = idle; te = vcc; else ss = counting; te = gnd; end if; END CASE; END;

Save, compile and made default symbol for timedelay Go through the normal steps after copying and pasting the function timedelay into the text editor Save as timedelay.tdf Set project to current file Compile Make default symbol for timedelay

Example Project that uses timedelay In this project we’re going to go from state s0 to s1 after 5 clock cycles, to s2 after 8 clock cycles and back to s0 after 3 clock cycles. We’re going to have the following outputs: Y1 – high during s0 Y2 – high during s1 and s2 Y3 – high only during s2

Some points to remember We have to as outputs from our new project the signals for timedelay (start and nsec) We have to have an input for te We have to subtract from the variable nsec one clock cycle for the startstate clock cycle We have to have a unique state to “START” the timedelay function We have to have a ‘loop-back’ to the same state until te goes high

Bubble Graph for Simple w/timedelay Design

Table to show State Transistions Current StateTE (the only input that has an effect on table transitions Next State S0X (don’t care)S0a 0 1S1 X (don’t care)S1a 0 1S2 X (don’t care)S2a 0 1S0

Table to show Outputs Current StateNsec[]STARTY1Y2Y3 S04VCC GND S0a4GNDVCCGND S18VCCGNDVCCGND S1a8GND VCCGND S22VCCGNDVCC S2a2GND VCC

SubDesign and Var Sections

Define Clk and Reset for State Machine

State Transition Table in AHDL

Output Table in AHDL

Complete File for Example Part 1

Complete File for Example Part 2

Save and Compile Example Save as exampleweek6.tdf Compile (ignore warnings) Create Default Symbol

Start Final Design (uses both timedelay and exampleweek6 Open Graphic Editor and add the inputs, outputs and the two symbols just designed. NOTE – ALL files must be in the same directory, don’t create separate directories for the three projects

Final Design Drawing Note must be a BUS

Save as NEW Project Name Save drawing as week6final.gdf Change Project to current project Save and Compile Define Device and I/O pins

Simulation Same as before except you’ll need to change the end time to at least 4.5uS to see complete cycle Note you can see the internal state machine states along with the count – again helps with troubleshooting non-working designs

Lab 5 Introduction to State Machines and Time Delay Design using the techniques discussed in class a Finite State Machine (FSM) that will simulate a basic stop light with the MAJOR states shown on the next slide. (You can shorten the times if desired; these times seem to last forever when trying to verify the project) Please Note that inside each state there needs to be several sub-states that perform the following. a) Place on the output of the FSM the number of seconds (minus 1) that the FSM is to remain in that state, and sets the start signal high. b) Removes the start signal (to start the timedelay component), and number of seconds c) Waits until the TE signal goes high from timedelay d) Please note that during all of these sub-states the outputs have to be set correctly, this is NOT a computer program that the outputs are set until changed – they must be specified for ALL states and sub-states (look at the example which had s0, s0a for s0) Built up the circuit using the Altera Educational Board, remove the onboard clock if present and use a function generator on Pin 2 on the Altera Board for the clock Submit a Formal Lab Report using the Standard ECET format

Lab 5 Table