Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.

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 in transistor level using Microwind
//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Verilog.
Supplement on Verilog adder examples
EE 361 Fall 2003University of Hawaii1 Hardware Design Tips EE 361 University of Hawaii.
Combinational Logic.
Verilog Modules for Common Digital Functions
Table 7.1 Verilog Operators.
Verilog Intro: Part 1.
Hardware Description Language (HDL)
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.
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.
ECE 4680 Computer Architecture Verilog Presentation I. Verilog HDL.
2-to-1 Multiplexer: if Statement Discussion D7.1 Example 4.
CS 61C Discussion 10 (1) Jaein Jeong Fall input MUX °Out = in0 * select’ + in1 * select in0in1selectout
ECEN ECEN475 Introduction to VLSI System Design Verilog HDL.
Advanced Verilog EECS 270 v10/23/06.
Introduction to Verilog Multiplexers. Introduction to Verilog Verilog Hardware Description Language (Verilog HDL) released by Gateway Design Automation.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior : initial blocks execute.
Quad 2-to-1 Multiplexer Discussion D7.4 Example 7.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
each of these is an instantiation of “full_adder”
INTRODUCTION TO VERILOG HDL Presented by m.vinoth.
Chapter 4: Behavioral Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 4-1 Ders – 4: Davranışsal Modelleme.
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.
Module 2.1 Gate-Level/Structural Modeling UNIT 2: Modeling in Verilog.
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.
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.
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.
Brief Verilog.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Introduction to ASIC flow and Verilog HDL
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.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
Chapter 6: Hierarchical Structural Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 6-1 Chapter 6: Hierarchical.
Introduction to Verilog. Structure of a Verilog Program A Verilog program is structured as a set of modules, which may represent anything from a collection.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Overview Logistics Last lecture Today HW5 due today
Hardware Description Languages: Verilog
TODAY’S OUTLINE Verilog Codings Concurrent and Sequential If-else
Introduction to Verilog
Verilog Introduction Fall
‘if-else’ & ‘case’ Statements
Supplement on Verilog Sequential circuit examples: FSM
Lecture 2 Supplement Verilog-01
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Introduction to Verilog
Behavioral Modeling in Verilog
Verilog.
Chapter 4: Behavioral Modeling
Supplement on Verilog Sequential circuit examples: FSM
Introduction to Verilog
Supplement on Verilog adder examples
Introduction to Verilog
The Verilog Hardware Description Language
Introduction to Verilog
Introduction to Digital IC Design
Introduction to Verilog – Part-2 Procedural Statements
Presentation transcript:

Verilog Intro: Part 2

Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute only once at time zero (start execution at time zero). – always for cyclic behavior: always blocks loop to execute over and over again, in other words as the name implies, it always executes. Procedural assignment may only appear in initial and always constructs. The initial and always constructs are used to model sequential logic. Continuous statement is used to model combinational logic.

Example: Initial Block module initial_example; reg clk,reset,enable,data; initial begin clk = 0; reset = 0; enable = 0; data = 0; end endmodule The initial block is executed at time 0. Initial block just execute all the statements within begin and end statements.

Control Constructs – Can be used in the procedural sections of code. Selection – if statement: if (A == 4) B = 2; else begin B = 4; end – case statements: case ( ) : default: endcase

Example: 4-1 MUX in behavioral (1) module mux4 (Y,sel, A, B, C, D); input [1:0] sel; // 2-bit control signal input A, B, C, D; output Y; reg Y; // target of assignment or A or B or C or D) if(sel == 2’b00) Y = A; else if(sel == 2’b01) Y = B; else if(sel == 2’b10) Y = C; else if(sel == 2’b11) Y = D; endmodule A B C D Y sel[1:0]

Example: 4-1 MUX in behavioral (2) // 4-1 mux using case statement module mux4 (Y,sel, A, B, C, D); input [1:0] sel; // 2-bit control signal input A, B, C, D; output Y; reg Y; // target of assignment or A or B or C or D) case (sel) 2’b00: Y = A; 2’b01: Y = B; 2’b10: Y = C; 2’b11: Y = D; endcase endmodule A B C D Y Sel[1:0]

Example: 4-1 MUX in behavioral (3) // 4-1 mux using case statement module mux4 (q, select, d); input [1:0] select; // 2-bit control signal input [3:0] d; output q; reg q; // target of assignment or d) case (select) 2’b00: q = d[0]; 2’b01: q = d[1]; 2’b10: q = d[2]; 2’b11: q = d[3]; endcase endmodule

Example: 4-1 MUX in structural module mux4(q, select, d); input[1:0] select; input[3:0] d; output q; wire q1, q2, q3, q4, NOTselect0, NOTselect1; not n1( NOTselect0, select[0] ); not n2( NOTselect1, select[1] ); and a1( q1, NOTselect0, NOTselect1, d[0] ); and a2( q2, select[0], NOTselect1, d[1] ); and a3( q3, NOTselect0, select[1], d[2] ); and a4( q4, select[0], select[1], d[3] ); or o1( q, q1, q2, q3, q4 ); endmodule

4-bit Full Adder using 1-bit Full Adder module FourBitAdder( sum, c_out, x, y, c_in); output [3:0] sum; output c_out; input [3:0] x, y; input c_in; wire c1, c2, c3; fulladder fa0( sum[0], c1, x[0], y[0], c_in ); fulladder fa1( sum[1], c2, x[1], y[1], c1 ); fulladder fa2( sum[2], c3, x[2], y[2], c2 ); fulladder fa3( sum[3], c_out, x[3], y[3], c3 ); endmodule module fulladder( sum, c_out, x, y, c_in ); output sum, c_out; input x, y, c_in; wire a, b, c; xor( a, x, y); xor( sum, a, c_in ); and( b, x, y ); and( c, a, c_in ); or( c_out, c, b ); endmodule

Repetition // for loop for(i = 0; i < 10; i = i + 1) begin $display(“i = %d", i); end //while loop i = 0; while(i < 10) begin $display(“i = %d", i); i = i + 1; end // repeat loop repeat (5) //repeats the block 5 times, begin $display(“i = %d", i); i = i + 1; end

Blocking and Non-blocking Procedural Assignments The blocking assignment statement (= operator) acts much like in traditional programming languages. Blocking statement must complete execute before the next statement in the behavior can execute. The non-blocking (<= operator) evaluates all the right-hand sides for the current time unit and assigns the left-hand sides at the end of the time unit. Non-blocking assignment statements execute concurrently rather than sequentially.