Programmable Logic Architecture Verilog HDL FPGA Design Jason Tseng Week 2-3.

Slides:



Advertisements
Similar presentations
Verilog HDL -Introduction
Advertisements

Simulation executable (simv)
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Chapter 11 Verilog HDL Application-Specific Integrated Circuits Michael John Sebastian Smith Addison Wesley, 1997.
Verilog Intro: Part 1.
Hardware Description Language (HDL)
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value Z:high-impedance.
CSE 341 Verilog HDL An Introduction. Hardware Specification Languages Verilog  Similar syntax to C  Commonly used in  Industry (USA & Japan) VHDL 
ELEN 468 Lecture 41 ELEN 468 Advanced Logic Design Lecture 4 Data Types and Operators.
CSE241 R1 Verilog.1Kahng & Cichy, UCSD ©2003 CSE241 VLSI Digital Circuits Winter 2003 Recitation 1: Verilog Introduction.
ELEN 468 Lecture 111 ELEN 468 Advanced Logic Design Lecture 11 Switch Level Models.
CSE241 R1 Verilog.1Kahng & Cichy, UCSD ©2003 CSE241 VLSI Digital Circuits Winter 2003 Recitation 1: RTL Coding in Verilog.
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value Z:high-impedance.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 3 - Combinational.
CSCI 660 EEGN-CSCI 660 Introduction to VLSI Design Lecture 6 Khurram Kazi.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
Reconfigurable Computing (EN2911X, Fall07) Lecture 05: Verilog (1/3) Prof. Sherief Reda Division of Engineering, Brown University
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi.
Computer Organization Lecture Set – 03 Introduction to Verilog Huei-Yung Lin.
University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Hardware Description Language(HDL). Verilog simulator was first used beginning in 1985 and was extended substantially through The implementation.
Digital System Design EEE344 Lecture 3 Introduction to Verilog HDL Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock1.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
Lecture Note on Verilog, Course # , EE, NTU, C.H Tsai Basic Logic Design with Verilog TA: Chen-han Tsai.
INTRODUCTION TO VERILOG HDL Presented by m.vinoth.
Introduction to Verilog Tahir Muhammad FPGA Based System Design.
ECE 2372 Modern Digital System Design
COE 405 Introduction to Logic Design with Verilog
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.
Programmable Logic Architecture Verilog HDL FPGA Design Jason Tseng Week 4.
Module 1.3 Verilog Basics UNIT 1 : Introduction to Verilog Data Types.
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
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,
1 Verilog Digital System Design Z. Navabi, 2006 Verilog Language Concepts.
Introduction to ASIC flow and Verilog HDL
Introduction to Verilog
National Taiwan University Verilog HDL Overview Prof. An-Yeu Wu Date:2002/05/17 For NTUEE Undergraduate VLSI Design Course.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Chapter 3: Dataflow Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 3-1 Chapter 3: Dataflow Modeling.
Verilog Intro: Part 1. Hardware Description Languages A Hardware Description Language (HDL) is a language used to describe a digital system, for example,
1 University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Exp#5 & 6 Introduction to Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
Introduction to Verilog COE 202 Digital Logic Design Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals.
Hardware Description Languages: Verilog
SystemVerilog for Verification
Discussion 2: More to discuss
Verilog Introduction Fall
Verilog-HDL-3 by Dr. Amin Danial Asham.
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Behavioral Modeling in Verilog
Chapter 3: Dataflow Modeling
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
For NTUEE Undergraduate
Introduction to Verilog
Introduction to Verilog® HDL
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
Introduction to Verilog® HDL
Verilog HDL Basic Syntax
COE 202 Introduction to Verilog
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

Programmable Logic Architecture Verilog HDL FPGA Design Jason Tseng Week 2-3

Abstract Today’s class:  Modules:  Program structure  Lexical tokens  Data types  Modulation instantiations  Examples 2

Modules The Verilog language describes a digital system as a set of modules. Each of these modules has an interface (port) to other modules to describe how they are interconnected. The top level module invokes instances of other submodules where may run concurrently. The top module specifies a closed system containing both test data and hardware models. 3

Modules The structure of a module is the following: module ( ); ; endmodule – Module name: an identifier uniquely names the module – Port list: a list of input and output ports used to connect to other modules – Declares: specify data objects as registers, memories, wires and procedure constructs – Module items: initial, always constructs, continuous assignment or instances of modules. 4

Program Structure- Lexical Tokens( 語詞的標記 ) White Space: –space –tab –newline Comments: – // (one line commented); – /* and */ (more than one line are commented) Numbers: – Storage is defined as a number of bits. E.g. reg [31:0] a,b,c: declare a, b, and c as 32-bit variables – Values are specified in binary, octal, decimal, hexadecimal. E.g. 3’b001 (binary), 5’d30(=5’b11110) (decimal), 16’h5ED4(=16’d24276) (hexadecimal) 5

Program Structure- Lexical Tokens Identifiers: – User defined words for variables, function names, module names, block names, and instance names. –Simple identifier: [a-zA-Z][a-zA-Z_$] –Escaped identifier: \{Any_ASCII_character_except_white_space} –Examples:  _ok,ok_,OK_$,Ok_123,CASE_SENSITIVE,case_sensitive  \ok, \/ok, Operators: – Consisted of one, two and sometimes three characters used to perform operations on variables. – E.g. >, +, ~, &, != 6

Program Structure- Data Types Keywords: – Specially reserved words that are part of the Verilog language. – A list of keywords is shown in Table 2-2. They should not be used as identifiers. Logic values: ‘0’, ‘1’, ‘x’, ‘z’ –‘0’: logic zero or false condition. –‘1’: logic one or true condition. –‘x’: uninitialized or unknown logic value –‘z’: high-impedance state Registers –Command: reg –The reg variables are data objects that store the last value which was procedurally assigned to them.  They are used only in functions and procedural blocks (e.g. initial, always).  In multi-bit registers, data is stored as unsigned number of vector. 7

8 always and assign attribute begin buf bufif0 bufif1 case casex casez cmos deassign default defparam disable endattrib ute endcase edge else end endfuncti on endmodul e endprimiti ve endspecif y endtable endtask event for force forever fork function ifnone initial inout highz0 highz1 if input integer join medium module large macromo dule nand negedge nmos nor not output parameter pmos notif0 notif1 or posedge primitive pull0 pull1 pulldown pullup rcmos real realtime reg release repeat rtranif1 scalared signed rpmos rtran rtranif0 small specify specpara m strength strong0 strong1 supply0 supply1 table task time tran tri0 tri1 triand tranif0 tranif1 tri trior trireg unsign ed vectore d wait wand weak0 weak1 while wire wor xnor xo r Verilog HDL Keywords

Program Structure- Data Types Syntax of register: –reg [msb:lsb] register variable list; –msb: maxi. significant bit –lsb: least significant bit Example: –reg a; // single 1-bit register variable –reg [7:0] tom; // an 8-bit vector; a bank of 8 registers –reg [5:0] b,c; // two 6-bit variables b and c Examples: monitest.v, counter.v (chapter 2) 9

Program Structure- Data Types Nets: wire, wand, wor, tri –Wire:  A physical wire in a circuit and is used to connect gates or modules.  Unable to store its value and must be driven by a continuous assignment (assign) statement or by connecting it to the output of a gate or module.  A single-bit wire is a scalar. We may also declare a wire as a vector. –Other types of wires:  wand (wire-AND): depending on logic AND of all the drivers connected to it.  wor (wire-OR): depending on logic OR of all the drivers connected to it.  tri (three-state): all drivers connected to tri must be z. –Syntax: wire [msl:lsb] wire variable list 10

Program Structure- Data Types Input, output, input-output ports: – Command: input, output, inout –Declare input, output and bi-directional ports of a module or task. –An input or output port can be configured to be of type wire, reg, wand, wor or tri. The default is wire. –Syntax:  input [msb:lsb] input_port_list; declare input port  output [msb:lsb] output_port_list; declare output port  inout [msb:lsb] inout_port_list; // declare tri-state bus –Example (chapter 3):  dff.v, mux2_1.v, dff_sel.v  wand_example.v, wor_example.v  NAND.v  triBuffer.v, wire_types.v 11

12 D-type Flip-Flop 2-1 multiplexer Selective output data

13 Selective output data

Wire-And 14

Wire-Or 15

in1in2ANDNADN Not-And 16

Tri-state 17

Wire-Types 18

Program Structure- Data Types Integer: –Command: integer –General purpose variables and store data as signed number (positive/negative), which defaults to 32-bit, range: [2^31-1,-2^31] –Example:  integer a; // single 32-bit signed integer initial a=-5; Real: –Command: real –64 bits long using decimal ( ) or scientific notation (1.0e3), range: [2^63-1,-2^-63] –Example: –real alpha; // single 64-bit real initial alpha=1.3e10; 19

Program Structure- Data Types Time: –Command: time –64 bits reg varialbe to get the present simulation time. –Example: reg [63:0] current_time = $time; // declare and initialize variable Parameter: –Command: parameter –A constant that can be set when instantiating a module. –Example: (also see module parameterization) parameter wordsize=16; // define parameter wordsize reg [wordsize-1:0] data; // declare a vector data parameter a=16, b=-5, c=(a+b)/2; // define parameters 20

Program Structure- Data Types Array –Data type of reg, integer and time can be declared as array –Syntax: –Example:  reg a[7:0]; // declare 8 1-bit register variables: a[0],…,[7]. a is an array variable.  integer [7:0] b[15:0];// declare 16 8-bit (vector) integers: b[0],…b[15]. b is an array integer  reg[7:0] mem256[255:0]; // declare variable mem_256 as a register array variable having 8-bit of 256 elements. 21

Program Structure- Module Instantiations Module instantiations: module templates from which one creates actual objects (instantiations). Modules are instantiated inside other modules, and each instantiation creates a unique object from the template. The top-level module is its own instantiation. The instantiated module’s ports must match to those defined in the template by the following two approaches:  By port’s position: placing the ports in exactly the same positions in the port lists of both the template and the instance.  By port’s name: using a dot(.), in this case no need to follow the same position in the port lists of template “.template_port_name(name_of_wire_connected_to_port)” 22

Program Structure- Module Instantiations Syntax: –module_name instance_name_1(port_connection_list),..., instance_name_N(port_connection_list); Example: (chapter 3) –wire [3:0] in1,in2,o1,o2; and4 C1(in1,in2,01); // C1 ports referenced by position and4 C2(.a(in1),.b(in2),.c(o2));// C2 ports are referenced by name // where the template module definition: module and4(a,b,c); input [3:0] a,b; output[3:0] c; assign c= (a & b); endmodule –wire_types.v, diff_sel.v (chapter 3) 23

D-type Flip Flop 24

Program Structure – Parameterized Modules Module parameterization: Modules are parameterized by specifying the value of the parameter at each instantiation of the module. Syntax: – module_name #(parameter_values) instance_name(port_connection_list); Example: (chapter 3) – Shift_n.v – Test_shift.v 25

Test-Shift 26