Jump to content
sumit_tuwien

Display of Copyright

Recommended Posts

I have an interesting question.

 

I am writing a library which will link systemc library. 

 

I want to display library copyright information just after ASI copyright information. How do I do that ?

 

I know that I can write a function which contains copyright information and call it once in every library component using an extern flag (setting the flag false after once it is called) . But I do not want to declare "extern". Any clean way to perform this ?

 

-Sumit

Share this post


Link to post
Share on other sites

Hello Sumit,

 

I guess, the message you want to print should only be displayed once you actually use something from your library, i.e., either instantiate a class/module from the library or call some of its functions. Then, you can simply call the function displaying the copyright message in either:

  • the class/module's constructor
  • the module's before_end_of_elaboration() callback.
  • the function body.

As you only want the message to appear once, you will have to declare a static boolean flag in the body of the copyright message function, which is initially initialized to true and then is assigned false after the message has been conditionally displayed based on the flag.

 

If you want to be able to display the copyright message several times by calling the function, you will need a helper that handles the flag and uses your copyright message function. If I remember correctly, SystemC and SystemC-AMS display the copyright message from the context of their respective simulation context object, which is a singleton class. However, you'll need this heavier solution only if you also need to manage some more complex state centrally.

 

Best regards, Torsten

Share this post


Link to post
Share on other sites

This isn't in the LRM, but the ASI simulator seems to have the option of suppressing the copyright message using an environment variable or a #define - have a look in the code in sc_ver.h

 

You can print out the SystemC copyright using sc_copyright() (which *is* in the LRM)

 

regards

Alan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×