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

From: Neil Korpusik <neil.korpusik@oracle.com>
Date: Fri May 27 2011 - 11:07:42 PDT

<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 b dut module output and it is
also driven by NBA to virtua 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.
Received on Fri May 27 11:08:20 2011

This archive was generated by hypermail 2.1.8 : Fri May 27 2011 - 11:08:32 PDT