日志打印基于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

 

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐