mirror of https://github.com/zachjs/sv2v.git
don't use positional error message on extra named bindings
This commit is contained in:
parent
e4c47363bb
commit
b7738a3238
|
|
@ -23,6 +23,7 @@
|
|||
* 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
|
||||
* 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
|
||||
|
||||
|
|
|
|||
|
|
@ -102,12 +102,13 @@ type Binding t = (Identifier, t)
|
|||
-- give a set of bindings explicit names
|
||||
resolveBindings :: String -> [Identifier] -> [Binding t] -> [Binding t]
|
||||
resolveBindings _ _ [] = []
|
||||
resolveBindings location available bindings =
|
||||
resolveBindings location available bindings@(("", _) : _) =
|
||||
if length available < length bindings then
|
||||
error $ "too many bindings specified for " ++ location
|
||||
else if null $ fst $ head bindings then
|
||||
else
|
||||
zip available $ map snd bindings
|
||||
else if not $ null unknowns then
|
||||
resolveBindings location available bindings =
|
||||
if not $ null unknowns then
|
||||
error $ "unknown binding" ++ unknownsPlural ++ " "
|
||||
++ unknownsStr ++ " specified for " ++ location
|
||||
else
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
// 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
|
||||
Loading…
Reference in New Issue