RE: [sv-ec] multi drive of variable via virtual interface

From: Gran, Alex <alex_gran@mentor.com>
Date: Fri May 27 2011 - 11:26:31 PDT

Daniel,
   I believe this should be an error. Are you expecting something different? If so, how are you expecting sig_read to behave.

This rule for Sec 6.5 should be in effect for this case.

        The precise rule is that it shall be an error to have multiple continuous assignments or a mixture of procedural
        and continuous assignments writing to any term in the expansion of a written longest static prefix of a
        variable (see 11.5.3 for the definition of a longest static prefix).

~Alex

-----Original Message-----
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Neil Korpusik
Sent: Friday, May 27, 2011 11:08 AM
To: SV_EC List
Cc: danielm
Subject: [sv-ec] multi drive of variable via virtual interface

<forwarding email from Daniel Mlynek>

-------- Original Message --------
Date: Fri, 27 May 2011 09:08:22 +0200
From: Daniel Mlynek <danielm@aldec.com>
To: "sv-ec@eda.org" <sv-ec@eda.org>
Subject: multi drive of variable via continous assignment and procedural assignment
  via virtual interface

In below code varaible sig_read is driven by dut module output and it is
also driven by NBA to virtual interface select.
How should tool behave for such code.
Detect multidrive and fail?

CODE:

     interface iface;
          logic clk;
          logic sig_read;
     endinterface

     module dut(input clk,output reg xbus_read);
          initial xbus_read<=1'bz;
          always @(posedge clk)begin
              xbus_read<=1'bz;
              $display("2: xbus_read<=1'bz");
          end
     endmodule

     class C;
          virtual iface vi;
          function new(virtual iface i);
              vi=i;
          endfunction
          function drive;
              vi.sig_read<=1;* //procedural drive of sig_read*
              $display("1: vi.sig_read<=1");
          endfunction
     endclass

     module top;
          iface iface_i();
          dut uut(iface_i.clk,iface_i.sig_read);* //dut instantation - continous drive of sig_read*
          C c =new(iface_i);
          initial iface_i.clk=0;
          always #5 iface_i.clk = ~ iface_i.clk;
          initial begin
              $display("START");
               $monitor($time,">>>>", iface_i.sig_read);
              @(posedge iface_i.clk)
              c.drive();
              @(posedge iface_i.clk);
              #1;
              $display("END");
              assert(iface_i.sig_read)else $fatal("fatal error");
              $finish;
              end

     endmodule

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri May 27 11:26:55 2011

This archive was generated by hypermail 2.1.8 : Fri May 27 2011 - 11:26:57 PDT