[topgen] Add Auto-connect for Xbar
Previously, the connection between the module, memory list and the xbar
port shall be described manually in top["inter_module"]["connect"].
Now topgen, after generating the Xbar ips, adds the connections if
doesn't exist. It loops the node in every crossbars and check if it
comes from the module or connects to the other xbars. Then it adds
connection based on the information.
To make it easier and to not create double connection case,
`add_intermodule_connect()` function is added. The function checks if
the connection already exists and add if not.
Signed-off-by: Eunchan Kim <eunchan@opentitan.org>
diff --git a/util/topgen.py b/util/topgen.py
index 62fed66..2a39200 100755
--- a/util/topgen.py
+++ b/util/topgen.py
@@ -21,7 +21,7 @@
from reggen import gen_dv, gen_rtl, validate
from topgen import (amend_clocks, get_hjsonobj_xbars, merge_top, search_ips,
validate_top)
-from topgen.intermodule import elab_intermodule
+from topgen import intermodule as im
# Common header for generated files
genhdr = '''// Copyright lowRISC contributors.
@@ -866,7 +866,11 @@
generate_xbars(completecfg, out_path)
# All IPs are generated. Connect phase now
- elab_intermodule(completecfg)
+ # Find {memory, module} <-> {xbar} connections first.
+ im.autoconnect(completecfg)
+
+ # Generic Inter-module connection
+ im.elab_intermodule(completecfg)
top_name = completecfg["name"]