From 3661551ac561ce54132a324e1537c5e3182e8715 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sun, 27 Aug 2017 21:05:04 +0100 Subject: [PATCH] Improve component mismatch error message a bit --- src/elab.c | 12 +++++++++--- tools/build-xilinx-vivado.rb | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/elab.c b/src/elab.c index 87eafa2c..313d2e7f 100644 --- a/src/elab.c +++ b/src/elab.c @@ -848,7 +848,8 @@ static tree_t elab_copy(tree_t t) } static bool elab_compatible_map(tree_t comp, tree_t entity, char *what, - tree_formals_t tree_Fs, tree_formal_t tree_F) + const loc_t *where, tree_formals_t tree_Fs, + tree_formal_t tree_F) { // TODO: for now they must exactly match up @@ -884,6 +885,9 @@ static bool elab_compatible_map(tree_t comp, tree_t entity, char *what, if (!found) { error_at(tree_loc(comp_f), "%s %s not found in entity %s", what, istr(tree_ident(comp_f)), istr(tree_ident(entity))); + note_at(where, "while elaborating instance here"); + note_at(tree_loc(entity), "entity %s declared here", + istr(tree_ident(entity))); ++errors; return false; } @@ -961,11 +965,13 @@ static tree_t elab_default_binding(tree_t inst, lib_t *new_lib, // Check entity is compatible with component declaration - if (!elab_compatible_map(comp, entity, "generic", + const loc_t *loc = tree_loc(inst); + + if (!elab_compatible_map(comp, entity, "generic", loc, tree_generics, tree_generic)) return NULL; - if (!elab_compatible_map(comp, entity, "port", tree_ports, tree_port)) + if (!elab_compatible_map(comp, entity, "port", loc, tree_ports, tree_port)) return NULL; return arch; diff --git a/tools/build-xilinx-vivado.rb b/tools/build-xilinx-vivado.rb index 21e30a4c..b6bf912d 100755 --- a/tools/build-xilinx-vivado.rb +++ b/tools/build-xilinx-vivado.rb @@ -10,7 +10,7 @@ xilinx = ENV['XILINX_VIVADO'] unless xilinx # Try searching some common installation directories - search = (2014..2015).collect do |major| + search = (2014..2017).collect do |major| (1..4).collect { |minor| [ "/opt/Xilinx/Vivado/#{major}.#{minor}", "/cygdrive/C/Xilinx/Vivado/#{major}.#{minor}" ] } -- 2.39.2