Figure 8.30. Implementation of an FSM in a CPLD..

Slides:



Advertisements
Similar presentations
FSM and Efficient Synthesizable FSM Design using Verilog
Advertisements

Counters Discussion D8.3.
Traffic light contoller using FSM
CPSC 321 Computer Architecture Andreas Klappenecker
CDA 3100 Recitation Week 11.
Table 7.1 Verilog Operators.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
//HDL Example 5-1 // //Description of D latch (See Fig.5-6) module D_latch (Q,D,control); output Q; input.
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
FSM Revisit Synchronous sequential circuit can be drawn like below  These are called FSMs  Super-important in digital circuit design FSM is composed.
//HDL Example 6-1 // //Behavioral description of //Universal shift register // Fig. 6-7 and Table 6-3 module shftreg.
Latches and Flip-Flops Discussion D8.1 Section 13-9.
FSM examples.
Pulse-Width Modulated DAC
FSMs 1 Sequential logic implementation  Sequential circuits  primitive sequential elements  combinational logic  Models for representing sequential.
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
Arbitrary Waveform Discussion 12.2 Example 34. Recall Divide-by-8 Counter Use q2, q1, q0 as inputs to a combinational circuit to produce an arbitrary.
Counters Discussion 12.1 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
Chapter 8 -- Analysis and Synthesis of Synchronous Sequential Circuits.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 4 - Verilog 2 (Sequential.
ELEN 468 Advanced Logic Design
Advanced Verilog EECS 270 v10/23/06.
D Flip-Flops in Verilog Discussion 10.3 Example 27.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior : initial blocks execute.
Sequential Logic in Verilog
Figure 7.1. Control of an alarm system. Memory element Alarm Sensor Reset Set OnOff 
Verilog Digital System Design Z. Navabi, 2006
CS/EE 3700 : Fundamentals of Digital System Design Chris J. Myers Lecture 8: Synchronous Sequential Circuits Chapter 8.
Registers & Counters M. Önder Efe
Registers CPE 49 RMUTI KOTAT.
State Machines.
Figure A flip-flop with an enable input. D Q Q Q R Clock E 0 1.
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Ders 8: FSM Gerçekleme ve.
CprE / ComS 583 Reconfigurable Computing
ECE/CS 352 Digital System Fundamentals© 2001 C. Kime 1 ECE/CS 352 Digital Systems Fundamentals Spring 2001 Chapters 3 and 4: Verilog – Part 2 Charles R.
Register Transfer Level & Design with ASM
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Verilog Part 3 – Chapter.
Finite State Machine (FSM) Nattha Jindapetch December 2008.
Figure ASM chart for the bit counter.. Figure Verilog code for the bit-counting circuit (Part a). module bitcount (Clock, Resetn, LA, s,
Figure 7.6. Gated SR latch. (a) Circuit Q Q R S R S R Clk Q Q S Time (c) Timing diagram Clk ? ? SR xx Q(t) (no change) 0 1.
Chapter 8 -- Analysis and Synthesis of Synchronous Sequential Circuits.
SYEN 3330 Digital SystemsJung H. Kim 1 SYEN 3330 Digital Systems Chapter 7 – Part 2.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Chapter 11: System Design.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
1 (c) W. J. Dally Digital Design: A Systems Approach Lecture 7: Data Path State Machines.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
EMT 351/4 DIGITAL IC DESIGN Verilog Behavioral Modeling  Finite State Machine -Moore & Mealy Machine -State Encoding Techniques.
Pusat Pengajian Kejuruteraan Mikroelektronik EMT 351/4 DIGITAL IC DESIGN Verilog Behavioural Modeling (Part 4) Week #
1 Lecture 3: Modeling Sequential Logic in Verilog HDL.
Supplement on Verilog FF circuit examples
Supplement on Verilog for Algorithm State Machine Chart
Figure 8.1. The general form of a sequential circuit.
Supplement on Verilog Sequential circuit examples: FSM
FSM MODELING MOORE FSM MELAY FSM. Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]
VHDL (VHSIC Hardware Description Language)
COE 202 Introduction to Verilog
Supplement on Verilog Sequential circuit examples: FSM
Register-Transfer Level Components in Verilog
Figure 8.1. The general form of a sequential circuit.
Dr. Tassadaq Hussain Introduction to Verilog – Part-3 Expressing Sequential Circuits and FSM.
ASM and Micro-programmed State Machines
The Verilog Hardware Description Language
Lecture 4: Continuation of SystemVerilog
332:437 Lecture 9 Verilog Example
332:437 Lecture 9 Verilog Example
Instructor: Alexander Stoytchev
Dr. Tassadaq Hussain Introduction to Verilog – Part-4 Expressing FSM in Verilog (contd) and FSM State Encoding Dr. Tassadaq Hussain.
332:437 Lecture 9 Verilog Example
Presentation transcript:

Figure Implementation of an FSM in a CPLD.

module control (Clock, Resetn, w, R1in, R1out, R2in, R2out, R3in, R3out,Done); input Clock, Resetn, w; output R1in, R1out, R2in, R2out, R3in, R3out, Done; reg [2:1] y, Y; parameter [2:1] A = 2'b00, B = 2'b01, C = 2'b10, D = 2'b11; // Define the next state combinational circuit or y) case (y) A: if (w)Y = B; elseY = A; B:Y = C; C:Y = D; D:Y = A; endcase // Define the sequential block Resetn or posedge Clock) if (Resetn == 0)y <= A; elsey <= Y; // Define outputs assign R2out = (y == B); assign R3in = (y == B); assign R1out = (y == C); assign R2in = (y == C); assign R3out = (y == D); assign R1in = (y == D); assign Done = (y == D); endmodule Figure Verilog code for the FSM in Figure 8.11.

module mealy (Clock, Resetn, w, z); input Clock, Resetn, w; output z; reg y, Y, z; parameter A = 0, B = 1; // Define the next state and output combinational circuits or y) case (y) A:if (w) begin z = 0; Y = B; end else begin z = 0; Y = A; end B:if (w) begin z = 1; Y = B; end else begin z = 0; Y = A; end endcase // Define the sequential block Resetn or posedge Clock) if (Resetn == 0) y <= A; else y <= Y; endmodule Figure Verilog code for the Mealy machine of Figure 8.23.

Figure Verilog code for the serial adder. module serial_adder (A, B, Reset, Clock, Sum); input [7:0] A, B; input Reset, Clock; output [7:0] Sum; reg [3:0] Count; reg s, y, Y; wire [7:0] QA, QB, Sum; wire Run; parameter G = 0, H = 1; shiftrne shift_A (A, Reset, 1, 0, Clock, QA); shiftrne shift_B (B, Reset, 1, 0, Clock, QB); shiftrne shift_Sum (0, Reset, Run, s, Clock, Sum); // Adder FSM // Output and next state combinational circuit or QB or y) case (y) G: begin s = QA[0] ^ QB[0]; if (QA[0] & QB[0])Y = H; elseY = G; end H: begin s = QA[0] ~^ QB[0]; if (~QA[0] & ~QB[0])Y = G; else Y = H; end default: Y = G; endcase // Sequential block Clock) if (Reset)y <= G; elsey <= Y; // Control the shifting process Clock) if (Reset)Count = 8; else if (Run)Count = Count - 1; assign Run = |Count; endmodule

Figure Circuit diagram for the counter. D Q Q D Q Q Clock y 0 w y 1 y 2 Y 0 Y 1 Y 2 Resetn D Q Q

Figure Karnaugh maps for JK flip-flops in the counter d 0d d d d 1d d d y 1 y 0 wy d0 0 0 d d d 1 d1 1 1 d d d11 10 y 1 y 0 wy d d d d d d d d y 1 y 0 wy d dd d d dd d11 10 y 1 y 0 wy dd 0 d 0 d 0 d 00 d 1 d 0 d11 10 y 1 y 0 wy d 00 d 0 d 0 d 0 dd 1 d 0 d y 1 y 0 wy 2 J 1 0 = J 0 w = J 2 0 y 1 = K 1 0 = K 0 w = K 2 0 y 1 =

module arbiter (r, Resetn, Clock, g); input [1:3] r; input Resetn, Clock; output [1:3] g; wire [1:3] g; reg [2:1] y, Y; parameter Idle = 2'b00, gnt1 = 2'b01, gnt2 = 2'b10, gnt3 = 2'b11; // Next state combinational circuit or y) case (y) Idle: case (r) 3'b000: Y = Idle; 3'b1xx: Y = gnt1; 3'b01x: Y = gnt2; 3'b001: Y = gnt3; default: Y = Idle; endcase gnt1: if (r[1]) Y = gnt1; else Y = Idle; gnt2: if (r[2]) Y = gnt2; else Y = Idle; gnt3: if (r[3]) Y = gnt3; else Y = Idle; default: Y = Idle; endcase // Sequential block Clock) if (Resetn == 0) y <= Idle; else y <= Y; // Define output assign g[1] = (y == gnt1); assign g[2] = (y == gnt2); assign g[3] = (y == gnt3); endmodule Figure Verilog code for the arbiter.

Figure ASM chart for a simple FSM. w w w A B C z Reset