1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#ifndef UTILS_H
#define UTILS_H
#include <cstdio>
#define LOG(FMT, ...) \
do { \
std::fprintf(stderr, "%10s | %4lld:%2lld | %10s | " FMT "\n", \
sc_core::sc_time_stamp().to_string().c_str(), \
sc_core::sc_delta_count(), \
sc_core::sc_delta_count_at_current_time(), __FUNCTION__, \
##__VA_ARGS__); \
} while (0)
#define LOGM(FMT, ...) LOG("%12s | " FMT, name(), ##__VA_ARGS__)
// -- COLOR LOGS ---------------------------------------------------------------
#define RESET "\e[0m"
#define BLACK "\e[0;30m"
#define RED "\e[0;31m"
#define GREEN "\e[0;32m"
#define YELLOW "\e[0;33m"
#define BLUE "\e[0;34m"
#define MAGENTA "\e[0;35m"
#define CYAN "\e[0;36m"
#define WHITE "\e[0;37m"
#define CLOG(COL, FMT, ...) LOG(COL FMT "\e[0m", ##__VA_ARGS__)
#define CLOGM(COL, FMT, ...) LOGM(COL FMT "\e[0m", ##__VA_ARGS__)
#endif
|