FSMD%Block%Diagram. FSM$Datapath*Systems. Datapath%Elements

Similar documents
EECS 3201: Digital Logic Design Lecture 9. Ihab Amer, PhD, SMIEEE, P.Eng.

analysis with T flip-flops Follow the same procedure for JK flip-flops next state is determined by characteristic table or characteristic equation

Chapter 5 Synchronous Sequential Logic

Unit-5 Sequential Circuits - 1

Chapter 5. Introduction

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

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

Registers and Counters

Registers & Counters. BME208 Logic Circuits Yalçın İŞLER

Outputs Combinational circuit. Next state. Fig. 4-1 Block Diagram of a Sequential Circuit

EE178 Spring 2018 Lecture Module 5. Eric Crabill

EE178 Lecture Module 4. Eric Crabill SJSU / Xilinx Fall 2005

CAD FOR VLSI DESIGN - I Lecture 32. V. Kamakoti and Shankar Balachandran

PESIT Bangalore South Campus

DEPARTMENT OF ELECTRICAL &ELECTRONICS ENGINEERING DIGITAL DESIGN

Modeling Digital Systems with Verilog


HDL & High Level Synthesize (EEET 2035) Laboratory II Sequential Circuits with VHDL: DFF, Counter, TFF and Timer

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

WEEK 10. Sequential Circuits: Analysis and Design. Page 1

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

Sequential Logic. E&CE 223 Digital Circuits and Systems (A. Kennings) Page 1

Sequential Logic. Sequential Circuits. ! Timing Methodologies " Cascading flip-flops for proper operation " Clock skew

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

Logic Design. Flip Flops, Registers and Counters

Linear-Feedback Shift-Registers (cont.)

Figure 1 shows a simple implementation of a clock switch, using an AND-OR type multiplexer logic.

Synchronous Sequential Logic

ENGN3213 Digital Systems and Microprocessors Sequential Circuits

ACS College of Engineering. Department of Biomedical Engineering. HDL pre lab questions ( ) Cycle-1

SEQUENTIAL CIRCUITS SEQUENTIAL CIRCUITS

4 of 40. Multi-ASIC reset synchronization Good Multi-Flip-Flop. Synthesis issues with reset nets. 3 of 40. Synchronous Resets? Asynchronous Resets?

Modeling Latches and Flip-flops

Flip-Flops and Registers

DALHOUSIE UNIVERSITY Department of Electrical & Computer Engineering Digital Circuits - ECED 220. Experiment 4 - Latches and Flip-Flops

ENGR 303 Introduction to Logic Design Lecture 10. Dr. Chuck Brown Engineering and Computer Information Science Folsom Lake College

1.b. Realize a 5-input NOR function using 2-input NOR gates only.

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

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

Chapter 6. sequential logic design. This is the beginning of the second part of this course, sequential logic.

Sequential Logic Circuits

Chapter 5 Synchronous Sequential Logic

Sequential Circuits. Sequential Logic. Circuits with Feedback. Simplest Circuits with Feedback. Memory with Cross-coupled Gates.

Advanced Digital Logic Design EECS 303

Other Flip-Flops. Lecture 27 1

0 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 1 1 Stop bits. 11-bit Serial Data format

Universidad Carlos III de Madrid Digital Electronics Exercises

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

Flip-flop and Registers

Asynchronous & Synchronous Reset Design Techniques - Part Deux

Digital Circuits ECS 371

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

Modeling Latches and Flip-flops

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

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

Two types of state machine as classified by output formation

Go BEARS~ What are Machine Structures? Lecture #15 Intro to Synchronous Digital Systems, State Elements I C

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

! Two inverters form a static memory cell " Will hold value as long as it has power applied

Fall 2000 Chapter 5 Part 1

Serial In/Serial Left/Serial Out Operation

Chapter 2. Digital Circuits

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

1. Convert the decimal number to binary, octal, and hexadecimal.

CprE 281: Digital Logic

Chapter 6. Flip-Flops and Simple Flip-Flop Applications

Part II. Chapter2: Synchronous Sequential Logic

Digital Design Datapath Components: Parallel Load Register

CSE Latches and Flip-flops Dr. Izadi. NOR gate property: A B Z Cross coupled NOR gates: S M S R Q M

ECE 263 Digital Systems, Fall 2015

Module 4:FLIP-FLOP. Quote of the day. Never think you are nothing, never think you are everything, but think you are something and achieve anything.

Combinational vs Sequential

Register Transfer Level in Verilog: Part II

Synchronous Sequential Logic

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District UNIT-III SEQUENTIAL CIRCUITS

Chapter. Synchronous Sequential Circuits

Sequential Design Basics

NAME SYMBOL CHARACTERISTIC TABLE EXCITATION TABLE. S R Q(next) 0 0 Q. (hold) (reset) (set) 1 1? (undefined) J K Q(next) (hold) (reset) (set) 1 1 Q'

Efficient Architecture for Flexible Prescaler Using Multimodulo Prescaler

MODULE 3. Combinational & Sequential logic

Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

6. Sequential Logic Flip-Flops

B.Tech CSE Sem. 3 15CS202 DIGITAL SYSTEM DESIGN (Regulations 2015) UNIT -IV

L11/12: Reconfigurable Logic Architectures

Engr354: Digital Logic Circuits

Asynchronous (Ripple) Counters

ELCT201: DIGITAL LOGIC DESIGN

Rensselaer Polytechnic Institute Computer Hardware Design ECSE Report. Lab Three Xilinx Richards Controller and Logic Analyzer Laboratory

EMT 125 Digital Electronic Principles I CHAPTER 6 : FLIP-FLOP

CHAPTER 4: Logic Circuits

CHAPTER1: Digital Logic Circuits

IS1500 (not part of IS1200) Logic Design Lab (LD-Lab)

CPE 200L LABORATORY 3: SEQUENTIAL LOGIC CIRCUITS UNIVERSITY OF NEVADA, LAS VEGAS GOALS: BACKGROUND: SR FLIP-FLOP/LATCH

Experiment 8 Introduction to Latches and Flip-Flops and registers

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

CHAPTER 4: Logic Circuits

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

VARIABLE FREQUENCY CLOCKING HARDWARE

How to Design a Sequential Counter

MODU LE DAY. Class-A, B, AB and C amplifiers - basic concepts, power, efficiency Basic concepts of Feedback and Oscillation. Day 1

Transcription:

FSMD%Block%Diagram FSM$Datapath*Systems Datapath%Elements FSMD%Example%Requires%RAM,%omparator,%ounter Altera%LPM%library%has%many%elements%useful%for% building%common%datapath%functions LPM_RAM_DQ%% onfigurable%as%either%asynchronous%or%synchronous%ram Uses%EAB%(Extended%Array%BlockJded.%Mem.)in%Flex%10K%family LPM_RAM_IO% asynchronous%ram%% Uses%EAB%in%Flex%10K%in%family LPM_OMPARE comparing%two%values.%outputs%are%aeqb,%alb,%aleb,%agb,% ageb LPM_OUNTER up/down%counter%function%with%parallel%load

ontrollers%in%fsmds The%job%of%the%finite%state%machine%is%to%sequence% operations%on%a%datapath DIN R E G R E G + R E G X DOUT FSM ontrol (reg load lines, mux selects) Synchronous%vs%Asynchronous%RAM Asynchronous%RAM combinational%element,%no%lock%input No%lock Data%available%after%propagation%delay%from%address Address%MUST%BE%stable%while%WE%(write%enable)%is% high%so%that%only%one%location%is%written%too.%%data%must% also%be%stable%during%write%cycle. Synchronous%RAM sequential%element,%lock%input%present latches%input%data%and%control%lines%(address,%data)

ounters%for%driving%address%lines WE%and%addr%can%hange%lose%in%Time Delays%can%cause%WE%to%change%before%or%after%address.%%If% before,%then%can%write%to%both%loca%and%locb

Sync%RAM%latches%address%and%WE WE,%addr%latched%here Write%occurs%here Use%Synchronous%RAM%when%Possible Often%when%using%Asynchronous%RAM%generally% end%up%latching%the%address,%we,%and%din%anyway Use%Synchronous%RAM%if%available%and%possible% for%application In%Lab%exercises%and%lass%Examples,%will%always% use/assume%synchronous%ram Will%not%latch%output%data%unless%specifically%needed Options%to%latch%control,%input%data,%output%data%available% on%lpm_ram_dq

Asynchronous%vs%Synchronous%ontrol Many%LPMS%have%both%synchronous%and% asynchronous%control%lines LPM_OUNTER%has% aload %(asynchronous%load),%and% sload %(synchronous%load)\%% aclr %and% sclr %(async%and% sync%clear) Always%use%a%Synchronous%control%line%if%possible,% especially%if%connected%to%a%fsm%output. Any%glitch%on%an%asynchronous%control%line%can%trigger%it If%using%a%FSM%output%for%an%asynchronous%control,%the% output%should%come%directly%from%a%flipjflop%output,%not% from%combinational%gating. Sample%FSMD%Design reate%a%synchronous%ram%block%that% has%a% zeroing %capability If%external% zero %input%asserted,%assert% BUSY%output%and%zero%RAM%block Load%a%LOW%and%HIGH%address%that% specifies%the%memory%words%to%reset Assume%RAM%size%is%64%x%8

Memory%Zeroing%FSMD RAM*&*External*Datapath omponents FSMD%Design%Steps 1) Define/Specify%Input/Output%Signals 2) Design%the%Datapath%Diagram 3) Define/Specify%ontrol%Signals 4) Design%the%ontroller%ASM%hart 5) Realize%ontroller%in%HDL 6) Realize%Datapath%in%HDL%and/or%Schematic% apture 7) Interconnect%Datapath%&%ontroller 8) Validate%Design/Perform%Timing%Analysis

FSMD%Input/Output%Signals Inputs! clk, reset! low_ld J load%low%value%obtained%from%address%bus! high_ld J load%high%value%obtained%from%address%bus! din[7..0] J data%bus%input%to%ram! addr[5..0] J address%bus%input%to%ram%%! zero J initiate%a%zero%cycle Outputs! dout[7..0] J memory%output%during% normal %operation! busy J output%indicating%zeroing%operation%is%occurring Datapath%Elements%%Needed Two%registers%to%hold%LOW,%HIGH%value Use%LPM_DFF%or%write%Verilog%model%(reg6.v) Need%a%6Jbit%counter%to%cycle%address%lines%of% RAM LPM_OUNTER ounter%needs%to%be%loaded%with%low%value%when%we% start%to%zero%the%ram Need%a%omparator%to%compare%ounter%value% and%high%value%to%see%if%we%are%finished Need%the%RAM%(use%LPM_RAM_DQ) Multiplexers%(LPM_MUX%or%HDL)

Datapath%Block%Diagram ontrol*lines*are*not*shown*on*datapath*diagrams!!! Required%FSM%ontrol%Signals (examine%each%datapath%component) Registers:%Load%lines%for%LOW,%HIGH%registers%driven% externally%and%not%under%fsm%control. ounter:%%%sload%(synchronous%load),%cnt_en%(count% enable).%ounter%will%be%configured%to%only%count%up. Mux%Selects:%%When%doing% zero %operation,%counter% will%be%driving%ram%address%lines%and%ram%input%data% line%will%be%zero.%the%same%select%line%can%drive%both% multiplexers. RAM:%%The%WE%of%the%RAM%needs%to%be%an%OR%of%the% external%we%and%a%we%that%is%provided%by%the%fsm.

ontrol%signals Required%ontroller%Operations 1) Wait%for%external%zero command% (controller%waits%for% zero %input%to%be% asserted)% RAM%in% normal %mode 2) Load%the%counter%with%the%LOW%address% value 3) Write% 0 %data%value%to%ram%via%address% specified%by%counter,%incrementing% counter%each%clock%cycle.%%stop%writing% when%high%register%value%equals% counter%value. Three*DISTINT*operationsA*need*3*control*STATES

ASM%State%Definitions Three%States State%S0 waits%for%zero operation.%in%this%state%the% external%addr and%din busses%are%multiplexed%to% RAM.%%Set%busy%flag%on%transition%to%State%S1. State%S1 loads%counter%with%low%register%value State%S2 does%zero%operation.%%exit%this%state%with% counter%value%equals%to%high%register%value.%%on% state%exit,%clear%the%busy%flag%output%(conditional% output).%% ontroller%requires%highjlow+1%clocks%in%this%state% (clear%low%to%high%locations%inclusive) Memory%Zeroing%ASM%hart

Memory%Zeroing%FSMD%Diagram Design%Implementation DESIGN%TASK: Specify/define%Input/Output%(often%this%is%in%prior% spec %phase) Design%Datapath%(draw%datapath%diagram) Specify%ontroller%and%Datapath%Interface Design%ontroller%(draw%ASM%chart) IMPLEMENTATION: Realize%Datapath%in%HDL%or%Schematic Realize%ontroller%(HDL%only%in%this%class) Interface%Datapath%and%ontroller%to%produce%FSMD Datapath$first*approach*is*my*preference*$ can*often*find*logic flaws*through*careful*consideration*of*datapath*before*worrying about*the*controller

Design%Implementation%Guidelines Perform%some%Intermediate%Validation%on%Datapath Datapath%omponent%Hierarchy%can%be%Helpful After%Datapath%is%finished,%Implement%ontroller%in%HDL Initially%Specify%FSM%State%Value%as%External%Output%for%Debugging Generate%ontroller%HDL%directly%from%ASM%chart Some%Intermediate%Validation%of%ontroller FSMD%Validate/Debug%J take%a%systematic%approach FSMD%will%USUALLY%NOT%WORK%the%first%time%J be%prepared%to% debug. Attach%external%pins%to%as%many%internal%nets%as%possible%or%use%the% logic%probe %capability%to%observe%the%internal%net%values Debug%FSMD%ONE%state%at%a%time%beginning%with%RESET%state.% Do%not%test%the%next%state%until%the%current%state%works%as%expected. Design%Implementation%Guidelines Based%on%your%confidence%with%HDL,%decide%to%use% LPM%components%versus%HDL%Specification%in% Datapath Always%use%a%VERY%LONG%clock%cycle%to%start%out% with%so%that%you%do%not%encounter%timing%problems an%also%use%functional%simulation To%be%absolutely%safe,%make%external%inputs%change%on% the%falling%edge%if%your%internal%logic%is%rising%edge% triggered%(this%gives%you%1/2%clock%of%setup%time).

DATAPATH% OMPONENT% SPEIFIATION% USING%AN%HDL Data%(D)%Latch //HDL Example 5-1 //-------------------------------------- //Description of D latch (See Fig.5-6) module D_latch (Q,D,control); output Q; input D,control; reg Q; always @ (control or D) if (control) Q = D; //Same as: if (control == 1 b1) Q = D; endmodule D control Q No%default% assignment%for% Q \%only% assigned%when% gate%is%high.

D FLIPJFLOP //HDL Example 5-2 (adaptated-mat) //----------------------- //D flip-flop module D_FF (Q,D,LK); output Q; input D,LK; reg Q; always @ (posedge LK) Q <= D; endmodule DFF*with*Single* Synchronous*Input Rising%edge D Q LK Assignment% protected %by% clock%edge.%so% DFF%is% synthesized. Another*D FLIPJFLOP //D flip-flop with asynchronous reset. //(adapted-mat) module DFF (Q,D,LK,RST); output Q; input D,LK,RST; reg Q; always @(posedge LK or negedge RST) if (~RST) Q <= 1'b0; // Same as: if (RST == 1'b0) else Q <= D; endmodule DFF*with*Single* Synchronous*Input and*asynchronous reset*(rst) D Q LK RST Assignment% after%rising%edge% clock%so%dff%is% synthesized.

JK and%t FLIPJFLOPS //T flip-flop from D // flip-flop and gates module TFF (Q,T,LK,RST); output Q; input T,LK,RST; wire DT; assign DT = Q ^ T ; //Instantiate the D flipflop DFF TF1 (Q,DT,LK,RST); endmodule //JK flip-flop from // D flip-flop and gates module JKFF (Q,J,K,LK,RST); output Q; input J,K,LK,RST; wire JK; assign JK = (J & ~Q) (~K & Q); //Instantiate D flipflop DFF JK1 (Q,JK,LK,RST); endmodule JK FLIPJFLOP //HDL Example 5-4 (adapted-mat) //---------------------------------- // Functional description of JK flip-flop module JK_FF (J,K,LK,Q,Qnot); output Q,Qnot; input J,K,LK; reg Q; assign Qnot = ~ Q ; always @ (posedge LK) case ({J,K}) 2'b00: Q <= Q; 2'b01: Q <= 1'b0; 2'b10: Q <= 1'b1; 2'b11: Q <= ~ Q; endcase endmodule Description*Based*on*haracteristic*Table*Directly

JK FLIPJFLOP // Functional description of JK flip-flop // (adapted-mat) module JK_FF (J,K,LK,Q,Qnot,RST,PST); output Q,Qnot; input J,K,LK; reg Q; assign Qnot = ~ Q ; always @ (posedge LK or negedge RST or negedge PST) if (~RST and ~PST) Q <= 1 bx; else if (~RST and PST) Q <= 1 b0; else if (~PST and RST) Q <= 1 b1; else case ({J,K}) 2'b00: Q <= Q; 2'b01: Q <= 1'b0; 2'b10: Q <= 1'b1; 2'b11: Q <= ~ Q; endcase endmodule omments%on%examples Modules%with%a%clock%in%sensitivity%list%are%called%% clocked%modules. ALL%assignments%that%are%protected%by%a%clock edge% will%have%a%dffs%placed%on%the%logic%outputs. posedge and%negedge Do%Not%Necessarily%Imply% DFFs%will%be%Synthesized an%very%easily%insert%dffs%between%blocks%of%logic% (i.e.%pipelining)%in%verilog

Registers The%most%common%sequential%building%block%is%the% register.%%a%register%is%n%bits%wide,%and%has%a%load%line%for% loading%in%a%new%value%into%the%register. DIN LK LD N ALR R E G DOUT N Register%contents%do%not% change%unless%ld%=%1%on% active%edge%of%clock. A%DFF%is%NOT%a%register!%DFF% contents%change%every%clock% edge.%% ALR%used%to% asynchronously%clear%the% register Verilog%for%8Jbit%Register module reg8(dout,clk,reset,load,din); input [7:0] din; input clk, reset, load; output [7:0] dout; reg [7:0] dout; always @(posedge clk or posedge reset) begin if (reset == 1 b1) end endmodule dout <= 8 h00; else if (ld == 1 b1) dout <= din; No%default%clause% intentional% inferred% storage Asynchronous% Reset hange%register% state%on%rising%edge% and%%assertion%of% load%line.

Pipelined%Datapath%Example A A_1 B B_1 AB_1 D _1 D_1 D_2 Y Verilog%Module module plogic (y, a, b, c, d, clk); input a, b, c, d, clk; output y; reg y, a_1, b_1, c_1; reg d_1, d_2, abc_1; always @(posedge clk) begin a_1 <= a; b_1 <= b; c_1 <= c; d_1 <= d; end always @(posedge clk) begin abc_1 <= a_1 & b_1 & c_1; d_2 <= d_1; end always @(posedge clk); y <= abc_1 d_2; endmodule Each%always%block% defines%a%block%%of% logic%plus%dffs. Logic%in%always% block%can%be%as% complex%as%you% wish.

A Block%1 Always%Blocks Block%2 Block%3 A_1 B B_1 AB_1 D _1 D_1 D_2 Y