1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.

Slides:



Advertisements
Similar presentations
VERILOG: Synthesis - Combinational Logic Combination logic function can be expressed as: logic_output(t) = f(logic_inputs(t)) Rules Avoid technology dependent.
Advertisements

Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Supplement on Verilog adder examples
Synchronous Sequential Logic
EE 361 Fall 2003University of Hawaii1 Hardware Design Tips EE 361 University of Hawaii.
Combinational Logic.
Table 7.1 Verilog Operators.
Hardware Description Language (HDL)
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
1 COMP541 Sequential Circuits Montek Singh Sep 17, 2014.
Spring 20067W. Rhett Davis with minor modifications by Dean Brock ECE 406 at UNASlide 1 ECE 406 Design of Complex Digital Systems Lecture 10: 9: State.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
Digital System Design by Verilog University of Maryland ENEE408C.
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
ELEN 468 Lecture 161 ELEN 468 Advanced Logic Design Lecture 16 Synthesis of Language Construct II.
Verilog HDL (Behavioral Modeling) Bilal Saqib. Behavioral Modeling.
ELEN 468 Advanced Logic Design
Advanced Verilog EECS 270 v10/23/06.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior : initial blocks execute.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
Overview Logistics Last lecture Today HW5 due today
RTL Coding tips Lecture 7,8 Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock.
ECE 551 Digital System Design & Synthesis Lecture 11 Verilog Design for Synthesis.
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
Introduction to FPGA AVI SINGH. Prerequisites Digital Circuit Design - Logic Gates, FlipFlops, Counters, Mux-Demux Familiarity with a procedural programming.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Slide 1 6. VHDL/Verilog Behavioral Description. Slide 2 Verilog for Synthesis: Behavioral description Instead of instantiating components, describe them.
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.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 7: Design Example, Modeling Flip-Flops Spring.
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
Verilog for Synthesis Ing. Pullini Antonio
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
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.
3/4/20031 ECE 551: Digital System Design * & Synthesis Lecture Set 3 3.1: Verilog - User-Defined Primitives (UDPs) (In separate file) 3.2: Verilog – Operators,
1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
Verilog A Hardware Description Language (HDL ) is a machine readable and human readable language for describing hardware. Verilog and VHDL are HDLs.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Introduction to ASIC flow and Verilog HDL
COMP541 Sequential Circuits
Multiplexers Section Topics Multiplexers – Definition – Examples – Verilog Modeling.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Chapter 11: System Design.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
1 COMP541 Sequential Circuits Montek Singh Feb 24, 2016.
1 Lecture 3: Modeling Sequential Logic in Verilog HDL.
Structural Description
Overview Logistics Last lecture Today HW5 due today
Lecture 10 Flip-Flops/Latches
Verilog Tutorial Fall
Supplement on Verilog FF circuit examples
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
‘if-else’ & ‘case’ Statements
SYNTHESIS OF SEQUENTIAL LOGIC
FSM MODELING MOORE FSM MELAY FSM. Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]
332:437 Lecture 8 Verilog and Finite State Machines
Chapter 4: Behavioral Modeling
COE 202 Introduction to Verilog
Dr. Tassadaq Hussain Introduction to Verilog – Part-3 Expressing Sequential Circuits and FSM.
The Verilog Hardware Description Language
ECE 551: Digital System Design & Synthesis
332:437 Lecture 6 Verilog Behavioral Modeling and Concurrency
332:437 Lecture 8 Verilog and Finite State Machines
Introduction to Digital IC Design
332:437 Lecture 6 Verilog Behavioral Modeling and Concurrency
Lecture 7: Verilog Part II
Presentation transcript:

1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar

Loop Statements Repeat While For

Modeling Synchronous Logic with Cyclic Behaviors Use edge-sensitive cyclic behaviors to model flip-flops and sequential logic. (posedge clock, negedge reset) begin // procedural statements go here end Edge qualifier Execute cyclically Event control operator Execute when the clock has a rising edge or the reset has a falling edge. Sensitivity List

Modeling Synchronous Logic (1 of 2) Example: D Flip-Flop with asynchronous set / reset module df_behav (input data, set, clk, reset, output reg q, output q_bar ); assign q_bar = ~ q; (posedge clk, negedge reset, negedge set) begin if (reset == 0) q <= 0; else if (set == 0) q <= 1; else q <= data; end endmodule Non-blocking assignment operator How does a synthesis tool identify the synchronizing signal? df_behav clk dataq reset set q_bar

Modeling Synchronous Logic (2 of 2) Example: D flip-flop with synchronous set / reset module df_behav (input data, set, clk, reset, output reg q, output q_bar ); assign q_bar = ~ q; (posedge clk) // Flip-flop with synchronous set/reset begin if (reset == 0) q <= 0; else if (set == 0) q <= 1; else q <= data; end endmodule

Generating Clock and Reset!! Initial // All the initializations should be in the initial block begin clk = 0; # 5 rst_n = 0; // pull it low # 2 rst_n=1; // pull it high end // generated clock #10 clk=(~clk); // resetting inside the module (posedge clk or negedge rst_n) begin If (! rst_n) // If rst_n=0 reg a <= 4’b0; else a_reg <= a; end

Example: Accumulator a acc_out sum

module acc(a, clk, rst_n, acc_out); input [3:0] a; input clk, rst_n; output [7:0] acc_out; reg [7:0] acc_out; reg [7:0] sum; or acc_out) sum = a + acc_out; clk or negedge rst_n) begin if(!rst_n) acc_out <= 0; else acc_out <= sum; end endmodule module test; reg [3:0] A; reg CLK, RST_N; wire [7:0] ACC_OUT; integer i; acc ACC0(A, CLK, RST_N, ACC_OUT); initial begin #5 RST_N = 0; #2 RST_N = 1; end initial begin #5 A = 1; for(i=0; i<10; i=i+1) #20 A = A + 1; end always #10 CLK = ~CLK; initial $monitor($time, " A=%d, sum=%d, ACC_OUT=%d", A, ACC0.sum, ACC_OUT); initial #60 $stop; endmodule

ANSI-Style port lists Module mux8 ( output reg [7:0] y, input wire [7:0] a, Input wire en );

A Combinational Circuit Using behavioral constructs –Logic for a simple MUX is specified procedurally here –This example is synthesizable module MUX(f, sel, b, c); output regf; input sel, b, c; (sel or b or c) begin if (sel == 1) f = b; else f = c; end endmodule Read this as follows: Wait for any change on sel, b, or c, then execute the begin-end block containing the if. Then wait for another change. Read this as follows: Wait for any change on sel, b, or c, then execute the begin-end block containing the if. Then wait for another change. This “if” functionally describes the MUX f b c

Huh? Is It Really Correct? WWWWaaaaaiiiiiitttt a minute? –Where’s the register? The synthesis tool figures out that this is a combinational circuit. Therefore, it doesn’t need a register. The register is there as an “artifact” of the description — things on the left-hand side have to be registers. –How does it figure out that this is combinational? The output is only a function of the inputs (and not of previous values) Anytime an input changes, the output is re-evaluated f b c module MUX (f, sel, b, c); output reg f; input sel, b, c; (sel or b or c) begin if (sel == 1) f = b; else f = c; end endmodule ?

The Basic Rules The rules for specifying combinational logic using procedural statements –Every element of the input set must be in the sensitivity list –The combinational output must be assigned in every control path So, we’re saying that if any input changes, then the output is re- evaluated. — That’s the definition of combinational logic. module MUX (output reg f, input sel, b, c); (sel or b or c) begin if (sel == 1) f = b; else f = c; end endmodule

What If You Mess Up? If you don’t follow the rules...? –Verilog assumes you are trying to do something clever with the timing –It’s legal, but it won’t be combinational module blah (output reg f, g; input a, b, c); (a or b or c) begin if (a == 1) f = b; else g = c; end endmodule What’s wrong? This says: as long as a==1, then f follows b. (i.e., when b changes, so does f.) But, when a==0, f remembers the old value of b. Combinational circuits don’t remember anything! This says: as long as a==1, then f follows b. (i.e., when b changes, so does f.) But, when a==0, f remembers the old value of b. Combinational circuits don’t remember anything! f doesn’t appear in every control path in the always block (neither does g).