aboutsummaryrefslogtreecommitdiffstats
path: root/src/ghdldrv
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-11-16 04:58:21 +0100
committerTristan Gingold <tgingold@free.fr>2017-11-16 05:16:18 +0100
commite0da896fef32b75b10a4fe722f176d6651e81a6c (patch)
tree7050b3431e814df6b7ce3b1544718584e1d84aa1 /src/ghdldrv
parent7414046cc73ecc16bfa2ce3af3cb529195ce120f (diff)
downloadghdl-e0da896fef32b75b10a4fe722f176d6651e81a6c.tar.gz
ghdl-e0da896fef32b75b10a4fe722f176d6651e81a6c.tar.bz2
ghdl-e0da896fef32b75b10a4fe722f176d6651e81a6c.zip
Drivers: add --pre-elab (as a stub).
Diffstat (limited to 'src/ghdldrv')
-rw-r--r--src/ghdldrv/ghdldrv.adb26
-rw-r--r--src/ghdldrv/ghdlrun.adb29
2 files changed, 52 insertions, 3 deletions
diff --git a/src/ghdldrv/ghdldrv.adb b/src/ghdldrv/ghdldrv.adb
index 31ca44b4a..03861f793 100644
--- a/src/ghdldrv/ghdldrv.adb
+++ b/src/ghdldrv/ghdldrv.adb
@@ -81,6 +81,17 @@ package body Ghdldrv is
-- True if failure expected.
Flag_Expect_Failure : Boolean;
+ -- Elaboration mode.
+ type Elab_Mode_Type is
+ (-- Static elaboration (or pre-elaboration).
+ Elab_Static,
+
+ -- Dynamic elaboration: design is elaborated just before being run.
+ Elab_Dynamic);
+
+ -- Default elaboration mode is dynamic.
+ Elab_Mode : Elab_Mode_Type := Elab_Dynamic;
+
-- Argument table for the tools.
-- Each table low bound is 1 so that the length of a table is equal to
-- the last bound.
@@ -651,6 +662,12 @@ package body Ghdldrv is
-- for -C. Done before Flags.Parse_Option.
Add_Argument (Compiler_Args, new String'("--mb-comments"));
Res := Option_Ok;
+ elsif Opt = "--pre-elab" then
+ Elab_Mode := Elab_Static;
+ Res := Option_Ok;
+ elsif Opt = "--dyn-elab" then
+ Elab_Mode := Elab_Dynamic;
+ Res := Option_Ok;
elsif Options.Parse_Option (Opt) then
if Opt'Length > 2 and then Opt (1 .. 2) = "-P" then
-- Discard -Pxxx switches, as they are already added to
@@ -911,10 +928,17 @@ package body Ghdldrv is
procedure Bind
is
Comp_List : Argument_List (1 .. 4);
+ Elab_Cmd : String_Access;
begin
Filelist_Name := new String'(Elab_Name.all & List_Suffix);
- Comp_List (1) := new String'("--elab");
+ case Elab_Mode is
+ when Elab_Static =>
+ Elab_Cmd := new String'("--pre-elab");
+ when Elab_Dynamic =>
+ Elab_Cmd := new String'("--elab");
+ end case;
+ Comp_List (1) := Elab_Cmd;
Comp_List (2) := Unit_Name;
Comp_List (3) := new String'("-l");
Comp_List (4) := Filelist_Name;
diff --git a/src/ghdldrv/ghdlrun.adb b/src/ghdldrv/ghdlrun.adb
index 3f0cd10c6..698879202 100644
--- a/src/ghdldrv/ghdlrun.adb
+++ b/src/ghdldrv/ghdlrun.adb
@@ -66,6 +66,17 @@ with Foreigns;
with Grtlink;
package body Ghdlrun is
+ -- Elaboration mode.
+ type Elab_Mode_Type is
+ (-- Static elaboration (or pre-elaboration).
+ Elab_Static,
+
+ -- Dynamic elaboration: design is elaborated just before being run.
+ Elab_Dynamic);
+
+ -- Default elaboration mode is dynamic.
+ Elab_Mode : constant Elab_Mode_Type := Elab_Dynamic;
+
procedure Foreign_Hook (Decl : Iir;
Info : Translation.Foreign_Info_Type;
Ortho : O_Dnode);
@@ -90,7 +101,16 @@ package body Ghdlrun is
Ortho_Jit.Init;
Translation.Initialize;
- Canon.Canon_Flag_Add_Labels := True;
+
+ case Elab_Mode is
+ when Elab_Static =>
+ Canon.Canon_Flag_Add_Labels := True;
+ Canon.Canon_Flag_Sequentials_Stmts := True;
+ Canon.Canon_Flag_Expressions := True;
+ Canon.Canon_Flag_All_Sensitivity := True;
+ when Elab_Dynamic =>
+ Canon.Canon_Flag_Add_Labels := True;
+ end case;
end Compile_Init;
procedure Compile_Elab
@@ -103,7 +123,12 @@ package body Ghdlrun is
end if;
Flags.Flag_Elaborate := True;
- Translation.Elaborate (Prim_Name.all, Sec_Name.all, "", True);
+ case Elab_Mode is
+ when Elab_Static =>
+ raise Program_Error;
+ when Elab_Dynamic =>
+ Translation.Elaborate (Prim_Name.all, Sec_Name.all, "", True);
+ end case;
if Errorout.Nbr_Errors > 0 then
-- This may happen (bad entity for example).