RE: [sv-ec] compilation unit - class static variables

From: Daniel Mlynek <daniel.mlynek_at_.....>
Date: Tue Jul 15 2008 - 07:44:46 PDT
well, - yes you can workaround this by using packages
But dont you think that this is quite odd aproach and completly different
than ie  C++ one - and for sure can make a lot of confusion among SV users?
I was quite suprised when I realized that - and finding solution take me
some time. 
 
DANiel

  _____  

From: Rich, Dave [mailto:Dave_Rich@mentor.com] 
Sent: 15 lipca 2008 16:17
To: Daniel Mlynek; SV-EC
Cc: Piotr Winter; Mirek Forczek
Subject: RE: [sv-ec] compilation unit - class static variables



This is exactly why we have packages.

 

pkgC.sv

package C_pkg;

`include "c.svh"

endpackage

 

Then change your `include's to import C_pkg::*;

 

Dave

 

 

  _____  

From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org] On
Behalf Of Daniel Mlynek
Sent: Tuesday, July 15, 2008 7:04 AM
To: 'SV-EC'
Cc: 'Piotr Winter'; 'Mirek Forczek'
Subject: [sv-ec] compilation unit - class static variables

 

Consider the code:

<c.svh)

class C;

    static int i;

endclass

 

<top.v>

`include "c.svh"

module top;

    initial C::i=123;

endmodule

 

<top1.v>

`include "c.svh"

module top1;

    initial #0 $display(C::i);

endmodule

 

Both file are compiled in separate compilation - so class C is compiled
twice into two separate compilation units. As far as i undertand the
description - we get two separate class C definition with two separate sets
of statics?

 

This way user cannot divide his design to part to compile them separetely
(ie if he has stucks on some lack of memory problems in sinngle compilation)
because C::i in first compilation and C::i in 2nd are totally different.
There is no way to workaround the problem... Why IEEE have decided to
describe it this way???

 

Am I right?

 

 

 

DANiel


-- 
This message has been scanned for viruses and 
dangerous content by  <http://www.mailscanner.info/> 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 Tue Jul 15 07:47:24 2008

This archive was generated by hypermail 2.1.8 : Tue Jul 15 2008 - 07:47:56 PDT