Commit 9bab0448 by Zachary Snow

drop explicit string type from parameters

parent c840bcd6
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
some designs some designs
* Fixed unneeded scoping of constant function calls used in type lookups * Fixed unneeded scoping of constant function calls used in type lookups
### New Features
* `string` data type is now dropped from parameters and localparams
### Other Enhancements ### Other Enhancements
* Added elaboration for accesses to fields of struct constants, which can * Added elaboration for accesses to fields of struct constants, which can
......
...@@ -47,6 +47,7 @@ import qualified Convert.ResolveBindings ...@@ -47,6 +47,7 @@ import qualified Convert.ResolveBindings
import qualified Convert.Simplify import qualified Convert.Simplify
import qualified Convert.Stream import qualified Convert.Stream
import qualified Convert.StringParam import qualified Convert.StringParam
import qualified Convert.StringType
import qualified Convert.Struct import qualified Convert.Struct
import qualified Convert.StructConst import qualified Convert.StructConst
import qualified Convert.TFBlock import qualified Convert.TFBlock
...@@ -71,6 +72,7 @@ finalPhases _ = ...@@ -71,6 +72,7 @@ finalPhases _ =
, Convert.EmptyArgs.convert , Convert.EmptyArgs.convert
, Convert.FuncRet.convert , Convert.FuncRet.convert
, Convert.TFBlock.convert , Convert.TFBlock.convert
, Convert.StringType.convert
] ]
mainPhases :: Selector -> [Phase] mainPhases :: Selector -> [Phase]
......
{- sv2v
- Author: Zachary Snow <zach@zachjs.com>
-
- Drop explicit `string` data type from parameters and localparams
-}
module Convert.StringType (convert) where
import Convert.Traverse
import Language.SystemVerilog.AST
convert :: [AST] -> [AST]
convert = map $ traverseDescriptions $ traverseModuleItems convertModuleItem
convertModuleItem :: ModuleItem -> ModuleItem
convertModuleItem = traverseNodes id traverseDecl id id traverseStmt
traverseStmt :: Stmt -> Stmt
traverseStmt = traverseNestedStmts $ traverseStmtDecls traverseDecl
traverseDecl :: Decl -> Decl
traverseDecl (Param s (NonInteger TString) x e) = Param s UnknownType x e
traverseDecl other = other
...@@ -100,6 +100,7 @@ executable sv2v ...@@ -100,6 +100,7 @@ executable sv2v
Convert.Simplify Convert.Simplify
Convert.Stream Convert.Stream
Convert.StringParam Convert.StringParam
Convert.StringType
Convert.Struct Convert.Struct
Convert.StructConst Convert.StructConst
Convert.TFBlock Convert.TFBlock
......
`define TYPE string
`include "string_type.vh"
`define TYPE
`include "string_type.vh"
module mod;
parameter `TYPE P = "not";
localparam `TYPE L = "here";
initial begin
$display("mod.P = %s", P);
$display("mod.L = %s", L);
end
endmodule
module top;
parameter `TYPE P = "param";
localparam `TYPE L = "local";
initial begin
$display("top.P = %s", P);
$display("top.L = %s", L);
end
mod m1();
mod #("over") m2();
endmodule
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment