COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.

Slides:



Advertisements
Similar presentations
//HDL Example 8-2 // //RTL description of design example (Fig.8-9) module Example_RTL (S,CLK,Clr,E,F,A);
Advertisements

Counters Discussion D8.3.
Traffic light contoller using FSM
CDA 3100 Recitation Week 11.
Synchronous Sequential Logic
Table 7.1 Verilog Operators.
COE 405 Design and Synthesis of DataPath Controllers Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals.
//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.
Finite State Machine (FSM)  When the sequence of actions in your design depend on the state of sequential elements, a finite state machine (FSM) can be.
1 Sequential Circuits Dr. Pang. 2 Outline Introduction to sequential circuits Basic latch Gated SR latch and gated D latch D flip-flop, T flip-flop, JK.
CSE Spring Verilog for Sequential Systems - 1 Today: Verilog and Sequential Logic zFlip-flops yrepresentation of clocks - timing of state.
FSM examples.
ELEN468 Lecture 101 ELEN 468 Advanced Logic Design Lecture 10 Behavioral Descriptions IV.
Pulse-Width Modulated DAC
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
Logic Design Review – 3 Basic Sequential Circuits Lecture L14.3 Verilog.
ELEN 468 Advanced Logic Design
Registers and Shift Registers Discussion D8.2. D Flip-Flop X 0 Q 0 ~Q 0 D CLK Q ~Q D gets latched to Q on the rising edge of the clock. Positive.
FSMs in Verilog and other random things 9/27/02. FSM structure CLK STATE Next State Logic Inputs Output Logic Outputs.
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 
1 Chapter 5 Synchronous Sequential Logic 5-1 Sequential Circuits Every digital system is likely to have combinational circuits, most systems encountered.
Registers & Counters M. Önder Efe
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Ders 8: FSM Gerçekleme ve.
ECE 551 Digital Design And Synthesis
COE 405 Logic Design with Behavioral Models of Combinational & Sequential Logic Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University.
Verilog for Synthesis Ing. Pullini Antonio
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
Finite State Machine (FSM) Nattha Jindapetch December 2008.
Digital Electronics.
 A test bench is an HDL program used for applying stimulus to an HDL design in order to test it and observe its response during simulation.  In addition.
Introduction to Verilog
ECE/CS 352 Digital System Fundamentals© T. Kaminski & C. Kime 1 ECE/CS 352 Digital Systems Fundamentals Fall 2000 Chapter 5 – Part 2 Tom Kaminski & Charles.
SYEN 3330 Digital SystemsJung H. Kim 1 SYEN 3330 Digital Systems Chapter 7 – Part 2.
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU 99-1 Under-Graduate Project Design of Datapath Controllers Speaker: Shao-Wei Feng Adviser:
Counters and registers Eng.Maha Alqubali. Registers Registers are groups of flip-flops, where each flip- flop is capable of storing one bit of information.
Lab5-1 張明峰 交大資工系 Lab 5: FSM and BCD counters Implement the vending machine of lab 2 A two-digit BCD counter –two BCD counters –can load data in parallel.
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.
Figure Implementation of an FSM in a CPLD..
Sequential statements (1) process
Supplement on Verilog FF circuit examples
Supplement on Verilog for Algorithm State Machine Chart
Figure 8.1. The general form of a sequential circuit.
Verilog Modules for Common Digital Functions
Lecture 11 Registers and Counters
HDL for Sequential Circuits
Supplement on Verilog Sequential circuit examples: FSM
CS Fall 2005 – Lec. #5 – Sequential Logic - 1
Chapter 9: Sequential Logic Modules
Digital Logic Design Digital Design, M. Morris Mano and Michael D
Chapter 5 Synchronous Sequential Logic 5-1 Sequential Circuits
Chapter 6 – Part 4 SYEN 3330 Digital Systems SYEN 3330 Digital Systems
FSM MODELING MOORE FSM MELAY FSM. Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]
Abdul-Rahman Elshafei COE-561
Verilog.
ESE 437: Sensors and Instrumentation
COE 202 Introduction to Verilog
6. Registers and Counters
Supplement on Verilog Sequential circuit examples: FSM
Register-Transfer Level Components in Verilog
Dr. Tassadaq Hussain Introduction to Verilog – Part-3 Expressing Sequential Circuits and FSM.
The Verilog Hardware Description Language
Presentation transcript:

COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals

Outline  D Latch  D Flip Flop  Structural Modeling of a Sequential Circuit  FSM Modeling  Parallel Load Register  Shift Register  Up-Down Counter

D Latch module dlatch (output q, input data, enable); assign q = enable ? data: q; endmodule module dlatch2 (output reg q, input data, enable); data) if (enable == 1'b1) q <= data; endmodule

D Flip Flop – Synchronous Set/Reset module dff (output reg q, output q_bar, input data, set, reset, clk); assign q_bar = !q; clk)// Synchronous set/reset if (reset == 1'b1) q <= 0; else if (set == 1'b1) q <=1; else q <= data; endmodule

D Flip Flop–Asynchronous Set/Reset module dff2 (output reg q, output q_bar, input data, set, reset, clk); assign q_bar = !q; clk, posedge set, posedge reset)// Asynchronous set/reset if (reset == 1'b1) q <= 0; else if (set == 1'b1) q <=1; else q <= data; endmodule

Structural Modeling of a Sequential Circuit module SeqStruct(output Y, input X, Reset, CLK); dff2 F0 (B, Bb, DB, 1'b0, Reset, CLK); dff2 F1 (A, Ab, DA, 1'b0, Reset, CLK); and (DB, Ab, X); and (w1, A, X); and (w2, B, X); or (DA, w1, w2); or (w3, A, B); not (w4, X); and (Y, w3, w4); endmodule

FSM Modeling  Moore Sequence Detector: Detection sequence is 110 IF 110 found on x Then Z gets ‘1’ Else z gets ‘0’ End x clk z Reset /0 got1 /0 got11 /0 got110 /

FSM Modeling module moore_110_detector (output reg z, input x, clk, rst ); parameter reset = 2'b00, got1=2'b01, got11=2'b10, got110=2'b11; reg [1:0] state, next_state; clk) if (rst) state <= reset;else state <= next_state; x) begin z = 0; case (state) reset: if (x) next_state=got1; else next_state=reset; got1: if (x) next_state=got11; else next_state=reset; got11: if (x) next_state=got11; else next_state=got110; got110: begin z=1; if (x) next_state=got1; else next_state=reset; end endcase end endmodule

Parallel Load Register module Par_load_reg4 #(parameter word_size=4) ( output reg [word_size-1:0] Data_out, input [word_size-1:0] Data_in, input load, clock, reset); clock, posedge reset) if (reset==1'b1) Data_out <= 0; else if (load==1'b1) Data_out <= Data_in; endmodule

Shift Register module Shift_reg4 #(parameter word_size=4) ( output Data_out, input Data_in, clock, reset); reg [word_size-1:0] Data_reg; assign Data_out = Data_reg[0]; clock, negedge reset) if (reset==1'b0) Data_reg <= 0; else Data_reg <= {Data_in, Data_reg[word_size-1:1]}; endmodule

MultiFunction Register module MFRegister #(parameter n=3) (output reg [n-1:0] Q, input [n-1:0] I, input s1, s0, clk, reset, SI); clk) begin if (reset==1'b1) Q <= 0; // synchronous reset else case ({s1,s0}) 2'b00: Q <=Q; // no change 2'b01: Q <= I; // parallel load 2'b10: Q <= {Q[n-2:0], SI}; // shift left 2'b11: Q <= {SI, Q[n-1:1]}; //shift right endcase end endmodule

Up-Down Counter module Up_Down_Counter2 ( output reg [2:0] count, input load, count_up, counter_on, clock, reset, input [2:0] Data_in); clock, posedge reset) if (reset==1'b1) count <= 3'b0; else if (load == 1'b1) count <= Data_in; else if (counter_on == 1'b1) if (count_up == 1'b1) count<=count+1; else count<=count-1; endmodule