MatchLib
nvhls_verify.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License")
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
75 #if !BOOST_PP_IS_ITERATING
77 
78 #include <mc_scverify.h> //needed for scverify to work, and still needed in vcsmx for the wrapper
79 
80 // If we're not running synthesis, rerun preprocessor regardless of
81 // simulation type.
82 #ifndef __SYNTHESIS__
83 #include <boost/preprocessor.hpp>
84 
85 #ifndef DOXYGEN_SHOULD_SKIP_THIS
86 
87 #define BOOST_PP_FILENAME_1 "nvhls_verify.h"
88 #define BOOST_PP_ITERATION_LIMITS \
89  (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(NVHLS_VERIFY_BLOCKS)))
90 
91 #include BOOST_PP_ITERATE()
92 
93 #endif // ifndef DOXYGEN_SHOULD_SKIP_THIS
94 
95 #endif
96 
98 // If this is running in CCS_SCVERIFY (instead of standalone g++ or vcsmx)
99 #ifndef NVHLS_VERIFY_ISVCSMX
100 
101 // This section just defines a shortcut macro to be more consistent with how
102 // SCVERIFY CCS_DESIGN worked
103 #ifndef __NVHLS_VERIFY__H
104 
105 #ifndef DOXYGEN_SHOULD_SKIP_THIS
106 #define __NVHLS_VERIFY__H
107 #endif // ifndef DOXYGEN_SHOULD_SKIP_THIS
108 
109 #define NVHLS_DESIGN(X) CCS_DESIGN(X)
111 // If synthesis, be don't use typedef
112 #ifdef __SYNTHESIS__
113 #define NVHLS_DESIGN_IN_CHIP(X) X
114 #else
115 #define NVHLS_DESIGN_IN_CHIP(X) NVHLS_DESIGN_##X
116 #endif
117 
118 #endif
119 
121 #else // NVHLS_VERIFY_ISVCSMX
122 
123 // We are running the nvhls_verify stand_sim flow.
124 
125 /* #include <boost/preprocessor.hpp> */
126 
127 /* #define BOOST_PP_FILENAME_1 "nvhls_verify.h" */
128 /* #define BOOST_PP_ITERATION_LIMITS \ */
129 /* (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(NVHLS_VERIFY_BLOCKS))) */
130 
131 /* #include BOOST_PP_ITERATE() */
132 
133 // This section just defines a shortcut macro to be more consistent with how
134 // SCVERIFY CCS_DESIGN worked
135 #ifndef __NVHLS_VERIFY__H
136 #define __NVHLS_VERIFY__H
137 
138 #define NVHLS_DESIGN(X) NVHLS_DESIGN_##X
139 #define NVHLS_DESIGN_IN_CHIP(X) NVHLS_DESIGN_##X
140 
141 #endif
142 
143 #endif // NVHLS_VERIFY_ISVCSMX
145 
146 // Undefine this so that nested uses of nvhls_verify.h doesn't throw warnings
147 #undef NVHLS_VERIFY_BLOCKS
148 
150 #else // !BOOST_PP_IS_ITERATING
152 
153 #define CURRENT BOOST_PP_SEQ_ELEM(BOOST_PP_ITERATION(), NVHLS_VERIFY_BLOCKS)
154 #define CURRENT_TYPE BOOST_PP_CAT(NVHLS_DESIGN_, CURRENT)
155 #define CURRENT_WRAP_DEF BOOST_PP_CAT(BOOST_PP_CAT(__WRAP_, CURRENT), __)
156 #define CURRENT_WRAP_CLASS BOOST_PP_CAT(CURRENT, _vcsmx_wrapper)
157 //#define CURRENT_MAX BOOST_PP_CAT(CURRENT, _MAX)
158 //#define FOO BOOST_PP_CAT(NVHLS_DESIGN_, CURRENT)
159 
160 #if CURRENT_WRAP_DEF && defined(NVHLS_VERIFY_ISVCSMX)
161 
162 // If this will be a Verilog module in vcsmx, include the wrapper and typedef
163 // it.
164 #include BOOST_PP_STRINGIZE(BOOST_PP_CAT(CURRENT, _wrapper.h))
165 typedef CURRENT_WRAP_CLASS CURRENT_TYPE;
166 
167 #else
168 
169 // If it is the normal module name.
170 typedef CURRENT CURRENT_TYPE;
171 
172 #endif
173 
174 // Leave no trace
175 #undef CURRENT
176 #undef CURRENT_TYPE
177 #undef CURRENT_WRAP_DEF
178 #undef CURRENT_WRAP_CLASS
179 
180 #endif // !BOOST_PP_IS_ITERATING