Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value Z:high-impedance.

Slides:



Advertisements
Similar presentations
Verilog HDL -Introduction
Advertisements

Simulation executable (simv)
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Chap. 6 Dataflow Modeling
Chapter 11 Verilog HDL Application-Specific Integrated Circuits Michael John Sebastian Smith Addison Wesley, 1997.
Table 7.1 Verilog Operators.
Verilog Intro: Part 1.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
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 
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.
Verilog - 1 Writing Hardware Programs in Abstract Verilog  Abstract Verilog is a language with special semantics  Allows fine-grained parallelism to.
7-Segment LED Display DD: Section Mano: Section 3.10.
ELEN 468 Lecture 41 ELEN 468 Advanced Logic Design Lecture 4 Data Types and Operators.
ELEN 468 Lecture 151 ELEN 468 Advanced Logic Design Lecture 15 Synthesis of Language Construct I.
CSCI 660 EEGN-CSCI 660 Introduction to VLSI Design Lecture 6 Khurram Kazi.
2-to-1 Multiplexer: if Statement Discussion D7.1 Example 4.
Reconfigurable Computing (EN2911X, Fall07) Lecture 05: Verilog (1/3) Prof. Sherief Reda Division of Engineering, Brown University
Computer Organization Lecture Set – 03 Introduction to Verilog Huei-Yung Lin.
Digital System Design EEE344 Lecture 3 Introduction to Verilog HDL Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock1.
Overview Logistics Last lecture Today HW5 due today
Chap. 3 Basic Concepts. 2 Basic Concepts Lexical Conventions Data Types System Tasks and Compiler Directives Summary.
Digital System Design Verilog ® HDL Basic Concepts Maziar Goudarzi.
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
Programmable Logic Architecture Verilog HDL FPGA Design Jason Tseng Week 2-3.
Lecture Note on Verilog, Course # , EE, NTU, C.H Tsai Basic Logic Design with Verilog TA: Chen-han Tsai.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Introduction to Verilog Tahir Muhammad FPGA Based System Design.
ECE 2372 Modern Digital System Design
Workshop Topics - Outline
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.
Digital System Design Introduction to Verilog ® HDL Maziar Goudarzi.
Module 1.3 Verilog Basics UNIT 1 : Introduction to Verilog Data Types.
EEE2243 Digital System Design Chapter 3: Verilog HDL (Combinational) by Muhazam Mustapha, January 2011.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
1 Verilog Digital System Design Z. Navabi, 2006 Verilog Language Concepts.
Introduction to Verilog. Data Types A wire specifies a combinational signal. – Think of it as an actual wire. A reg (register) holds a value. – A reg.
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.
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,
Sharif University of Technology Department of Computer Engineering Digital System Design Verilog ® HDL Basic Concepts Digital System Design Verilog ® HDL.
Exp#5 & 6 Introduction to Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
Structural Description
Hardware Description Languages: Verilog
SystemVerilog for Verification
Reg and Wire:.
Verilog Introduction Fall
KARTHIK.S Lecturer/ECE S.N.G.C.E
Lecture 2 Supplement Verilog-01
Verilog-HDL-3 by Dr. Amin Danial Asham.
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Chapter 4 Combinational Logic
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® HDL
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
COE 202 Introduction to Verilog
Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value
Supplement on Verilog adder examples
Supplement on Verilog combinational circuit examples
Introduction to Verilog® HDL
Verilog HDL Basic Syntax
Reconfigurable Computing (EN2911X, Fall07)
Presentation transcript:

Logic Values 0:logic 0 / false 1:logic 1 / true X:unknown logic value Z:high-impedance

Strength levels Strength levelTypeDegree supplyDrivingstrongest strongDriving pullDriving largeStorage weakDriving mediumStorage smallStorage highzHigh Impedanceweakest

Data Types Nets Connects between hardware elements Must be continuously driven by Continuous assignment (assign) Module or gate instantiation (output ports) Default initial value for a wire is “ Z ” (and for a trireg is “ x ” ) Registers Represent data storage elements Retain value until another value is placed on to them Similar to “ variables ” in other high level language Different to edge-triggered flip-flop in real ciucuits Do not need clock Default initial value for a reg is “ X ”

Examples reg a; // a scalar register wand w; // a scalar net of type “ wire and ” reg [3:0] v; // a 4-bit vector register from msb to lsb reg [7:0] m, n; // two 8-bit registers tri [15:0] busa; // a 16-bit tri-state bus wire [0:31] w1, w2; // Two 32-bit wires with msb being the 0 bit, not recommended

Net Types The most common and important net types wire and tri for standard interconnection wires wire: single driver e.g. output of “ and ” gate tri: multiple driver e.g. multiplexer supply1 and supply0  “ x ” strong1 and supply1  “ supply1 ”

Net Types Other wire types wand, wor, triand, and trior for multiple drivers that are wired-anded and wired-ored tri0 and tri1 pull down and pull up trireg for net with capacitive storage If all drivers at z, previous value is retained Two states: Driven state: at least one driver drives 0, 1, x Capacitive state: all driver have high impedance “ z ” Strength: small, medium, large; default is medium

An example for wire, tri0, tri1 module tritest(); wire w1, w2, w3, w4; tri0 t01, t02, t03, t04; tri1 t11, t12, t13, t14; assign w1 = 0; assign t01 = 0; assign t11 = 0; assign w2 = 1'bz; assign t02 = 1'bz; assign t12 = 1'bz; assign w3 = 1; assign t03 = 1; assign t13 = 1; Initial begin #1;$display(w1, w2, w3, w4); $display(t01, t02, t03, t04); $display(t11, t12, t13, t14); end endmodule Results: 0 z 1 z

Register Types reg any size, unsigned Integer integet a,b; // declaration 32-bit signed (2 ’ s complement) Time 64-bit unsigned, behaves like a 64-bit reg $display( “ At %t, value=%d ”,$time,val_now) real real c,d; //declaration 64-bit real number Defaults to an initial value of 0

Numbers & Negative Numbers Constant numbers are integer or real constants. Integer constants are written as “ width ‘ radix value ” The radix indicates the type of number Decimal (d or D) Hex (h or H) Octal (o or O) Binary (b or B) A number may be sized or unsized

Number Specification (continue) Sized numbers ’ is in decimal and specifies the number of bits ‘ is: ‘d ‘D ‘h ‘H ‘b ‘B ‘o ‘O The digits are 0-f, uppercase may be used Examples: 4’b ’habc 16’d255

Number Specification Unsized numbers – The is not specified (default is simulator/compiler specific, >= 32 bits) Numbers without a base are decimal by default Examples 100 // Decimal 100, 32 bits by default 6’h3a // Binary ’bx // One-bit X 32’bz // 32 bits of High-Z (impedance)

Operators

Example assign A1 = (3+2) %2; // A1 = 1 assign A2 = 4 >> 1; assign A4 = 1 << 2; // A2 = 2 A4 = 4 assign Ax = (1= =1'bx); //Ax=x assign Bx = (1'bx!=1'bz); //Bx=x assign D0 = (1= =0); //D0=False assign D1 = (1= =1); //D1=True assign E0 = (1= = =1'bx); //E0=False assign E1 = (4'b01xz = = = 4'b01xz);; //E1=True assign F1 = (4'bxxxx = = = 4'bxxxx); //F1= True assign x = a ? b : c //if (a) then x = b else x = c

Concatenation operator // A=1 ’ b1; B=2 ’ b00, C=2 ’ b10; D=3 ’ b110; Y={B, C} //Result Y is 4 ’ b0010 Y={A, B, C, D, 3 ’ b001} //Result Y is 11 ’ b Y={A, B[0], C[1]} // Result Y is 3 ’ b101

Replication operator Reg A; Reg [1:0] B, C; Reg [2:0] D; A=1 ’ b1; B=2 ’ b00, C=2 ’ b10; D=3 ’ b110; Y={4{A}} // Result Y is 4 ’ b1111 Y={4{A}, 2{B}} // Result Y is 8 ’ b Y ={4{A}, 2{B}, C} //Result Y is 8 ’ b

Example – Multiplexer_1 // Verilog code for Multiplexer implementation using assign // File name: mux1.v // by Harsha Perla for // // Available at module mux1( select, d, q ); input [1:0] select; input [3:0] d; output q; wire q; wire[1:0] select; wire[3:0] d; assign q = d[select];

Example – Multiplexer_2 // Verilog code for Multiplexer implementation using always block. // by Harsha Perla for // // Available at module mux2( select, d, q ); input[1:0] select; input[3:0] d; output q; reg q; wire[1:0] select; wire[3:0] d; or select) q = d[select]; endmodule

Example – Multiplexer_3 module mux4_1 (out, in0, in1, in2, in3, sel) ; output out ; input in0,in1,in2,in3 ; input [1:0] sel ; assign out = (sel == 2'b00) ? in0 : (sel == 2'b01) ? in1 : (sel == 2'b10) ? in2 : (sel == 2'b11) ? in3 : 1'bx ; endmodule

Exercise Design an 1-to-8 Demultiplexer