[sv-ec] Typos in virtual interface example (20.8)

From: Dickol, John <john.dickol_at_.....>
Date: Fri Apr 21 2006 - 08:39:49 PDT
I don't know if this has been caught yet - I didn't see anything in the
e-mail archives.

 

The first example in section 20.8 (Virtual interfaces) has several typos
which prevent compilation of the example code.  These typos are various
different spellings for SBus and SBusTransactor.  Below is a modified
version which does compile cleanly.

 

--John

  

 

interface SBus;            // A Simple bus interface

  logic req, grant;

  logic [7:0] addr, data;

endinterface

 

class SBusTransactor;      // SBus transactor class

  virtual SBus bus;        // virtual interface of type Sbus

 

  function new( virtual SBus s );

    bus = s;               // initialize the virtual interface

  endfunction

 

  task request(); // request the bus

    bus.req <= 1'b1;

  endtask

 

  task wait_for_bus();     // wait for the bus to be granted

    @(posedge bus.grant);

  endtask

 

endclass

 

module devA( SBus s );  /*...*/ endmodule // devices that use SBus

module devB( SBus s );  /*...*/ endmodule

 

module top;

  SBus s[1:4] ();          // instantiate 4 interfaces

  devA a1( s[1] );         // instantiate 4 devices

  devB b1( s[2] );

  devA a2( s[3] );

  devB b2( s[4] );

  initial begin

    SBusTransactor t[1:4]; // create 4 bus-transactors and bind

    t[1] = new( s[1] );

    t[2] = new( s[2] );

    t[3] = new( s[3] );

    t[4] = new( s[4] );

  end

endmodule

 

 
Received on Fri Apr 21 08:40:54 2006

This archive was generated by hypermail 2.1.8 : Fri Apr 21 2006 - 08:41:23 PDT