Chapter 7: Advanced Modeling Techniques - Wiley

501 downloads 102 Views 327KB Size Report
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~ 2010, John Wiley. 7-1. Chapter 7: Advanced Modeling. Techniques. Department  ...
Chapter 7: Advanced Modeling Techniques

Chapter 7: Advanced Modeling Techniques Prof. Ming-Bo Lin

Department of Electronic Engineering National Taiwan University of Science and Technology

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-1

Chapter 7: Advanced Modeling Techniques

Syllabus ™ ™ ™ ™

Objectives Blocks Procedural continuous assignments Delay models and timing checks

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-2

Chapter 7: Advanced Modeling Techniques

Objectives After completing this chapter, you will be able to: ™ Describe the features of sequential blocks ™ Describe the features of parallel blocks ™ Describe the features of nested blocks ™ Describe the features of procedural continuous assignments ™ Describe how to model a module delay ™ Describe the features of specify blocks ™ Describe the features of timing checks

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-3

Chapter 7: Advanced Modeling Techniques

Syllabus ™ Objectives ™ Blocks ƒ ƒ ƒ ƒ

Sequential blocks Parallel blocks Special blocks The disable statement

™ Procedural continuous assignments ™ Delay models and timing checks

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-4

Chapter 7: Advanced Modeling Techniques

Sequential Blocks initial begin x = 1’b1; // at time 0 #12 y = 1’b1; // at time 12 #20 z = 1’b0; // at time 32 end initial begin x = 1'b0; // at time 0 #20 w = 1'b1; // at time 20 #12 y (out -: in) = (8, 6); ƒ module path: from clock to out ƒ rise time = 8 and fall delay = 6 ƒ data path: from in to out

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-29

Chapter 7: Advanced Modeling Techniques

Level-Sensitive Path ™ clock => (out : in) = (8, 6); ƒ At any change in clock, a module path extends from clock to out

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-30

Chapter 7: Advanced Modeling Techniques

State-Dependent Path ™ Syntax if (cond_expr) simple_path_declaration if (cond_expr) edge_sensitive_path_declaration ifnone simple_path_declaration specify if (x) (x => f) = 10; if (~x) (y => f) = 8; endspecify specify if (!reset && !clear) (positive clock => (out +: in) = (8, 6); endspecify Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-31

Chapter 7: Advanced Modeling Techniques

The specparam Statement specify // define parameters inside the specify block specparam d_to_q = (10, 12); specparam clk_to_q = (15, 18); ( d => q) = d_to_q; (clk => q) = clk_to_q; endspecify

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-32

Chapter 7: Advanced Modeling Techniques

An Example --- An NOR Gate module my_nor (a, b, out); … output out; nor nor1 (out, a, b); specify specparam trise = 1, tfall = 2 specparam trise_n = 2, tfall_n = 3; if (a) (b => out) = (trise, tfall); if (b) (a => out) = (trise, tfall); if (~a)(b => out) = (trise_n, tfall_n); if (~b)(a => out) = (trise_n, tfall_n); endspecify … Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-33

Chapter 7: Advanced Modeling Techniques

Syllabus ™ ™ ™ ™

Objectives Blocks Procedural continuous assignments Delay models and timing checks ƒ Delay models ƒ Specify blocks ƒ Timing checks

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-34

Chapter 7: Advanced Modeling Techniques

Timing Checks ™ Must be inside the specify blocks ™ The most commonly used timing checks ƒ ƒ ƒ ƒ ƒ ƒ ƒ

$setup $hold $setuphold $width $skew $period $recovery

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-35

Chapter 7: Advanced Modeling Techniques

Timing Checks -- $setup Timing Check

$setup (data_event, reference_event, limit); Violation when treference_event – tdata_event < limit specify $setup (data, posedge clock, 15); endspecify Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-36

Chapter 7: Advanced Modeling Techniques

Timing Checks -- $hold Timing Check

$hold (reference_event, data_event, limit); Violation when tdata_event – treference_event < limit specify $hold (posedge clock, data, 8); endspecify Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-37

Chapter 7: Advanced Modeling Techniques

Timing Checks -- $setuphold Timing Check

$setuphold (reference_event, data_event, setup_limit, hold_limit); Violation when: treference_event – tdata_event < setup_limit tdata_event – treference_event < hold_limit specify $setuphold (posedge clock, data, 10, 5); endspecify Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-38

Chapter 7: Advanced Modeling Techniques

Timing Checks -- $width Timing Check

$width (reference_event, limit); Violation when tdata_event – treference_event < limit specify $width (posedge reset, 6); endspecify Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-39

Chapter 7: Advanced Modeling Techniques

Timing Checks -- $skew Timing Check

$skew (reference_event, data_event, limit); Violation when tdata_event – treference_event > limit specify $skew (posedge clk1, posedge clk2, 5); endspecify Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-40

Chapter 7: Advanced Modeling Techniques

Timing Checks -- $period Timing Check

$period (reference_event, limit); Violation when tdata_event – treference_event < limit specify $period (posedge clk, 15); endspecify Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley

7-41

Chapter 7: Advanced Modeling Techniques

Timing Checks -- $recovery Timing Check

$recovery (reference_event, data_event, limit); Violation when treference_event