1/*****************************************************************************
2
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements.  See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied.  See the License for the specific language governing
16  permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/* ---------------------------------------------------------------------------
21  Original Author:
22    Charles Wilson, XtremeEDA Corporation
23
24 @description
25  This header contains preprocessor and compiler symbols to allow for the
26   determination of the TLM version information. This conforms to
27   IEEE 1666-2005 section 8.5.5 - 8.5.7
28   The following are provided:
29
30   preprocessor: TLM_VERSION_MAJOR        numeric
31                 TLM_VERSION_MINOR        numeric
32                 TLM_VERSION_PATCH        numeric
33                 TLM_VERSION_ORIGINATOR   string       ([A-Z][a-z][0-9]_)
34                 TLM_VERSION_RELEASE_DATE ISO8601 date (YYYYMMDD)
35                 TLM_VERSION_PRERELEASE   string       ([A-Z][a-z][0-9]_)
36                 TLM_IS_PRERELEASE        bool         (1,0)
37                 TLM_VERSION              string       {2.0.0_DR3-TLMWG}
38                 TLM_COPYRIGHT            string
39
40   compiler:     tlm_version_major        const unsigned int
41                 tlm_version_minor        const unsigned int
42                 tlm_version_patch        const unsigned int
43                 tlm_version_originator   const std::string
44                 tlm_version_release_date const std::string
45                 tlm_version_prerelease   const std::string
46                 tlm_is_prerelease        const bool
47                 tlm_version              const string
48                 tlm_copyright            const string
49
50   accessors:    inline const char* tlm_release   (void)
51                 inline const char* tlm_version   (void)
52                 inline const char* tlm_copyright (void)
53--------------------------------------------------------------------------- */
54
55#ifndef __SYSTEMC_EXT_TLM_CORE_2_VERSION_HH__
56#define __SYSTEMC_EXT_TLM_CORE_2_VERSION_HH__
57
58namespace tlm
59{
60
61#define TLM_VERSION_MAJOR 2 ///< version major level ( numeric )
62#define TLM_VERSION_MINOR 0 ///< version minor level ( numeric )
63#define TLM_VERSION_PATCH 4 ///< version patch level ( numeric )
64#define TLM_VERSION_ORIGINATOR "Accellera" ///< TLM creator string
65#define TLM_VERSION_SEPARATOR "." ///< version string separator
66
67#define TLM_IS_PRERELEASE 0 ///< pre-release flag (1/0)
68
69#if TLM_IS_PRERELEASE
70#    define TLM_VERSION_PRERELEASE "pub_rev" ///< pre-release version string
71#else
72#    define TLM_VERSION_PRERELEASE "" ///< pre-release version string
73#endif
74
75#define TLM_VERSION_RELEASE_YEAR "2017" ///< release year  ( YYYY )
76#define TLM_VERSION_RELEASE_MONTH "10" ///< release month ( MM )
77#define TLM_VERSION_RELEASE_DAY "12" ///< release day   ( DD )
78
79#define TLM_COPYRIGHT \
80  "Copyright (c) 1996-" TLM_VERSION_RELEASE_YEAR " by all Contributors\n" \
81  "ALL RIGHTS RESERVED"
82
83/******************** do not modify below this line *************************/
84
85/************************* preprocessor symbols *****************************/
86
87#define TLM_VERSION_RELEASE_DATE TLM_VERSION_RELEASE_YEAR \
88                                 TLM_VERSION_RELEASE_MONTH \
89                                 TLM_VERSION_RELEASE_DAY
90
91#define TLM_VERSION_STR(x) TLM_VERSION_STR_HELPER(x)
92#define TLM_VERSION_STR_HELPER(x) #x
93
94#define TLM_VERSION_STRING_MAJOR TLM_VERSION_STR(TLM_VERSION_MAJOR)
95#define TLM_VERSION_STRING_MINOR TLM_VERSION_STR(TLM_VERSION_MINOR)
96#define TLM_VERSION_STRING_PATCH TLM_VERSION_STR(TLM_VERSION_PATCH)
97
98#define TLM_VERSION_STRING_MMP TLM_VERSION_STRING_MAJOR TLM_VERSION_SEPARATOR \
99                               TLM_VERSION_STRING_MINOR TLM_VERSION_SEPARATOR \
100                               TLM_VERSION_STRING_PATCH
101
102#define TLM_VERSION_STRING_PRE_START "_"
103#define TLM_VERSION_STRING_PRE_END "-"
104
105#if (TLM_IS_PRERELEASE == 1)
106
107#   define TLM_VERSION_STRING_PRERELEASE TLM_VERSION_PRERELEASE
108#   define TLM_VERSION_STRING_RELEASE_DATE ""
109
110#else /* TLM_IS_PRERELEASE == 1 */
111
112#   define TLM_VERSION_STRING_PRERELEASE ""
113#   define TLM_VERSION_STRING_RELEASE_DATE TLM_VERSION_RELEASE_DATE
114
115#endif /* TLM_IS_PRERELEASE == 1 */
116
117#define TLM_VERSION_STRING TLM_VERSION_STRING_MMP \
118                           TLM_VERSION_STRING_PRE_START \
119                           TLM_VERSION_STRING_PRERELEASE \
120                           TLM_VERSION_STRING_PRE_END \
121                           TLM_VERSION_ORIGINATOR
122
123#define TLM_VERSION_STRING_2 "TLM " \
124                             TLM_VERSION_STRING_MMP \
125                             " --- " \
126                             TLM_VERSION_RELEASE_YEAR \
127                             "-" \
128                             TLM_VERSION_RELEASE_MONTH \
129                             "-" \
130                             TLM_VERSION_RELEASE_DAY
131
132#define TLM_VERSION TLM_VERSION_STRING
133
134/*************************** compiler symbols ********************************/
135
136const unsigned int tlm_version_major(TLM_VERSION_MAJOR);
137const unsigned int tlm_version_minor(TLM_VERSION_MINOR);
138const unsigned int tlm_version_patch(TLM_VERSION_PATCH);
139
140const bool tlm_is_prerelease(TLM_IS_PRERELEASE);
141
142const std::string tlm_version_string(TLM_VERSION_STRING);
143const std::string tlm_version_originator(TLM_VERSION_ORIGINATOR);
144const std::string tlm_version_prerelease(TLM_VERSION_PRERELEASE);
145const std::string tlm_version_release_date(TLM_VERSION_STRING_RELEASE_DATE);
146const std::string tlm_copyright_string(TLM_COPYRIGHT);
147const std::string tlm_version_string_2(TLM_VERSION_STRING_2);
148
149inline const char *tlm_release() { return tlm_version_string.c_str(); }
150inline const char *tlm_version() { return tlm_version_string_2.c_str(); }
151inline const char *tlm_copyright() { return tlm_copyright_string.c_str(); }
152
153} // namespace tlm
154
155#endif /* __SYSTEMC_EXT_TLM_CORE_2_VERSION_HH__ */
156