mirror of https://github.com/zachjs/sv2v.git
check for unknown named bindings
This commit is contained in:
parent
e52de9d4a6
commit
e0e296349a
|
|
@ -17,6 +17,7 @@ module Convert.ResolveBindings
|
|||
) where
|
||||
|
||||
import Control.Monad.Writer.Strict
|
||||
import Data.List (intercalate, (\\))
|
||||
import qualified Data.Map.Strict as Map
|
||||
|
||||
import Convert.ExprUtils (simplify)
|
||||
|
|
@ -121,5 +122,12 @@ resolveBindings location available bindings =
|
|||
error $ "too many bindings specified for " ++ location
|
||||
else if null $ fst $ head bindings then
|
||||
zip available $ map snd bindings
|
||||
else if not $ null unknowns then
|
||||
error $ "unknown binding" ++ unknownsPlural ++ " "
|
||||
++ unknownsStr ++ " specified for " ++ location
|
||||
else
|
||||
bindings
|
||||
where
|
||||
unknowns = map fst bindings \\ available
|
||||
unknownsPlural = if length unknowns == 1 then "" else "s"
|
||||
unknownsStr = intercalate ", " $ map show unknowns
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
// pattern: unknown binding "R" specified for parameters in class specialization of "example"
|
||||
class example #(
|
||||
parameter P = 1,
|
||||
parameter Q = 1
|
||||
);
|
||||
typedef logic [P * Q:0] T;
|
||||
endclass
|
||||
module top;
|
||||
example#(.P(1), .R(2))::T x;
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// pattern: unknown binding "R" specified for parameter overrides in instance "e" of "example"
|
||||
module example;
|
||||
parameter P = 1;
|
||||
parameter Q = 1;
|
||||
endmodule
|
||||
module top;
|
||||
example #(.P(1), .R(2)) e();
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// pattern: unknown bindings "w", "z" specified for port connections in instance "e" of "example"
|
||||
module example(
|
||||
input x, y
|
||||
);
|
||||
endmodule
|
||||
module top;
|
||||
example e(.w(1), .z(1'b0));
|
||||
endmodule
|
||||
Loading…
Reference in New Issue