sc_ver.cpp revision 12027:1eb7dc7aa10b
18981Sandreas.hansson@arm.com/*****************************************************************************
28981Sandreas.hansson@arm.com
38981Sandreas.hansson@arm.com  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
48981Sandreas.hansson@arm.com  more contributor license agreements.  See the NOTICE file distributed
58981Sandreas.hansson@arm.com  with this work for additional information regarding copyright ownership.
68981Sandreas.hansson@arm.com  Accellera licenses this file to you under the Apache License, Version 2.0
78981Sandreas.hansson@arm.com  (the "License"); you may not use this file except in compliance with the
88981Sandreas.hansson@arm.com  License.  You may obtain a copy of the License at
98981Sandreas.hansson@arm.com
108981Sandreas.hansson@arm.com    http://www.apache.org/licenses/LICENSE-2.0
118981Sandreas.hansson@arm.com
128981Sandreas.hansson@arm.com  Unless required by applicable law or agreed to in writing, software
138981Sandreas.hansson@arm.com  distributed under the License is distributed on an "AS IS" BASIS,
148981Sandreas.hansson@arm.com  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
158981Sandreas.hansson@arm.com  implied.  See the License for the specific language governing
168981Sandreas.hansson@arm.com  permissions and limitations under the License.
178981Sandreas.hansson@arm.com
188981Sandreas.hansson@arm.com *****************************************************************************/
198981Sandreas.hansson@arm.com
208981Sandreas.hansson@arm.com/*****************************************************************************
218981Sandreas.hansson@arm.com
228981Sandreas.hansson@arm.com    sc_ver.cpp -- copyright information.
238981Sandreas.hansson@arm.com
248981Sandreas.hansson@arm.com    Original Author: Stan Y. Liao, Synopsys, Inc.
258981Sandreas.hansson@arm.com
268981Sandreas.hansson@arm.com  CHANGE LOG AT THE END OF THE FILE
278981Sandreas.hansson@arm.com *****************************************************************************/
288981Sandreas.hansson@arm.com
298981Sandreas.hansson@arm.com#include <cstddef>
308981Sandreas.hansson@arm.com#include <cstdlib>
318981Sandreas.hansson@arm.com
328981Sandreas.hansson@arm.com#define SC_DISABLE_API_VERSION_CHECK // for in-library sc_ver.h inclusion
338981Sandreas.hansson@arm.com
348981Sandreas.hansson@arm.com#include "sysc/kernel/sc_ver.h"
358981Sandreas.hansson@arm.com#include "sysc/kernel/sc_kernel_ids.h"
368981Sandreas.hansson@arm.com#include "sysc/utils/sc_iostream.h"
378981Sandreas.hansson@arm.com#include "sysc/utils/sc_report.h"
388981Sandreas.hansson@arm.com
398981Sandreas.hansson@arm.comusing std::getenv;
4010129SSascha.Bischoff@ARM.comusing std::strcmp;
418981Sandreas.hansson@arm.comusing std::cerr;
4210129SSascha.Bischoff@ARM.comusing std::endl;
438981Sandreas.hansson@arm.com
448981Sandreas.hansson@arm.comnamespace sc_core {
458981Sandreas.hansson@arm.com
468981Sandreas.hansson@arm.com
478981Sandreas.hansson@arm.comstatic
489338SAndreas.Sandberg@arm.comconst char systemc_version[] =
498981Sandreas.hansson@arm.com    "SystemC " SC_VERSION " --- " __DATE__ " " __TIME__;
5010129SSascha.Bischoff@ARM.com
5110129SSascha.Bischoff@ARM.comconst unsigned int sc_version_major = SC_VERSION_MAJOR;
528981Sandreas.hansson@arm.comconst unsigned int sc_version_minor = SC_VERSION_MINOR;
538981Sandreas.hansson@arm.comconst unsigned int sc_version_patch = SC_VERSION_PATCH;
548981Sandreas.hansson@arm.comconst bool         sc_is_prerelease = SC_IS_PRERELEASE;
558981Sandreas.hansson@arm.com
569398Sandreas.hansson@arm.comconst std::string  sc_version_originator   = SC_VERSION_ORIGINATOR;
579398Sandreas.hansson@arm.comconst std::string  sc_version_release_date = SC_VERSION_RELEASE_DATE;
589398Sandreas.hansson@arm.comconst std::string  sc_version_prerelease   = SC_VERSION_PRERELEASE;
598981Sandreas.hansson@arm.comconst std::string  sc_version_string       = SC_VERSION;
608981Sandreas.hansson@arm.comconst std::string  sc_copyright_string     = SC_COPYRIGHT;
618981Sandreas.hansson@arm.com
628981Sandreas.hansson@arm.comconst char*
638981Sandreas.hansson@arm.comsc_copyright()
648981Sandreas.hansson@arm.com{
658981Sandreas.hansson@arm.com    return SC_COPYRIGHT;
668981Sandreas.hansson@arm.com}
678981Sandreas.hansson@arm.com
688981Sandreas.hansson@arm.com
698981Sandreas.hansson@arm.comconst char*
708981Sandreas.hansson@arm.comsc_release()
718981Sandreas.hansson@arm.com{
728981Sandreas.hansson@arm.com    return SC_VERSION;
738981Sandreas.hansson@arm.com}
748981Sandreas.hansson@arm.com
758981Sandreas.hansson@arm.com
768981Sandreas.hansson@arm.comconst char*
778981Sandreas.hansson@arm.comsc_version()
788981Sandreas.hansson@arm.com{
798981Sandreas.hansson@arm.com    return systemc_version;
808981Sandreas.hansson@arm.com}
818981Sandreas.hansson@arm.com
828981Sandreas.hansson@arm.com
838981Sandreas.hansson@arm.com#if !defined(SC_DISABLE_COPYRIGHT_MESSAGE)
848981Sandreas.hansson@arm.com#  define SC_DISABLE_COPYRIGHT_MESSAGE 0
858981Sandreas.hansson@arm.com#endif
868981Sandreas.hansson@arm.com
878981Sandreas.hansson@arm.com// ----------------------------------------------------------------------------
888981Sandreas.hansson@arm.com
898981Sandreas.hansson@arm.comvoid
908981Sandreas.hansson@arm.compln()
918981Sandreas.hansson@arm.com{
928981Sandreas.hansson@arm.com    static bool lnp = SC_DISABLE_COPYRIGHT_MESSAGE;
938981Sandreas.hansson@arm.com    if ( lnp || getenv("SYSTEMC_DISABLE_COPYRIGHT_MESSAGE") != 0 )
948981Sandreas.hansson@arm.com        lnp = true;
958981Sandreas.hansson@arm.com    if ( const char * lnp_env = getenv("SC_COPYRIGHT_MESSAGE") ) {
968981Sandreas.hansson@arm.com        lnp = !strcmp( lnp_env, "DISABLE" );
978981Sandreas.hansson@arm.com    }
988981Sandreas.hansson@arm.com    if( ! lnp ) {
998981Sandreas.hansson@arm.com
1008981Sandreas.hansson@arm.com        static const char indent[] = "        ";
1018981Sandreas.hansson@arm.com        std::string       line;
1028981Sandreas.hansson@arm.com        std::stringstream copyright;
1038981Sandreas.hansson@arm.com
1048981Sandreas.hansson@arm.com        // temporary stream to print copyright line-wise with indentation
1058981Sandreas.hansson@arm.com        copyright << sc_copyright();
106
107        cerr << endl;
108        cerr << indent << sc_version() << endl;
109        while( getline( copyright, line ) )
110            cerr << indent << line << endl;
111
112        //  regressions check point
113
114        if( getenv( "SYSTEMC_REGRESSION" ) != 0 ) {
115            cerr << "SystemC Simulation" << endl;
116        }
117
118        lnp = true;
119    }
120}
121
122#define SC_API_PERFORM_CHECK_( Type, Name, Symbol ) \
123  do { \
124    static bool SC_CONCAT_UNDERSCORE_( Name, config_seen ) = false; \
125    static Type SC_CONCAT_UNDERSCORE_( Name, config ); \
126    if( ! SC_CONCAT_UNDERSCORE_( Name, config_seen ) ) { \
127      SC_CONCAT_UNDERSCORE_( Name, config_seen ) = true; \
128      SC_CONCAT_UNDERSCORE_( Name, config ) = Name; \
129    } else if( SC_CONCAT_UNDERSCORE_( Name, config ) != Name ) { \
130      SC_REPORT_FATAL( SC_ID_INCONSISTENT_API_CONFIG_, Symbol ); \
131    } \
132  } while( false )
133
134// THIS CONSTRUCTOR ROOTS OUT OLD OBJECTS AT LINK TIME
135//
136// Each source file which includes sc_ver.h for this SystemC version
137// will have a static instance of the class sc_api_version_XXX defined
138// in it. That object instanciation will cause the constructor below
139// to be invoked. If the version of the SystemC being linked against
140// does not contain the constructor below a linkage error will occur.
141//
142// Some preprocessor switches need to be consistent between the application
143// and the library (e.g. if sizes of classes are affected or other parts of
144// the ABI are affected).  (Some of) these are checked here at link-time as
145// well, by setting template parameters to sc_api_version_XXX, while only
146// one variant is defined here.
147//
148// Some preprocessor switches need to be consistent between different
149// translation units of an application.  Those can't be easily checked
150// during link-time.  Instead, perform a check during run-time by
151// passing the value to the constructor of the api_version_check object.
152
153// const int DEBUG_SYSTEMC_CHECK_           = 1;
154const int SC_DISABLE_VIRTUAL_BIND_CHECK_ = 1;
155
156template<>
157SC_API_VERSION_STRING
158<
159//   & DEBUG_SYSTEMC_CHECK_,
160  & SC_DISABLE_VIRTUAL_BIND_CHECK_
161>
162::SC_API_VERSION_STRING
163(
164  sc_writer_policy default_writer_policy
165)
166{
167  SC_API_PERFORM_CHECK_( sc_writer_policy
168                          , default_writer_policy
169                          , "SC_DEFAULT_WRITER_POLICY" );
170}
171
172} // namespace sc_core
173
174// $Log: sc_ver.cpp,v $
175// Revision 1.14  2011/08/26 21:56:55  acg
176//  Torsten Maehne: use usings rather than absolute namespace addressing.
177//
178// Revision 1.13  2011/08/26 20:46:11  acg
179//  Andy Goodrich: moved the modification log to the end of the file to
180//  eliminate source line number skew when check-ins are done.
181//
182// Revision 1.12  2011/07/25 10:20:34  acg
183//  Andy Goodrich: check in aftermath of call to automake.
184//
185// Revision 1.11  2011/07/02 12:55:19  acg
186//  Andy Goodrich: automake refresh.
187//
188// Revision 1.10  2011/07/01 18:49:07  acg
189//  Andy Goodrich: moved pln() from sc_simcontext.cpp to sc_ver.cpp.
190//
191// Revision 1.9  2011/07/01 18:33:08  acg
192//  Andy Goodrich: changes for IEEE 1666, removal of macros and use of them.
193//
194// Revision 1.8  2011/04/08 18:27:53  acg
195//  Andy Goodrich: respin of the PoC.
196//
197// Revision 1.7  2011/04/05 20:50:57  acg
198//  Andy Goodrich:
199//    (1) changes to make sure that event(), posedge() and negedge() only
200//        return true if the clock has not moved.
201//    (2) fixes for method self-resumes.
202//    (3) added SC_PRERELEASE_VERSION
203//    (4) removed kernel events from the object hierarchy, added
204//        sc_hierarchy_name_exists().
205//
206// Revision 1.6  2011/02/18 20:27:14  acg
207//  Andy Goodrich: Updated Copyrights.
208//
209// Revision 1.5  2011/02/13 21:47:38  acg
210//  Andy Goodrich: update copyright notice.
211//
212// Revision 1.4  2011/01/18 20:10:45  acg
213//  Andy Goodrich: changes for IEEE1666_2011 semantics.
214//
215// Revision 1.3  2010/11/20 17:10:57  acg
216//  Andy Goodrich: reset processing changes for new IEEE 1666 standard.
217//
218// Revision 1.2  2008/05/22 17:06:27  acg
219//  Andy Goodrich: updated copyright notice to include 2008.
220//
221// Revision 1.1.1.1  2006/12/15 20:20:05  acg
222// SystemC 2.3
223//
224// Revision 1.3  2006/01/13 18:44:30  acg
225// Added $Log to record CVS changes into the source.
226//
227
228// Taf!
229