M.Mohajjel. Objectives Learn How to write synthesizable Verilog code Common mistakes and how to avoid them What is synthesized for what we code Digital.

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

CPSC 321 Computer Architecture Andreas Klappenecker
//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Synchronous Sequential Logic
Combinational Logic.
Verilog Modules for Common Digital Functions
Table 7.1 Verilog Operators.
Hardware Description Language (HDL)
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
//HDL Example 5-1 // //Description of D latch (See Fig.5-6) module D_latch (Q,D,control); output Q; input.
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
ECE 551 Digital System Design & Synthesis Lecture 08 The Synthesis Process Constraints and Design Rules High-Level Synthesis Options.
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.
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
Lecture 2: Hardware Modeling with Verilog HDL
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.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
ECE 353 Computer Systems Lab I Verilog Hardware Description Language.
ENEE 408C Lab Capstone Project: Digital System Design Verilog Tutorial Class Web Site:
Verilog HDL (Behavioral Modeling) Bilal Saqib. Behavioral Modeling.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
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
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
1 VERILOG Fundamentals Workshop סמסטר א ' תשע " ה מרצה : משה דורון הפקולטה להנדסה Workshop Objectives: Gain basic understanding of the essential concepts.
Synthesis Presented by: Ms. Sangeeta L. Mahaddalkar ME(Microelectronics) Sem II Subject: Subject:ASIC Design and FPGA.
Chapter 4: Behavioral Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 4-1 Ders – 4: Davranışsal Modelleme.
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 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
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.
CH71 Chapter 7 Hardware Description Language (HDL) By Taweesak Reungpeerakul.
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.
Module 1.2 Introduction to Verilog
TOPIC : SYNTHESIS INTRODUCTION Module 4.3 : Synthesis.
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
Verilog for Synthesis Ing. Pullini Antonio
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
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.
ELEN 468 Lecture 131 ELEN 468 Advanced Logic Design Lecture 13 Synthesis of Combinational Logic II.
February 6, 2009http://csg.csail.mit.edu/6.375/L02-1 Verilog 1 - Fundamentals Complex Digital Systems Arvind February 6, 2009 FA module adder( input.
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.
Introduction to ASIC flow and Verilog HDL
Multiplexers Section Topics Multiplexers – Definition – Examples – Verilog Modeling.
Introduction to Verilog
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
Verilog-HDL Reference: Verilog HDL: a guide to digital design and synthesis, Palnitkar, Samir Some of slides in this lecture are supported by Prof. An-Yeu.
102-1 Under-Graduate Project Synthesis of Combinational Logic
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
1 Lecture 3: Modeling Sequential Logic in Verilog HDL.
Overview Logistics Last lecture Today HW5 due today
Hardware Description Languages: Verilog
Supplement on Verilog FF circuit examples
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
Behavioral Modeling Structural modeling Behavioral modeling
Hardware Description Languages: Verilog
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
SYNTHESIS OF SEQUENTIAL LOGIC
Behavioral/RTL Description (HDL)
Presentation transcript:

M.Mohajjel

Objectives Learn How to write synthesizable Verilog code Common mistakes and how to avoid them What is synthesized for what we code Digital System Design2

Logic Synthesis Why? Definition process of converting a high-level description of the design into an optimized gate-level representation, given a standard cell library and certain design constraints Digital System Design3

Logic Synthesis (cont.) RTL to gate level Behavioral Synthesis (High Level Synthesis) Decide number of registers and their interconnects in addition to RTL synthesis Digital System Design4

Logic Synthesis (cont.) Behavioral Synthesis (High Level Synthesis) Scheduling Allocation Mapping Digital System Design5 Source:

Logic Synthesis (cont.) Behavioral Synthesis (High Level Synthesis) Example Digital System Design6 PROCEDURE Test; VAR A,B,C,D,E,F,G:int eger; BEGIN Read(A,B,C,D,E); F := E*(A+B); G := (A+B)*(C+D);... END; Input behavioral specification

Logic Synthesis (cont.) Behavioral Synthesis (High Level Synthesis) Example Digital System Design7 PROCEDURE Test; VAR A,B,C,D,E,F,G:int eger; BEGIN Read(A,B,C,D,E); F := E*(A+B); G := (A+B)*(C+D);... END; Input behavioral specification

Logic Synthesis (cont.) Behavioral Synthesis (High Level Synthesis) Example Digital System Design8 Data-path allocation Control allocation

Traditional Logic Design Flow Design constraints Timing Area Power … Digital System Design9 Limitations Human errors Time overhead

Logic Design Flow Digital System Design10

Computer-Aided Logic Design Flow Translation Logic optimization Technology mapping and optimization Digital System Design11

Computer-Aided Logic Design Flow (cont.) Technology library Functionality Area Timing Power Design constraints Timing Area Power Digital System Design12

An Example of RTL-to-Gates module magnitude_comparator(A_gt_B, A_lt_B, A_eq_B, A, B); output A_gt_B, A_lt_B, A_eq_B; input [3:0] A, B; assign A_gt_B = (A > B); assign A_lt_B = (A < B); assign A_eq_B = (A == B); endmodule Digital System Design13 RTL description

An Example of RTL-to-Gates (cont.) //Library cells for abc_100 technology VNAND//2-input nand gate VAND//2-input and gate VNOR//2-input nor gate VOR//2-input or gate VNOT//not gate VBUF//buffer NDFF//Negative edge triggered D flip-flop PDFF//Positive edge triggered D flip-flop Digital System Design14 Technology library

An Example of RTL-to-Gates (cont.) Digital System Design15 Final, Optimized, Gate-Level Schematic

An Example of RTL-to-Gates (cont.) Digital System Design16 Final, Optimized, Gate-Level Description module magnitude_comparator ( A_gt_B, A_lt_B, A_eq_B, A, B ); input [3:0] A; input [3:0] B; output A_gt_B, A_lt_B, A_eq_B; wire n60, n61, n62, n50, n63, n51, n64, n52, n65, n40, n53, n41, n54, n42, n55, n43, n56, n44, n57, n45, n58, n46, n59, n47, n48, n49, n38, n39; VAND U7 (.in0(n48),.in1(n49),.out(n38) ); VAND U8 (.in0(n51),.in1(n52),.out(n50) ); VAND U9 (.in0(n54),.in1(n55),.out(n53) ); VNOT U30 (.in(A[2]),.out(n62) ); VNOT U31 (.in(A[1]),.out(n59) ); VNOT U32 (.in(A[0]),.out(n60) ); VNAND U20 (.in0(B[2]),.in1(n62),.out(n45) ); VNAND U21 (.in0(n61),.in1(n45),.out(n63) ); …. VNAND U18 (.in0(n56),.in1(n55),.out(n51) ); VNAND U19 (.in0(n50),.in1(n44),.out(n61) ); VAND U2 (.in0(n38),.in1(n39),.out(A_eq_B) ); VNAND U3 (.in0(n40),.in1(n41),.out(A_lt_B) ); VNAND U4 (.in0(n42),.in1(n43),.out(A_gt_B) ); VAND U5 (.in0(n45),.in1(n46),.out(n44) ); VAND U6 (.in0(n47),.in1(n44),.out(n39) ); endmodule

An Example of RTL-to-Gates (cont.) module stimulus; reg [3:0] A, B; wire A_GT_B, A_LT_B, A_EQ_B; magnitude_comparator MC(A_GT_B, A_LT_B, A_EQ_B, A, B); initial $monitor($time," A = %b, B = %b, A_GT_B = %b, A_LT_B = %b, A_EQ_B = %b", A, B, A_GT_B, A_LT_B, A_EQ_B); initial begin A = 4'b1010; B = 4'b1001; # 10 A = 4'b1110; B = 4'b1111; # 10 A = 4'b0000; B = 4'b0000; # 10 A = 4'b1000; B = 4'b1100; # 10 A = 4'b0110; B = 4'b1110; # 10 A = 4'b1110; B = 4'b1110; end endmodule Digital System Design17

An Example of RTL-to-Gates (cont.) Simulation Library //Simulation Library abc_100.v. Extremely simple. No timing checks. module VAND (out, in0, in1); input in0; input in1; output out; //timing information, rise/fall and min:typ:max specify (in0 => out) = ( : : , : : ); (in1 => out) = ( : : , : : ); endspecify //instantiate a Verilog HDL primitive and (out, in0, in1); endmodule... //All library cells will have corresponding module definitions //in terms of Verilog primitives.... Digital System Design18

Modeling Tips for Logic Synthesis Avoid mixing positive and negative edge-triggered flipflops Be careful with multiple assignments to the same variable clk) if(load1) q <= a1; clk) if(load2) q <= a2; Digital System Design19

Modeling Tips for Logic Synthesis (cont.) Use parentheses to optimize logic structure out = a + b + c + d; out = (a + b) + (c + d) ; Digital System Design20

Modeling Tips for Logic Synthesis (cont.) Define if-else or case statements explicitly level-sensitive latches may be inferred Digital System Design21 case ({a,b}) 2’b10 : out=1; 2’b01 : out=0; endcase case ({a,b}) 2’b10 : out=1; 2’b01 : out=0; default: out=0; endcase Out=0; case ({a,b}) 2’b10 : out=1; 2’b01 : out=0; endcase

Modeling Tips for Logic Synthesis (cont.) Digital System Design22

Modeling Tips for Logic Synthesis (cont.) Can't mix posedge/negedge use with plain signal references Digital System Design23 module DFF_bad (clk, reset, d, q); input clk,reset,d; output reg q; clk or reset) begin if (reset) q <= 1'b0; else q <= d; end endmodule

Modeling Tips for Logic Synthesis (cont.) Use nonblocking assignment for sequential always block Use blocking assignment for combinational always block Digital System Design24 clk) begin q1=d; q2=q1; q=q2; end clk) begin q1<=d ; q2<=q1; q <=q2; end

Modeling Tips for Logic Synthesis (cont.) Temporal loop in the body Not recommended Spatial loop or i2) for(k=0; k<2; k=k+1) out[k] = i1[k] & i2[k]; endmodule Digital System Design25

Modeling Tips for Logic Synthesis (cont.) Spatial loop (cont.) module syn (output reg [2:0] matchCount = 0, input [6:0] message, pattern); integer i; begin for (i = 0; i < 7 ; i = i + 1) matchCount = matchCount + ~(message[i] ^ pattern[i]); end endmodule Digital System Design26

Modeling Tips for Logic Synthesis (cont.) Spatial loop (cont.) Digital System Design27

Synthesizable Codes Structural & Dataflow Models Delays (#) are ignored Behavioral Models Synthesizability is restricted to a subset Digital System Design28

Synthesizable Behavioral Models initial is not supported While and forever loops must clk) clk) Not recommended Digital System Design29