# Working of bind construct

**URL:** <https://verificationacademy.com/forums/t/working-of-bind-construct/41111>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, Working-of-bind-construct\
**Created:** [December 19, 2022, 7:19pm UTC](https://verificationacademy.com/forums/t/working-of-bind-construct/41111 "2022-12-19T19:19:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Have\_A\_Doubt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Have\_A\_Doubt](https://verificationacademy.com/forums/u/Have_A_Doubt)\
**Post date:** [December 19, 2022, 7:19pm UTC](https://verificationacademy.com/forums/t/working-of-bind-construct/41111/1 "2022-12-19T19:19:36Z")

</div>

From assertion perspective ::

**’ bind ’ allows us to keep design logic separate from the assertion logic . Designers do not like to see anything in RTL that isn’t going to be synthesized . ’ bind ’ helps in that direction**

Consider following code ::

```verilog

module designmodule ( da , db , dclk );
  input da , dclk ;
  output logic db;
  always @( posedge dclk ) db <= da;
endmodule

module propertymodule ( pa , pb , pclk );
  input pa , pb , pclk ;

  property rc1;
    pa |=> pb ;
  endproperty

  baseP:assert property ( @( posedge pclk ) rc1 ) else $display($time , " property fails ");
endmodule

```

[Q1] What’s the difference between following 2 Scenarios ::

```verilog

// Scenario1 :: Using bind
module tb1;

 bind designmodule propertymodule dpM ( .pa( da ) , .pb( db ) , .pclk( dclk ) );

endmodule

// Scenario2 :: Without bind
module tb2;
 logic ta , tb , tclk;

 designmodule DM ( .da(ta) , .db( tb ) , .dclk( tclk ) ) ;

 propertymodule PM ( .pa( ta ) , .pb( tb ) , .pclk( tclk ) );

endmodule

```

One possible answer is Scenario2 applies to only specific instance of designmodule whereas with Scenatio1 applies to every instances of designmodule .

**[Q2] Are there any further differences between the two ?**

```
 **Significance of instance created by ' bind ' construct ::**

  Within Scenatio1 , an instance of propertymodule named ' dpM ' is created by default within every instance of designmodule .

  By default in Verilog a module declaration in itself doesn't do anything ( unless it's top_tb ) , one needs to instantiate it for the logic defined within it to work . 

  Hence simply declaring propertymodule doesn't do anything , one needs to create an instance of propertymodule for the assertions to execute .  

  bind construct creates the instance of propertymodule for the assertions to trigger . 

  This explains the significance of instance name created by bind construct for assertion based logic .

  **[Q3] For non-assertion based module / interface what's the significance of the instance name ?**

```

---

<div class="post-metadata">

**Author:** ![user49](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/user49/32/4533_2.png) [@user49](https://verificationacademy.com/forums/u/user49)\
**Post date:** [December 20, 2022, 12:13am UTC](https://verificationacademy.com/forums/t/working-of-bind-construct/41111/2 "2022-12-20T00:13:58Z")

</div>

_In reply to [Have\_A\_Doubt](https://verificationacademy.com/forums/t/working-of-bind-construct/41111):_

1. The **bind** is a better approach because your verification module can easily access signals that are internal to the design. When you bind, you are like instantiating the VF module inside the design module.
2. Use the SVG module interface syntax instead of the Verilog approach; it is more readable.
3. Use the same variable name throughout. Your da, pa stuff is confusing, particularly whne debugging. It will drive you crazy to continually convert one for the other.

> **[EDA Playground](https://www.edaplayground.com/x/iRu8)**
>
> Edit, save, simulate, synthesize SystemVerilog, Verilog, VHDL and other HDLs from your web browser.

```verilog

module designmodule (input bit da, dclk, output bit db);
  always @( posedge dclk ) db <= da;
  bit a, b; // used internally in the desing and are not IO
  int count; 
  always @( posedge dclk) if(da) count <= count+1; 
endmodule
 
module propertymodule ( input bit da , db , dclk, a, b, int count); 
  property rc1;
    da |=> db ;
  endproperty
 
  baseP:assert property ( @( posedge dclk ) rc1 );

ap_Count: assert property(@(posedge dclk) da |-> ##1 count==$past(count) +1);
endmodule

// Scenario1 :: Using bind
module tb1;
 
 bind designmodule propertymodule dpM
  ( .da(da), .db(db),.dclk(dclk), .a(a), .b(b), .count(count));
 
endmodule

```

Ben Cohen  
[http://www.systemverilog.us/](http://www.systemverilog.us/) [ben@systemverilog.us](mailto:ben@systemverilog.us)  
\*\* SVA Handbook 4th Edition, 2016 ISBN 978-1518681448  
…

1. SVA Package: Dynamic and range delays and repeats [SVA: Package for dynamic and range delays and repeats - SystemVerilog - Verification Academy](https://rb.gy/a89jlh)
2. Free books:

- Component Design by Example [https://rb.gy/9tcbhl](https://rb.gy/9tcbhl)
- Real Chip Design and Verification Using Verilog and VHDL($3) [https://rb.gy/cwy7nb](https://rb.gy/cwy7nb)
- A Pragmatic Approach to VMM Adoption  
[http://SystemVerilog.us/vf/VMM/VMM\_pdf\_release070506.zip](http://SystemVerilog.us/vf/VMM/VMM_pdf_release070506.zip)  
[http://SystemVerilog.us/vf/VMM/VMM\_code\_release\_071806.tar](http://SystemVerilog.us/vf/VMM/VMM_code_release_071806.tar)

1. Papers:  
Understanding the SVA Engine,  
[Verification Horizons](https://verificationacademy.com/verification-horizons/july-2020-volume-16-issue-2)  
Reflections on Users’ Experiences with SVA, part 1  
[Reflections on Users’ Experiences with SVA](https://verificationacademy.com/verification-horizons/march-2022-volume-18-issue-1/reflections-on-users-experiences-with-systemverilog-assertions-sva)  
Reflections on Users’ Experiences with SVA, part 2  
[Reflections on Users’ Experiences with SVA - Part II](https://verificationacademy.com/verification-horizons/july-2022-volume-18-issue-2/reflections-on-users-experiences-with-sva-part-2)  
Understanding and Using Immediate Assertions  
[Understanding and Using Immediate Assertions](https://verificationacademy.com/verification-horizons/december-2022-volume-18-issue-3/understanding-and-using-immediate-assertions)  
SUPPORT LOGIC AND THE ALWAYS PROPERTY  
[http://systemverilog.us/vf/support\_logic\_always.pdf](http://systemverilog.us/vf/support_logic_always.pdf)  
SVA Alternative for Complex Assertions  
[https://verificationacademy.com/news/verification-horizons-march-2018-issue](https://verificationacademy.com/news/verification-horizons-march-2018-issue)  
SVA in a UVM Class-based Environment  
[https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment](https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment)  
SVA for statistical analysis of a weighted work-conserving prioritized round-robin arbiter.  
[https://verificationacademy.com/forums/coverage/sva-statistical-analysis-weighted-work-conserving-prioritized-round-robin-arbiter](https://verificationacademy.com/forums/coverage/sva-statistical-analysis-weighted-work-conserving-prioritized-round-robin-arbiter).  
Udemy courses by Srinivasan Venkataramanan ([http://cvcblr.com/home.html](http://cvcblr.com/home.html))  
[https://www.udemy.com/course/sva-basic/](https://www.udemy.com/course/sva-basic/)  
[https://www.udemy.com/course/sv-pre-uvm/splay](https://www.udemy.com/course/sv-pre-uvm/splay)($time , " property fails ");
