mirror of https://github.com/zachjs/sv2v.git
drop explicit string type from parameters
This commit is contained in:
parent
c840bcd623
commit
9bab0448e3
|
|
@ -7,6 +7,10 @@
|
|||
some designs
|
||||
* 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
|
||||
|
||||
* Added elaboration for accesses to fields of struct constants, which can
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import qualified Convert.ResolveBindings
|
|||
import qualified Convert.Simplify
|
||||
import qualified Convert.Stream
|
||||
import qualified Convert.StringParam
|
||||
import qualified Convert.StringType
|
||||
import qualified Convert.Struct
|
||||
import qualified Convert.StructConst
|
||||
import qualified Convert.TFBlock
|
||||
|
|
@ -71,6 +72,7 @@ finalPhases _ =
|
|||
, Convert.EmptyArgs.convert
|
||||
, Convert.FuncRet.convert
|
||||
, Convert.TFBlock.convert
|
||||
, Convert.StringType.convert
|
||||
]
|
||||
|
||||
mainPhases :: Selector -> [Phase]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
{- 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
|
|||
Convert.Simplify
|
||||
Convert.Stream
|
||||
Convert.StringParam
|
||||
Convert.StringType
|
||||
Convert.Struct
|
||||
Convert.StructConst
|
||||
Convert.TFBlock
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
`define TYPE string
|
||||
`include "string_type.vh"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
`define TYPE
|
||||
`include "string_type.vh"
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
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
|
||||
Loading…
Reference in New Issue