#define CPP_INCL_MINIMUM #define CPP_INCL_STREAMS #include "libcpp/src/cpp.h" #include "libmproc/src/mprocmutexlock.h" #include "libpmnl/src/pmnldebug.h" #include "pmnlrealmsgs.h" #include "libcore/src/coreLog.h" #include SXLEGAL_NOTICE_CPP_SRC(pmnl, PmnlDebug, "2006"); /**Variable************************************************************ Synopsis [ list of messages - make SURE this is always consistent with the defines in the .h file! ] ***********************************************************************/ namespace { typedef struct Pmnl_DbgDefinition_s { char character; Pmnl_DebugFlag mask; const char * description; } Pmnl_DbgDefinition; Pmnl_DbgDefinition s_MsgList [PMNL_DBG_ALL] = { {'a', PMNLI_DBG_ACT, "signal activity"}, {'b', PMNL_DBG_BUILD, "netlist construction messages"}, {'c', PMNL_DBG_CAP, "pin capacitance"}, {'d', PMNLI_DBG_DSPF, "dspf parser messages"}, {'e', PMNL_DBG_RAIL, "power/ground rail processing"}, {'f', PMNL_DBG_FUNC, "function/bdd processing"}, {'g', PROP_DBG_PROP, "propagation ordering messages"}, {'h', PMNL_DBG_PINDIR, "pin direction revision messages"}, {'i', PM_DBG_INTERNAL, "internal power calculation"}, {'j', PMNLI_DBG_CLKNET, "clock network tracing"}, {'k', PMNL_DBG_CLIP, "duty and density clipping"}, {'l', PMNLI_DBG_SIGS, "signalstorm db"}, {'m', PMNLI_DBG_TTIME, "transition time messages"}, {'n', PMNL_DBG_GATE, "gate netlist view messages"}, {'o', PMNLI_DBG_TCF, "tOggle count format messages"}, {'p', PMNL_DBG_PRIM, "primary instance/input detection"}, {'q', PROP_DBG_SEQ, "sequential propagation"}, {'r', PROP_DBG_RANK, "rank ordering messages"}, {'s', PMNLI_DBG_SPEF, "spef parser messages"}, {'t', PMNL_DBG_TEMP, "netlist traversal messages/temperature"}, {'u', PM_DBG_USERDEF, "user define power messages"}, {'v', PMNLI_DBG_VCD, "vcd parser messages"}, {'w', PMNL_DBG_POWER, "read/write power values"}, {'x', PMPD_DBG_POWER, "pseudo dynamic power calculation"}, {'y', PM_DBG_LEAK, "leakage power calculation"}, {'z', PM_DBG_TD, "report average transition density"}, {'A', PMIO_DBG_ALLPOW, "report all (neg & zero) power"}, {'B', PM_DBG_KFACTOR, "kfactor data"}, {'C', PMNL_DBG_ARC, "arc-based power calculation"}, {'D', PMNLI_DBG_DOMAIN, "clock domains"}, {'E', PMNL_DBG_OA_EXTRA, "Extra information about OA realted work"}, {'F', PMNLI_DBG_POWER_GATE, "power gate related information"}, {'G', PMPD_DBG_PGDC, "PGDC Waveform lookup"}, {'H', PMPD_DBG_SCHED, "pseudo dynamic TWF scheduling"}, {'I', PROP_DBG_STATS, "propagation activity statistics"}, {'K', PMNL_DBG_SPICEDECK,"spicedeck messages"}, {'L', PMPD_DBG_PWL, "Pwl messages"}, {'M', PROP_DBG_METHOD, "propagation method info"}, {'N', PM_DBG_BINARY, "binary debug info"}, {'O', PMNL_DBG_OA, "Flattener related netlist"}, {'P', PM_DBG_POWERRAIL, "power rail assignment"}, {'Q', PM_DBG_POWERMETH, "power calculation method"}, {'R', PMIO_DBG_RUNTIME, "runtime/memory information"}, {'S', PMNL_DBG_SCLP, "library view information"}, {'T', PMPD_DBG_TWF, "pseudo dynamic TWF debug"}, {'U', PMIO_DBG_UTI, "static powermeter uti output"}, {'V', PMPD_DBG_VCD, "pseudo dynamic VCD debug"}, {'W', PMPD_DBG_UTIWRTR, "pseudo dynamic UTI writer"}, {'Y', PMNLI_DBG_SYN, "syntech messages"}, {'Z', PMPD_DBG_SLACK, "worst slack"}, {'0', PMATTR_DBG_ANNOT, "annotation"}, {'1', PMPD_DBG_BIN, "binary TWF"}, {'2', PMNL_DBG_FILLER, "filler processing"}, {'3', PM_DBG_GPWR, "synopsys ground power constructs"}, {'4', PMPD_DBG_THREAD, "multithreading data"}, {'5', PMPD_DBG_ZERODEL, "zero delay flow"}, {'6', CPE_DBG_MEMORY, "print memory usage"}, {'7', PMNL_DBG_DIE, "print die area data"}, {'8', PMPD_DBG_MTTWF, "multithread TWF"}, {'9', PMPD_DBG_RF, "rfactor information"}, {'%', PMIO_DBG_PWRDENSITY, "power density"}, {'_', PMNL_DBG_VERBOSE, "verbose debugging"}, }; } /**Function************************************************************ Synopsis [ constructor - build the flag mask from the string ] SideEffects [ ] ***********************************************************************/ Pmnl_Debug::Pmnl_Debug(const string& debug_flags) : m_Flags(0), m_FlagString(debug_flags), m_LogMsgs(false) { const Cpp_Int32 len = static_cast(m_FlagString.size()); for (Cpp_Int32 i = 0; i < len; ++i) { const char userFlagChar = m_FlagString[i]; for (Cpp_Int32 j = 0; j < PMNL_DBG_ALL; ++j) { if (s_MsgList[j].character == userFlagChar) { m_Flags |= (1LL << s_MsgList[j].mask); break; } } } } Pmnl_Debug::Pmnl_Debug(const Pmnl_Debug & d) : m_Flags(d.m_Flags), m_FlagString(d.m_FlagString), m_LogMsgs(false) { } /**Function************************************************************ Synopsis [ print an info message in a standard way to the stdout (will not wrap) ] SideEffects [ ] ***********************************************************************/ void Pmnl_Debug::printInfo(const string & msg) const { print("INFO", msg); } /**Function************************************************************ Synopsis [ print a warning message in a standard way to the stdout (will not wrap) ] SideEffects [ ] ***********************************************************************/ void Pmnl_Debug::printWarning(const string & msg) const { print("WARN", msg); } /**Function************************************************************ Synopsis [ print an error message in a standard way to the stdout (will not wrap) ] SideEffects [ ] ***********************************************************************/ void Pmnl_Debug::printError(const string & msg) const { print("ERR ", msg); } void Pmnl_Debug::print(const string& type, const string & msg) const { if (m_Flags != 0) { #ifdef CPE_POWER cout << type << ":" << msg << endl; #else PMNL_DEBUG_LOCK_COUT( cout << type << ":" << msg << endl; ); #endif } } /**Function************************************************************ Synopsis [ print a debug message in a standard way to the stdout (will not wrap) ] SideEffects [ ] ***********************************************************************/ void Pmnl_Debug::printDebugInfo(const Pmnl_DebugFlag flag, const string & msg) const { if (checkFlag(flag)) { printDebug(flag, msg); } } /**Function************************************************************ Synopsis [ print a debug message in a standard way to the stdout (will not wrap) ] SideEffects [ ] ***********************************************************************/ void Pmnl_Debug::printDebug(const Pmnl_DebugFlag flag, const string & msg) const { #ifdef CPE_POWER cout << "DBG" << s_MsgList[flag].character << " " << msg << endl; #else string debugMsg ("DBG"); debugMsg = debugMsg + s_MsgList[flag].character + " " + msg; PMNL_DEBUG_LOCK_COUT( if(m_LogMsgs || s_MsgList[flag].character == 'R' || s_MsgList[flag].character == '4') { Core_Output3(InfoNowrap, Pmnl_InfoMsgsOnly, .SetParam("msg", debugMsg.c_str())); } else { cout << debugMsg << endl; } ); #endif } bool Pmnl_Debug::checkFlagDebugFile(void) const { Cpp_UInt64 filemask = 0; // initialize any flags here that you don't want to generate a debug file for filemask = filemask | (1LL << s_MsgList[PMPD_DBG_THREAD].mask); filemask = filemask | (1LL << s_MsgList[CPE_DBG_MEMORY].mask); filemask = filemask | (1LL << s_MsgList[PMIO_DBG_RUNTIME].mask); filemask = filemask | (1LL << s_MsgList[PMNL_DBG_DIE].mask); return ((~filemask & m_Flags) > 0); } 244,1 Bot