Advanced Verilog EECS 270 v10/23/06.

Slides:



Advertisements
Similar presentations
Digital System Design-II (CSEB312)
Advertisements

VERILOG: Synthesis - Combinational Logic Combination logic function can be expressed as: logic_output(t) = f(logic_inputs(t)) Rules Avoid technology dependent.
ECE 551 Digital Design And Synthesis
Supplement on Verilog adder examples
Synchronous Sequential Logic
EE 361 Fall 2003University of Hawaii1 Hardware Design Tips EE 361 University of Hawaii.
Combinational Logic.
Register Transfer Level
Table 7.1 Verilog Operators.
Hardware Description Language (HDL)
Give qualifications of instructors: DAP
Slide 1 7. Verilog: Combinational always statements. VHDL: Combinational Processes: To avoid (I.E. DO NOT What in your HDL code?) Cases that generate Synthesis.
Lecture 12 Latches Section , Block Diagram of Sequential Circuit gates New output is dependent on the inputs and the preceding values.
 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.
Specifies combinational logic (unclocked) always stmt. should use “=“ (called “blocking” assignment) in comb. logic always statements. RHS just takes output.
CSE Spring Verilog for Sequential Systems - 1 Today: Verilog and Sequential Logic zFlip-flops yrepresentation of clocks - timing of state.
Spring 20067W. Rhett Davis with minor modifications by Dean Brock ECE 406 at UNASlide 1 ECE 406 Design of Complex Digital Systems Lecture 10: 9: State.
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
Digital System Design by Verilog University of Maryland ENEE408C.
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
ELEN 468 Lecture 161 ELEN 468 Advanced Logic Design Lecture 16 Synthesis of Language Construct II.
ELEN 468 Advanced Logic Design
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
Overview Logistics Last lecture Today HW5 due today
each of these is an instantiation of “full_adder”
Sequential Logic in Verilog
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
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Ders 8: FSM Gerçekleme ve.
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.
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
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.
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,
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
Finite State Machine (FSM) Nattha Jindapetch December 2008.
Verilog A Hardware Description Language (HDL ) is a machine readable and human readable language for describing hardware. Verilog and VHDL are HDLs.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Introduction to ASIC flow and Verilog HDL
1 COMP541 State Machines - II Montek Singh Feb 13, 2012.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 9: State Machines & Reset Behavior Spring.
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.
EMT 351/4 DIGITAL IC DESIGN Verilog Behavioral Modeling  Finite State Machine -Moore & Mealy Machine -State Encoding Techniques.
1 Lecture 3: Modeling Sequential Logic in Verilog HDL.
Structural Description
Overview Logistics Last lecture Today HW5 due today
Verilog Tutorial Fall
Supplement on Verilog FF circuit examples
Adapted from Krste Asanovic
Figure 8.1. The general form of a sequential circuit.
TODAY’S OUTLINE Verilog Codings Concurrent and Sequential If-else
Last Lecture Talked about combinational logic always statements. e.g.,
Reg and Wire:.
Verilog Introduction Fall
‘if-else’ & ‘case’ Statements
Supplement on Verilog Sequential circuit examples: FSM
TODAY’S OUTLINE Procedural Assignments Verilog Coding Guidelines
CS Fall 2005 – Lec. #5 – Sequential Logic - 1
HDL Compiler Unsupport (Do NOT use in your verilog code)
COE 202 Introduction to Verilog
Supplement on Verilog Sequential circuit examples: FSM
Dr. Tassadaq Hussain Introduction to Verilog – Part-3 Expressing Sequential Circuits and FSM.
The Verilog Hardware Description Language
Introduction to Verilog – Part-2 Procedural Statements
Lecture 7: Verilog Part II
Presentation transcript:

Advanced Verilog EECS 270 v10/23/06

Continuous Assignments review Continuously assigns right side of expression to left side. Limited to basic Boolean and ? operators. For example a 2:1 mux: ? operator assign D = (A= =1) ? B : C;  // if A then D = B else D = C; Boolean operators assign D = (B & A) | (C & ~A);  // if A then D = B else D = C;

Procedural Assignments Executes a procedure allowing for more powerful constructs such as if-then-else and case statement. For example 2:1 mux: if-then-else if (A) then D = B else D = C; case case(A)  1'b1 : D = B;  1'b0 : D = C;  endcase This is obviously much easier to implement and read then Boolean expressions!!

Always Block An always block is an example of a procedure. The procedure executes a set of assignments when a defined set of inputs change.

2:1 mux Always Block Literally: always execute at a or b or sel. Declare Module and IO as before. Module mux_2_1(a, b, out, sel); input a, b, sel; output out; reg out; always @ (a or b or sel) begin if (sel) out = a; else out = b; end endmodule All data types in always blocks must be declared as a ‘reg’ type. This is required even if the data type is for combinational logic. The always block ‘executes’ whenever signals named in the sensitivity list change. Literally: always execute at a or b or sel. Sensitivity list should include conditional (sel) and right side (a, b) assignment variables.

As Easier Way to Implement the Sensitivity List Recent versions of Verilog provides a means to implement the sensitivity list without explicitly listing each potential variable. Instead of listing variables as in the previous example always @ (a or b or sel) Simply use always @* The * operator will automatically identify all sensitive variables.

Blocking vs Non-Blocking Assignments Blocking (=) and non-blocking (<=) assignments are provided to control the execution order within an always block. Blocking assignments literally block the execution of the next statement until the current statement is executed. Consequently, blocking assignments result in ordered statement execution. For example: assume a = b = 0 initially; a = 1; //executed first b = a; //executed second then a = 1, b = 1 after ordered execution

Blocking vs Non-Blocking Cont Non-blocking assignments literally do not block the execution of the next statements. The right side of all statements are determined first, then the left sides are assigned together. Consequently, non-blocking assignments result in simultaneous or parallel statement execution. For example: assume a = b = 0 initially; a <= 1; b <= a; then a = 1, b = 0 after parallel execution Execute together (in parallel) Result is different from ordered exec!!! Does not preserve logic flow

To Block or Not to Block ? Ordered execution mimics the inherent logic flow of combinational logic. Hence blocking assignments generally work better for combinational logic. For example: x = a & b y = x | b logic flow

To Block or Not to Block ? cont Module blocking(a,b,c,x,y); input a,b,c; output x,y; reg x,y; always @* begin x = a & b; y = x | c; end endmodule Module nonblocking(a,b,c,x,y); x <= a & b; y <= x | c; Blocking behavior a b c x y Initial values 1 a changesalways block execs x = a & b; //make assignment y = x | c; //make assignment Non-blocking behavior a b c x y Initial values 1 a changesalways block execs x = a & b; y = x | c; //x not passed from here make x, y assignments non-blocking behavior does not preserve logic flow!!

Sequential Logic Can be generalized as a series of combinational blocks with registers to hold results. comb logic register comb logic register inputs results inputs results more stages clk Results of each stage are stored (latched) in a register (D-Flip-Flops) by a common clock

Sequential Example Shift registers are used to implement multiplication/division and other functions. Consider a simple 2-bit “right” shift: clk D0 Q0 Q1 initial 1 rising edge common clock No combinational logic for simple shift, just simple pass thru

Sequential Example Cont 1 Notice that the inputs of each stage are “evaluated” then latched into the registers at each rising clock edge. inputs evaluated between rising clk edges results latched on rising clk edge

Sequential Example Cont 2 Because the shift logic evaluates inputs in parallel and latches result on a rising clk edge, a non-blocking always procedure sensitive to a rising clock can be used to implement. Sensitive to rising clock edge. Note that in this case we must explicitly specify sensitivity to the rising edge of clock. Simply using the * will not work. process statements in parallel

Sequential Example Cont 3 What if we used blocking statements instead. Notice the following results: The logic statements are simplified to Q0 = Q1 = D0. Logic is evaluated on rising edge of clk. Verilog is synthesized as one stage logic.

Summary Combinational logic: Use blocking statements with always blocks with the * operator to mimic logic flow of combinational logic. Sequential logic: Use non-blocking statements with always blocks sensitive to rising clock edge to mimic parallel sequential logic.

Modeling Finite State Machines with Verilog Finite State Machines can be modeled with three general functions: Next State Logic (combinational) Combinational logic that determines next state based on current state and inputs. State Register (sequential) Sequential logic that holds the value of the current state. Output Logic (combinational) Combinational logic that sets the output based on current state.

FSM Example: A Simple Arbiter Four inputs: reset, clock req_0 and req_1. Two outputs: gnt_0 and gnt_1.

Modeling the Arbiter in Verilog Identify the combinational and sequential components. Express each component as a combinational or sequential always block.

Arbiter Next State Always Block Use this combinational always block to implement state transition logic with case and if-then-else constructs

Arbiter State Register Always Block The state register will be loaded with next_state from the next state logic on the rising edge of clock. Reset will set the state register to IDLE state on RESET and the rising edge of clock.

Arbiter Output Always Block Use a combinational always block to implement logic output based on state.

Integrate Into One Module Module and IO Declaration Next State Always Block State Register Always Block Output Always Block