From f396fab26611d6107e223a6a3f41c9dff3e2ee9e Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Sun, 27 Aug 2023 21:18:53 +0200 Subject: move sources into src/ subdir --- src/utils.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/utils.h (limited to 'src/utils.h') diff --git a/src/utils.h b/src/utils.h new file mode 100644 index 0000000..5584027 --- /dev/null +++ b/src/utils.h @@ -0,0 +1,32 @@ +#ifndef UTILS_H +#define UTILS_H + +#include + +#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 -- cgit v1.2.3