From ca8626bf3906345ddd833d7b7b8fa22fe57ea932 Mon Sep 17 00:00:00 2001 From: Ethan Sifferman Date: Tue, 30 Jan 2024 01:56:06 -0800 Subject: [PATCH] refactor --- CHANGELOG.md | 1 + README.md | 2 +- src/Convert.hs | 4 ++-- .../{SystemTasks.hs => SeverityTasks.hs} | 19 +++++++++++++------ src/Job.hs | 3 ++- sv2v.cabal | 2 +- 6 files changed, 20 insertions(+), 11 deletions(-) rename src/Convert/{SystemTasks.hs => SeverityTasks.hs} (90%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 588f3208..44c68e3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### New Features +* Added conversion of of standard and elaboration severity tasks * `unique`, `unique0`, and `priority` case statements now produce corresponding `parallel_case` and `full_case` statement attributes * Added support for attributes in unary, binary, and ternary expressions diff --git a/README.md b/README.md index 2bee0dec..9356e1f1 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ Preprocessing: Conversion: --pass-through Dump input without converting -E --exclude=CONV Exclude a particular conversion (Always, Assert, - Interface, Logic, or UnbasedUnsized) + Interface, Logic, SeverityTasks, or UnbasedUnsized) -v --verbose Retain certain conversion artifacts -w --write=MODE/FILE/DIR How to write output; default is 'stdout'; use 'adjacent' to create a .v file next to each input; diff --git a/src/Convert.hs b/src/Convert.hs index 0c044064..7a9ca4c4 100644 --- a/src/Convert.hs +++ b/src/Convert.hs @@ -51,7 +51,7 @@ import qualified Convert.StringParam import qualified Convert.StringType import qualified Convert.Struct import qualified Convert.StructConst -import qualified Convert.SystemTasks +import qualified Convert.SeverityTasks import qualified Convert.TFBlock import qualified Convert.Typedef import qualified Convert.TypeOf @@ -122,7 +122,7 @@ initialPhases tops selectExclude = , Convert.Interface.disambiguate , Convert.Package.convert , Convert.StructConst.convert - , Convert.SystemTasks.convert + , selectExclude Job.SeverityTasks Convert.SeverityTasks.convert , Convert.PortDecl.convert , Convert.ParamNoDefault.convert tops , Convert.ResolveBindings.convert diff --git a/src/Convert/SystemTasks.hs b/src/Convert/SeverityTasks.hs similarity index 90% rename from src/Convert/SystemTasks.hs rename to src/Convert/SeverityTasks.hs index 4ef236dd..053b40c2 100644 --- a/src/Convert/SystemTasks.hs +++ b/src/Convert/SeverityTasks.hs @@ -1,10 +1,17 @@ {- sv2v -- Author: Ethan Sifferman -- -- Conversion of SystemVerilog System Tasks to Verilog. --} - -module Convert.SystemTasks (convert) where + - Author: Ethan Sifferman + - + - Conversion of standard and elaboration severity tasks `$info`, `$warning`, + - `$error`, and `$fatal` (20.10 and 20.11). + - + - * Severity task messages are converted into `$display` tasks. + - * Standard `$fatal` tasks run `$finish` directly after running `$display`. + - * Elaboration `$fatal` tasks set `_sv2v_elaboration_fatal` to a + - non-negative value, causing the simulation to exit once all elaboration + - severity task messages have been printed. + -} + +module Convert.SeverityTasks (convert) where import Convert.Traverse import Language.SystemVerilog.AST diff --git a/src/Job.hs b/src/Job.hs index e7641158..928d5c61 100644 --- a/src/Job.hs +++ b/src/Job.hs @@ -24,6 +24,7 @@ data Exclude | Assert | Interface | Logic + | SeverityTasks | Succinct | UnbasedUnsized deriving (Typeable, Data, Eq) @@ -75,7 +76,7 @@ defaultJob = Job &= groupname "Conversion" , exclude = nam_ "exclude" &= name "E" &= typ "CONV" &= help ("Exclude a particular conversion (Always, Assert, Interface," - ++ " Logic, or UnbasedUnsized)") + ++ " Logic, SeverityTasks, or UnbasedUnsized)") , verbose = nam "verbose" &= help "Retain certain conversion artifacts" , write = Stdout &= ignore -- parsed from the flexible flag below , writeRaw = "s" &= name "write" &= name "w" &= explicit diff --git a/sv2v.cabal b/sv2v.cabal index 0a3f9eba..c3d7b6ae 100644 --- a/sv2v.cabal +++ b/sv2v.cabal @@ -104,7 +104,7 @@ executable sv2v Convert.StringType Convert.Struct Convert.StructConst - Convert.SystemTasks + Convert.SeverityTasks Convert.TFBlock Convert.Traverse Convert.Typedef