diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-07-26 00:05:14 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-07-26 00:05:14 +0200 |
commit | 173622e9e82b7c2b1c6f8146056661b2a6577735 (patch) | |
tree | 4d14127163d9621e7462a8fc25444552b5a80137 /utils.h | |
download | sysc-playground-173622e9e82b7c2b1c6f8146056661b2a6577735.tar.gz sysc-playground-173622e9e82b7c2b1c6f8146056661b2a6577735.zip |
add some initial playground examples + scripts to build
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -0,0 +1,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 |