diff options
author | Tristan Gingold <tgingold@free.fr> | 2018-10-19 05:12:20 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2018-10-21 08:03:38 +0200 |
commit | 1803f976121985c6e8e7506c9b959e8d2b5f718c (patch) | |
tree | c590acb9a797c28b01adc40cf5b00b5b017c799c /src/ghdldrv | |
parent | f910e02797a83d0c5748768d20359a3d95569cc7 (diff) | |
download | ghdl-1803f976121985c6e8e7506c9b959e8d2b5f718c.tar.gz ghdl-1803f976121985c6e8e7506c9b959e8d2b5f718c.tar.bz2 ghdl-1803f976121985c6e8e7506c9b959e8d2b5f718c.zip |
Pass time-resolution to grt.
Use time-resolution for Put_Time.
Use time-resolution for --stop-time (Parse_Time).
Use time-resolution as VpiTimePrecision and for vcd.
TODO: ghw (but needs to update ghwlib and gtkwave)
Fix #672
Diffstat (limited to 'src/ghdldrv')
-rw-r--r-- | src/ghdldrv/ghdlcomp.adb | 9 | ||||
-rw-r--r-- | src/ghdldrv/ghdlmain.adb | 2 | ||||
-rw-r--r-- | src/ghdldrv/ghdlmain.ads | 5 | ||||
-rw-r--r-- | src/ghdldrv/ghdlrun.adb | 13 |
4 files changed, 16 insertions, 13 deletions
diff --git a/src/ghdldrv/ghdlcomp.adb b/src/ghdldrv/ghdlcomp.adb index df7f02cb1..eb1ef80e3 100644 --- a/src/ghdldrv/ghdlcomp.adb +++ b/src/ghdldrv/ghdlcomp.adb @@ -75,14 +75,11 @@ package body Ghdlcomp is Time_Resolution := 'm'; elsif Option (19 .. Option'Last) = "sec" then Time_Resolution := 's'; - elsif Option (19 .. Option'Last) = "min" then - Time_Resolution := 'M'; - elsif Option (19 .. Option'Last) = "hr" then - Time_Resolution := 'h'; elsif Option (19 .. Option'Last) = "auto" then Time_Resolution := 'a'; else - Res := Option_Bad; + Error ("unknown unit name for --time-resolution"); + Res := Option_Err; end if; else Decode_Option (Command_Lib (Cmd), Option, Arg, Res); @@ -98,7 +95,7 @@ package body Ghdlcomp is Hooks.Disp_Long_Help.all; Put_Line (" --expect-failure Expect analysis/elaboration failure"); Put_Line (" --time-resolution=UNIT Set the resolution of type time"); - Put_Line (" UNIT can be fs, ps, ns, us, ms, sec, min or hr"); + Put_Line (" UNIT can be fs, ps, ns, us, ms, sec or auto"); end Disp_Long_Help; -- Command -r diff --git a/src/ghdldrv/ghdlmain.adb b/src/ghdldrv/ghdlmain.adb index 81337af50..da23ea47f 100644 --- a/src/ghdldrv/ghdlmain.adb +++ b/src/ghdldrv/ghdlmain.adb @@ -354,6 +354,8 @@ package body Ghdlmain is Error ("unknown option '" & Arg.all & "' for command '" & Cmd_Name.all & "'"); raise Option_Error; + when Option_Err => + raise Option_Error; when Option_Ok => Arg_Index := Arg_Index + 1; when Option_Arg_Req => diff --git a/src/ghdldrv/ghdlmain.ads b/src/ghdldrv/ghdlmain.ads index c79530934..0625dfde9 100644 --- a/src/ghdldrv/ghdlmain.ads +++ b/src/ghdldrv/ghdlmain.ads @@ -36,11 +36,14 @@ package Ghdlmain is -- Option_OK: OPTION is handled. -- Option_Bad: OPTION is unknown. + -- Option_Err: OPTION has an error (message was displayed). -- Option_Arg_Req: OPTION requires an argument. Must be set only when -- ARG = "", the manager will recall Decode_Option. -- Option_Arg: OPTION used the argument. type Option_Res is - (Option_Bad, Option_Ok, Option_Arg, Option_Arg_Req, Option_End); + (Option_Bad, Option_Err, + Option_Ok, Option_Arg, Option_Arg_Req, + Option_End); procedure Decode_Option (Cmd : in out Command_Type; Option : String; Arg : String; diff --git a/src/ghdldrv/ghdlrun.adb b/src/ghdldrv/ghdlrun.adb index b2cff0411..d612095f7 100644 --- a/src/ghdldrv/ghdlrun.adb +++ b/src/ghdldrv/ghdlrun.adb @@ -110,10 +110,6 @@ package body Ghdlrun is -- The design is always analyzed in whole. Flags.Flag_Whole_Analyze := True; - Ortho_Jit.Init; - - Translation.Initialize; - case Elab_Mode is when Elab_Static => Canon.Canon_Flag_Add_Labels := True; @@ -159,8 +155,6 @@ package body Ghdlrun is when 'u' => Put ("us"); when 'm' => Put ("ms"); when 's' => Put ("sec"); - when 'M' => Put ("min"); - when 'h' => Put ("hr"); when others => Put ("??"); end case; New_Line; @@ -169,6 +163,13 @@ package body Ghdlrun is end if; Std_Package.Set_Time_Resolution (Time_Resolution); + -- Overwrite time resolution in flag string. + Flags.Flag_String (5) := Time_Resolution; + + Ortho_Jit.Init; + + Translation.Initialize; + case Elab_Mode is when Elab_Static => raise Program_Error; |