mirror of https://github.com/zachjs/sv2v.git
support for empty port connections
This commit is contained in:
parent
eae46b7ad2
commit
801955ffab
|
|
@ -965,11 +965,14 @@ LHSs :: { [LHS] }
|
||||||
| LHSs "," LHS { $1 ++ [$3] }
|
| LHSs "," LHS { $1 ++ [$3] }
|
||||||
|
|
||||||
PortBindings :: { [PortBinding] }
|
PortBindings :: { [PortBinding] }
|
||||||
: "(" ")" { [] }
|
: "(" PortBindingsInside ")" {% checkPortBindings $2 }
|
||||||
| "(" PortBindingsInside ")" {% checkPortBindings $2 }
|
|
||||||
PortBindingsInside :: { [PortBinding] }
|
PortBindingsInside :: { [PortBinding] }
|
||||||
: PortBinding opt(",") { [$1] }
|
: OptPortBinding { [$1] }
|
||||||
| PortBinding "," PortBindingsInside { $1 : $3}
|
| OptPortBinding "," PortBindingsInside { $1 : $3}
|
||||||
|
OptPortBinding :: { PortBinding }
|
||||||
|
: {- empty -} { ("", Nil) }
|
||||||
|
| PortBinding { $1 }
|
||||||
|
|
||||||
PortBinding :: { PortBinding }
|
PortBinding :: { PortBinding }
|
||||||
: "." Identifier "(" ExprOrNil ")" { ($2, $4) }
|
: "." Identifier "(" ExprOrNil ")" { ($2, $4) }
|
||||||
| "." Identifier { ($2, Ident $2) }
|
| "." Identifier { ($2, Ident $2) }
|
||||||
|
|
@ -1507,7 +1510,12 @@ missingToken expected = do
|
||||||
throwError $ show p ++ ": Parse error: missing expected `" ++ expected ++ "`"
|
throwError $ show p ++ ": Parse error: missing expected `" ++ expected ++ "`"
|
||||||
|
|
||||||
checkPortBindings :: [PortBinding] -> ParseState [PortBinding]
|
checkPortBindings :: [PortBinding] -> ParseState [PortBinding]
|
||||||
checkPortBindings = checkBindings "port connections"
|
checkPortBindings [] = return []
|
||||||
|
checkPortBindings bindings =
|
||||||
|
checkBindings "port connections" $
|
||||||
|
if last bindings == ("", Nil)
|
||||||
|
then init bindings
|
||||||
|
else bindings
|
||||||
|
|
||||||
checkParamBindings :: [ParamBinding] -> ParseState [ParamBinding]
|
checkParamBindings :: [ParamBinding] -> ParseState [ParamBinding]
|
||||||
checkParamBindings = checkBindings "parameter overrides"
|
checkParamBindings = checkBindings "parameter overrides"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
`ifndef TRAIL
|
||||||
|
`define TRAIL ,
|
||||||
|
`endif
|
||||||
|
|
||||||
|
module mod #(
|
||||||
|
parameter [23:0] KEY = "INV"
|
||||||
|
) (a, b, c);
|
||||||
|
input wire [31:0] a, b, c;
|
||||||
|
initial #1 $display("%s a=%0d b=%0d c=%0d", KEY, a, b, c);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module top;
|
||||||
|
mod #("MA0") MA0(, , );
|
||||||
|
mod #("MA1") MA1(1, , );
|
||||||
|
mod #("MA2") MA2(1, 2, );
|
||||||
|
mod #("MA3") MA3(1, 2, 3);
|
||||||
|
mod #("MA4") MA4(1, , 3);
|
||||||
|
mod #("MA5") MA5(1, , 3);
|
||||||
|
mod #("MA6") MA6(, 2, 3);
|
||||||
|
mod #("MA7") MA7(, , 3);
|
||||||
|
mod #("MB0") MB0(, , `TRAIL);
|
||||||
|
mod #("MB1") MB1(1, , `TRAIL);
|
||||||
|
mod #("MB2") MB2(1, 2, `TRAIL);
|
||||||
|
mod #("MB3") MB3(1, 2, 3 `TRAIL);
|
||||||
|
mod #("MB4") MB4(1, , 3 `TRAIL);
|
||||||
|
mod #("MB5") MB5(1, , 3 `TRAIL);
|
||||||
|
mod #("MB6") MB6(, 2, 3 `TRAIL);
|
||||||
|
mod #("MB7") MB7(, , 3 `TRAIL);
|
||||||
|
endmodule
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
`define TRAIL
|
||||||
|
`include "unbound_port.sv"
|
||||||
|
|
@ -22,6 +22,7 @@ simulate() {
|
||||||
-Wall \
|
-Wall \
|
||||||
-Wno-select-range \
|
-Wno-select-range \
|
||||||
-Wno-anachronisms \
|
-Wno-anachronisms \
|
||||||
|
-Wno-portbind \
|
||||||
-o $sim_prog \
|
-o $sim_prog \
|
||||||
-g2005 \
|
-g2005 \
|
||||||
-DTEST_VCD="\"$sim_vcd\"" \
|
-DTEST_VCD="\"$sim_vcd\"" \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue