CSE140L: Components and Design Techniques for Digital Systems Lab. FSMs. Tajana Simunic Rosing. Source: Vahid, Katz

Similar documents
CSE140L: Components and Design Techniques for Digital Systems Lab. CPU design and PLDs. Tajana Simunic Rosing. Source: Vahid, Katz

L11/12: Reconfigurable Logic Architectures

L12: Reconfigurable Logic Architectures

Chapter 7 Memory and Programmable Logic

Faculty of Electrical & Electronics Engineering BEE3233 Electronics System Design. Laboratory 3: Finite State Machine (FSM)

Combinational vs Sequential

Read-only memory (ROM) Digital logic: ALUs Sequential logic circuits. Don't cares. Bus

Introduction Actel Logic Modules Xilinx LCA Altera FLEX, Altera MAX Power Dissipation

Field Programmable Gate Arrays (FPGAs)

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

Why FPGAs? FPGA Overview. Why FPGAs?

9 Programmable Logic Devices

Sequential Circuits. Output depends only and immediately on the inputs Have no memory (dependence on past values of the inputs)

Sequencing. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Fall,

March 13, :36 vra80334_appe Sheet number 1 Page number 893 black. appendix. Commercial Devices

Modeling Digital Systems with Verilog

Register Transfer Level (RTL) Design Cont.

CSE115: Digital Design Lecture 23: Latches & Flip-Flops


Figure 1: segment of an unprogrammed and programmed PAL.

Difference with latch: output changes on (not after) falling clock edge

Introduction to Digital Logic Missouri S&T University CPE 2210 Exam 3 Logistics

IE1204 Digital Design F11: Programmable Logic, VHDL for Sequential Circuits

CHAPTER1: Digital Logic Circuits

IE1204 Digital Design. F11: Programmable Logic, VHDL for Sequential Circuits. Masoumeh (Azin) Ebrahimi

CSE 140 Exam #3 Tajana Simunic Rosing

L14: Quiz Information and Final Project Kickoff. L14: Spring 2004 Introductory Digital Systems Laboratory

Lecture 10: Programmable Logic

S.K.P. Engineering College, Tiruvannamalai UNIT I

Digital Integrated Circuits EECS 312

ECE 263 Digital Systems, Fall 2015

Sequential logic. Circuits with feedback. How to control feedback? Sequential circuits. Timing methodologies. Basic registers

Computer Architecture and Organization

Chapter 5. Introduction

Memory, Latches, & Registers

A Tour of PLDs. PLD ARCHITECTURES. [Prof.Ben-Avi]

CSE140: Components and Design Techniques for Digital Systems. More D-Flip-Flops. Tajana Simunic Rosing. Sources: TSR, Katz, Boriello & Vahid

Computer Systems Architecture

Principles of Computer Architecture. Appendix A: Digital Logic

COE328 Course Outline. Fall 2007

Examples of FPLD Families: Actel ACT, Xilinx LCA, Altera MAX 5000 & 7000

Switching Circuits & Logic Design, Fall Final Examination (1/13/2012, 3:30pm~5:20pm)

CPS311 Lecture: Sequential Circuits

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

Microprocessor Design

Digital Design, Kyung Hee Univ. Chapter 5. Synchronous Sequential Logic


11. Sequential Elements

CSE 140 Exam #3 Solution Tajana Simunic Rosing

DIGITAL CIRCUIT LOGIC UNIT 11: SEQUENTIAL CIRCUITS (LATCHES AND FLIP-FLOPS)

WINTER 14 EXAMINATION

Chapter Contents. Appendix A: Digital Logic. Some Definitions

Chapter 5 Flip-Flops and Related Devices

Copyright 2011 by Enoch Hwang, Ph.D. and Global Specialties. All rights reserved. Printed in Taiwan.

Laboratory Exercise 7

Lecture 6: Simple and Complex Programmable Logic Devices. EE 3610 Digital Systems

Objectives. Combinational logics Sequential logics Finite state machine Arithmetic circuits Datapath

EECS150 - Digital Design Lecture 15 Finite State Machines. Announcements

TYPICAL QUESTIONS & ANSWERS

Logic and Computer Design Fundamentals. Chapter 7. Registers and Counters

Lecture 10: Sequential Circuits

Chapter 5 Synchronous Sequential Logic

problem maximum score 1 28pts 2 10pts 3 10pts 4 15pts 5 14pts 6 12pts 7 11pts total 100pts

Logic Design. Flip Flops, Registers and Counters

EE 447/547 VLSI Design. Lecture 9: Sequential Circuits. VLSI Design EE 447/547 Sequential circuits 1

DIGITAL SYSTEM FUNDAMENTALS (ECE421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE422) LATCHES and FLIP-FLOPS

FPGA Design with VHDL

Modeling Latches and Flip-flops

DIGITAL CIRCUIT LOGIC UNIT 9: MULTIPLEXERS, DECODERS, AND PROGRAMMABLE LOGIC DEVICES

More on Flip-Flops Digital Design and Computer Architecture: ARM Edition 2015 Chapter 3 <98> 98

VU Mobile Powered by S NO Group

WINTER 15 EXAMINATION Model Answer

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

RELATED WORK Integrated circuits and programmable devices

YEDITEPE UNIVERSITY DEPARTMENT OF COMPUTER ENGINEERING. EXPERIMENT VIII: FLIP-FLOPS, COUNTERS 2014 Fall

Saturated Non Saturated PMOS NMOS CMOS RTL Schottky TTL ECL DTL I I L TTL

L14: Final Project Kickoff. L14: Spring 2006 Introductory Digital Systems Laboratory

D Latch (Transparent Latch)

L13: Final Project Kickoff. L13: Spring 2005 Introductory Digital Systems Laboratory

Reconfigurable Architectures. Greg Stitt ECE Department University of Florida

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science SOLUTIONS

Report on 4-bit Counter design Report- 1, 2. Report on D- Flipflop. Course project for ECE533

CS8803: Advanced Digital Design for Embedded Hardware

2.6 Reset Design Strategy

Registers and Counters

Experiment # 12. Traffic Light Controller

Logic Design ( Part 3) Sequential Logic- Finite State Machines (Chapter 3)

The outputs are formed by a combinational logic function of the inputs to the circuit or the values stored in the flip-flops (or both).

Unit 11. Latches and Flip-Flops

California State University, Bakersfield Computer & Electrical Engineering & Computer Science ECE 3220: Digital Design with VHDL Laboratory 7

Electrical and Telecommunications Engineering Technology_TCET3122/TC520. NEW YORK CITY COLLEGE OF TECHNOLOGY The City University of New York

Unit-5 Sequential Circuits - 1

CSCB58 - Lab 4. Prelab /3 Part I (in-lab) /1 Part II (in-lab) /1 Part III (in-lab) /2 TOTAL /8

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY CS 2202 DIGITAL PRINCIPLES AND SYSTEM DESIGN

Outline. CPE/EE 422/522 Advanced Logic Design L04. Review: 8421 BCD to Excess3 BCD Code Converter. Review: Mealy Sequential Networks

When the OR-array is pre-programed (fixed) and the AND-array. is programmable, you have what is known as a PAL/GAL. These are very low

Sequential Logic Circuits

Side Street. Traffic Sensor. Main Street. Walk Button. Traffic Lights

Asynchronous (Ripple) Counters

First Name Last Name November 10, 2009 CS-343 Exam 2

Transcription:

CSE140L: Components and Design Techniques for Digital Systems Lab FSMs Tajana Simunic Rosing Source: Vahid, Katz 1

Flip-flops Hardware Description Languages and Sequential Logic representation of clocks - timing of state changes asynchronous vs. synchronous FSMs structural view (FFs separate from combinational logic) behavioral view (synthesis of sequencers not in this course) Datapath = data computation (e.g., ALUs, comparators) + registers use of arithmetic/logical operators control of storage elements

FSM design example Moore vs. Mealy Remove one 1 from every string of 1s on the input Moore Mealy zero [0] 1 0 zero [0] 0/0 0 0 one1 [0] 1 two1s [1] 1 0/0 one1 [0] 1/0 1/1

Verilog FSM - Reduce 1s example Moore machine module reduce (clk, reset, in, out); input clk, reset, in; output out; state assignment (easy to change, if in one place) parameter zero = 2 b00; parameter one1 = 2 b01; parameter two1s = 2 b10; reg out; reg [2:1] state; reg [2:1] next_state; // state variables always @(posedge clk) if (reset) state = zero; else state = next_state; 0 0 zero [0] 1 one1 [0] 1 two1s [1] 0 1

Moore Verilog FSM (cont d) always @(in or state) case (state) zero: // last input was a zero begin if (in) next_state = one1; else next_state = zero; end one1: // we've seen one 1 begin if (in) next_state = two1s; else next_state = zero; end two1s: // we've seen at least 2 ones begin if (in) next_state = two1s; else end endcase next_state = zero; crucial to include all signals that are input to state determination note that output depends only on state always @(state) case (state) zero: out = 0; one1: out = 0; two1s: out = 1; endcase endmodule

Mealy Verilog FSM module reduce (clk, reset, in, out); input clk, reset, in; output out; reg out; reg state; // state variables reg next_state; always @(posedge clk) if (reset) state = zero; else state = next_state; always @(in or state) case (state) zero: begin out = 0; // last input was a zero if (in) next_state = one; else next_state = zero; end one: // we've seen one 1 if (in) begin next_state = one; out = 1; end else begin next_state = zero; out = 0; end endcase endmodule 0/0 zero [0] one1 [0] 1/0 0/0 1/1

Synchronous Mealy Machine module reduce (clk, reset, in, out); input clk, reset, in; output out; reg out; reg state; // state variables always @(posedge clk) if (reset) state = zero; else case (state) zero: begin out = 0; // last input was a zero if (in) state = one; else state = zero; end one: // we've seen one 1 if (in) begin state = one; out = 1; end else begin state = zero; out = 0; end endcase endmodule

Example: Traffic light controller Highway/farm road intersection farm road car sensors highway

Traffic light controller (cont.) Detectors C sense the presence of cars waiting on the farm road with no car on farm road, light remain green in highway direction if vehicle on farm road, highway lights go from Green to Yellow to Red, allowing the farm road lights to become green these stay green only as long as a farm road car is detected but never longer than a set interval; after the interval expires, farm lights transition from Green to Yellow to Red, allowing highway to return to green even if farm road vehicles are waiting, highway gets at least a set interval of green Assume you have an interval timer that generates: a short time pulse (TS) and a long time pulse (TL), in response to a set (ST) signal. TS is to be used for timing yellow lights and TL for green lights

Traffic light controller (cont.) inputs description outputs description reset place FSM in initial state HG, HY, HR assert green/yellow/red highway lights C detect vehicle on the farm road FG, FY, FR assert green/yellow/red highway lights TS short time interval expired ST start timing a short or long interval TL long time interval expired state description HG highway green (farm road red) HY highway yellow (farm road red) FG farm road green (highway red) FY farm road yellow (highway red) (TL C)' TL C / ST HG Reset TS / ST TS' HY FY TS' TS / ST FG TL+C' / ST (TL+C')'

Traffic light controller (cont.) Generate state table with symbolic states Consider state assignments output encoding similar problem to state assignment (Green = 00, Yellow = 01, Red = 10) Inputs Present State Next State Outputs C TL TS ST H F 0 HG HG 0 Green Red 0 HG HG 0 Green Red 1 1 HG HY 1 Green Red 0 HY HY 0 Yellow Red 1 HY FG 1 Yellow Red 1 0 FG FG 0 Red Green 0 FG FY 1 Red Green 1 FG FY 1 Red Green 0 FY FY 0 Red Yellow 1 FY HG 1 Red Yellow SA1: HG = 00 HY = 01 FG = 11 FY = 10 SA2: HG = 00 HY = 10 FG = 01 FY = 11 SA3: HG = 0001 HY = 0010 FG = 0100 FY = 1000 (one-hot)

Traffic light controller FSM Specification of inputs, outputs, and state elements module FSM(HR, HY, HG, FR, FY, FG, ST, TS, TL, C, reset, Clk); output HR; output HY; output HG; parameter highwaygreen = 6'b001100; output FR; parameter highwayyellow = 6'b010100; output FY; parameter farmroadgreen = 6'b100001; output FG; parameter farmroadyellow = 6'b100010; output ST; input TS; input TL; assign HR = state[6]; input C; assign HY = state[5]; input reset; assign HG = state[4]; input Clk; assign FR = state[3]; assign FY = state[2]; reg [6:1] state; assign FG = state[1]; reg ST; specify state bits and codes for each state as well as connections to outputs

Traffic light controller FSM initial begin state = highwaygreen; ST = 0; end always @(posedge Clk) begin if (reset) begin state = highwaygreen; ST = 1; end else begin ST = 0; case (state) highwaygreen: end endmodule case statement triggerred by clock edge if (TL & C) begin state = highwayyellow; ST = 1; end highwayyellow: if (TS) begin state = farmroadgreen; ST = 1; end farmroadgreen: if (TL!C) begin state = farmroadyellow; ST = 1; end farmroadyellow: if (TS) begin state = highwaygreen; ST = 1; end endcase end

Timer FSM for traffic light controller module Timer(TS, TL, ST, Clk); output TS; output TL; input ST; input Clk; integer value; assign TS = (value >= 4); // 5 cycles after reset assign TL = (value >= 14); // 15 cycles after reset always @(posedge ST) value = 0; // async reset always @(posedge Clk) value = value + 1; endmodule

Complete traffic light controller Tying it all together (FSM + timer) with structural Verilog (same as a schematic drawing) module main(hr, HY, HG, FR, FY, FG, reset, C, Clk); output HR, HY, HG, FR, FY, FG; input reset, C, Clk; Timer part1(ts, TL, ST, Clk); FSM part2(hr, HY, HG, FR, FY, FG, ST, TS, TL, C, reset, Clk); endmodule traffic light controller ST timer TS TL

Finite state machines summary Models for representing sequential circuits abstraction of sequential elements finite state machines and their state diagrams inputs/outputs Mealy, Moore, and synchronous Mealy machines Finite state machine design procedure deriving state diagram deriving state transition table determining next state and output functions implementing combinational logic Hardware description languages Use good coding style Communicating FSMs

CSE140L: Components and Design Techniques for Digital Systems Lab Programmable Logic Devices Tajana Simunic Rosing Source: Vahid, Katz, Culler 17

Evolution of Programmable Technologies Discrete devices: relays, transistors (1940s-50s) Discrete logic gates (1950s-60s) Integrated circuits (1960s-70s) Map circuit to Data Book parts e.g. TTL packages: Data Book for 100 s of different parts Gate Arrays (IBM 1970s) Custom integrated circuit chips Transistors are already on the chip Place and route software puts the chip together automatically + Large circuits on a chip + Automatic design tools (no tedious custom layout) - Only good if you want 1000 s of parts trend toward higher levels of integration

Programmable Logic Technologies Fuse and anti-fuse Fuse makes or breaks link between two wires Typical connections are 50-300 ohm One-time programmable (testing before programming?) Very high density EPROM and EEPROM High power consumption Typical connections are 2K-4K ohm Fairly high density RAM-based Memory bit controls a switch that connects/disconnects two wires Typical connections are.5k-1k ohm Can be programmed and re-programmed in the circuit Low density

Comparing RAM Register file Fastest But biggest size REGISTER FILE CLK OUT1 OUT2 OUT3 OUT4 R S R S R S R S D Q D Q D Q D Q SRAM Fast (e.g. 10ns) More compact than register file IN1 IN2 IN3 IN4 Data' SRAM Data DRAM Slowest (e.g. 20ns) And refreshing takes time But very compact Different technology for large caps. W DRAM Data W 20

ROM Types 1 data line 0 data line cell cell Mask-programmed ROM Programmed at manufacturing time Fuse-Based Programmable ROM Programming blows fuses One-Time Programmable ROM EPROM Erase with ultraviolet light EEPROM Erasing one word at a time electronically Flash Erase large blocks of words simultaneously word enable word enable floating-gate transistor 1 data line 1 data line cell cell fuse blown fuse data line data line cell cell 1 0 word enable e Ð e Ð trapped electrons 21

Memory in Verilog Modeled as an array of registers Source: John Wawrzynek 22

Programmable Logic Devices (PLD) PLDs combine PLA/PAL with memory and other advanced structures Similar to PLA/PAL, hence Field-Programmable Gate Arrays Types: Antifuse PLDs EPLD & EEPLD FPGAs with RAMs FPGA with processing Digital Signal Processing General purpose CPU 23

Field-Programmable Gate Arrays Logic blocks To implement combinational and sequential logic Interconnect Wires to connect inputs and outputs to logic blocks I/O blocks Special logic blocks at periphery of device for external connections Key questions: How to make logic blocks programmable? How to connect the wires? After the chip has been manufactured

Actel s Axcelerator Family Antifuse PLDs Antifuse: open when not programmed Low resistance when programmed 25

Actel s Axcelerator C-Cell C-Cell Basic multiplexer logic plus more inputs and support for fast carry calculation Carry connections are direct and do not require propagation through the programmable interconnect

Actel s Accelerator R-Cell R-Cell Core is D flip-flop Muxes for altering the clock and selecting an input Feed back path for current value of the flip-flop for simple hold Direct connection from one C-cell output of logic module to an R-cell input; Eliminates need to use the programmable interconnect Interconnection Fabric Partitioned wires Special long wires

Altera s Erasable Programmable Logic Devices (EPLDs) Historical Perspective PALs: same technology as programmed once bipolar PROM EPLDs: CMOS erasable programmable ROM (EPROM) erased by UV light Altera building block = MACROCELL CLK 8 Product Term AND-OR Array + Programmable MUX's AND ARRAY Inv ert Control Clk MUX Q F/B MUX Output MUX pad I/O Pin Seq. Logic Block Programmable polarity Programmable feedback

Altera EPLD: Synchronous vs. Asynchronous Mode Altera EPLDs contain 10s-100s of independently programmed macrocells Personalized by EPROM bits: OE/Local CLK Global CLK 1 Clk MUX Synchronous Mode Flipflop controlled by global clock signal EPROM Cell Q local signal computes output enable OE/Local CLK Global CLK 1 Clk MUX Asynchronous Mode Q Flipflop controlled by locally generated clock signal EPROM Cell + Seq Logic: could be D, T positive or negative edge triggered + product term to implement clear function

Altera Multiple Array Matrix (MAX) AND-OR structures are relatively limited Cannot share signals/product terms among macrocells Logic Array Blocks (similar to macrocells) LAB A LAB B LAB C P I A LAB H LAB G LAB F Global Routing: Programmable Interconnect Array EPM5128: 8 Fixed Inputs 52 I/O Pins 8 LABs 16 Macrocells/LAB 32 Expanders/LAB LAB D LAB E

Altera s EEPLD Altera s MAX 7k Block Diagram 31

EEPLD Altera s MAX 7k Logic Block 32

SRAM based PLD Altera s Flex 10k Block Diagram 33

SRAM based PLD Altera s Flex 10k Logic Array Block (LAB) 34

SRAM based PLD Altera s Flex 10k Logic Element (LE) 35

FPGA with DSP Altera s Stratix II: Block Diagram 36

FPGA with DSP Altera s Stratix II: DSP Detail 37

FPGA with General Purpose CPU & Analog Actel s Fusion Family Diagram FPGA with ARM 7 CPU and Analog Components 38

Discrete Gates Packaged Logic PLAs Programmable Logic Summary Ever more general architectures of programmable combinational + sequential logic and interconnect Altera Actel Xilinx