Commit e0e29634 by Zachary Snow

check for unknown named bindings

parent e52de9d4
......@@ -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
// 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
// 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
// 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
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