From 9029a876c92a6469536585c64737e8ed1a8c9cac Mon Sep 17 00:00:00 2001 From: Ondrej Ille Date: Sat, 20 Mar 2021 11:35:48 +0100 Subject: src: Add -Wpsl-uncovered option to optionally warn about uncovered PSL sequences at the end of simulation. --- src/flags.ads | 4 ++++ src/grt/grt-lib.adb | 3 +-- src/options.adb | 21 +++++++++++++++------ src/vhdl/translate/trans-chap9.adb | 20 +++++++++++--------- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/flags.ads b/src/flags.ads index 18dbf1e14..af99e3fe7 100644 --- a/src/flags.ads +++ b/src/flags.ads @@ -158,6 +158,10 @@ package Flags is -- If True, disp original source line and a caret indicating the column. Flag_Caret_Diagnostics : Boolean := False; + -- If True, warning is printed for each uncovered PSL cover points at the + -- end of simulation + Flag_Psl_Warn_Uncovered : Boolean := False; + type On_Off_Auto_Type is (On, Off, Auto); -- -fcolor-diagnostics diff --git a/src/grt/grt-lib.adb b/src/grt/grt-lib.adb index af3b52567..81383d3a7 100644 --- a/src/grt/grt-lib.adb +++ b/src/grt/grt-lib.adb @@ -139,8 +139,7 @@ package body Grt.Lib is procedure Ghdl_Psl_Cover_Failed (Str : Std_String_Ptr; Severity : Integer; Loc : Ghdl_Location_Ptr) is begin - Do_Report ("psl cover failure", - Str, "sequence not covered", Severity, Loc); + Do_Report ("psl cover", Str, "sequence not covered", Severity, Loc); end Ghdl_Psl_Cover_Failed; procedure Ghdl_Report (Str : Std_String_Ptr; diff --git a/src/options.adb b/src/options.adb index 6fa3df36e..7aa31e253 100644 --- a/src/options.adb +++ b/src/options.adb @@ -100,6 +100,12 @@ package body Options is return Option_Ok; end if; + -- Handles -Wpsl-uncovered + if Opt = "psl-uncovered" then + Flag_Psl_Warn_Uncovered := True; + return Option_Ok; + end if; + -- Unknown warning. Error_Msg_Option ("unknown warning identifier"); return Option_Err; @@ -289,17 +295,20 @@ package body Options is P (" -Wspecs warns if a all/others spec does not apply"); P (" -Wunused warns if a subprogram is never used"); P (" -Werror turns warnings into errors"); + P (" -Wpsl-uncovered Prints warning after simulation for each"); + P (" uncovered PSL cover point."); + P (" Only valid with '-fpsl'"); -- P ("Simulation option:"); -- P (" --assert-level=LEVEL set the level which stop the"); -- P (" simulation. LEVEL is note, warning, error,"); -- P (" failure or none"); P ("Extensions:"); - P (" -fexplicit give priority to explicitly declared operator"); - P (" -frelaxed-rules relax some LRM rules"); - P (" -C --mb-comments allow multi-bytes chars in a comment"); - P (" --bootstrap allow --work=std"); - P (" --syn-binding use synthesis default binding rule"); - P (" -fpsl parse psl in comments"); + P (" -fexplicit give priority to explicitly declared operator"); + P (" -frelaxed-rules relax some LRM rules"); + P (" -C --mb-comments allow multi-bytes chars in a comment"); + P (" --bootstrap allow --work=std"); + P (" --syn-binding use synthesis default binding rule"); + P (" -fpsl parse psl in comments"); P ("Compilation list:"); P (" -l[sca] after semantics, canon or annotation"); P (" --lall -lX options apply to all files"); diff --git a/src/vhdl/translate/trans-chap9.adb b/src/vhdl/translate/trans-chap9.adb index 60b19d222..70ee8fa16 100644 --- a/src/vhdl/translate/trans-chap9.adb +++ b/src/vhdl/translate/trans-chap9.adb @@ -489,15 +489,17 @@ package body Trans.Chap9 is Ghdl_Location_Ptr_Node)); New_Procedure_Call (Assocs); - New_Else_Stmt (Blk); - - Start_Association (Assocs, Ghdl_Psl_Cover_Failed); - New_Association (Assocs, New_Obj_Value (Msg_Var)); - New_Association (Assocs, New_Lit (Get_Ortho_Literal - (Severity_Level_Error))); - New_Association (Assocs, New_Address (New_Obj (Loc), - Ghdl_Location_Ptr_Node)); - New_Procedure_Call (Assocs); + if Flags.Flag_Psl_Warn_Uncovered = True then + New_Else_Stmt (Blk); + + Start_Association (Assocs, Ghdl_Psl_Cover_Failed); + New_Association (Assocs, New_Obj_Value (Msg_Var)); + New_Association (Assocs, New_Lit (Get_Ortho_Literal + (Severity_Level_Warning))); + New_Association (Assocs, New_Address (New_Obj (Loc), + Ghdl_Location_Ptr_Node)); + New_Procedure_Call (Assocs); + end if; Finish_If_Stmt (Blk); -- cgit v1.2.3