Manisha, that is true, but in your example the sequence has a parameter and so it could (should?) be constrcuted anew with every instance of the class that maps to a different instance of the interface? It is true that the interface instances are known, so it could pre-construct an instance of the sequence for each of them, but still... ed ________________________________ From: owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] On Behalf Of Kulshrestha, Manisha Sent: Tuesday, May 16, 2006 4:30 PM To: Arturo Salz; sv-ac@eda.org Subject: RE: [sv-ac] Question about usage of endpoints in class methods Hello Arturo, Method triggered on a sequence can be called in a procedural context so I do not think it should be illegal due to that reason. In the LRM, there is an example in section 10.11 (Level sensitive sequence controls) where .triggered is used on a sequence in procedural context as follows: sequence abc; @(posedge clk) a ##1 b ##1 c; endsequence sequence de; @(negedge clk) d ##[2:5] e; endsequence program check; initial begin wait( abc.triggered || de.triggered ); if( abc.triggered ) $display( "abc succeeded" ); if( de.triggered ) $display( "de succeeded" ); L2 : ... end endprogram Yes, there is an error in the constructor as mentioned by you. Thanks. Manisha ________________________________ From: Arturo Salz [mailto:Arturo.Salz@synopsys.com] Sent: Tuesday, May 16, 2006 12:13 PM To: Kulshrestha, Manisha; sv-ac@eda.org Subject: RE: [sv-ac] Question about usage of endpoints in class methods Manisha, The statement "if( s0(ifc.clk).triggered)" ought to be illegal. The sequence "s0" cannot instantiated in a procedural context. User can accomplish this similar functionality using an expect statement. For example, replacing the incorrect statement with: expect( @(posedge ifc.clk) 1 ); The above statement is legal in a procedural context. There seems to be another minor error in your example: I believe the constructor was intended to be written as: function new (virtual if1 _ifc); Arturo ________________________________ From: owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] On Behalf Of Kulshrestha, Manisha Sent: Tuesday, May 16, 2006 10:54 AM To: sv-ac@eda.org Subject: [sv-ac] Question about usage of endpoints in class methods Hi, I have a question regarding usage of endpoints in class methods. I would like to know if this is legal or allowed by LRM. I could not find any restrictions in the LRM regarding this. But since class objects are dynamic in nature, how is it supposed to work if class object gets created sometime after first clock tick. Here is an example which uses virtual interface inside class. As you can see from the example the clock passed to the endpoint is dynamic and different for different objects of the same class. Also, note that class object c4 is getting created at time 50 where as the first clock tick for the endpoint in the method is at 40. interface if1(clk); input clk; endinterface module A; reg bla; reg clk1, clk2; sequence s0(clk); @(posedge clk) 1; endsequence class ctype; virtual if1 ifc; function new (virtual abc _ifc); ifc = _ifc; endfunction task execute(); if (s0(ifc.clk).triggered) $display($time, ": sequence triggered"); endtask endclass if1 abc1(clk1); if1 abc2(clk2); ctype c3 = new(abc1); ctype c4; initial begin clk1 = 0; clk2 = 0; #50 c4 = new(abc2); end always #20 clk1 = ~clk1; always #40 clk2 = ~clk2; endmodule Thanks. ManishaReceived on Tue May 16 13:36:40 2006
This archive was generated by hypermail 2.1.8 : Tue May 16 2006 - 13:36:43 PDT