Advanced Digital Circuits ECET 146 Week 7 Professor Iskandar Hack ET 221B, 481-5733

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

Lab7: Introduction to Arduino
1 Lecture 13 VHDL 3/16/09. 2 VHDL VHDL is a hardware description language. The behavior of a digital system can be described (specified) by writing a.
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
LAB 3 – Review of the Assignment. -- Clarifications Vikram Murali. TA : CSE 140L Prof. CK Cheng.
How to use the VHDL and schematic design entry tools.
Week 6.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 6 VHDL Programming [Adapted from Dave Patterson’s UCB CS152.
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.
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s.
4/10/20081 Lab 9 RT methodology introduction Register operations Data Path Control Path ASM Example TA: Jorge Crichigno.
1 Lecture 14: FSM and Basic CPU Design Today’s topics:  Finite state machines  Single-cycle CPU Reminder: midterm on Tue 10/24  will cover Chapters.
Capacitance Sensor Project
Introduction to FPGA Design Illustrating the FPGA design process using Quartus II design software and the Cyclone II FPGA Starter Board. Physics 536 –
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,
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,
Graduate Computer Architecture I VHDL Structure and Testing Michael Sorensen.
Advanced Digital Circuits ECET 146 Week 5 Professor Iskandar Hack ET 221B,
Advanced Digital Circuits ECET 146 Week 2 Professor Iskandar Hack ET 221B,
Chapter 10 State Machine Design. 2 State Machine Definitions State Machine: A synchronous sequential circuit consisting of a sequential logic section.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
ENG2410 Digital Design LAB #6 LAB #6 Sequential Logic Design (Flip Flops)
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
Advanced Digital Circuits ECET 146 Week 6 Professor Iskandar Hack ET 221G, Me as I typed this slides.
Programmable Logic Training Course HDL Editor
Copyright © 1997 Altera Corporation 11/20/2015 P.1 Beginner VHDL Training Class Danny Mok Altera HK FAE
Reaction Timer Project
Electrical and Computer Engineering University of Cyprus LAB 1: VHDL.
Copyright © 1997 Altera Corporation & 提供 Beginner VHDL Training Class Danny Mok Altera HK FAE
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
VHDL Discussion Finite State Machines
VHDL Discussion Finite State Machines IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL State Machines Anselmo Lastra.
VHDL Discussion Sequential Sytems. Memory Elements. Registers. Counters IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology.
 Seattle Pacific University EE Logic System DesignCounters-1 Shift Registers DQ clk DQ DQ ShiftIn Q3Q3 Q2Q2 DQ Q1Q1 Q0Q0 A shift register shifts.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Digital System Design using VHDL
Edge Detection. 256x256 Byte image UART interface PC FPGA 1 Byte every a few hundred cycles of FPGA Sobel circuit Edge and direction.
ENG241 Digital Design Week #7 Sequential Circuits (Part B)
Teaching Digital Logic courses with Altera Technology
ECE 3450 M. A. Jupina, VU, 2016 Capacitance Sensor Project Goal: Creation of a digital capacitance sensor circuit where a variation in capacitance changes.
Pusat Pengajian Kejuruteraan Mikroelektronik EMT 351/4 DIGITAL IC DESIGN Verilog Behavioural Modeling (Part 4) Week #
1 Introduction to Engineering Spring 2007 Lecture 18: Digital Tools 2.
1 Lecture 13: Sequential Circuits, FSM Today’s topics:  Sequential circuits  Finite state machines  Single-cycle CPU Reminder: midterm on Tue 10/20.
EECE6017C Lab 1 Introduction to Altera tools and Circuit Simulation
LAB #6 Sequential Logic Design (Flip Flops, Shift Registers)
Finite State Machines (part 1)
Week #7 Sequential Circuits (Part B)
The first change to your project files that is needed is to change the device to the correct FPGA. This is done by going to the Assignments tab on the.
Registers and Counters
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
ECEN 248 Lab 9: Design of a Traffic Light Controller
Instructor: Alexander Stoytchev
VHDL 5 FINITE STATE MACHINES (FSM)
FPGA Project I: Up/Down Counter w/ Async Reset
VHDL (VHSIC Hardware Description Language)
Introduction to Sequential Circuits
Founded in Silicon Valley in 1984
Figure 8.1. The general form of a sequential circuit.
Finite State Machines (part 1)
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.
Lecture 4: Continuation of SystemVerilog
Sequntial-Circuit Building Blocks
Finite State Machine Continued
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
(Sequential-Circuit Building Blocks)
Presentation transcript:

Advanced Digital Circuits ECET 146 Week 7 Professor Iskandar Hack ET 221B,

This Week’s Goals Adding a Time Delay to a Simple Finite State Machine Designing a Simple Control System using VHDL 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 NOTE – Use [3..0] instead

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 (NOTE – the version I uploaded is count[3..0] 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[3..0] : INPUT; te : OUTPUT; ) VARIABLE ss: MACHINE WITH STATES (idle, startstate, counting ); count[3..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"0000" 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 Open timedelay.tdf 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

Entity and Start of Architecture

Begin and Start the Process

State Transition

Define the Output for Each State

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

Start Final Design (uses both timedelay and exampleweek6 Open Block/Schematic 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.bdf Change Top-Level 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

Div_Clock In order to see clock transitions we must slow down the clock from the on-board clock Clock used on DE0 is 50 MHz Need to reduce the frequency or divide down the clock to 1 Hz for real time testing

Div_clock Code LIBRARY IEEE; USE ieee.std_logic_1164.ALL; ENTITY div_clock IS PORT(clk_in:IN std_logic; clk_out:BUFFER std_logic); END div_clock; ARCHITECTURE behavior OF div_clock IS SIGNAL reg :integer RANGE 0 TO ; BEGIN PROCESS(clk_in) BEGIN if rising_edge(clk_in) then if (reg= ) then clk_out<=not(clk_out); reg <= 0; else reg<= reg + 1; end if; end process; end behavior;

Lab 6 Introduction to State Machines and Time Delay Watch the video for Week 7 before starting!!!! 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) After simulation add div_clk block, assign pins, assign unused pins to tri-state, and recompile Download on board and test. Submit a Formal Lab Report using the Standard ECET format

Lab 5 Table State NameOutputsTime EWGNS - R15 EW - G EWYNS - R5 EW-Y EWRNS - R2 EW - R NSGNS-G15 EW-R NSYNS-Y5 EW-R NSRNS-R2

Hints Use Pin G21 for clock input (you must use DIV_CLOCK, otherwise all LED’s will be on) Use LED0 – LED3 for North-South lights (we’ll be using the 4 th LED on the next lab) Use LED4-LED7 for East-West lights Use a Single 8-bit output assigned to the 8-LEDs Use the following format for the LED’s Red Yellow Green (Not used) Example 0 to turn on the Red NS light and Green EW light you need to output to the LED output LED = x”82” Use an 8-Bit Integer for all LED’s

Output Pins