Digital Design. Sequential Logic Design -- Controllers. Copyright 2007 Frank Vahid

Similar documents
ECE 274 Digital Logic Fall 2009 Digital Design

ECE 274 Digital Logic. Digital Design. Datapath Components Shifters, Comparators, Counters, Multipliers Digital Design

Sequential Logic (2) Synchronous vs Asynchronous Sequential Circuit. Clock Signal. Synchronous Sequential Circuits. FSM Overview 9/10/12

Math Circles Finite Automata Question Sheet 3 (Solutions)

ECE 274 Digital Logic Spring Digital Design. Combinational Logic Design Process and Common Combinational Components Digital Design

EE Controls Lab #2: Implementing State-Transition Logic on a PLC

ECE 274 Digital Logic

CS 135: Computer Architecture I. Boolean Algebra. Basic Logic Gates

Digital Design. Chapter 1: Introduction

Student Book SERIES. Patterns and Algebra. Name

CS2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2005

Solutions to exercise 1 in ETS052 Computer Communication

Kirchhoff s Rules. Kirchhoff s Laws. Kirchhoff s Rules. Kirchhoff s Laws. Practice. Understanding SPH4UW. Kirchhoff s Voltage Rule (KVR):

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Synchronous Machine Parameter Measurement

& Y Connected resistors, Light emitting diode.

Dataflow Language Model. DataFlow Models. Applications of Dataflow. Dataflow Languages. Kahn process networks. A Kahn Process (1)

Module 9. DC Machines. Version 2 EE IIT, Kharagpur

Misty. Sudnow Dot Songs

Discontinued AN6262N, AN6263N. (planed maintenance type, maintenance type, planed discontinued typed, discontinued type)

The Math Learning Center PO Box 12929, Salem, Oregon Math Learning Center

Synchronous Generator Line Synchronization

CHAPTER 2 LITERATURE STUDY

On the Description of Communications Between Software Components with UML

Synchronous Machine Parameter Measurement

Unit 1: Chapter 4 Roots & Powers

Design and implementation of a high-speed bit-serial SFQ adder based on the binary decision diagram

Algebra Practice. Dr. Barbara Sandall, Ed.D., and Travis Olson, M.S.

DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING, THE UNIVERSITY OF NEW MEXICO ECE-238L:

MOS Transistors. Silicon Lattice

Patterns and Relationships

Regular languages can be expressed as regular expressions.

Geometric quantities for polar curves

PROGRAMMING MANUAL MTMA/01 MTMV/01 FB00329-EN

METHOD OF LOCATION USING SIGNALS OF UNKNOWN ORIGIN. Inventor: Brian L. Baskin

Triangles and parallelograms of equal area in an ellipse

The Discussion of this exercise covers the following points:

Student Book SERIES. Fractions. Name

CS2204 DIGITAL LOGIC & STATE MACHINE DESIGN fall 2008

10.4 AREAS AND LENGTHS IN POLAR COORDINATES

SOLVING TRIANGLES USING THE SINE AND COSINE RULES

Section 17.2: Line Integrals. 1 Objectives. 2 Assignments. 3 Maple Commands. 1. Compute line integrals in IR 2 and IR Read Section 17.

1 tray of toffee 1 bar of toffee. 10 In the decimal number, 0 7, the 7 refers to 7 tenths or

Lecture 20. Intro to line integrals. Dan Nichols MATH 233, Spring 2018 University of Massachusetts.

mac profile Configuration Guide Adobe Photoshop CS/CC Sawgrass Virtuoso SG400/SG800 Macintosh v

Exercise 1-1. The Sine Wave EXERCISE OBJECTIVE DISCUSSION OUTLINE. Relationship between a rotating phasor and a sine wave DISCUSSION

Algorithms for Memory Hierarchies Lecture 14

Three-Phase Synchronous Machines The synchronous machine can be used to operate as: 1. Synchronous motors 2. Synchronous generators (Alternator)

ABB STOTZ-KONTAKT. ABB i-bus EIB Current Module SM/S Intelligent Installation Systems. User Manual SM/S In = 16 A AC Un = 230 V AC

Example. Check that the Jacobian of the transformation to spherical coordinates is

Homework #1 due Monday at 6pm. White drop box in Student Lounge on the second floor of Cory. Tuesday labs cancelled next week

Direct Current Circuits. Chapter Outline Electromotive Force 28.2 Resistors in Series and in Parallel 28.3 Kirchhoff s Rules 28.

Challenge! 1 Warm-up. 2 Conversation. Language box. a Discuss the pictures with a partner.

CHAPTER 3 AMPLIFIER DESIGN TECHNIQUES

MAXIMUM FLOWS IN FUZZY NETWORKS WITH FUNNEL-SHAPED NODES

(1) Non-linear system

(CATALYST GROUP) B"sic Electric"l Engineering

Section 6.1 Law of Sines. Notes. Oblique Triangles - triangles that have no right angles. A c. A is acute. A is obtuse

ECE Digital Logic (Labs) ECE 274 Digital Logic. ECE Digital Logic (Textbook) ECE Digital Logic (Optional Textbook)

Aquauno Select MINUTES. (duration) FREQUENCY LED. OFF 8h AQUAUNO SELECT 5 MIN FREQUENCY. the timer is being programmed;

Polar Coordinates. July 30, 2014

Understanding Basic Analog Ideal Op Amps

First Round Solutions Grades 4, 5, and 6

001CK CK0012 FR-001CK0013 FR EN English

Spiral Tilings with C-curves

Topic 20: Huffman Coding

Translate and Classify Conic Sections

Job Sheet 2. Variable Speed Drive Operation OBJECTIVE PROCEDURE. To install and operate a Variable Speed Drive.

Specifying Data-Flow Requirements for the Automated Composition of Web Services

Safety Relay Unit. Main contacts Auxiliary contact Number of input channels Rated voltage Model Category. possible 24 VAC/VDC G9SA-501.

Comparison of soundscape on the ground floor of tube-houses in Hanoi and open urban space in Bordeaux

LSI/CSI LS7211N-7212N PROGRAMMABLE DIGITAL DELAY TIMER

ISSCC 2006 / SESSION 21 / ADVANCED CLOCKING, LOGIC AND SIGNALING TECHNIQUES / 21.5

Energy Harvesting Two-Way Channels With Decoding and Processing Costs

Alternating-Current Circuits

Experiment 3: Non-Ideal Operational Amplifiers

MONOCHRONICLE STRAIGHT

9.4. ; 65. A family of curves has polar equations. ; 66. The astronomer Giovanni Cassini ( ) studied the family of curves with polar equations

Experiment 8 Series DC Motor (II)

Lecture 16: Four Quadrant operation of DC Drive (or) TYPE E Four Quadrant chopper Fed Drive: Operation

ABOUT THIS MANUAL ABOUT THIS MANUAL

A Practical DPA Countermeasure with BDD Architecture

Series. Teacher. Numbers

Multi-beam antennas in a broadband wireless access system

ECE 274 Digital Logic Fall Digital Design. RTL Design RTL Design Method: Preview Example. RTL Design RTL Design Method

Section 16.3 Double Integrals over General Regions

Operation Manual. Addendum. Embroidery Machine. Product Code: 884-T13

Arduino for Model Railroaders

Mixed CMOS PTL Adders

Experiment 3: Non-Ideal Operational Amplifiers

Logic Design of Elementary Functional Operators in Quaternary Algebra

Francis Gaspalou Second edition of February 10, 2012 (First edition on January 28, 2012) HOW MANY SQUARES ARE THERE, Mr TARRY?

Application Note. Differential Amplifier

REVIEW, pages

Engineer-to-Engineer Note

Re: PCT Minimum Documentation: Updating of the Inventory of Patent Documents According to PCT Rule 34.1

ECE 274 Digital Logic. Digital Design. RTL Design RTL Design Method. RTL Design Memory Components

Crime Scene Documentation. Crime Scene Documentation. Taking the C.S. What should my notes include. Note Taking 9/26/2013

Lab 8. Speed Control of a D.C. motor. The Motor Drive

Probability and Statistics P(A) Mathletics Instant Workbooks. Copyright

Transcription:

Digitl Design Sequentil Logic Design -- Controllers Slides to ccompny the tetook Digitl Design, First Edition, y, John Wiley nd Sons Pulishers, 27. http://www.ddvhid.com Copyright 27 Instructors of courses requiring Vhid's Digitl Design tetook (pulished y John Wiley nd Sons) hve permission to modify nd use these slides for customry course-relted ctivities, suject to keeping Digitl this copyright Design notice in plce nd unmodified. These slides my e posted s unnimted pdf versions on pulicly-ccessile course wesites.. PowerPoint source (or pdf with nimtions) my not e posted to pulicly-ccessile wesites, ut my e posted for students on internl protected sites or distriuted directly to students y other electronic mens. Copyright 26 Instructors my mke printouts of the slides ville to students for resonle photocopying chrge, without incurring roylties. Any other use requires eplicit permission. Instructors my otin PowerPoint Frnk source Vhidor otin specil use permissions from Wiley see http://www.ddvhid.com for informtion.

Introduction 3. Sequentil circuit Output depends not just on present inputs (s in comintionl circuit), ut on pst sequence of inputs Stores its, lso known s hving stte Comintionl digitl circuit F Simple emple: circuit tht counts up in inry In this chpter, we will: Design new uilding lock, flip-flop, tht stores one it Sequentil digitl circuit? F Comine tht lock to uild multi-it storge register Descrie the sequentil ehvior using finite stte mchine Must know sequence of pst inputs to know output Convert finite stte mchine to controller sequentil circuit hving register nd comintionl logic Digitl Design Copyright 26 Note: Slides with nimtion re denoted with smll red "" ner the nimted items 2

Emple Needing Bit Storge 3.2 Flight ttendnt cll utton Press cll: light turns on Stys on fter utton relesed Cll utton Cncel utton Bit Storge Blue light Press cncel: light turns off. Cll utton pressed light turns on Blue light Logic gte circuit to implement this? utton Bit Cll Cncel Q Cll Cncel utton Storge 2. Cll utton relesed light stys on Doesn t work. Q= when Cll=, ut doesn t sty when Cll returns to Need some form of feedck in the circuit Digitl Design Copyright 26 Cll utton Cncel utton Bit Storge Blue light 3. Cncel utton pressed light turns off 3

Clocks Clock period: time intervl etween pulses Freq Period Aove signl: period = 2 ns Clock cycle: one such time intervl Aove signl shows 3.5 clock cycles Clock frequency: /period Aove signl: frequency = / 2 ns = 5 MHz Hz = /s GHz GHz GHz MHz MHz. ns. ns ns ns ns Digitl Design Copyright 26 4

Finite-Stte Mchines (FSMs) nd Controllers 3.3 Wnt sequentil circuit with prticulr ehvior over time Controller lser Emple: Lser timer Push utton: = for 3 clock cycles ptient How? Let s try three flip-flops = gets stored in first D flip-flop Then 2nd flip-flop on net cycle, then 3rd flipflop on net OR the three flip-flop outputs, so should e for three cycles D Q D Q D Q Digitl Design Copyright 26 5

Need Better Wy to Design Sequentil Circuits Tril nd error is not good design method Will we e le to guess circuit tht works for other desired ehvior? How out counting up from to 9? Pulsing n output for cycle every cycles? Detecting the sequence 3 5 in inry on 3-it input? And, circuit uilt y guessing my hve undesired ehvior Lser timer: Wht if press utton gin while =? then stys one nother 3 cycles. Is tht wht we wnt? Comintionl circuit design process hd two importnt things. A forml wy to descrie desired circuit ehvior Boolen eqution, or truth tle 2. A well-defined process to convert tht ehvior to circuit We need those things for sequence circuit design Digitl Design Copyright 26 6

Descriing Behvior of Sequentil Circuit: FSM Finite-Stte Mchine (FSM) A wy to descrie desired ehvior of sequentil circuit Akin to Boolen equtions for comintionl ehvior List sttes, nd trnsitions mong sttes Emple: Mke chnge toggle ( to, or to ) every clock cycle Outputs: = ^ = Off On ^ Off On Off On Off On Off On Two sttes: Off (=), nd On (=) cycle cycle 2 cycle 3 cycle 4 Trnsition from Off to On, or On to Off, on rising clock edge stte Off On Off On Arrow with no strting stte points to initil stte (when circuit first strts) Outputs: Digitl Design Copyright 26 7

FSM Emple:,,,,repet Wnt,,,,,,,,... Ech vlue for one clock cycle Cn descrie s FSM Four sttes Outputs: = ^ = ^ = ^ = Off On On2 On3 ^ Trnsition on rising clock edge to net stte Stte Off OnOn2On3 Off OnOn2On3 Off Outputs: Digitl Design Copyright 26 8

Etend FSM to Three-Cycles High Lser Timer Four sttes Wit in Off stte while is ( ) Inputs: ; Outputs: = Off *^ ^ When is (nd rising clock edge), trnsition to On Sets = *^ = On ^ = On2 ^ = On3 On net two clock edges, trnsition to On2, then On3, which lso set = So = for three cycles fter utton pressed Inputs: Stte Off Off Off Off Off On On2 On3 Off Outputs: Digitl Design Copyright 26 9

FSM Simplifiction: Rising Clock Edges Implicit Showing rising clock on every trnsition: cluttered nd unnecessry Mke implicit -- ssume every edge hs rising clock, even if not shown. Eg., it is understood tht trnsition out of stte is on clock edge. Inputs: ; Outputs: = Off *^ *^ = ^ = On On2 ^ ^ = On3 Wht if we wnted trnsition without rising edge We don t consider such synchronous FSMs -- less common, nd dvnced topic Inputs: ; Outputs: = Off Only consider synchronous FSMs -- rising edge on every trnsition = = = On On2 On3 Digitl Design Copyright 26 Note: Trnsition with no ssocited condition thus trnsistions to net stte on net clock cycle

FSM Definition FSM consists of Set of sttes E: {Off, On, On2, On3} Set of inputs, set of outputs E: Inputs: {}, Outputs: {} Initil stte E: Off Inputs: ; Outputs: = Off = = On On2 = On3 Set of trnsitions Descries net sttes Eg: Hs 5 trnsitions Set of ctions Sets outputs while in sttes Eg: =, =, =, nd = We often drw FSM grphiclly, known s stte digrm Cn lso use tle (stte tle), or tetul lnguges Digitl Design Copyright 26

FSM Emple: Secure Cr Key Mny new cr keys include tiny computer chip When cr strts, cr s computer (under engine hood) requests identifier from key Key trnsmits identifier If not, computer shuts off cr FSM Wit until computer requests ID (=) Trnsmit ID (in this cse, ) Digitl Design Copyright 26 Inputs: ; Outputs: r Wit r= K K2 K3 K4 r= r= r= r=.k.., A Sequencer 2

FSM Emple: Secure Cr Key (cont.) Nice feture of FSM Cn evlute output ehvior for different input sequence r= Inputs: ; Outputs: r Wit K K2 K3 K4 Timing digrms show sttes nd output vlues for different input wveforms Inputs r= r= r= r= Q: Determine sttes nd r vlue for given input wveform: Inputs Stte Wit Wit K K2 K3 K4 Wit Wit Stte Wit Wit K K2 K3 K4 Wit Outputs r Output r Digitl Design Copyright 26 3

FSM Emple: Code Detector Unlock door (u=) only when uttons pressed in sequence: strt, then red, lue, green, red Input from ech utton: s, r, g, Also, output indictes tht some colored utton pressed Strt Red Green Blue s r g Code detector u Door lock FSM Wit for strt (s=) in Wit Once strted ( Strt ) If see red, go to Red Then, if see lue, go to Blue Then, if see green, go to Green Then, if see red, go to Red2 In tht stte, open the door (u=) Wrong utton t ny step, return to Wit, without opening door Digitl Design Copyright 26 u= s u= r Wit Inputs: s,r,g,,; Outputs: u Q: Cn you trick this FSM to open the door, without knowing the code? Strt Red u= s r g r Blue g Green r Red2 u= u= u= A: Yes, hold ll uttons simultneously 4

Improve FSM for Code Detector Inputs: s,r,g,,; Outputs: u Wit u= s r g r s Strt u= r Red u= Blue g Green r Red2 u= u= u= Note: smll prolem still remins; we ll discuss lter New trnsition conditions detect if wrong utton pressed, returns to Wit FSM provides forml, concrete mens to ccurtely define desired ehvior Digitl Design Copyright 26 5

Stndrd Controller Architecture How implement FSM s sequentil circuit? Use stndrd rchitecture Stte register -- to store the present stte Comintionl logic -- to compute outputs, nd net stte For lser timer FSM 2-it stte register, cn represent four sttes Inputs: ; Outputs: = Off = = On On2 = On3 Input, output Known s controller FSM inputs I Comintionl logic S m m O FSM outputs FSM inputs Comintionl logic s s Stte register n n FSM outputs m-it stte register Digitl Design Copyright 26 N Generl version 6

Stte Digrm Emple Modify the lser pulse genertor stte digrm (elow left), so tht the new FSM will only produce one pulse (3 cycles wide) for ech ctution of... or stted nother wy, one pulse out for one pulse in. Inputs: ; Outputs: = Off Inputs: ; Outputs: Off = On = On2 = On3 On On2 On3 Digitl Design Copyright 26 7

Controller Design 3.4 Five step controller design process Digitl Design Copyright 26 8

Controller Design: Lser Timer Emple Step : Cpture the FSM Alredy done Step 2: Crete rchitecture 2-it stte register (for 4 sttes) Input, output Inputs: ; Outputs: = Off = = = On On2 On3 Net stte signls n, n Step 3: Encode the sttes Any encoding with ech stte unique will work (in lue) FSM inputs Comintionl logic s s Stte register n n FSM outputs Digitl Design Copyright 26 9

Controller Design: Lser Timer Emple (cont) Step 4: Crete stte tle Inputs: ; Outputs: = Off = = = On On2 On3 FSM inputs Comintionl logic s s n n FSM outputs Stte register Digitl Design Copyright 26 2

Controller Design: Lser Timer Emple (cont) Step 5: Implement comintionl logic FSM inputs Comintionl logic s s n n FSM outputs Stte register = s + s (note from the tle tht = if s = or s = ) n = s s + s s + ss + ss n = s s + ss n = s s + ss + ss n = s s + ss Digitl Design Copyright 26 2

Controller Design: Lser Timer Emple (cont) Step 5: Implement comintionl logic (cont) FSM inputs Comintionl Logic Comintionl logic s s n n FSM outputs n Stte register n s s Stte register = s + s n = s s + ss n = s s + ss Digitl Design Copyright 26 22

Understnding the Controller s Behvior = Off = = = On On2 On3 = Off = = = On On2 On3 = Off = = = On On2 On3 s s n n s s n n s s n n stte= stte= stte= Inputs: Outputs: Digitl Design Copyright 26 23

Controller Emple: Button Press Synchronizer cycle cycle2 cycle3 cycle4 i Button press synchronizer controller o Inputs: i Outputs: o Wnt simple sequentil circuit tht converts utton press to single cycle durtion, regrdless of length of time tht utton ctully pressed We ssumed such n idel utton press signl in erlier emple, like the utton in the lser timer controller Digitl Design Copyright 26 24

Controller Emple: Button Press Synchronizer (cont) FSM inputs: i; FSM outputs: o i i i A B i C i i o= o= o= FSM inputs i Comintionl logic s s Stte register o n n FSM outputs Step 2: Crete rchitecture n = s si + ssi n = s s i o = s si + s si = ss Step : FSM Comintionl logic o FSM inputs: i; FSM outputs: o i i i i i i o= o= o= Step 3: Encode sttes A B C unused Comintionl logic Inputs Outputs s s i n n o i s s Stte register n n Digitl Design Copyright 26 Step 4: Stte tle Step 5: Crete comintionl circuit 25

Controller Emple: Sequence Genertor Wnt generte sequence,,,, (repet) Ech vlue for one clock cycle Common, e.g., to crete pttern in 4 lights, or control mgnets of stepper motor Inputs: none; Outputs: w,,y,z wyz= wyz= A D B C wyz= wyz= Step : Crete FSM Comintionl logic s s Stte register n n Step 2: Crete rchitecture w y z Inputs: none; Outputs: w,,y,z wyz= wyz= A B D C wyz= wyz= Step 3: Encode sttes Digitl Design Copyright 26 Step 4: Crete stte tle w = s = ss y = s s z = s n = s or s n = s s s Stte register n w y z n Step 5: Crete comintionl circuit 26

Controller Emple: Secure Cr Key (from erlier emple) Inputs: ; Outputs: r Step Wit r= K K2 K3 K4 r= r= r= r= r Step 2 Comintionl logic n2 n n s2 s s Stte register Step 3 r= r= r= r= r= Digitl Design Copyright 26 Inputs: ; Outputs: r Step 4 We ll omit Step 5 circuits from equtions is old ht y now. 27

Emple: Seq. Circuit to FSM (Reverse Engineering).k.. Circuit Anlysis Wht does this circuit do? y z y=s z = ss n=(s or s) n=(s *s ) A D Outputs: y, z B C sttes n n A yz= D yz= B yz= C yz= sttes with outputs s s Stte register Work ckwrds Inputs: ; Outputs:y, z A D yz= B C yz= yz= Digitl Design Copyright 26 Pick ny stte nmes you wnt yz= sttes with outputs nd trnsitions 28

Common Pitflls Regrding Trnsition Properties Only one condition should e true For ll trnsitions leving stte = net stte? Else, which one? One condition must e true For ll trnsitions leving stte wht if =? Else, where go? Digitl Design Copyright 26 29

Defining the FSM using VHDL Using the model put forth y the uthor there will e two process sttements Comintionl logic (net stte logic nd output logic comined) Stte register Modeling the stte register Assume cs (current stte) nd ns (net stte) re it vectors process () egin if ( event nd = ) then cs <= ns; end if; end process; This register is uilt with rising edge triggered D-FF s. Digitl Design Copyright 26 3

FSM w/ VHDL (cont.) For flling-edge triggered register process () egin if ( event nd = ) then cs <= ns; end if; end process; For rising-edge triggered register, with sync. reset process (, reset) egin if (reset = ) then cs <= ; elsif ( event nd = ) then cs <= ns; end if; end process; For flling-edge triggered register, with sync. ctive-low reset Digitl Design Copyright 26 process (, reset) egin if ( event nd = ) then if (reset = ) then cs <= ; else cs <= ns; end if; end if; end process; 3

FSM w/ VHDL (cont.) If you define enumerte new type, life will e esier Emple: rchitecture Behviorl of duledgedetect is type sttetype is (init, rising, wit4flling, flling); signl ns, cs: sttetype; egin Note the stte nmes in Modelsim very hndy no decoding required. Another enefit for using enumerted types for nming sttes is when designing the comintoril logic lock Digitl Design Copyright 26 32

FSM w/ VHDL (cont.) Setup comintoril logic lock in process sttement nd cse sttement: Inputs: i; Outputs: z = zr,zf i z = init i z= i i' z= z= rising Digitl Design Copyright 26 wit4flling i i' flling process(i, cs) egin cse cs is when init => if i='' then ns <= init; else ns <= rising; end if; zr <= ; zf <= ; when rising => if i='' then ns <=flling; else ns <= wit4flling; end if; zr <= ; zf <= ; when wit4flling => if i='' then ns <= flling; else ns <= wit4flling; end if; zr <= ; zf <= ; when flling => ns <= init; zr <= ; zf <= ; when others => ns <= init; zr <= ; zf <= ; end cse; end process; 33