Module 2.1 Gate-Level/Structural Modeling UNIT 2: Modeling in Verilog.

Slides:



Advertisements
Similar presentations
//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Advertisements

Verilog.
Simulation executable (simv)
The Verilog Hardware Description Language
1 Introduction to VHDL (Continued) EE19D. 2 Basic elements of a VHDL Model Package Declaration ENTITY (interface description) ARCHITECTURE (functionality)
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Supplement on Verilog adder examples
ELEN 468 Lecture 21 ELEN 468 Advanced Logic Design Lecture 2 Hardware Modeling.
Verilog Intro: Part 1.
Anurag Dwivedi.  Verilog- Hardware Description Language  Modules  Combinational circuits  assign statement  Control statements  Sequential circuits.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
Verilog - 1 Writing Hardware Programs in Abstract Verilog  Abstract Verilog is a language with special semantics  Allows fine-grained parallelism to.
Verilog-HDL Reference: Verilog HDL: a guide to digital design and synthesis, Palnitkar, Samir Some of slides in this lecture are supported by Prof. An-Yeu.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
CS 61C Discussion 10 (1) Jaein Jeong Fall input MUX °Out = in0 * select’ + in1 * select in0in1selectout
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.
DIGITAL DESIGN WITH VHDL Exercise 1 1Muhammad Amir Yousaf.
RTL Coding tips Lecture 7,8 Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock.
Module : TASKS, Functions and UDPs in Verilog. Functions Functions are declared with the keywords function and endfunction. Functions are used if all.
1 VERILOG Fundamentals Workshop סמסטר א ' תשע " ה מרצה : משה דורון הפקולטה להנדסה Workshop Objectives: Gain basic understanding of the essential concepts.
Modeling styles: 1. Structural Modeling: As a set of interconnected components (to represent structure), 2. Dataflow Modeling: As a set of concurrent assignment.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.
ECE 2372 Modern Digital System Design
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Verilog HDL: A solution for Everybody By, Anil Kumar Ram Rakhyani
Verilog Language Concepts
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 3: Structural Modeling Spring 2009 W. Rhett.
Digital System 數位系統 Verilog HDL Ping-Liang Lai (賴秉樑)  
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.
Module 1.2 Introduction to Verilog
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Chap. 4 Modules and Ports. 2 Modules and Ports Modules Ports Hierarchical Names Summary.
1/8/ L2 VHDL Introcution© Copyright Joanne DeGroat, ECE, OSU1 Introduction to VHDL.
Digital System Design Verilog ® HDL Design at Structural Level Maziar Goudarzi.
LECTURE VII SECTION 4.12 PART 1 MODELS OF COMBINATIONAL CIRCUITS.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Introduction to ASIC flow and Verilog HDL
Slide 1 3.VHDL/Verilog Description Elements. Slide 2 To create a digital component, we start with…? The component’s interface signals Defined in MODULE.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Chapter 6: Hierarchical Structural Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 6-1 Chapter 6: Hierarchical.
Chapter1: Introduction Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 1-1 Chapter 1: Introduction Prof. Ming-Bo.
Introduction to Verilog COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals.
Structural Description
Hardware Description Languages: Verilog
Chapter 4 Modules and Ports
Verilog-HDL Reference: Verilog HDL: a guide to digital design and synthesis, Palnitkar, Samir Some of slides in this lecture are supported by Prof. An-Yeu.
Reg and Wire:.
Verilog Introduction Fall
‘if-else’ & ‘case’ Statements
Lecture 2 Supplement Verilog-01
Structural style Modular design and hierarchy Part 1
Hardware Description Languages: Verilog
Hardware Description Languages
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Behavioral Modeling in Verilog
Introduction to Verilog
Structural style Modular design and hierarchy Part 1
Verilog.
Verilog-HDL Reference: Verilog HDL: a guide to digital design and synthesis, Palnitkar, Samir Some of slides in this lecture are supported by Prof. An-Yeu.
Supplement on Verilog adder examples
The Verilog Hardware Description Language
© Copyright Joanne DeGroat, ECE, OSU
COE 202 Introduction to Verilog
Reconfigurable Computing (EN2911X, Fall07)
Presentation transcript:

Module 2.1 Gate-Level/Structural Modeling UNIT 2: Modeling in Verilog

Module in Verilog A module definition always begins with the keyword module. The module name, port list, port declarations, and optional parameters must come first in a module definition. Port list and port declarations are present only if the module has any ports to interact with the external environment. The five components within a module are – variable declarations, dataflow statements, instantiation of lower modules, behavioral blocks, and tasks or functions. These components can be in any order and at any place in the module definition. The endmodule statement must always come last in a module definition. All components except module, module name, and endmodule are optional and can be mixed and matched as per design needs. Verilog allows multiple modules to be defined in a single file. The modules can be defined in any order in the file.

PORTS A module definition contains an optional list of ports. (If the module does not exchange any signals with the environment, there are no ports in the list). Consider a 4-bit full adder that is instantiated inside a top-level module Top. The module fulladd4 takes input on ports a, b, and c_in and produces an output on ports sum and c_out. I/O Ports for Top and Full Adder module fulladd4(sum, c_out, a, b, c_in); //module with a list of ports module Top; / / No list of ports, top-level module in simulation

Port Declaration Each port in the port list is defined as input, output, or inout, based on the direction of the port signal. module fulladd4(sum, c_out, a, b, c_in); //Begin port declarations section output [3 : 0] sum; output c_out; input [3:0] a, b; input c_in; //End port declarations section endmodule

Wire and Reg Note that all port declarations are implicitly declared as wire in Verilog. If a port is intended to be a wire, it is sufficient to declare it as output, input, or inout. Input or inout ports are normally declared as wires. However, if output ports hold their value, they must be declared as reg as shown below : module DFF(q, d, clk, reset) ; output q; reg q; // Output port q holds value; therefore it is declared as reg input d, clk, reset;... endmodule NOTE : Ports of the type input and inout cannot be declared as reg

Port Connection Rules There are two methods of making connections between signals specified in the module instantiation and the ports in a module definition. Connecting by ordered list : It is the most intuitive method for most beginners. The signals to be connected must appear in the module instantiation in the same order as the ports in the port list in the module definition.

Connecting by ordered list module Top; //Declare connection variables reg [3:O]A,B; reg C-IN; wire [3:0] SUM; wire C_OUT; //Instantiate fulladd4, call it fa_ordered. //Signals are connected to ports in order (by position) fulladd4 fa-ordered(SUM, C_OUT, A, B, C_IN); endmodule module fulladd4 (sum, c_out, a, b, c_in) ; output [3 : 0] sum; output c_cout; input [ 3 : 0 ] a, b; input c_in; endmodule

Connecting ports by name For large designs where modules have, say, 50 ports, remembering the order of the ports in the module definition is impractical and error prone. Verilog provides the capability to connect external signals to ports by the port names, rather than by position.

Connecting ports by name Another advantage of connecting ports by name is that as long as the port name is not changed, the order of ports in the port list of a module can be rearranged without changing the port connections in module instantiations. / / Instantiate module fa-byname and connect signals to ports by name fulladd4 fa-byname(.c_out(C_OUT),.sum(SUM),.b(B),.c-in(C_IN),.a(A), ) ; If the port c-out were to be kept unconnected, the instantiation of filladd4 would look as follows: / / Instantiate module fa-byname and connect signals to ports by name fulladd4 fa-byname(. sum(SUM),. b (B),.c_in (C_IN),.a (A), ) ;