cocotb 1.9.2__cp312-cp312-win_amd64.whl → 2.0.0b1__cp312-cp312-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cocotb might be problematic. Click here for more details.
- cocotb/{ANSI.py → _ANSI.py} +5 -25
- cocotb/__init__.py +76 -332
- cocotb/_base_triggers.py +513 -0
- cocotb/_bridge.py +187 -0
- cocotb/_decorators.py +515 -0
- cocotb/_deprecation.py +3 -3
- cocotb/_exceptions.py +7 -0
- cocotb/_extended_awaitables.py +419 -0
- cocotb/_gpi_triggers.py +382 -0
- cocotb/_init.py +295 -0
- cocotb/_outcomes.py +54 -0
- cocotb/_profiling.py +46 -0
- cocotb/_py_compat.py +100 -29
- cocotb/_scheduler.py +454 -0
- cocotb/_test.py +245 -0
- cocotb/_test_factory.py +309 -0
- cocotb/_test_functions.py +42 -0
- cocotb/_typing.py +7 -0
- cocotb/_utils.py +296 -0
- cocotb/_version.py +3 -7
- cocotb/_xunit_reporter.py +66 -0
- cocotb/clock.py +271 -108
- cocotb/handle.py +1342 -795
- cocotb/libs/cocotb.dll +0 -0
- cocotb/libs/cocotb.exp +0 -0
- cocotb/libs/cocotb.lib +0 -0
- cocotb/libs/cocotbfli_modelsim.dll +0 -0
- cocotb/libs/cocotbfli_modelsim.exp +0 -0
- cocotb/libs/cocotbfli_modelsim.lib +0 -0
- cocotb/libs/cocotbutils.dll +0 -0
- cocotb/libs/cocotbutils.exp +0 -0
- cocotb/libs/cocotbutils.lib +0 -0
- cocotb/libs/cocotbvhpi_aldec.dll +0 -0
- cocotb/libs/cocotbvhpi_aldec.exp +0 -0
- cocotb/libs/cocotbvhpi_aldec.lib +0 -0
- cocotb/libs/cocotbvhpi_modelsim.dll +0 -0
- cocotb/libs/cocotbvhpi_modelsim.exp +0 -0
- cocotb/libs/cocotbvhpi_modelsim.lib +0 -0
- cocotb/libs/cocotbvpi_aldec.dll +0 -0
- cocotb/libs/cocotbvpi_aldec.exp +0 -0
- cocotb/libs/cocotbvpi_aldec.lib +0 -0
- cocotb/libs/cocotbvpi_ghdl.dll +0 -0
- cocotb/libs/cocotbvpi_ghdl.exp +0 -0
- cocotb/libs/cocotbvpi_ghdl.lib +0 -0
- cocotb/libs/cocotbvpi_icarus.exp +0 -0
- cocotb/libs/cocotbvpi_icarus.lib +0 -0
- cocotb/libs/cocotbvpi_icarus.vpl +0 -0
- cocotb/libs/cocotbvpi_modelsim.dll +0 -0
- cocotb/libs/cocotbvpi_modelsim.exp +0 -0
- cocotb/libs/cocotbvpi_modelsim.lib +0 -0
- cocotb/libs/embed.dll +0 -0
- cocotb/libs/embed.exp +0 -0
- cocotb/libs/embed.lib +0 -0
- cocotb/libs/gpi.dll +0 -0
- cocotb/libs/gpi.exp +0 -0
- cocotb/libs/gpi.lib +0 -0
- cocotb/libs/gpilog.dll +0 -0
- cocotb/libs/gpilog.exp +0 -0
- cocotb/libs/gpilog.lib +0 -0
- cocotb/libs/pygpilog.dll +0 -0
- cocotb/libs/pygpilog.exp +0 -0
- cocotb/libs/pygpilog.lib +0 -0
- cocotb/{log.py → logging.py} +105 -110
- cocotb/queue.py +103 -57
- cocotb/regression.py +667 -712
- cocotb/result.py +17 -188
- cocotb/share/def/aldec.exp +0 -0
- cocotb/share/def/aldec.lib +0 -0
- cocotb/share/def/ghdl.exp +0 -0
- cocotb/share/def/ghdl.lib +0 -0
- cocotb/share/def/icarus.exp +0 -0
- cocotb/share/def/icarus.lib +0 -0
- cocotb/share/def/modelsim.def +1 -0
- cocotb/share/def/modelsim.exp +0 -0
- cocotb/share/def/modelsim.lib +0 -0
- cocotb/share/include/cocotb_utils.h +6 -29
- cocotb/share/include/embed.h +5 -28
- cocotb/share/include/gpi.h +137 -92
- cocotb/share/include/gpi_logging.h +221 -142
- cocotb/share/include/py_gpi_logging.h +7 -4
- cocotb/share/include/vpi_user_ext.h +4 -26
- cocotb/share/lib/verilator/verilator.cpp +59 -54
- cocotb/simulator.cp312-win_amd64.exp +0 -0
- cocotb/simulator.cp312-win_amd64.lib +0 -0
- cocotb/simulator.cp312-win_amd64.pyd +0 -0
- cocotb/simulator.pyi +107 -0
- cocotb/task.py +434 -212
- cocotb/triggers.py +55 -1092
- cocotb/types/__init__.py +25 -47
- cocotb/types/_abstract_array.py +151 -0
- cocotb/types/_array.py +264 -0
- cocotb/types/_logic.py +296 -0
- cocotb/types/_logic_array.py +834 -0
- cocotb/types/{range.py → _range.py} +36 -44
- cocotb/types/_resolve.py +76 -0
- cocotb/utils.py +119 -587
- cocotb-2.0.0b1.dist-info/METADATA +60 -0
- cocotb-2.0.0b1.dist-info/RECORD +143 -0
- {cocotb-1.9.2.dist-info → cocotb-2.0.0b1.dist-info}/WHEEL +1 -1
- cocotb-2.0.0b1.dist-info/entry_points.txt +2 -0
- {cocotb-1.9.2.dist-info → cocotb-2.0.0b1.dist-info}/top_level.txt +1 -0
- cocotb_tools/__init__.py +0 -0
- cocotb_tools/_coverage.py +33 -0
- cocotb_tools/_vendor/__init__.py +3 -0
- cocotb_tools/check_results.py +65 -0
- cocotb_tools/combine_results.py +152 -0
- cocotb_tools/config.py +241 -0
- {cocotb → cocotb_tools}/ipython_support.py +29 -22
- cocotb_tools/makefiles/Makefile.deprecations +27 -0
- {cocotb/share → cocotb_tools}/makefiles/Makefile.inc +82 -54
- {cocotb/share → cocotb_tools}/makefiles/Makefile.sim +8 -33
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.activehdl +9 -16
- cocotb_tools/makefiles/simulators/Makefile.cvc +61 -0
- cocotb_tools/makefiles/simulators/Makefile.dsim +39 -0
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.ghdl +13 -42
- cocotb_tools/makefiles/simulators/Makefile.icarus +80 -0
- cocotb_tools/makefiles/simulators/Makefile.ius +93 -0
- cocotb_tools/makefiles/simulators/Makefile.modelsim +9 -0
- cocotb_tools/makefiles/simulators/Makefile.nvc +60 -0
- cocotb_tools/makefiles/simulators/Makefile.questa +29 -0
- cocotb/share/makefiles/simulators/Makefile.questa → cocotb_tools/makefiles/simulators/Makefile.questa-compat +26 -54
- cocotb_tools/makefiles/simulators/Makefile.questa-qisqrun +149 -0
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.riviera +17 -56
- cocotb_tools/makefiles/simulators/Makefile.vcs +65 -0
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.verilator +15 -22
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.xcelium +20 -52
- cocotb_tools/py.typed +0 -0
- {cocotb → cocotb_tools}/runner.py +794 -361
- cocotb/_sim_versions.py → cocotb_tools/sim_versions.py +16 -21
- pygpi/entry.py +34 -17
- pygpi/py.typed +0 -0
- cocotb/binary.py +0 -858
- cocotb/config.py +0 -289
- cocotb/decorators.py +0 -332
- cocotb/memdebug.py +0 -35
- cocotb/outcomes.py +0 -56
- cocotb/scheduler.py +0 -1099
- cocotb/share/makefiles/Makefile.deprecations +0 -12
- cocotb/share/makefiles/simulators/Makefile.cvc +0 -94
- cocotb/share/makefiles/simulators/Makefile.icarus +0 -111
- cocotb/share/makefiles/simulators/Makefile.ius +0 -125
- cocotb/share/makefiles/simulators/Makefile.modelsim +0 -32
- cocotb/share/makefiles/simulators/Makefile.nvc +0 -64
- cocotb/share/makefiles/simulators/Makefile.vcs +0 -98
- cocotb/types/array.py +0 -309
- cocotb/types/logic.py +0 -292
- cocotb/types/logic_array.py +0 -298
- cocotb/wavedrom.py +0 -199
- cocotb/xunit_reporter.py +0 -80
- cocotb-1.9.2.dist-info/METADATA +0 -168
- cocotb-1.9.2.dist-info/RECORD +0 -121
- cocotb-1.9.2.dist-info/entry_points.txt +0 -2
- /cocotb/{_vendor/__init__.py → py.typed} +0 -0
- {cocotb-1.9.2.dist-info → cocotb-2.0.0b1.dist-info/licenses}/LICENSE +0 -0
- {cocotb → cocotb_tools}/_vendor/distutils_version.py +0 -0
|
@@ -1,44 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Redistribution and use in source and binary forms, with or without
|
|
7
|
-
* modification, are permitted provided that the following conditions are met:
|
|
8
|
-
* * Redistributions of source code must retain the above copyright
|
|
9
|
-
* notice, this list of conditions and the following disclaimer.
|
|
10
|
-
* * Redistributions in binary form must reproduce the above copyright
|
|
11
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
-
* documentation and/or other materials provided with the distribution.
|
|
13
|
-
* * Neither the name of Potential Ventures Ltd,
|
|
14
|
-
* SolarFlare Communications Inc nor the
|
|
15
|
-
* names of its contributors may be used to endorse or promote products
|
|
16
|
-
* derived from this software without specific prior written permission.
|
|
17
|
-
*
|
|
18
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
21
|
-
* ARE DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
|
|
22
|
-
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
23
|
-
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24
|
-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
25
|
-
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
27
|
-
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
-
******************************************************************************/
|
|
1
|
+
// Copyright cocotb contributors
|
|
2
|
+
// Copyright (c) 2013 Potential Ventures Ltd
|
|
3
|
+
// Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
+
// Licensed under the Revised BSD License, see LICENSE for details.
|
|
5
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
29
6
|
|
|
30
7
|
#ifndef COCOTB_GPI_LOGGING_H_
|
|
31
8
|
#define COCOTB_GPI_LOGGING_H_
|
|
32
9
|
|
|
33
|
-
#include <
|
|
10
|
+
#include <cstdarg> // va_list
|
|
11
|
+
#include <cstring> // strlen
|
|
12
|
+
|
|
13
|
+
#include "exports.h"
|
|
14
|
+
|
|
34
15
|
#ifdef GPILOG_EXPORTS
|
|
35
16
|
#define GPILOG_EXPORT COCOTB_EXPORT
|
|
36
17
|
#else
|
|
37
18
|
#define GPILOG_EXPORT COCOTB_IMPORT
|
|
38
19
|
#endif
|
|
39
20
|
|
|
40
|
-
#include <cstdarg>
|
|
41
|
-
|
|
42
21
|
#ifdef __cplusplus
|
|
43
22
|
extern "C" {
|
|
44
23
|
#endif
|
|
@@ -50,158 +29,258 @@ extern "C" {
|
|
|
50
29
|
* Python logging module. Implementers of custom loggers should emit human
|
|
51
30
|
* readable level names for these value, but may support other values.
|
|
52
31
|
*/
|
|
53
|
-
enum
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
32
|
+
enum gpi_log_level {
|
|
33
|
+
GPI_NOTSET = 0, ///< Lets the parent logger in the hierarchy decide the
|
|
34
|
+
///< effective log level. By default this behaves like
|
|
35
|
+
///< `INFO`.
|
|
36
|
+
GPI_TRACE = 5, ///< Prints `TRACE` by default. Information about execution
|
|
37
|
+
///< of simulator callbacks and Python/simulator contexts.
|
|
38
|
+
GPI_DEBUG = 10, ///< Prints `DEBUG` by default. Verbose information, useful
|
|
39
|
+
///< for debugging.
|
|
40
|
+
GPI_INFO = 20, ///< Prints `INFO` by default. Information about major
|
|
41
|
+
///< events in the current program.
|
|
42
|
+
GPI_WARNING = 30, ///< Prints `WARN` by default. Encountered a recoverable
|
|
43
|
+
///< bug, or information about surprising behavior.
|
|
44
|
+
GPI_ERROR = 40, ///< Prints `ERROR` by default. An unrecoverable error
|
|
45
|
+
GPI_CRITICAL = 50 ///< Prints `CRITICAL` by default. An unrecoverable
|
|
46
|
+
///< error, to be followed by immediate simulator
|
|
47
|
+
///< shutdown.
|
|
65
48
|
};
|
|
66
49
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*/
|
|
50
|
+
#define LOG_EXPLICIT(logger, level, file, func, lineno, ...) \
|
|
51
|
+
gpi_log_(logger, level, file, func, lineno, __VA_ARGS__)
|
|
52
|
+
|
|
71
53
|
#define LOG_(level, ...) \
|
|
72
|
-
|
|
54
|
+
gpi_log_("gpi", level, __FILE__, __func__, __LINE__, __VA_ARGS__)
|
|
73
55
|
|
|
74
56
|
/** Logs a message at TRACE log level using the current log handler.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
#define LOG_TRACE(...) LOG_(
|
|
57
|
+
Automatically populates arguments using information in the called context.
|
|
58
|
+
*/
|
|
59
|
+
#define LOG_TRACE(...) LOG_(GPI_TRACE, __VA_ARGS__)
|
|
78
60
|
|
|
79
61
|
/** Logs a message at DEBUG log level using the current log handler.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
#define LOG_DEBUG(...) LOG_(
|
|
62
|
+
Automatically populates arguments using information in the called context.
|
|
63
|
+
*/
|
|
64
|
+
#define LOG_DEBUG(...) LOG_(GPI_DEBUG, __VA_ARGS__)
|
|
83
65
|
|
|
84
66
|
/** Logs a message at INFO log level using the current log handler.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
#define LOG_INFO(...) LOG_(
|
|
67
|
+
Automatically populates arguments using information in the called context.
|
|
68
|
+
*/
|
|
69
|
+
#define LOG_INFO(...) LOG_(GPI_INFO, __VA_ARGS__)
|
|
88
70
|
|
|
89
71
|
/** Logs a message at WARN log level using the current log handler.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
#define LOG_WARN(...) LOG_(
|
|
72
|
+
Automatically populates arguments using information in the called context.
|
|
73
|
+
*/
|
|
74
|
+
#define LOG_WARN(...) LOG_(GPI_WARNING, __VA_ARGS__)
|
|
93
75
|
|
|
94
76
|
/** Logs a message at ERROR log level using the current log handler.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
#define LOG_ERROR(...) LOG_(
|
|
77
|
+
Automatically populates arguments using information in the called context.
|
|
78
|
+
*/
|
|
79
|
+
#define LOG_ERROR(...) LOG_(GPI_ERROR, __VA_ARGS__)
|
|
98
80
|
|
|
99
81
|
/** Logs a message at CRITICAL log level using the current log handler.
|
|
100
|
-
|
|
82
|
+
Automatically populates arguments using information in the called context.
|
|
83
|
+
*/
|
|
84
|
+
#define LOG_CRITICAL(...) LOG_(GPI_CRITICAL, __VA_ARGS__)
|
|
85
|
+
|
|
86
|
+
#define MAKE_LOG_NAME_(extra_name) \
|
|
87
|
+
(extra_name[0] == '\0' ? "gpi" : "gpi." extra_name)
|
|
88
|
+
|
|
89
|
+
/** Type of a logger handler function.
|
|
90
|
+
* @param userdata private implementation data registered with this function
|
|
91
|
+
* @param name Name of the logger
|
|
92
|
+
* @param level Level at which to log the message
|
|
93
|
+
* @param pathname Name of the file where the call site is located
|
|
94
|
+
* @param funcname Name of the function where the call site is located
|
|
95
|
+
* @param lineno Line number of the call site
|
|
96
|
+
* @param msg The message to log, uses C-sprintf-style format specifier
|
|
97
|
+
* @param args Additional arguments; formatted and inserted in message
|
|
98
|
+
* according to format specifier in msg argument
|
|
101
99
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
100
|
+
typedef void (*gpi_log_handler_ftype)(void *userdata, const char *name,
|
|
101
|
+
int level, const char *pathname,
|
|
102
|
+
const char *funcname, long lineno,
|
|
103
|
+
const char *msg, va_list args);
|
|
104
|
+
|
|
105
|
+
/** Type of a logger filter function.
|
|
106
|
+
*
|
|
107
|
+
* Log filter functions test to see if a message would be emitted if logged at
|
|
108
|
+
* the given log level.
|
|
109
|
+
*
|
|
110
|
+
* @param userdata Private implementation data registered with this function.
|
|
111
|
+
* @param logger Name of the logger.
|
|
112
|
+
* @param level Level at which to test if the logger would emit a message.
|
|
113
|
+
* @return `true` if the *logger* is enabled at *level*.
|
|
114
114
|
*/
|
|
115
|
-
typedef
|
|
116
|
-
|
|
117
|
-
long lineno, const char *msg, va_list args);
|
|
115
|
+
typedef bool (*gpi_log_filter_ftype)(void *userdata, const char *logger,
|
|
116
|
+
int level);
|
|
118
117
|
|
|
119
|
-
/**
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
according to format specifier in msg argument
|
|
118
|
+
/** Type of a logger set level function.
|
|
119
|
+
*
|
|
120
|
+
* Log filter functions test to see if a message would be emitted if logged at
|
|
121
|
+
* the given log level.
|
|
122
|
+
*
|
|
123
|
+
* @param userdata Private implementation data registered with this function.
|
|
124
|
+
* @param logger Name of the logger.
|
|
125
|
+
* @param level Level at which to test if the logger would emit a message.
|
|
126
|
+
* @return `true` if the *logger* is enabled at *level*.
|
|
129
127
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
...);
|
|
128
|
+
typedef bool (*gpi_log_set_level_ftype)(void *userdata, const char *logger,
|
|
129
|
+
int level);
|
|
133
130
|
|
|
134
131
|
/** Log a message using the currently registered log handler.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
132
|
+
*
|
|
133
|
+
* @param extra_name Name of the "gpi" child logger, "" for the root logger
|
|
134
|
+
* @param level Level at which to log the message
|
|
135
|
+
* @param pathname Name of the file where the call site is located
|
|
136
|
+
* @param funcname Name of the function where the call site is located
|
|
137
|
+
* @param lineno Line number of the call site
|
|
138
|
+
* @param msg The message to log, uses C-sprintf-style format specifier
|
|
139
|
+
* @param ... Additional arguments; formatted and inserted in message
|
|
140
|
+
* according to format specifier in msg argument
|
|
144
141
|
*/
|
|
145
|
-
|
|
142
|
+
#define gpi_log(extra_name, level, pathname, funcname, lineno, ...) \
|
|
143
|
+
gpi_log_(MAKE_LOG_NAME_(extra_name), level, pathname, funcname, lineno, \
|
|
144
|
+
__VA_ARGS__)
|
|
145
|
+
|
|
146
|
+
// Don't call this function directly unless the name is "gpi" or starts with
|
|
147
|
+
// "gpi."
|
|
148
|
+
GPILOG_EXPORT void gpi_log_(const char *name, int level, const char *pathname,
|
|
146
149
|
const char *funcname, long lineno, const char *msg,
|
|
147
|
-
|
|
150
|
+
...);
|
|
151
|
+
|
|
152
|
+
/** Log a message using the currently registered log handler.
|
|
153
|
+
*
|
|
154
|
+
* @param extra_name Name of the "gpi" child logger, "" for the root logger
|
|
155
|
+
* @param level Level at which to log the message
|
|
156
|
+
* @param pathname Name of the file where the call site is located
|
|
157
|
+
* @param funcname Name of the function where the call site is located
|
|
158
|
+
* @param lineno Line number of the call site
|
|
159
|
+
* @param msg The message to log, uses C-sprintf-style format specifier
|
|
160
|
+
* @param args Additional arguments; formatted and inserted in message
|
|
161
|
+
* according to format specifier in msg argument
|
|
162
|
+
*/
|
|
163
|
+
#define gpi_vlog(extra_name, level, pathname, funcname, lineno, msg, args) \
|
|
164
|
+
gpi_vlog_(MAKE_LOG_NAME_(extra_name), level, pathname, funcname, lineno, \
|
|
165
|
+
msg, args)
|
|
166
|
+
|
|
167
|
+
// Don't call this function directly unless the name is "gpi" or starts with
|
|
168
|
+
// "gpi."
|
|
169
|
+
GPILOG_EXPORT void gpi_vlog_(const char *name, int level, const char *pathname,
|
|
170
|
+
const char *funcname, long lineno, const char *msg,
|
|
171
|
+
va_list args);
|
|
172
|
+
|
|
173
|
+
/** Check if a log would be filtered.
|
|
174
|
+
*
|
|
175
|
+
* @param logger Name of the logger.
|
|
176
|
+
* @param level Level at which to test if the logger would emit a message.
|
|
177
|
+
* @return `true` if the *logger* is enabled at *level*.
|
|
178
|
+
*/
|
|
179
|
+
GPILOG_EXPORT bool gpi_log_filtered(const char *logger, int level);
|
|
180
|
+
|
|
181
|
+
/** Set the log level of a logger.
|
|
182
|
+
*
|
|
183
|
+
* @param logger Name of the logger.
|
|
184
|
+
* @param level Level to set the logger to.
|
|
185
|
+
* @return The old log level.
|
|
186
|
+
*/
|
|
187
|
+
GPILOG_EXPORT int gpi_log_set_level(const char *logger, int level);
|
|
188
|
+
|
|
189
|
+
/** @return The string representation of the GPI log level. */
|
|
190
|
+
GPILOG_EXPORT const char *gpi_log_level_to_str(int level);
|
|
148
191
|
|
|
149
192
|
/** Retrieve the current log handler.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
193
|
+
* @param handler Location to return current log handler function. If no
|
|
194
|
+
* custom logger is registered this will be `NULL`.
|
|
195
|
+
* @param filter Location to return current log filter function. If no
|
|
196
|
+
* custom logger is registered this will be `NULL`.
|
|
197
|
+
* @param set_level Location to return current log set level function. If no
|
|
198
|
+
* custom logger is registered this will be `NULL`.
|
|
199
|
+
* @param userdata Location to return log handler userdata. If no custom
|
|
200
|
+
* logger is registered this will be `NULL`.
|
|
153
201
|
*/
|
|
154
|
-
GPILOG_EXPORT void gpi_get_log_handler(
|
|
202
|
+
GPILOG_EXPORT void gpi_get_log_handler(gpi_log_handler_ftype *handler,
|
|
203
|
+
gpi_log_filter_ftype *filter,
|
|
204
|
+
gpi_log_set_level_ftype *set_level,
|
|
155
205
|
void **userdata);
|
|
156
206
|
|
|
157
207
|
/** Set custom log handler
|
|
158
|
-
|
|
159
|
-
|
|
208
|
+
* @param handler Logger handler function.
|
|
209
|
+
* @param filter Logger level filter function.
|
|
210
|
+
* @param set_level Logger set level function.
|
|
211
|
+
* @param userdata Data passed to the above functions.
|
|
160
212
|
*/
|
|
161
|
-
GPILOG_EXPORT void gpi_set_log_handler(
|
|
213
|
+
GPILOG_EXPORT void gpi_set_log_handler(gpi_log_handler_ftype handler,
|
|
214
|
+
gpi_log_filter_ftype filter,
|
|
215
|
+
gpi_log_set_level_ftype set_level,
|
|
162
216
|
void *userdata);
|
|
163
217
|
|
|
164
|
-
/** Clear the current custom log handler and use native logger
|
|
165
|
-
*/
|
|
218
|
+
/** Clear the current custom log handler and use native logger. */
|
|
166
219
|
GPILOG_EXPORT void gpi_clear_log_handler(void);
|
|
167
220
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
@param level Level at which to log the message
|
|
172
|
-
@param pathname Name of the file where the call site is located
|
|
173
|
-
@param funcname Name of the function where the call site is located
|
|
174
|
-
@param lineno Line number of the call site
|
|
175
|
-
@param msg The message to log, uses C-sprintf-style format specifier
|
|
176
|
-
@param ... Additional arguments; formatted and inserted in message
|
|
177
|
-
according to format specifier in msg argument
|
|
178
|
-
*/
|
|
179
|
-
GPILOG_EXPORT void gpi_native_logger_log(const char *name, int level,
|
|
180
|
-
const char *pathname,
|
|
181
|
-
const char *funcname, long lineno,
|
|
182
|
-
const char *msg, ...);
|
|
221
|
+
/*******************************************************************************
|
|
222
|
+
* GPI Native Logger
|
|
223
|
+
*******************************************************************************/
|
|
183
224
|
|
|
184
225
|
/** Log a message using the native log handler.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
226
|
+
* User is expected to populate all arguments to this function.
|
|
227
|
+
* @param extra_name Name of the "gpi" child logger, "" for the root logger
|
|
228
|
+
* @param level Level at which to log the message
|
|
229
|
+
* @param pathname Name of the file where the call site is located
|
|
230
|
+
* @param funcname Name of the function where the call site is located
|
|
231
|
+
* @param lineno Line number of the call site
|
|
232
|
+
* @param msg The message to log, uses C-sprintf-style format specifier
|
|
233
|
+
* @param ... Additional arguments; formatted and inserted in message
|
|
234
|
+
* according to format specifier in msg argument
|
|
194
235
|
*/
|
|
195
|
-
|
|
236
|
+
#define gpi_native_logger_log(extra_name, level, pathname, funcname, lineno, \
|
|
237
|
+
...) \
|
|
238
|
+
gpi_native_logger_log_(MAKE_LOG_NAME_(extra_name), level, pathname, \
|
|
239
|
+
funcname, lineno, __VA_ARGS__)
|
|
240
|
+
|
|
241
|
+
// Don't call this function directly unless the name is "gpi" or starts with
|
|
242
|
+
// "gpi."
|
|
243
|
+
GPILOG_EXPORT void gpi_native_logger_log_(const char *name, int level,
|
|
196
244
|
const char *pathname,
|
|
197
245
|
const char *funcname, long lineno,
|
|
198
|
-
const char *msg,
|
|
246
|
+
const char *msg, ...);
|
|
247
|
+
|
|
248
|
+
/** Log a message using the native log handler.
|
|
249
|
+
* User is expected to populate all arguments to this function.
|
|
250
|
+
* @param extra_name Name of the "gpi" child logger, "" for the root logger
|
|
251
|
+
* @param level Level at which to log the message
|
|
252
|
+
* @param pathname Name of the file where the call site is located
|
|
253
|
+
* @param funcname Name of the function where the call site is located
|
|
254
|
+
* @param lineno Line number of the call site
|
|
255
|
+
* @param msg The message to log, uses C-sprintf-style format specifier
|
|
256
|
+
* @param args Additional arguments; formatted and inserted in message
|
|
257
|
+
* according to format specifier in msg argument
|
|
258
|
+
*/
|
|
259
|
+
#define gpi_native_logger_vlog(extra_name, level, pathname, funcname, lineno, \
|
|
260
|
+
msg, args) \
|
|
261
|
+
gpi_native_logger_vlog_(MAKE_LOG_NAME_(extra_name), level, pathname, \
|
|
262
|
+
funcname, lineno, msg, args)
|
|
263
|
+
|
|
264
|
+
// Don't call this function directly unless the name is "gpi" or starts with
|
|
265
|
+
// "gpi."
|
|
266
|
+
GPILOG_EXPORT void gpi_native_logger_vlog_(const char *name, int level,
|
|
267
|
+
const char *pathname,
|
|
268
|
+
const char *funcname, long lineno,
|
|
269
|
+
const char *msg, va_list args);
|
|
270
|
+
|
|
271
|
+
/** Check if a message would be filtered by the native logger.
|
|
272
|
+
*
|
|
273
|
+
* @param level Level at which to test if the logger would emit a message.
|
|
274
|
+
* @return `true` if the *logger* is enabled at *level*.
|
|
275
|
+
*/
|
|
276
|
+
GPILOG_EXPORT bool gpi_native_logger_filtered(int level);
|
|
199
277
|
|
|
200
278
|
/** Set minimum logging level of the native logger.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
279
|
+
*
|
|
280
|
+
* If a logging request occurs where the logging level is lower than the level
|
|
281
|
+
* set by this function, it is not logged. Only affects the native logger.
|
|
282
|
+
* @param level Logging level
|
|
283
|
+
* @return Previous logging level
|
|
205
284
|
*/
|
|
206
285
|
GPILOG_EXPORT int gpi_native_logger_set_level(int level);
|
|
207
286
|
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
#ifndef PY_GPI_LOGGING_H
|
|
6
6
|
#define PY_GPI_LOGGING_H
|
|
7
7
|
|
|
8
|
-
#include <
|
|
8
|
+
#include <Python.h>
|
|
9
|
+
|
|
10
|
+
#include "exports.h"
|
|
11
|
+
|
|
9
12
|
#ifdef PYGPILOG_EXPORTS
|
|
10
13
|
#define PYGPILOG_EXPORT COCOTB_EXPORT
|
|
11
14
|
#else
|
|
@@ -16,13 +19,13 @@
|
|
|
16
19
|
extern "C" {
|
|
17
20
|
#endif
|
|
18
21
|
|
|
19
|
-
PYGPILOG_EXPORT void py_gpi_logger_set_level(int level);
|
|
20
|
-
|
|
21
22
|
PYGPILOG_EXPORT void py_gpi_logger_initialize(PyObject* handler,
|
|
22
|
-
PyObject*
|
|
23
|
+
PyObject* get_logger);
|
|
23
24
|
|
|
24
25
|
PYGPILOG_EXPORT void py_gpi_logger_finalize();
|
|
25
26
|
|
|
27
|
+
extern PYGPILOG_EXPORT PyObject* pEventFn; // This is gross but I don't care
|
|
28
|
+
|
|
26
29
|
#ifdef __cplusplus
|
|
27
30
|
}
|
|
28
31
|
#endif
|
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Redistribution and use in source and binary forms, with or without
|
|
6
|
-
* modification, are permitted provided that the following conditions are met:
|
|
7
|
-
* * Redistributions of source code must retain the above copyright
|
|
8
|
-
* notice, this list of conditions and the following disclaimer.
|
|
9
|
-
* * Redistributions in binary form must reproduce the above copyright
|
|
10
|
-
* notice, this list of conditions and the following disclaimer in the
|
|
11
|
-
* documentation and/or other materials provided with the distribution.
|
|
12
|
-
* * Neither the name of Potential Ventures Ltd
|
|
13
|
-
* names of its contributors may be used to endorse or promote products
|
|
14
|
-
* derived from this software without specific prior written permission.
|
|
15
|
-
*
|
|
16
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
17
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
18
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
-
* DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
|
|
20
|
-
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
21
|
-
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
22
|
-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
23
|
-
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
24
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
-
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26
|
-
******************************************************************************/
|
|
1
|
+
// Copyright cocotb contributors
|
|
2
|
+
// Copyright (c) 2013, 2019 Potential Ventures Ltd
|
|
3
|
+
// Licensed under the Revised BSD License, see LICENSE for details.
|
|
4
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
27
5
|
|
|
28
6
|
/* extensions to vpi_user.h */
|
|
29
7
|
|