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

From: Neil Korpusik <Neil.Korpusik_at_.....>
Date: Mon Apr 24 2006 - 16:00:02 PDT
This has been turned into mantis 1436.
The proposal is attached.

Neil



Dickol, John wrote On 04/21/06 08:39,:
> 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
> 
>  
> 
>  
> 

-- 
---------------------------------------------------------------------
Neil Korpusik                                     Tel: 408-720-4852
Senior Staff Engineer                             Fax: 408-720-4850
Frontend Technologies - ASICs & Processors (FTAP)
Sun Microsystems
email: neil.korpusik@sun.com
---------------------------------------------------------------------


Received on Mon Apr 24 16:00:17 2006

This archive was generated by hypermail 2.1.8 : Mon Apr 24 2006 - 16:00:51 PDT