mirror of https://github.com/zachjs/sv2v.git
ignore port connection attributions
This commit is contained in:
parent
eca8714de7
commit
e4c47363bb
|
|
@ -21,6 +21,10 @@
|
|||
* Added elaboration for accesses to fields of struct constants, which can
|
||||
substantially improve performance on some designs
|
||||
* Added constant folding for comparisons involving string literals
|
||||
* Port connection attributes (e.g., [pulp_soc.sv]) are now ignored with a
|
||||
warning rather than failing to parse
|
||||
|
||||
[pulp_soc.sv]: https://github.com/pulp-platform/pulp_soc/blob/0573a85c/rtl/pulp_soc/pulp_soc.sv#L733
|
||||
|
||||
## v0.0.10
|
||||
|
||||
|
|
|
|||
|
|
@ -820,6 +820,8 @@ AttributeInstances :: { [Attr] }
|
|||
| AttributeInstance AttributeInstances { $1 : $2 }
|
||||
AttributeInstance :: { Attr }
|
||||
: AttributeInstanceP { snd $1 }
|
||||
AttributeInstancesP :: { (Position, [Attr]) }
|
||||
: AttributeInstanceP AttributeInstances { (fst $1, snd $1 : $2) }
|
||||
AttributeInstanceP :: { (Position, Attr) }
|
||||
: "(*" AttrSpecs "*)" { withPos $1 $ Attr $2 }
|
||||
AttrSpecs :: { [AttrSpec] }
|
||||
|
|
@ -1068,6 +1070,7 @@ PortBindingsInside :: { [PortBinding] }
|
|||
OptPortBinding :: { PortBinding }
|
||||
: {- empty -} { ("", Nil) }
|
||||
| PortBinding { $1 }
|
||||
| AttributeInstancesP PortBinding {% portBindingAttrs $1 >> return $2 }
|
||||
|
||||
PortBinding :: { PortBinding }
|
||||
: "." Identifier "(" ExprOrNil ")" { ($2, $4) }
|
||||
|
|
@ -1752,10 +1755,15 @@ readNumber :: Position -> String -> ParseState Number
|
|||
readNumber pos str = do
|
||||
oversizedNumbers <- gets pOversizedNumbers
|
||||
let (num, msg) = parseNumber oversizedNumbers str
|
||||
when (not $ null msg) $ lift $ lift $
|
||||
hPutStrLn stderr $ show pos ++ ": Warning: " ++ msg
|
||||
when (not $ null msg) $
|
||||
parseWarning pos msg
|
||||
return num
|
||||
|
||||
parseWarning :: Position -> String -> ParseState ()
|
||||
parseWarning pos msg =
|
||||
lift $ lift $ hPutStrLn stderr $
|
||||
show pos ++ ": Warning: " ++ msg
|
||||
|
||||
expectZeroDelay :: Token -> a -> ParseState a
|
||||
expectZeroDelay tok a = do
|
||||
num <- readNumber pos str
|
||||
|
|
@ -1813,4 +1821,9 @@ makeIncrExprAsgn True (pos, op) expr = do
|
|||
return $ BinOp op expr' minusOne
|
||||
where minusOne = Number $ Decimal 1 True 1
|
||||
|
||||
portBindingAttrs :: (Position, [Attr]) -> ParseState ()
|
||||
portBindingAttrs (pos, attrs) = parseWarning pos msg
|
||||
where msg = "Ignored port connection attributes "
|
||||
++ concatMap show attrs ++ "."
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
module mod(output logic out);
|
||||
assign out = 1;
|
||||
endmodule
|
||||
module top;
|
||||
logic x;
|
||||
mod m((* foo *)(* bar *).out(x));
|
||||
endmodule
|
||||
|
|
@ -3,9 +3,10 @@
|
|||
NO_FILES_WARNING="Warning: No input files specified (try \`sv2v --help\`)"
|
||||
PACKAGE_WARNING="Warning: Source includes packages but no modules. Please convert packages alongside the modules that use them."
|
||||
INTERFACE_WARNING="Warning: Source includes an interface but output is empty because there is no top-level module which has no ports which are interfaces."
|
||||
PORT_CONN_ATTR_WARNING="attr.sv:6:11: Warning: Ignored port connection attributes (* foo *)(* bar *)."
|
||||
|
||||
test_default() {
|
||||
runAndCapture *.sv
|
||||
runAndCapture interface.sv module.sv package.sv
|
||||
assertTrue "default conversion should succeed" $result
|
||||
assertNotNull "stdout should not be empty" "$stdout"
|
||||
assertNull "stderr should be empty" "$stderr"
|
||||
|
|
@ -18,6 +19,13 @@ test_no_files() {
|
|||
assertEquals "stderr should should have warning" "$NO_FILES_WARNING" "$stderr"
|
||||
}
|
||||
|
||||
test_port_conn_attr() {
|
||||
runAndCapture attr.sv
|
||||
assertTrue "conversion should succeed" $result
|
||||
assertNotNull "stdout should not be empty" "$stdout"
|
||||
assertEquals "stderr should should have warning" "$PORT_CONN_ATTR_WARNING" "$stderr"
|
||||
}
|
||||
|
||||
test_only_package() {
|
||||
runAndCapture package.sv
|
||||
assertTrue "conversion should succeed" $result
|
||||
|
|
|
|||
Loading…
Reference in New Issue