天天看點

nvdla SystemC model日志輸出控制

日志列印基于SystemC中的sc_report API。sc_report有四個标準API

SC_REPORT_INFO
SC_REPORT_WARNING
SC_REPORT_ERROR
SC_REPORT_FATAL
           

調用時,每個API都有不同的操作。

例如,SC_REPORT_FATAL将顯示日志資訊并調用sc_abort,SC_REPORT_INFO僅顯示日志資訊。 在大多數情況下,我們使用SC_REPORT_INFO,并且設定其中有不同的詳細級别。

SC_NONE = 0,
SC_LOW = 100,
SC_MEDIUM = 200,
SC_HIGH = 300,
SC_FULL = 400,
SC_DEBUG = 500
           

預設級别為SC_MEDIUM,這意味着SC_HIGH / SC_FULL / SC_DEBUG不會在預設配置中顯示。

SystemC模型的日志輸出由配置字元串控制,可以通過下面的方式設定:

ENV variable "SC_LOG"
           

In bash shell:

export SC_LOG="outfile:sc_log_file;verbosity_level:sc_debug;"
export SC_LOG="outfile:sc.log;verbosity_level:sc_debug;csb_adaptor:enable" -- print the register access transaction from QEMU to NVDLA
export SC_LOG="outfile:sc.log;verbosity_level:sc_debug;dbb_adaptor:enable;sram_adaptor:enable" -- print the memory access from NVDLA to external memory
           

In tcsh shell:

setenv SC_LOG "outfile:sc_log_file;verbosity_level:sc_debug;"
           

控制字元串的格式為:

"outfile:<log_file>;verbosity_level:<info_level>;<msg_string>:<report_level>"
 <log_file>: 	log output file name -- Log file name string
 <info_level>: 	info verbosity -- sc_none/sc_low/sc_medium/sc_high/sc_full/sc_debug
 <msg_string>:	message string specified in sc_report.
 <report_level>:sc report level --  info/warning/error/fatal/enable/disable
           

控制字元串的格式舉例如下:

Info: nvdla.csb_adaptor: GP: iswrite=0 addr=0x300c len=4 data=0x 00000000 resp=TLM_OK_RESPONSE
Info: nvdla.dbb_adaptor: GP: iswrite=1 addr=0xc0001e80 len=64 data=0x abcd01b0 abcd01b1 abcd01b2 abcd01b3 abcd01b4 abcd01b5 abcd01b6 abcd01b7 abcd01b8 abcd01b9 abcd01ba abcd01bb abcd01bc abcd01bd abcd01be abcd01bf resp=TLM_OK_RESPONSE