Commit b7738a32 by Zachary Snow

don't use positional error message on extra named bindings

parent e4c47363
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* Added constant folding for comparisons involving string literals * Added constant folding for comparisons involving string literals
* Port connection attributes (e.g., [pulp_soc.sv]) are now ignored with a * Port connection attributes (e.g., [pulp_soc.sv]) are now ignored with a
warning rather than failing to parse warning rather than failing to parse
* Improved error message when specifying an extraneous named port connection
[pulp_soc.sv]: https://github.com/pulp-platform/pulp_soc/blob/0573a85c/rtl/pulp_soc/pulp_soc.sv#L733 [pulp_soc.sv]: https://github.com/pulp-platform/pulp_soc/blob/0573a85c/rtl/pulp_soc/pulp_soc.sv#L733
......
...@@ -102,12 +102,13 @@ type Binding t = (Identifier, t) ...@@ -102,12 +102,13 @@ type Binding t = (Identifier, t)
-- give a set of bindings explicit names -- give a set of bindings explicit names
resolveBindings :: String -> [Identifier] -> [Binding t] -> [Binding t] resolveBindings :: String -> [Identifier] -> [Binding t] -> [Binding t]
resolveBindings _ _ [] = [] resolveBindings _ _ [] = []
resolveBindings location available bindings = resolveBindings location available bindings@(("", _) : _) =
if length available < length bindings then if length available < length bindings then
error $ "too many bindings specified for " ++ location error $ "too many bindings specified for " ++ location
else if null $ fst $ head bindings then else
zip available $ map snd bindings zip available $ map snd bindings
else if not $ null unknowns then resolveBindings location available bindings =
if not $ null unknowns then
error $ "unknown binding" ++ unknownsPlural ++ " " error $ "unknown binding" ++ unknownsPlural ++ " "
++ unknownsStr ++ " specified for " ++ location ++ unknownsStr ++ " specified for " ++ location
else else
......
// pattern: unknown binding "z" specified for port connections in instance "e" of "example"
module example(
input x, y
);
endmodule
module top;
example e(.x(1'b1), .y(1'b0), .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