Structural Description

Slides:



Advertisements
Similar presentations
Verilog HDL -Introduction
Advertisements

Simulation executable (simv)
Supplement on Verilog adder examples
Combinational Logic.
Verilog Intro: Part 1.
Hardware Description Language (HDL)
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
Reconfigurable Computing (EN2911X, Fall07) Lecture 05: Verilog (1/3) Prof. Sherief Reda Division of Engineering, Brown University
Digital System Design Verilog ® HDL Modules and Ports Maziar Goudarzi.
Advanced Verilog EECS 270 v10/23/06.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
Overview Logistics Last lecture Today HW5 due today
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
ECE 2372 Modern Digital System Design
MODULE 1.3 VERILOG BASICS UNIT 1 : INTRODUCTION TO VERILOG TOPIC : System Tasks and Compiler directive.
Verilog Language Concepts
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
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.
CH71 Chapter 7 Hardware Description Language (HDL) By Taweesak Reungpeerakul.
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.
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
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.
1 Verilog Digital System Design Z. Navabi, 2006 Verilog Language Concepts.
Digital System Design Verilog ® HDL Design at Structural Level Maziar Goudarzi.
Verilog A Hardware Description Language (HDL ) is a machine readable and human readable language for describing hardware. Verilog and VHDL are HDLs.
M.Mohajjel. Continuous Assignments Continuously Drive a value onto a net Left hand side must be net Right hand side registers nets function calls Keyword.
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
Digital System Design Verilog ® HDL Dataflow Modeling Maziar Goudarzi.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Overview Logistics Last lecture Today HW5 due today
Hardware Description Languages: Verilog
Verilog Tutorial Fall
Supplement on Verilog FF circuit examples
Reg and Wire:.
Discussion 2: More to discuss
Verilog Introduction Fall
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
‘if-else’ & ‘case’ Statements
Lecture 2 Supplement Verilog-01
Verilog-HDL-3 by Dr. Amin Danial Asham.
Hardware Description Languages: Verilog
TODAY’S OUTLINE Procedural Assignments Verilog Coding Guidelines
Hardware Description Languages
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Verilog基础 硬核实战营培训
SYNTHESIS OF SEQUENTIAL LOGIC
Introduction to Verilog® HDL
Levels in computer design
332:437 Lecture 8 Verilog and Finite State Machines
Lecture 3 Simulation and Testbench
Test Fixture (Testbench)
COE 202 Introduction to Verilog
Supplement on Verilog adder examples
The Verilog Hardware Description Language
CS 153 Logic Design Lab Professor Ian G. Harris
The Verilog Hardware Description Language
Introduction to Verilog® HDL
Verilog for Testbenches
332:437 Lecture 8 Verilog and Finite State Machines
Introduction to Verilog – Part-2 Procedural Statements
Sequntial-Circuit Building Blocks
COE 202 Introduction to Verilog
Reconfigurable Computing (EN2911X, Fall07)
Presentation transcript:

Structural Description module ripple_carry_counter(q, clk, reset); output [3:0] q; input clk, reset; //4 instances of the module TFF are created. TFF tff0(q[0],clk, reset); TFF tff1(q[1],q[0], reset); TFF tff2(q[2],q[1], reset); TFF tff3(q[3],q[2], reset); endmodule module TFF(q, clk, reset); output q; input clk, reset; wire d; DFF dff0(q, d, clk, reset); not n1(d, q); endmodule TFF is instantated within ripple_carry_counter DFF and not are instantiated within TFF Structural interconnect is established through instantiation

Behavioral Modeling, Structured Procedures Always blocks and initial blocks - Parallel constructs: all blocks can execute in parallel Initial blocks - The block executes only once - By default, starts at time 0 (but this can be changed) - Often used for initialization module stimulus; reg x,y, a,b, m; initial begin #5 a = 1'b1; #25 b = 1'b0; end initial begin #10 x = 1'b0; #25 y = 1'b1; end endmodule

Always Blocks Always blocks - The block executes in an infinite loop - By default, starts at time 0 (but this can be changed) - Represents a concurrent hardware block - Needs a delay module clock_gen; reg clock; initial clock = 1'b0; always #10 clock = ~clock; #1000 $finish; endmodule

Procedural Statements, Blocking Assignments - Represented with a = sign - All blocking assignments are executed in sequence module dummy; reg x, y, z; reg [15:0] reg_a, reg_b; integer count; initial begin x = 0; y = 1; z = 1; count = 0; reg_a = 16'b0; reg_b = reg_a; reg_a[2] = #15 1; reg_b[15:13] = #10 {x, y, z}; count = count + 1; end

Non-Blocking Assignments - Represented with a <= sign - All non-blocking assignments are executed in parallel - Try not to mix with blocking assignments module dummy; reg x, y, z; reg [15:0] reg_a, reg_b; integer count; initial begin x = 0; y = 1; z = 1; count = 0; reg_a = 16'b0; reg_b = reg_a; reg_a[2] <= #15 1; reg_b[15:13] <= #10 {x, y, z}; count = count + 1; end

Delay and Event Control Delay Statements - Represented with a # sign - Delays the execution of the statement immediately after - Inertial delay model (ignores glitches) - Additive with blocking statements Event Control Statements - Edge sensitive, represented with a @ sign - Delays the execution until expression transitions Ex. always @(clock) always @(posedge clock) always @(a or b) - Level sensitive, represented with wait statement Ex. always wait (enable) #20 cnt = cnt + 1;

Testbench (Stimulus Block) // Control the reset initial begin reset = 1'b1; #15 reset = 1'b0; #180 reset = 1'b1; #10 reset = 1'b0; #20 $stop; end // Monitor the outputs $monitor($time, " Output q = %d", q); endmodule module stimulus; reg clk; reg reset; wire[3:0] q; // instantiate the design block ripple_carry_counter r1(q, clk, reset); // Control the clock initial clk = 1'b0; always #5 clk = ~clk; Behavioral description, not structural The testbench generates the input stimulus Observation of data is often included in the testbench

Data Values and Strengths 0, 1, X, Z Reflect traditional digital logic values Strengths from highZ -> supply Used to resolve conflicts between drivers

Nets (Wires) and Registers Nets represent physical connections between hardware elements Declared with the keyword wire (or default for ports) Used to connect instantiated modules Must be continuously driven with a value Ex. wire b, c; Registers represent storage elements Not necessarily physical registers but synthesis tools often assume that Registers do not need to be continuously driven Registers will hold a value until it is overwritten Ex. reg reset; initial begin reset = 1’b1; #100 reset = 1’b0; end

Vectors Nets and Registers can be declared as vectors If no bitwidth is specified, 1 bit is assumed wire [7:0] a; reg [0:31] addr1, addr2; Subsets of bits can be selected addr1[2:0] = addr2[3:1];

Other Data Types Verilog allows integers, real, and time types Arrays can be made from other types - Arrays can be multidimensional - A vector is conceptually a single elements with many bits - An array is many elements put together wire [7:0] x; // a vector wire x [7:0]; // an array wire [7:0] x [7:0]; // an array of vectors wire x[7:0][7:0]; // a two dimensional array Parameters are constants parameter line_width=80;

System Tasks and Compiler Directives Typically I/O tasks which require special simulator operations System Tasks: $<keyword>, used at simulation time - $display is a print statement in the code (like printf) $display(“Hello, world!”); - $monitor prints a signal value when it changes $monitor(“clock= %b, reset = %b”, clock, reset); - Only one $monitor statement can be active - $monitoron, $monitoroff Compiler Directives: ‘<keyword>, used at compile time - ‘define creates macros (just like #define in C) ‘define x 32 - ‘include inserts entire verilog files (just like #include in C ‘include header.v

Dataflow Descriptions, Continuous Assignments assign out = i1 & i2; Use the assign keyword (in most cases) Left hand side must be a net of some kind (scalar or vector), not a register Right hand side can be registers, nets, or function calls Continuous assignments are always active. Execution hard to trace They are evaluated whenever a right hand side operand changes value Delays (inertial) can be added to represent component delays assign #10 out = i1 & i2; Continuous assignment can be implicit in a net declaration wire out = i1 & i2;

Continuous Assignment Example module edge_dff(q, qbar, d, clk, clear); // Inputs and outputs output q,qbar; input d, clk, clear; // Internal variables wire s, sbar, r, rbar,cbar; //Make complement of clear assign cbar = ~clear; // Input latches assign sbar = ~(rbar & s), s = ~(sbar & cbar & ~clk), r = ~(rbar & ~clk & s), rbar = ~(r & cbar & d); // Output latch assign q = ~(s & qbar), qbar = ~(q & r & cbar); endmodule This is basically a structural description