aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-09-12 21:22:16 +0200
committerTristan Gingold <tgingold@free.fr>2022-09-14 07:44:19 +0200
commit270d9354950e917b34c15661aedbc1ef58261b56 (patch)
tree796298fc573b9e65b3ce70e024c5bd362c621f13
parente15b91f0f4ed0fc3bcf990ec8a92ade9dc258206 (diff)
downloadghdl-270d9354950e917b34c15661aedbc1ef58261b56.tar.gz
ghdl-270d9354950e917b34c15661aedbc1ef58261b56.tar.bz2
ghdl-270d9354950e917b34c15661aedbc1ef58261b56.zip
simul: handle --expect-failure for elaboration
-rw-r--r--src/ghdldrv/ghdlcomp.adb2
-rw-r--r--src/ghdldrv/ghdlcomp.ads3
-rw-r--r--src/ghdldrv/ghdlsimul.adb21
3 files changed, 15 insertions, 11 deletions
diff --git a/src/ghdldrv/ghdlcomp.adb b/src/ghdldrv/ghdlcomp.adb
index 4f9644e9b..cf7b8148c 100644
--- a/src/ghdldrv/ghdlcomp.adb
+++ b/src/ghdldrv/ghdlcomp.adb
@@ -35,8 +35,6 @@ with Libraries;
package body Ghdlcomp is
- Flag_Expect_Failure : Boolean := False;
-
-- Commands which use the mcode compiler.
type Command_Comp is abstract new Command_Lib with null record;
diff --git a/src/ghdldrv/ghdlcomp.ads b/src/ghdldrv/ghdlcomp.ads
index 5af54eaad..6c014a302 100644
--- a/src/ghdldrv/ghdlcomp.ads
+++ b/src/ghdldrv/ghdlcomp.ads
@@ -67,6 +67,9 @@ package Ghdlcomp is
-- Output of --disp-config.
procedure Disp_Config;
+ -- Option --expect-failure.
+ Flag_Expect_Failure : Boolean := False;
+
-- --time-resolution=X
-- Where X corresponds to:
-- fs => 'f'
diff --git a/src/ghdldrv/ghdlsimul.adb b/src/ghdldrv/ghdlsimul.adb
index 44e0d133a..41dac66d2 100644
--- a/src/ghdldrv/ghdlsimul.adb
+++ b/src/ghdldrv/ghdlsimul.adb
@@ -82,22 +82,25 @@ package body Ghdlsimul is
begin
Common_Compile_Elab (Cmd_Name, Args, False, Opt_Arg, Config);
+ for I in Opt_Arg .. Args'Last loop
+ if Args (I).all = "--expect-failure" then
+ Flag_Expect_Failure := True;
+ exit;
+ end if;
+ end loop;
+
Lib_Unit := Get_Library_Unit (Config);
pragma Assert (Get_Kind (Lib_Unit) /= Iir_Kind_Foreign_Module);
Inst := Elab.Vhdl_Insts.Elab_Top_Unit (Lib_Unit);
if Errorout.Nbr_Errors > 0 then
- raise Errorout.Compilation_Error;
+ if Grt.Errors.Expect_Failure then
+ return;
+ else
+ raise Errorout.Compilation_Error;
+ end if;
end if;
--- if Inst = null then
--- if Cmd.Expect_Failure then
--- return;
--- else
--- raise Errorout.Compilation_Error;
--- end if;
--- end if;
-
Simul.Vhdl_Elab.Gather_Processes (Inst);
Simul.Vhdl_Elab.Elab_Processes;