ELEN 468 Lecture 161 ELEN 468 Advanced Logic Design Lecture 16 Synthesis of Language Construct II.

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

FSM and Efficient Synthesizable FSM Design using Verilog
ECE 551 Digital Design And Synthesis
Synchronous Sequential Logic
Combinational Logic.
Reconfigurable Computing S. Reda, Brown University Reconfigurable Computing (EN2911X, Fall07) Lecture 07: Verilog (3/3) Prof. Sherief Reda Division of.
Table 7.1 Verilog Operators.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
ECE 551 Digital System Design & Synthesis Lecture 09 Synthesis of Common Verilog Constructs.
ELEN468 Lecture 101 ELEN 468 Advanced Logic Design Lecture 10 Behavioral Descriptions IV.
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.
1 COMP541 Sequencing and Control Montek Singh Mar 29, 2007.
ELEN 468 Lecture 81 ELEN 468 Advanced Logic Design Lecture 8 Behavioral Descriptions II.
ELEN 468 Lecture 91 ELEN 468 Advanced Logic Design Lecture 9 Behavioral Descriptions III.
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 4 - Verilog 2 (Sequential.
ENEE 408C Lab Capstone Project: Digital System Design Fall 2005 Sequential Circuit Design.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE VLSI System Design Lecture 4 - Advanced Verilog.
ELEN 468 Advanced Logic Design
Advanced Verilog EECS 270 v10/23/06.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
Overview Logistics Last lecture Today HW5 due today
Sequential Logic in Verilog
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.
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.
Slide 1 6. VHDL/Verilog Behavioral Description. Slide 2 Verilog for Synthesis: Behavioral description Instead of instantiating components, describe them.
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.
Workshop Topics - Outline
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.
ELEN 468 Lecture 131 ELEN 468 Advanced Logic Design Lecture 13 Synthesis of Combinational Logic II.
Finite State Machine (FSM) Nattha Jindapetch December 2008.
M.Mohajjel. Structured Procedures Two basic structured procedure statements always initial All behavioral statements appear only inside these blocks Each.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Verilog® HDL Behavioral Modeling (2)
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Chapter 11: System Design.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU 99-1 Under-Graduate Project Design of Datapath Controllers Speaker: Shao-Wei Feng Adviser:
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.
Pusat Pengajian Kejuruteraan Mikroelektronik EMT 351/4 DIGITAL IC DESIGN Verilog Behavioural Modeling (Part 4) Week #
1 Lecture 3: Modeling Sequential Logic in Verilog HDL.
EMT 351/4 DIGITAL IC DESIGN Verilog Behavioral Modeling  Constructs for Activity Flow Control  Task & Function  System Tasks for Timing Checks.
Structural Description
Overview Logistics Last lecture Today HW5 due today
Supplement on Verilog FF circuit examples
Figure 8.1. The general form of a sequential circuit.
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
‘if-else’ & ‘case’ Statements
Verilog HDL.
HDL Compiler Unsupport (Do NOT use in your verilog code)
SYNTHESIS OF SEQUENTIAL LOGIC
FSM MODELING MOORE FSM MELAY FSM. Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]
332:437 Lecture 8 Verilog and Finite State Machines
Test Fixture (Testbench)
COE 202 Introduction to Verilog
Dr. Tassadaq Hussain Introduction to Verilog – Part-3 Expressing Sequential Circuits and FSM.
The Verilog Hardware Description Language
ECE 551: Digital System Design & Synthesis
332:437 Lecture 8 Verilog and Finite State Machines
Lecture 7: Verilog Part II
Presentation transcript:

ELEN 468 Lecture 161 ELEN 468 Advanced Logic Design Lecture 16 Synthesis of Language Construct II

ELEN 468 Lecture 162 Synthesis of Assignment Non-blocking assignment was not part of the original Verilog For synthesis, a variable cannot be the target of both blocking and non- blocking assignment

ELEN 468 Lecture 163 Synthesis of Resets assign…deassign allows a separate behavior for asynchronous reset Efficient for simulation Not always synthesizable

ELEN 468 Lecture 164 Delay Controls Not recommended If delay < clock period, it is ignored If delay > clock period, it is executed in subsequent cycles

ELEN 468 Lecture 165 Event Controls Synthesis engine will parse event control expression to determine if it contains a clock signal May not contain a signal qualified by both posedge and negedge If a branch statement has no condition in event control parsing, it is synchronized Ordering: Asynchronous signal has higher priority Synchronous branch should come at the end

ELEN 468 Lecture 166 Multiple Event Control Expressions Explicit finite state machine – only one event control Implicit finite state machine – can be more than one, but must be synchronized to the same clock edge ( posedge clk ) begin a = b; c = ( posedge clk ) begin e = f; g = h; end ( posedge clk ) begin a = b; c = ( posedge clk ) begin e = f; g = h; end

ELEN 468 Lecture 167 Synthesis of the wait Statment At least one value of the condition expression should be generated by a separated behavior or a continuous assignment Condition determining the delay must be held in true for at least one clock cycle When the value of the condition is generated by another behavior, both behaviors should follow a same clock signal For some tools, the delay from a wait statement must be synchronized with clock

ELEN 468 Lecture 168 Synthesis of Named Events Not always synthesizable Must have two behaviors One triggers the event The other references the event Two behaviors may use  same clock or different clocks with same period  same or different edges of the same clock If the same clock edge is used, a delay < clock period must be inserted before the triggering statement Avoid race conditions Behavior trigged by the event is executed in next clock cycle

ELEN 468 Lecture 169 Example of Named Event ( posedge clk ) begin statement1; statement2; #1;// delay control ->event_is_triggered; end ( event_is_triggered ( posedge clk ) begin … end ( posedge clk ) begin statement1; statement2; #1;// delay control ->event_is_triggered; end ( event_is_triggered ( posedge clk ) begin … end

ELEN 468 Lecture 1610 Synthesis of Loops repeat, for, while, forever Depends on Venders Timing control Data dependencies A loop is static or data-independent if the number of iterations can by determined by the complier before simulation

ELEN 468 Lecture 1611 Static Loops without Internal Timing Controls –> Combinational Logic module count1sA ( bit_cnt, data, clk, rst ); parameter data_width = 4; parameter cnt_width = 3; output [cnt_width-1:0] bit_cnt; input[data_width-1:0] data; input clk, rst; reg [cnt_width-1:0] cnt, bit_cnt, i; reg [data_width-1:0] tmp; ( posedge clk ) if ( rst ) begin cnt = 0; bit_cnt = 0; end else begin cnt = 0; tmp = data; for ( i = 0; i < data_width; i = i + 1 ) begin if ( tmp[0] ) cnt = cnt + 1; tmp = tmp >> 1; end bit_cnt = cnt; end endmodule module count1sA ( bit_cnt, data, clk, rst ); parameter data_width = 4; parameter cnt_width = 3; output [cnt_width-1:0] bit_cnt; input[data_width-1:0] data; input clk, rst; reg [cnt_width-1:0] cnt, bit_cnt, i; reg [data_width-1:0] tmp; ( posedge clk ) if ( rst ) begin cnt = 0; bit_cnt = 0; end else begin cnt = 0; tmp = data; for ( i = 0; i < data_width; i = i + 1 ) begin if ( tmp[0] ) cnt = cnt + 1; tmp = tmp >> 1; end bit_cnt = cnt; end endmodule

ELEN 468 Lecture 1612 Static Loops with Internal Timing Controls –> Sequential Logic module count1sB ( bit_cnt, data, clk, rst ); parameter data_width = 4; parameter cnt_width = 3; output [cnt_width-1:0] bit_cnt; input[data_width-1:0] data; input clk, rst; reg [cnt_width-1:0] cnt, bit_cnt, i; reg [data_width-1:0] tmp; ( posedge clk ) if ( rst ) begin cnt = 0; bit_cnt = 0; end else begin cnt = 0; tmp = data; for ( i = 0; i < data_width; i = i + 1 ( posedge clk ) begin if ( tmp[0] ) cnt = cnt + 1; tmp = tmp >> 1; end bit_cnt = cnt; end endmodule module count1sB ( bit_cnt, data, clk, rst ); parameter data_width = 4; parameter cnt_width = 3; output [cnt_width-1:0] bit_cnt; input[data_width-1:0] data; input clk, rst; reg [cnt_width-1:0] cnt, bit_cnt, i; reg [data_width-1:0] tmp; ( posedge clk ) if ( rst ) begin cnt = 0; bit_cnt = 0; end else begin cnt = 0; tmp = data; for ( i = 0; i < data_width; i = i + 1 ( posedge clk ) begin if ( tmp[0] ) cnt = cnt + 1; tmp = tmp >> 1; end bit_cnt = cnt; end endmodule

ELEN 468 Lecture 1613 Non-Static Loops without Internal Timing Controls –> Not Synthesizable module count1sC ( bit_cnt, data, clk, rst ); parameter data_width = 4; parameter cnt_width = 3; output [cnt_width-1:0] bit_cnt; input[data_width-1:0] data; input clk, rst; reg [cnt_width-1:0] cnt, bit_cnt, i; reg [data_width-1:0] tmp; ( posedge clk ) if ( rst ) begin cnt = 0; bit_cnt = 0; end else begin cnt = 0; tmp = data; for ( i = 0; | tmp; i = i + 1 ) begin if ( tmp[0] ) cnt = cnt + 1; tmp = tmp >> 1; end bit_cnt = cnt; end endmodule module count1sC ( bit_cnt, data, clk, rst ); parameter data_width = 4; parameter cnt_width = 3; output [cnt_width-1:0] bit_cnt; input[data_width-1:0] data; input clk, rst; reg [cnt_width-1:0] cnt, bit_cnt, i; reg [data_width-1:0] tmp; ( posedge clk ) if ( rst ) begin cnt = 0; bit_cnt = 0; end else begin cnt = 0; tmp = data; for ( i = 0; | tmp; i = i + 1 ) begin if ( tmp[0] ) cnt = cnt + 1; tmp = tmp >> 1; end bit_cnt = cnt; end endmodule

ELEN 468 Lecture 1614 Non-Static Loops with Internal Timing Controls –> Sequential Logic module count1sD ( bit_cnt, data, clk, rst ); parameter data_width = 4; parameter cnt_width = 3; output [cnt_width-1:0] bit_cnt; input[data_width-1:0] data; input clk, rst; reg [cnt_width-1:0] cnt, bit_cnt, i; reg [data_width-1:0] tmp; ( posedge clk ) if ( rst ) begin cnt = 0; bit_cnt = 0; end else begin: bit_counter cnt = 0; tmp = data; while ( tmp ( posedge clk ) begin if ( rst ) begin cnt = 0; disable bit_counter; end else begin cnt = cnt + tmp[0]; tmp = tmp >> 1; end bit_cnt = cnt; end endmodule module count1sD ( bit_cnt, data, clk, rst ); parameter data_width = 4; parameter cnt_width = 3; output [cnt_width-1:0] bit_cnt; input[data_width-1:0] data; input clk, rst; reg [cnt_width-1:0] cnt, bit_cnt, i; reg [data_width-1:0] tmp; ( posedge clk ) if ( rst ) begin cnt = 0; bit_cnt = 0; end else begin: bit_counter cnt = 0; tmp = data; while ( tmp ( posedge clk ) begin if ( rst ) begin cnt = 0; disable bit_counter; end else begin cnt = cnt + tmp[0]; tmp = tmp >> 1; end bit_cnt = cnt; end endmodule

ELEN 468 Lecture 1615 Implement Loops with Finite State Machine module count1s_FSM ( bit_cnt, ready, start, done, data, clk, rst ); parameter data_width = 4; parameter cnt_width = 3; parameter idle=0; parameter load=1; parameter count=2; parameter waiting=3; … … ( posedge clk ) if ( rst ) begin state <= idle; bit_cnt <= 0; tmp <= 0; end else begin state <= next_state; bit_cnt <= clear ? 0 : bit_cnt + tmp[0]; tmp >1; end module count1s_FSM ( bit_cnt, ready, start, done, data, clk, rst ); parameter data_width = 4; parameter cnt_width = 3; parameter idle=0; parameter load=1; parameter count=2; parameter waiting=3; … … ( posedge clk ) if ( rst ) begin state <= idle; bit_cnt <= 0; tmp <= 0; end else begin state <= next_state; bit_cnt <= clear ? 0 : bit_cnt + tmp[0]; tmp >1; end (state or ready or rst or tmp) case ( state ) idle: begin done <= 0; start <=0; clear <= 1; if ( ready ) next_state <= load; else next_state <= idle; end load: begin start <= 1; clear <= 0; tmp <= data; next_state <= count; end count: begin start <= 0; if ( tmp ) next_state <= count; else next_state <= waiting; end waiting: begin done <= 1; if ( !ready ) next_state <= idle; else next_state <= waiting; end … … (state or ready or rst or tmp) case ( state ) idle: begin done <= 0; start <=0; clear <= 1; if ( ready ) next_state <= load; else next_state <= idle; end load: begin start <= 1; clear <= 0; tmp <= data; next_state <= count; end count: begin start <= 0; if ( tmp ) next_state <= count; else next_state <= waiting; end waiting: begin done <= 1; if ( !ready ) next_state <= idle; else next_state <= waiting; end … …

ELEN 468 Lecture 1616 Synthesis of fork … join Blocks Synthesis tools may Either fail Or require that it does not contain event and delay controls that are equal to or longer than a clock cycle – equivalent to a set of non-blocking assignments

ELEN 468 Lecture 1617 Synthesis of the disable Statement External disables imply sequential logic Internal disables -> reset or interrupt signals

ELEN 468 Lecture 1618 Synthesis of Tasks and Functions Synthesis tools expand tasks and functions If multiple calls made to a task, duplicated control logic may result No mechanism to synchronize multiple calls to the same task A task may not contain inout ports Any specify … endspecify block is ignored by synthesis

ELEN 468 Lecture 1619 Exercise 6

ELEN 468 Lecture 1620 Answer to Exercise clk data rega pipe 1, 2, 3 x regc pipe 3 pipe 1 pipe x x x regb pipe 1, 3 pipe x x

ELEN 468 Lecture 1621

ELEN 468 Lecture 1622 Example: Sequence Detector Single bit serial input Synchronized to falling edge of clock Single bit output Assert if two or more successive 0 or 1 at input Active on rising edge of clock Clock Input Output

ELEN 468 Lecture 1623 State Transition Diagram State0 Start state State1 Input 0 State2 Input 1 0/0 1/0 0/1 1/1 1/0 0/0

ELEN 468 Lecture 1624 Synthesis of Assignment in FSM module seq_det ( clock, reset, inBit, outBit ); input clock, reset, inBit; output outBit; reg thisBit, lastBit, outBit; ( posedge clock or posedge reset ) if ( reset == 1 ) begin lastBit = 0; thisBit = 0; outBit = 0; end else begin lastBit = thisBit; thisBit = inBit; outBit = ( lastBit == thisBit ); end endmodule module seq_det ( clock, reset, inBit, outBit ); input clock, reset, inBit; output outBit; reg thisBit, lastBit, outBit; ( posedge clock or posedge reset ) if ( reset == 1 ) begin lastBit = 0; thisBit = 0; outBit = 0; end else begin lastBit = thisBit; thisBit = inBit; outBit = ( lastBit == thisBit ); end endmodule Example Different simulation result for pre and post synthesis Implicit pipelining