Digital Electronics Sequential Logic

Similar documents
Computers also need devices capable of Storing data and information Performing mathematical operations on such data

Sequential vs. Combinational

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Synchronous Sequential Logic

ELEC Digital Logic Circuits Fall 2014 Sequential Circuits (Chapter 6) Finite State Machines (Ch. 7-10)

Counters. We ll look at different kinds of counters and discuss how to build them

ELCT201: DIGITAL LOGIC DESIGN

Different encodings generate different circuits

LOGIC CIRCUITS. Basic Experiment and Design of Electronics

Chapter #7: Sequential Logic Case Studies Contemporary Logic Design

CPE100: Digital Logic Design I

Introduction EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 6: Sequential Logic 3 Registers & Counters 5/9/2010

Topic 8: Sequential Circuits

6. Finite State Machines

14:332:231 DIGITAL LOGIC DESIGN

L4: Sequential Building Blocks (Flip-flops, Latches and Registers)

Vidyalankar S.E. Sem. III [ETRX] Digital Circuits and Design Prelim Question Paper Solution

Synchronous Sequential Circuit Design. Digital Computer Design

ELCT201: DIGITAL LOGIC DESIGN

LOGIC CIRCUITS. Basic Experiment and Design of Electronics. Ho Kyung Kim, Ph.D.

Digital Design. Sequential Logic

Digital Logic and Design (Course Code: EE222) Lecture 19: Sequential Circuits Contd..

Ch 7. Finite State Machines. VII - Finite State Machines Contemporary Logic Design 1

Appendix B. Review of Digital Logic. Baback Izadi Division of Engineering Programs

Design of Sequential Circuits

Chapter 7 Sequential Logic

Appendix A: Digital Logic. Principles of Computer Architecture. Principles of Computer Architecture by M. Murdocca and V. Heuring

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

L4: Sequential Building Blocks (Flip-flops, Latches and Registers)

FSM model for sequential circuits

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 7 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

CPE100: Digital Logic Design I

Fundamentals of Digital Design

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

CSE140: Components and Design Techniques for Digital Systems. Midterm Information. Instructor: Mohsen Imani. Sources: TSR, Katz, Boriello & Vahid


Time Allowed 3:00 hrs. April, pages

The Design Procedure. Output Equation Determination - Derive output equations from the state table

Fundamentals of Computer Systems

Finite State Machine (FSM)

Models for representing sequential circuits

Lecture 10: Synchronous Sequential Circuits Design

Chapter 3. Chapter 3 :: Topics. Introduction. Sequential Circuits

Sequential Logic Worksheet

Lecture 7: Logic design. Combinational logic circuits

ECE/Comp Sci 352 Digital Systems Fundamentals. Charles R. Kime Section 2 Fall Logic and Computer Design Fundamentals

15.1 Elimination of Redundant States

Topic 8: Sequential Circuits. Bistable Devices. S-R Latches. Consider the following element. Readings : Patterson & Hennesy, Appendix B.4 - B.

3. Complete the following table of equivalent values. Use binary numbers with a sign bit and 7 bits for the value

Latches. October 13, 2003 Latches 1

Integrated Circuits & Systems

Sequential Circuit Design

14.1. Unit 14. State Machine Design

Show that the dual of the exclusive-or is equal to its compliment. 7

Overview of Chapter 4

ALU, Latches and Flip-Flops

Department of Electrical & Electronics EE-333 DIGITAL SYSTEMS

EECS150 - Digital Design Lecture 11 - Shifters & Counters. Register Summary

Week-5. Sequential Circuit Design. Acknowledgement: Most of the following slides are adapted from Prof. Kale's slides at UIUC, USA.

ECE 341. Lecture # 3

Sequential Logic. Rab Nawaz Khan Jadoon DCS. Lecturer COMSATS Lahore Pakistan. Department of Computer Science

Sequential Circuits Sequential circuits combinational circuits state gate delay

CPE/EE 422/522. Chapter 1 - Review of Logic Design Fundamentals. Dr. Rhonda Kay Gaede UAH. 1.1 Combinational Logic

Fundamentals of Computer Systems

Review for B33DV2-Digital Design. Digital Design

Fundamentals of Computer Systems

5. Sequential Logic x Computation Structures Part 1 Digital Circuits. Copyright 2015 MIT EECS

S.Y. Diploma : Sem. III [CO/CM/IF/CD/CW] Digital Techniques

( c) Give logic symbol, Truth table and circuit diagram for a clocked SR flip-flop. A combinational circuit is defined by the function

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

CPE100: Digital Logic Design I

COE 202: Digital Logic Design Sequential Circuits Part 4. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

Chapter 3 Digital Logic Structures

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

EECS150 - Digital Design Lecture 23 - FSMs & Counters

State and Finite State Machines

EECS Components and Design Techniques for Digital Systems. FSMs 9/11/2007

I. Motivation & Examples

Synchronous Sequential Circuit Design. Dr. Ehab A. H. AL-Hialy Page 1

EE 209 Logic Cumulative Exam Name:

Digital Circuit Engineering

Digital Electronics Circuits 2017

EET 310 Flip-Flops 11/17/2011 1

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

Review: Designing with FSM. EECS Components and Design Techniques for Digital Systems. Lec 09 Counters Outline.

Chapter 7. Sequential Circuits Registers, Counters, RAM

Chapter 4 Part 2 Sequential Circuits

Sequential Logic Circuits

Let s now begin to formalize our analysis of sequential machines Powerful methods for designing machines for System control Pattern recognition Etc.

CSE370 HW6 Solutions (Winter 2010)

Unit II Chapter 4:- Digital Logic Contents 4.1 Introduction... 4

Synchronous Sequential Circuit

SYNCHRONOUS SEQUENTIAL CIRCUITS

Example: vending machine

10/12/2016. An FSM with No Inputs Moves from State to State. ECE 120: Introduction to Computing. Eventually, the States Form a Loop

Vidyalankar S.E. Sem. III [CMPN] Digital Logic Design and Analysis Prelim Question Paper Solution

Memory Elements I. CS31 Pascal Van Hentenryck. CS031 Lecture 6 Page 1

Adders allow computers to add numbers 2-bit ripple-carry adder

Preparation of Examination Questions and Exercises: Solutions

CprE 281: Digital Logic

Transcription:

/5/27 igital Electronics Sequential Logic r. I. J. Wassell Sequential Logic The logic circuits discussed previously are known as combinational, in that the output depends only on the condition of the latest inputs However, we will now introduce a type of logic where the output depends not only on the latest inputs, but also on the condition of earlier inputs. These circuits are known as sequential, and implicitly they contain memory elements

/5/27 Memory Elements memory stores data usually one bit per element snapshot of the memory is called the one bit memory is often called a bistable, i.e., it has 2 stable internal s Flip-flops and latches are particular implementations of bistables S Latch n S latch is a memory element with 2 inputs: eset () and Set (S) and 2 outputs: and. S S Where and comment hold reset set illegal is the next is the current 2

/5/27 S Latch - Operation 2 S NO truth table a b y b complemented always = and S = Gate output in always condition, Gate 2 in complement condition, so This is the ()eset condition S Latch - Operation 2 S NO truth table a b y b complemented always S = and to Gate 2 remains in complement condition, Gate into complement condition, This is the hold condition 3

/5/27 S Latch - Operation 2 S NO truth table a b y b complemented always S = and = Gate into complement condition, Gate 2 in always condition, This is the (S)et condition S S Latch - Operation 2 S = and = Gate in always condition, Gate 2 in always condition, This is the illegal condition NO truth table a b y b complemented always 4

/5/27 S Latch State Transition Table transition table is an alternative way of viewing its operation S comment hold reset set illegal hold reset set illegal transition table can also be expressed in the form of a diagram S Latch State iagram diagram in this case has 2 s, i.e., = and = The diagram shows the input conditions required to transition between s. In this case we see that there are 4 possible transitions We will consider them in turn 5

/5/27 S S Latch State iagram comment hold reset set illegal hold reset set illegal From the table we can see: S. S. S. S.( ) S. S S. ( S S).( S ) S From the table we can see: S. S..( S S) S Latch State iagram S comment hold reset set illegal hold reset set illegal From the table we can see: S. S..( S S) From the table we can see: S. 6

/5/27 S Latch State iagram Which gives the following diagram: S. S similar diagram can be constructed for the output We will see later that diagrams are a useful tool for designing sequential systems Clocks and Synchronous Circuits For the S latch we have just described, we can see that the output changes occur directly in response to changes in the inputs. This is called asynchronous operation However, virtually all sequential circuits currently employ the notion of synchronous operation, that is, the output of a sequential circuit is constrained to change only at a time specified by a global enabling signal. This signal is generally known as the system clock 7

/5/27 Clocks and Synchronous Circuits The Clock: What is it and what is it for? Typically it is a square wave signal at a particular frequency It imposes order on the changes llows lots of s to appear to update simultaneously How can we modify an asynchronous circuit to act synchronously, i.e., in synchronism with a clock signal? Transparent Latch We now modify the S Latch such that its output is only permitted to change when a valid enable signal (which could be the system clock) is present This is achieved by introducing a couple of N gates in cascade with the and S inputs that are controlled by an additional input known as the enable (EN) input. 8

/5/27 Transparent Latch Symbol EN S See from the N truth table: if one of the inputs, say a is, the output is always Output follows b input if a is The complement function ensures that and S can never be at the same time, i.e., illegal avoided a EN N truth table b y Transparent Latch EN X EN S comment S hold S reset S set See follows input provided EN=. If EN=, maintains previous 9

/5/27 Master-Slave Flip-Flops The transparent latch is so called level triggered. We can see it exhibits transparent behaviour if EN=. It is often more simple to design sequential circuits if the outputs change only on the either rising (positive going) or falling (negative going) edges of the clock (i.e., enable) signal We can achieve this kind of operation by combining 2 transparent latches in a so called Master-Slave configuration Master-Slave Flip-Flop Master Slave Symbol int CLK To see how this works, we will use a timing diagram Note that both latch inputs are effectively connected to the clock signal (admittedly one is a complement of the other)

/5/27 Master-Slave Flip-Flop Master Slave CLK int See changes on rising edge of CLK CLK CLK int Note propagation delays have been neglected in the timing diagram Flip-Flops The Master-Slave configuration has now been superseded by new F-F circuits which are easier to implement and have better performance When designing synchronous circuits it is best to use truly edge triggered F-F devices We will not consider the design of such F-Fs on this course

/5/27 Other Types of Flip-Flops Historically, other types of Flip-Flops have been important, e.g., J-K Flip- Flops and T-Flip-Flops However, J-K FFs are a lot more complex to build than -types and so have fallen out of favour in modern designs, e.g., for field programmable gate arrays (FPGs) and VLSI chips Other Types of Flip-Flops Consequently we will only consider synchronous circuit design using -type FFs However for completeness we will briefly look at the truth table for J-K and T type FFs 2

/5/27 J-K Flip-Flop The J-K FF is similar in function to a clocked S FF, but with the illegal replaced with a new toggle J K comment Symbol Where and hold reset set toggle is the next is the current J K T Flip-Flop This is essentially a J-K FF with its J and K inputs connected together and renamed as the T input Symbol T comment Where and hold toggle is the next is the current T 3

/5/27 synchronous Inputs It is common for the FF types we have mentioned to also have additional so called asynchronous inputs They are called asynchronous since they take effect independently of any clock or enable inputs eset/clear force to Preset/Set force to Often used to force a synchronous circuit into a known, say at start-up. Timing Various timings must be satisfied if a FF is to operate properly: Setup time: Is the minimum duration that the data must be stable at the input before the clock edge Hold time: Is the minimum duration that the data must remain stable on the FF input after the clock edge 4

/5/27 Timing CLK tsu th t t t su h p t p Set-up time Hold time Propagation delay pplications of Flip-Flops Counters clocked sequential circuit that goes through a predetermined sequence of s commonly used counter is an n-bit binary counter. This has n FFs and 2 n s which are passed through in the order,, 2,.2 n -,,,. Uses include: Counting Producing delays of a particular duration Sequencers for control logic in a processor ivide by m counter (a divider), as used in a digital watch 5

/5/27 pplications of Flip-Flops Memories, e.g., Shift register Parallel loading shift register : can be used for parallel to serial conversion in serial data communication Serial in, parallel out shift register: can be used for serial to parallel conversion in a serial data communication system. Counters In most books you will see 2 basic types of counters, namely ripple counters and synchronous counters In this course we are concerned with synchronous design principles. ipple counters do not follow these principles and should generally be avoided if at all possible. We will now look at the problems with ripple counters 6

/5/27 ipple Counters ripple counter can be made be cascading together negative edge triggered T-type FFs operating in toggle mode, i.e., T = 2 T T T CLK See that the FFs are not clocked using the same clock, i.e., this is not a synchronous design. This gives some problems. CLK ipple Counters We will now draw a timing diagram 2 2 3 4 5 6 7 Problems: See outputs do not change at the same time, i.e., synchronously. So hard to know when count output is actually valid. Propagation delay builds up from stage to stage, limiting maximum clock speed before miscounting occurs. 7

/5/27 ipple Counters If you observe the frequency of the counter output signals you will note that each has half the frequency, i.e., double the repetition period of the previous one. This is why counters are often known as dividers Often we wish to have a count which is not a power of 2, e.g., for a BC counter ( to 9).To do this: use FFs having a eset/clear input Use an N gate to detect the count of and use its output to eset the FFs Synchronous Counters Owing to the problems identified with ripple counters, they should not usually be used to implement counter functions It is recommended that synchronous counter designs be used In a synchronous design all the FF clock inputs are directly connected to the clock signal and so all FF outputs change at the same time, i.e., synchronously more complex combinational logic is now needed to generate the appropriate FF input signals (which will be different depending upon the type of FF chosen) 8

/5/27 Synchronous Counters We will now investigate the design of synchronous counters We will consider the use of -type FFs only, although the technique can be extended to cover other FF types. s an example, we will consider a to 7 up-counter Synchronous Counters To assist in the design of the counter we will make use of a modified transition table. This table has additional columns that define the required FF inputs (or excitation as it is known) Note we have used a transition table previously when determining the diagram for an S latch We will also make use of the so called excitation table for a -type FF First however, we will investigate the so called characteristic table and characteristic equation for a -type FF 9

/5/27 Characteristic Table In general, a characteristic table for a FF gives the next of the output, i.e., in terms of its current and current inputs Which gives the characteristic equation, ' i.e., the next output is equal to the current input value Since is independent of the characteristic table can be rewritten as Excitation Table The characteristic table can be modified to give the excitation table. This table tells us the required FF input value required to achieve a particular next from a given current s with the characteristic table it can be seen that, does not depend upon,, however this is not generally true for other FF types, in which case, the excitation table is more useful. Clearly for a -FF, ' 2

/5/27 Characteristic and Excitation Tables Characteristic and excitation tables can be determined for other FF types. These should be used in the design process if -type FFs are not used For example, for a J-K FF the following tables are appropriate: Characteristic and Excitation Tables J K J x x K x x Truth table Excitation table We will now determine the modified transition table for the example to 7 up-counter 2

/5/27 Modified State Transition Table In addition to columns representing the current and desired next s (as in a conventional transition table), the modified table has additional columns representing the required FF inputs to achieve the next desired FF s Modified State Transition Table For a to 7 counter, 3 -type FFs are needed Current Next FF The procedure is to: inputs Write down the desired ' ' ' 2 2 2 count sequence in the current columns ' ' Write down the required next s in the next columns Fill in the FF inputs required to give the defined next Note: Since (or ) for a -FF, the required FF inputs are identical to the Next 22

/5/27 Synchronous Counter Example If using J-K FFs for example, we need J and K input columns for each FF lso note that if we are using -type FFs, it is not necessary to explicitly write out the FF input columns, since we know they are identical to those for the next To complete the design we now have to determine appropriate combinational logic circuits which will generate the required FF inputs from the current s We can do this from inspection, using Boolean algebra or using K-maps. Synchronous Counter Example Current 2 Next FF inputs ' ' ' 2 2 By inspection, Note: FF is toggling lso, Use a K-map for 2,. 2 2 2. 2.. 2 23

/5/27. 2 Synchronous Counter Example 2 2. 2.. 2 So,. 2 2 2 2.(. 2. ).... 2 2 2 2 2 Combinational logic 2 CLK Synchronous Counter similar procedure can be used to design counters having an arbitrary count sequence Write down the transition table etermine the FF excitation (easy for -types) etermine the combinational logic necessary to generate the required FF excitation from the current s Note: remember to take into account any unused counts since these can be used as don t care s when determining the combinational logic circuits 24

/5/27 Shift egister shift register can be implemented using a chain of -type FFs 2 in CLK Has a serial input, in and parallel output, and 2. CLK in Shift egister 2 See data moves one position to the right on application of each clock edge 25

/5/27 Shift egister Preset and Clear inputs on the FFs can be utilised to provide a parallel data input feature ata can then be clocked out through 2 in a serial fashion, i.e., we now have a parallel in, serial out arrangement This along with the previous serial in, parallel out shift register arrangement can be used as the basis for a serial data link Serial ata Link 2 2 Parallel in serial out Serial ata Serial in parallel out CLK One data bit at a time is sent across the serial data link See less wires are required than for a parallel data link 26

/5/27 Synchronous State Machines Synchronous State Machines We have seen how we can use FFs (-types in particular) to design synchronous counters We will now investigate how these principles can be extended to the design of synchronous machines (of which counters are a subset) We will begin with some definitions and then introduce two popular types of machines 27

/5/27 efinitions Finite State Machine (FSM) a deterministic machine (circuit) that produces outputs which depend on its internal and external inputs States the set of internal memorised values, shown as circles on the diagram Inputs External stimuli, labelled as arcs on the diagram Outputs esults from the FSM Types of State Machines Two types of machines are in general use, namely Moore machines and Mealy machines We will see that the diagrams (and associated tables) corresponding with the 2 types of machine are slightly different 28

/5/27 Moore Machine Inputs Machine Schematics n Current Next combinational logic m m Optional combinational logic Outputs CLK Mealy Machine Current Inputs n Next combinational logic m m combinational logic Outputs CLK Moore vs. Mealy Machines Outputs from Mealy Machines depend upon the timing of the inputs Outputs from Moore machines come directly from clocked FFs so: They have guaranteed timing characteristics They are glitch free ny Mealy machine can be converted to a Moore machine and vice versa, though their timing properties will be different 29

/5/27 Moore Machine State iagram Example FSM has 3 s (, B and C), inputs e and r, and output s e e.r r e. r e. r B [] [] C [] e.r r e FF labels [s s ] In this case the output s is given by s, i.e., s=s See inputs only appear on transitions between s, i.e., next is given by current and current inputs Outputs determined from current via combinational logic (if required) Mealy Machine State iagram Example FSM has 3 s (, B and C), inputs x and y, and output s x. y / s y / s x. y / s B [] [] x. y / s C [] y / s x / s FF labels: [s s ] Transition labels: Inputs/Output Inputs and outputs appear on transitions between s, i.e., next is given by current and current inputs Output determined from current and inputs via combinational logic 3

/5/27 Moore Machine - Example We will design a Moore Machine to implement a traffic light controller In order to visualise the problem it is often helpful to draw the transition diagram This is used to generate the transition table The transition table is used to generate The next combinational logic The output combinational logic (if required) Example Traffic Light Controller See we have 4 s So in theory we could use a minimum of 2 FFs However, by using 3 FFs we will see that we do not need to use any output combinational logic G So, we will only use 4 of the 8 possible s In general, assignment is a difficult problem and the optimum choice is not always obvious 3

/5/27 Example Traffic Light Controller State State G State State By using 3 FFs (we will use -types), we can assign one to each of the required outputs (,, G), eliminating the need for output logic We now need to write down the transition table We will label the FF outputs, and G emember we do not need to explicitly include columns for FF excitation since if we use -types these are identical to the next Example Traffic Light Controller State State G State State Current G Next ' ' G Unused s,,, and. Since these s will never occur, we don t care what output the next combinational logic gives for these inputs. These don t care conditions can be used to simplify the required next combinational logic ' 32

/5/27 Example Traffic Light Controller Current G Next ' ' G Unused s,,, and. ' We now need to determine the next combinational logic For the FF, we need to determine To do this we will use a K-map G G X X X X.... Example Traffic Light Controller Current G Next ' ' G ' By inspection we can also see: and, G. Unused s,,, and. 33

/5/27 Example Traffic Light Controller G G CLK FSM Problems Consider what could happen on power-up The of the FFs could by chance be in one of the unused s This could potentially cause the machine to become stuck in some unanticipated sequence of s which never goes back to a used 34

/5/27 FSM Problems What can be done? Check to see if the FSM can eventually enter a known from any of the unused s If not, add additional logic to do this, i.e., include unused s in the transition table along with a valid next lternatively use asynchronous Clear and Preset FF inputs to set a known (used) at power up Example Traffic Light Controller oes the example FSM self-start? Check what the next logic outputs if we begin in any of the unused s Turns out: Start Next logic output Which are all valid s So it does self start 35

/5/27 Example 2 We extend Example so that the traffic signals spend extra time for the and G lights Essentially, we need 2 additional s, i.e., 6 in total. In theory, the 3 FF machine gives us the potential for sufficient s However, to make the machine combinational logic easier, it is more convenient to add another FF (labelled S), making 4 in total Example 2 State State State See that new FF toggles which makes the next logic easier FF labels G S State G State G State s before, the first step is to write down the transition table 36

/5/27 State State G State State FF labels G S Example 2 State G State Current G S Next ' ' G S Clearly a lot of unused s. When plotting k-maps to determine the next logic it is probably easier to plot s and s in the map and then mark the unused s ' ' Current G S Next ' ' G S ' Example 2 ' We will now use k-maps to determine the next combinational logic For the FF, we need to determine G G S X X X X S X X X X X X.... 37

/5/27 Current G S Next ' ' G S ' Example 2 ' We can plot k-maps for and G to give:. S G. S or. S. S S G. G. S G G. S. S or By inspection we can also see: S S State ssignment s we have mentioned previously, assignment is not necessarily obvious or straightforward epends what we are trying to optimise, e.g., Complexity (which also depends on the implementation technology, e.g., FPG, 74 series logic chips). FF implementation may take less chip area than you may think given their gate level representation Wiring complexity can be as big an issue as gate complexity Speed lgorithms do exist for selecting the optimising assignment, but are not suitable for manual execution 38

/5/27 State ssignment If we have m s, we need at least log 2 m FFs (or more informally, bits) to encode the s, e.g., for 8 s we need a min of 3 FFs We will now present an example giving various potential assignments, some using more FFs than the minimum Example Problem We wish to investigate some assignment options to implement a divide by 5 counter which gives a output for 2 clock edges and is for 3 clock edges CLK Output 39

/5/27 Sequential State ssignment Here we simply assign the s in an increasing natural binary count s usual we need to write down the transition table. In this case we need 5 s, i.e., a minimum of 3 FFs (or bits). We will designate the 3 FF outputs as c, b, and a We can then determine the necessary next logic and any output logic. Current c a Sequential State ssignment b Next c b a Unused s,, and. By inspection we can see: The required output is from FF b Plot k-maps to determine the next logic: For FF a: a b a c c X X X a a. c b a.c 4

/5/27 Current c a Sequential State ssignment b Next c b a Unused s,, and. For FF b: a b a c c X X X a.b a.b b b a. b a. b a b For FF c: a b a c c X X X a.b c a. b b Current c a b Sliding State ssignment Next c b a Unused s,,, and. By inspection we can see that we can use any of the FF outputs as the wanted output Plot k-maps to determine the next logic: For FF a: a b a c X c X X a b. c b b.c 4

/5/27 Sliding State ssignment Current c a b Next c b a By inspection we can see that: For FF b: b a For FF c: c b Unused s,,, and. Shift egister ssignment s the name implies, the FFs are connected together to form a shift register. In addition, the output from the final shift register in the chain is connected to the input of the first FF: Consequently the data continuously cycles through the register 42

/5/27 e d Shift egister ssignment Current c a b e Next d c b a Unused s. Lots! Because of the shift register configuration and also from the table we can see that: a e b a c b d c e d By inspection we can see that we can use any of the FF outputs as the wanted output See needs 2 more FFs, but no logic and simple wiring One Hot State Encoding This is a shift register design style where only one FF at a time holds a Consequently we have FF per, compared with log 2 m for sequential assignment However, can result in simple fast machines Outputs are generated by Oing together appropriate FF outputs 43

/5/27 One Hot - Example We will return to the traffic signal example, which recall has 4 s G For hot, we need FF for each, i.e., 4 in this case The FFs are connected to form a shift register as in the previous shift register example, however in hot, only FF holds a at any time We can write down the transition table as follows G One Hot - Example r Current ra g a Next r ra g a Unused s. Lots! Because of the shift register configuration and also from the table we can see that: a g ra r r a g ra To generate the, and G outputs we do the following Oing: r ra ra a G g 44

/5/27 One Hot - Example a g g ra ra r r a r ra ra a G g r r ra g ra g a a CLK G Tripos Example The diagram for a synchroniser is shown. It has 3 s and 2 inputs, namely e and r. The s are mapped using sequential assignment as shown. e e. r e. r e.r Sync Hunt [] [] Sight [] e.r r e r FF labels [s s ] n output, s should be true if in Sync 45

/5/27 Tripos Example e e. r e. r e.r Sync Hunt [] [] e.r Sight [] Unused From inspection, s s r e r Current s s Input Next e r ' ' s s X X X X X X X X Current Input Next s s e r ' ' s s X X X X X X X X Tripos Example Plot k-maps to determine the next logic For FF : s e r s s s.e X X r X e X s. e. r s s.r s e s. r s. e. r. 46

/5/27 Current s s Input Next e r ' ' s s X X X X X X X X Tripos Example Plot k-maps to determine the next logic For FF : e e r s s s s.e X X r X X s e s. s. r. s s s. r. Tripos Example We will now re-implement the synchroniser using a hot approach In this case we will need 3 FFs e e. r e. r e.r Sync Hunt [] [] Sight [] e.r r e r FF labels [s 2 s s ] n output, s should be true if in Sync From inspection, s s2 47

/5/27 e e. r e. r e.r Sync Hunt [] [] Sight [] Tripos Example e.r r e r Current s 2 s s Input Next e r ' ' ' s 2 s s X X X X emember when interpreting this table, because of the - hot shift structure, only FF is at a time, consequently it is straightforward to write down the next equations Tripos Example Current s 2 s s Input Next e r ' ' ' s 2 s s X X X X For FF 2: 2 s. e. r s2. e s2. e. r For FF : s. r s. e For FF : s r s. e. r s. e. r. 2 48

/5/27 e e. r e. r e.r Sync Hunt [] [] Sight [] Tripos Example e.r r e r Note that it is not strictly necessary to write down the table, since the next equations can be obtained from the diagram It can be seen that for each variable, the required equation is given by terms representing the incoming arcs on the graph For example, for FF 2: 2 s. e. r s2. e s2. e. r lso note some simplification is possible by noting that: s 2 s s (which is equivalent to e.g., s2 s s ) Tripos Example So in this example, the hot is easier to design, but it results in more hardware compared with the sequential assignment design 49

/5/27 Elimination of edundant States Sometimes, when designing machines it is possible that unnecessary s may be introduced In general, reducing the number of s may reduce the number of FFs required and may also reduce the complexity of the next logic owing to the presence of more unused s (don t cares) Elimination of edundant States - Example Consider the following State Table that corresponds with a Mealy Machine implementation This is so, since the inputs and outputs from the machine are on the transitions (arcs) between s The following table is drawn in a compact form by incorporating the 2 possible input values as parallel columns within both the next and output columns of the table 5

/5/27 5 Example Current State Next State Output (Z) C E G I K P M B F H J N L B C E G F H I J K L M N P X= X= X= X= From the table, we see that there is no way of telling s H and I apart, so we can replace I with H when it appears in the Next State portion of the table Example Current State Next State Output (Z) C E G H K P M B F H J N L B C E G F H J K L M N P X= X= X= X= We also see that there is now no way to get to I so we can remove row I from the table Similarly, rows K, M, N and P have the same next and output as H and can be replaced by H

/5/27 Current State B C E F G H J L Next State Output (Z) X= X= X= X= B F H J C E G H H L H H H Example Similarly, there is now no way to get to s K, M, N and P and so we can remove these rows from the table lso, the next and outputs are identical for rows J and L, thus L can be replaced by J and row L eliminated from the table Current State B C E F G H J Next State Output (Z) X= X= X= X= B F H J C E G H H J H H H Example Now rows and G are identical, as are rows E and F. Consequently, G can be replaced by, and row G eliminated. lso, F can be replaced by E and row F eliminated from the table 52

/5/27 Current State B C E H J Next State Output (Z) X= X= X= X= B E H J C E H H Example The procedure employed to find equivalent s in this example is known as row matching. However, we note row matching is not sufficient to find all the equivalent s except for certain special cases Implementation of FSMs We saw previously that programmable logic can be used to implement combinational logic circuits, i.e., using PL devices PL style devices have been modified to include -type FFs to permit FSMs to be implemented using programmable logic One particular style is known as Generic Logic rray (GL) 53

/5/27 GL evices They are similar in concept to PLs, but have the option to make use of a -type flipflops in the O plane (one following each O gate). In addition, the outputs from the - types are also made available to the N plane (in addition to the usual inputs) Consequently it becomes possible to build programmable sequential logic circuits N plane GL evice O plane 54

/5/27 GL evices modified form of a GL known as a Generic rray Logic (GL) is used in the Hardware Laboratory classes to implement various FSMs. GL evices a b N plane O plane f CLK f n 55

/5/27 FPG Field Programmable Gate rrays (FPGs) are the latest type of programmable logic re an array of configurable logic blocks (CLBs) surrounded by Input Output Blocks (IOBs): programmable routing channels permit CLBs to be connected to other CLBs and to IOBs CLBs contain look up tables (LUTs), multiplexers (MUXs) and -type FFs The FPG is configured by specifying the contents of the LUTs and select signals for the MUXs FPG Xilinx Spartan 56

/5/27 FPG Xilinx Spartan Simplified schematic showing CLBs and programmable routing channels, i.e., wires plus programmable switch matrices (SMs) FPG - Spartan CLB 57

/5/27 FPG - Spartan CLB Has 2, 4-input LUTs (F and G) and, 3 input LUT (H) Has to combinational outputs (Y and X) and 2 registered outputs (i.e., from -FFs) Y and X epending on MUX configuration Y is given by output of either G or H LUTs and X from either F or H LUTs. -FF inputs come from IN, or from F, G, or H LUTs FPG - Spartan CLB Thus each CLB can perform up to 2 combinational and/or 2 registered functions ll functions can involve at least 4 input variables (e.g., G to G4, and F to F4), but can be up to 9 (owing to the possibility of implementing 2-level combinational logic functions), i.e., G to G4, F to F4, IN. Created using either a schematic (block) diagram or more likely a Hardware escription Language (HL) of the design 58

/5/27 FPG - Spartan CLB The synthesis tool determines how the LUTs, MUXs and routing channels are configured This configuration information is then downloaded to the FPG Xilinx devices store their configuration information in static M (SM) so can be easily reprogrammed The SM contents can be downloaded either from a computer or from an EEPOM device when the system is powered-up FPG Other FPG manufacturers are available, e.g., ltera. Particular manufacturers have many different product lines Main differences will be the no. of CLBs, the structure of the CLBs, internal or external OM, additional features such as specialised arithmetic blocks, user M etc. 59

/5/27 ppendix Workshop 2 Contact B Contact Contact B Contact ppendix Workshop 2 6