ELEN 468 Lecture 81 ELEN 468 Advanced Logic Design Lecture 8 Behavioral Descriptions II.

Slides:



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

Recap : Always block module and_gate (out, in1, in2); inputin1, in2; outputout; regout; or in2) begin out = in1 & in2; end endmodule zAlways.
CS 3850 Lecture 6 Tasks and Functions. 6.1 Tasks and Functions Tasks are like procedures in other programming languages. e. g., tasks may have zero or.
Simulation executable (simv)
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Synchronous Sequential Logic
Combinational Logic.
ELEN 468 Lecture 21 ELEN 468 Advanced Logic Design Lecture 2 Hardware Modeling.
Hardware Description Language (HDL)
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
2/9/20031 ECE 551: Digital System Design & Synthesis Lecture Set 4 4.1: Verilog – Procedural Assignments &Scheduling Semantics 4.2: Verilog – More Behavioral.
 HDLs – Verilog and Very High Speed Integrated Circuit (VHSIC) HDL  „ Widely used in logic design  „ Describe hardware  „ Document logic functions.
Specifies combinational logic (unclocked) always stmt. should use “=“ (called “blocking” assignment) in comb. logic always statements. RHS just takes output.
ECE 551 Digital System Design & Synthesis Lecture 09 Synthesis of Common Verilog Constructs.
ELEN 468 Lecture 151 ELEN 468 Advanced Logic Design Lecture 15 Synthesis of Language Construct I.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
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.
ELEN 468 Lecture 161 ELEN 468 Advanced Logic Design Lecture 16 Synthesis of Language Construct II.
Silicon Programming--Intro. to HDLs1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities.
ECEN ECEN475 Introduction to VLSI System Design Verilog HDL.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE VLSI System Design Lecture 4 - Advanced Verilog.
ELEN 468 Advanced Logic Design
Digital System Design Verilog ® HDL Behavioral Modeling (1) Maziar Goudarzi.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior : initial blocks execute.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
Timing control in verilog Module 3.1 Delays in Verilog.
Overview Logistics Last lecture Today HW5 due today
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
Introduction to FPGA AVI SINGH. Prerequisites Digital Circuit Design - Logic Gates, FlipFlops, Counters, Mux-Demux Familiarity with a procedural programming.
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.
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.
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.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 7: Design Example, Modeling Flip-Flops Spring.
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Digital System Design Verilog ® HDL Behavioral Modeling Maziar Goudarzi.
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,
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.
1 Verilog Digital System Design Z. Navabi, 2006 Verilog Language Concepts.
ELEN 468 Lecture 131 ELEN 468 Advanced Logic Design Lecture 13 Synthesis of Combinational Logic II.
M.Mohajjel. Structured Procedures Two basic structured procedure statements always initial All behavioral statements appear only inside these blocks Each.
Introduction to ASIC flow and Verilog HDL
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.
Timing Controls in Behavioral Modeling Programmable Logic Design (40-493) Fall 2001 Computer Engineering Department Sharif University of Technology Maziar.
Verilog® HDL Behavioral Modeling (2)
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
1 University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
Lecture #12 Page 1 ECE 4110– Digital Logic Design Lecture #12 Agenda 1.VHDL : Behavioral Design (Processes) Announcements 1.n/a.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
1 Lecture 3: Modeling Sequential Logic in Verilog HDL.
Structural Description
Overview Logistics Last lecture Today HW5 due today
Supplement on Verilog FF circuit examples
Last Lecture Talked about combinational logic always statements. e.g.,
ELEN 468 Advanced Logic Design
Verilog Introduction Fall
‘if-else’ & ‘case’ Statements
TODAY’S OUTLINE Procedural Assignments Verilog Coding Guidelines
Verilog HDL.
SYNTHESIS OF SEQUENTIAL LOGIC
332:437 Lecture 8 Verilog and Finite State Machines
COE 202 Introduction to Verilog
Dr. Tassadaq Hussain Introduction to Verilog – Part-3 Expressing Sequential Circuits and FSM.
332:437 Lecture 8 Verilog and Finite State Machines
Presentation transcript:

ELEN 468 Lecture 81 ELEN 468 Advanced Logic Design Lecture 8 Behavioral Descriptions II

ELEN 468 Lecture 82 Procedural Timing Control Delay control Event control Named events “wait” construct

ELEN 468 Lecture 83 Delay Control Operator (#) initial begin #0in1 = 0; in2 = 1; #10 in3 = 1; #40 in4 = 0; in5 = 1; #60 in3 = 0; end initial begin #0in1 = 0; in2 = 1; #10 in3 = 1; #40 in4 = 0; in5 = 1; #60 in3 = 0; end

ELEN 468 Lecture 84 Event Control Operator ( eventA or eventB ) begin ( eventC ) begin … end ( eventA or eventB ) begin ( eventC ) begin … end Event -> identifier or expression When is reached Activity flow is suspended The event is monitored Other processes keep going posedge: 0->1, 0->x, x->1 negedge: 1->0, 1->x, x->0 Cannot assign value to the event variable inside the synchronized behavior

ELEN 468 Lecture 85 Named Event module modA (…); … event sth_happens; // declaration always … ->sth_happens; // trigger event end endmodule module modB(…); … (top_mod.modA.sth_happens) … endmodule module modA (…); … event sth_happens; // declaration always … ->sth_happens; // trigger event end endmodule module modB(…); … (top_mod.modA.sth_happens) … endmodule Also called abstract event Declared only in module with keyword event Must be declared before it is used Event is triggered by “->” Provide high level inter- module communication without physical details

ELEN 468 Lecture 86 Example of Named Event module flop_event ( clk, reset, data, q, q_bar ); inputclk, reset, data; outputq, q_bar; regq; eventup_edge; assign q_bar = ~q; ( posedge clk ) -> up_edge; ( up_edge or negedge reset ) begin if ( reset == 0 ) q = 0; else q = data; end endmodule module flop_event ( clk, reset, data, q, q_bar ); inputclk, reset, data; outputq, q_bar; regq; eventup_edge; assign q_bar = ~q; ( posedge clk ) -> up_edge; ( up_edge or negedge reset ) begin if ( reset == 0 ) q = 0; else q = data; end endmodule

ELEN 468 Lecture 87 The “wait” Construct module modA (…); … always begin … wait ( enable ) ra = rb; … end endmodule module modA (…); … always begin … wait ( enable ) ra = rb; … end endmodule Activity flow is suspended if expression is false It resumes when the expression is true Other processes keep going

ELEN 468 Lecture 88 Intra-assignment Delay: Blocking Assignment // B = 0 at time 0 // B = 1 at time 4 … #5 A = B; // A = 1 C = D; … A = #5 B; // A = 0 C = D; … A B; C = D; … A B; C= D; … // B = 0 at time 0 // B = 1 at time 4 … #5 A = B; // A = 1 C = D; … A = #5 B; // A = 0 C = D; … A B; C = D; … A B; C= D; … If timing control on LHS Blocking delay RHS evaluated at Assignment at If timing control on RHS Intra-assignment delay RHS evaluated immediately Assignment at

ELEN 468 Lecture 89 Intra-assignment Delay: Non-blocking Assignment always ( posedge clk ) G (bus) acc; C <= D; // not blocked end always ( posedge clk ) G (bus) acc; C <= D; // not blocked end Sampling RHS immediately in the latest cycle Wait for time control to execute assignment Subsequent assignments are not blocked In 1 st cycle, “acc” is sampled What if no “bus” change in the same cycle? In next cycle, “acc” is sampled again Value of “acc” from previous cycle is overwritten Warning message

ELEN 468 Lecture 810 Be Cautious module or8( y, a, b ); input [7:0] a, b; output [7:0] y; reg [7:0] y; initial begin assign y = a | b; end endmodule module or8( y, a, b ); input [7:0] a, b; output [7:0] y; reg [7:0] y; initial begin assign y = a | b; end endmodule Model combinational logic by one-shot (initial) behavior Valid Not preferred Not accepted by synthesis tool

ELEN 468 Lecture 811 Example initial begin a = #10 1; b = #2 0; c = #3 1; end initial begin d <= #10 1; e <= #2 0; f <= #3 1; end initial begin a = #10 1; b = #2 0; c = #3 1; end initial begin d <= #10 1; e <= #2 0; f <= #3 1; end t a b c d e f 0 x x x x x x 2 x x x x 0 x 3 x x x x x x x

ELEN 468 Lecture 812 Tell the Differences (a or b) y = a|b; (a or b) #5 y = a|b; (a or b) y = #5 a|b; (a or b) y <= #5 a|b; (a or b) y = a|b; (a or b) #5 y = a|b; (a or b) y = #5 a|b; (a or b) y <= #5 a|b; Event control is blocked Which one describes or gate?

ELEN 468 Lecture 813 Simulation of Assignments For each given time step Evaluate all Right-Hand-Side Execute blocking assignment Execute non-blocking assignment that do not have intra-assignment timing control Execute past non-blocking assignment that is scheduled at this time Execute $monitor. However, $display is executed whenever it is encountered. Increment time step

ELEN 468 Lecture 814 Simulation of Non-blocking Assignment Normally the last assignment at certain simulation time step If it triggers other blocking assignments, it is executed before the blocking assignment it triggers always … begin A <= B; end … always … begin C D; end always … begin A <= B; end … always … begin C D; end

ELEN 468 Lecture 815 Example initial begin a = 1; b = 0; a <= b; b <= a; $display(“a=%b b=%b”, a, b); end initial begin a = 1; b = 0; a <= b; b <= a; $display(“a=%b b=%b”, a, b); end initial begin a = 1; b = 0; a <= b; b <= a; $monitor(“a=%b b=%b”, a, b); end initial begin a = 1; b = 0; a <= b; b <= a; $monitor(“a=%b b=%b”, a, b); end a=1 b=0 a=0 b=1

ELEN 468 Lecture 816 Repeated Intra-assignment Delay regA = repeat ( negedge clk ) regB; begin tmp = ( negedge clk ); regA = tmp; end begin tmp = ( negedge clk ); regA = tmp; end

ELEN 468 Lecture 817 Indeterminate Assignment module multi_assign(); reg a, b, c, d; initial begin #5 a = 1; b = 0; end ( posedge a ) begin c = a; end ( posedge a ) begin c = b; end ( posedge a ) begin d = b; end ( posedge a ) begin d = a; end endmodule module multi_assign(); reg a, b, c, d; initial begin #5 a = 1; b = 0; end ( posedge a ) begin c = a; end ( posedge a ) begin c = b; end ( posedge a ) begin d = b; end ( posedge a ) begin d = a; end endmodule Multiple assignments are made to same variable in different behavior Value depends on code order or vendor specifications Similar to race- conditions in hardware