# Work around for generating particular code using generate block with dynamic variable in SVA for assert property

**URL:** <https://verificationacademy.com/forums/t/work-around-for-generating-particular-code-using-generate-block-with-dynamic-variable-in-sva-for-assert-property/38275>\
**Category:** SystemVerilog\
**Tags:** SVA, SystemVerilog, generate, Assertions-using-Generate-Block, assertion\
**Created:** [October 28, 2020, 7:19am UTC](https://verificationacademy.com/forums/t/work-around-for-generating-particular-code-using-generate-block-with-dynamic-variable-in-sva-for-assert-property/38275 "2020-10-28T07:19:10Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Pavan\_Kumar\_Kollipara](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/p/919ad9/32.png) [@Pavan\_Kumar\_Kollipara](https://verificationacademy.com/forums/u/Pavan_Kumar_Kollipara)\
**Post date:** [October 29, 2020, 8:48am UTC](https://verificationacademy.com/forums/t/work-around-for-generating-particular-code-using-generate-block-with-dynamic-variable-in-sva-for-assert-property/38275/5 "2020-10-29T08:48:35Z")

</div>

Hello Ben,

This is the assertion I have written previously,

```verilog

property P_TAG_CHECK(tag);  
		@(posedge rd_rsp_clk) disable iff (rst_n !== 1)
		rdata_valid ##0 ((rdata_tag == tag) && (rdata_error == 0 || rdata_error == 1));		
endproperty: P_TAG_CHECK

// length(signal) is the signal changes with every command valid
// parameter READ_DATA = 32;
// tag is some value

always @(posedge cmd_valid) begin
      if(cmd_type == 0 && cmd_last == 1) begin
           for(genvar i = 0; i <= (length/(READ_DATA/8)); i++) begin
               property_a: assert property (P_TAG_CHECK(tag))
	         else $error("ERROR");
            end
       end
   end

```

I am using this genvar approach, it is throwing error(Because of dynamic variable) any work around for that (or) any other approach for this scenario.

My intension is to generate assert properties based on the condition of **length/(DATA\_WIDTH/8)**.

Thanks,  
Pavan.

---

_[View the full topic](https://verificationacademy.com/forums/t/work-around-for-generating-particular-code-using-generate-block-with-dynamic-variable-in-sva-for-assert-property/38275)._
