quic/qbox
Loading...
Searching...
No Matches
report.h
1/*
2 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
3 * Author: GreenSocs 2022
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8#ifndef BASIC_PLATFORM_REPORT_H
9#define BASIC_PLATFORM_REPORT_H
10
11#include <systemc>
12#include <cinttypes>
13
14namespace gs {
15
16static const char* log_enabled = std::getenv("GS_LOG");
17static const char* log_enabled_stdout = std::getenv("GS_LOG_STDOUT");
18#define GS_LOG(...) \
19 do { \
20 static char gs_log_buffer[100]; \
21 if (gs::log_enabled) { \
22 if (gs::log_enabled_stdout) { \
23 fprintf(stdout, "%s:%d ", __FILE__, __LINE__); \
24 fprintf(stdout, __VA_ARGS__); \
25 fprintf(stdout, "\n"); \
26 } else { \
27 snprintf(gs::gs_log_buffer, sizeof(gs::gs_log_buffer), __VA_ARGS__); \
28 auto p = sc_core::sc_get_current_process_b(); \
29 if (p) \
30 sc_core::sc_report_handler::report(sc_core::SC_INFO, p->get_parent_object()->basename(), \
31 gs::gs_log_buffer, __FILE__, __LINE__); \
32 else \
33 sc_core::sc_report_handler::report(sc_core::SC_INFO, "non_module", gs::gs_log_buffer, __FILE__, \
34 __LINE__); \
35 } \
36 } \
37 } while (0)
38
39} // namespace gs
40#endif // BASIC_PLATFORM_REPORT_H
Tool which reads a Lua configuration file and sets parameters.
Definition biflow.cc:10