VMM_LOG :
VMM log is a messaging utility class which is used to issue different kind of messages with different severity which can be contorolled fron the command line or from you testcases. generateor etc.
Advantages of using vmm_log class :
-
Consistancy - Provides a consistent format print format across the testbench so filtering or post processing of the messages becomes easier
-
More control - Each message issued have a serverity attached with it. So you can control which serverity level should be printed i.e In normal simulation the messages with note and above serverity are printed and in debug we can print the messages with trace and debug serverity.
- Runtime control - Messages can be controlled on the run time.
- Severity change - We can change the message severity like we can change all warning severity messages to error serverity to force the owner to fix all the warnings coming out of testbench for cleanup.
Message Severity
Individual messages are categorized into different severities. The fatal have the higher severity and the verbose have the lower severity. By default all the messages with note serverity and above will be displayed and lower than note severity will be masked (trace, debug, verbose). If we want to see the message with lower serverity we need to enable them either from command line with argument or from the testbench.
To change the serverity from the command line you need to add following switch to your simulation command :
+vmm_log_default=DEBUG
Something like :
vsim -c vmm_log_example -sv_lib fli -do "run -all" +vmm_log_default=DEBUG
- FATAL_SEV : An error which causes a program to abort.
- ERROR_SEV : Simulation aborts after a certain number of errors are observed.
- WARNING_SEV: Simulation can proceed and still produce useful result.
- NORMAL_SEV : This message indicates the state of simulation.
- TRACE_SEV : This message identifies high-level internal information that is not normally issued.
- DEBUG_SEV : This message identifies medium-level internal information that is not normally issued.
- VERBOSE_SEV: This message identifies low-level internal information that is not normally issued.
Vmm Log Macros :
We can use the following predefined macros to select the message severity.
- `vmm_fatal(vmm_log log, string msg);
- `vmm_error(vmm_log log, string msg);
- `vmm_warning(vmm_log log, string msg);
- `vmm_note(vmm_log log, string msg);
- `vmm_trace(vmm_log log, string msg);
- `vmm_debug(vmm_log log, string msg);
- `vmm_verbose(vmm_log log, string msg);
// vmm log example
`include "vmm.sv"
program vmm_log_example;
// create vmm log object
vmm_log log;
initial begin
log = new("vmm_log_example", null);
// by default the messages which are issued with
// trace and debug severity will not be visible
// unless you enable them from the command line
`vmm_trace(log, "Issued with vmm_trace");
`vmm_debug(log, "Issued with vmm_debug");
`vmm_verbose(log, "Issued with vmm_verbose");
// all messages will note and above serverity will
// be displayed
`vmm_note(log, "Issued with vmm_note");
`vmm_warning(log, "Issued with vmm_warning");
`vmm_error(log, "Issued with vmm_error");
// fatal severity will stop the simulation
`vmm_fatal(log, "Issued with vmm_fatal");
end
endprogram : vmm_log_example
// Output example :
# Normal[NOTE] on vmm_log_example() at 0:
# Issued with vmm_note
# WARNING[FAILURE] on vmm_log_example() at 0:
# Issued with vmm_warning
# !ERROR![FAILURE] on vmm_log_example() at 0:
# Issued with vmm_error
# *FATAL*[FAILURE] on vmm_log_example() at 0:
# Issued with vmm_fatal
// Output example with +vmm_log_default=DEBUG
# Trace[DEBUG] on vmm_log_example() at 0:
# Issued with vmm_trace
# Debug[DEBUG] on vmm_log_example() at 0:
# Issued with vmm_debug
# Normal[NOTE] on vmm_log_example() at 0:
# Issued with vmm_note
# WARNING[FAILURE] on vmm_log_example() at 0:
# Issued with vmm_warning
# !ERROR![FAILURE] on vmm_log_example() at 0:
# Issued with vmm_error
# *FATAL*[FAILURE] on vmm_log_example() at 0:
# Issued with vmm_fatal
|