[tlgen] Skeleton of Xbar being comportable IP

This commit is the first step to make Xbar being comportable IP.
`xbar.hjson.tpl` contains basic information of the xbar module's
input/output signals being represented as inter-module signal.

To not disrupt the generated process later, the tlgen `generate()`
function now returns a list of tuples. The tuple is a pair of path info
and its contents. Later, after generalizing all the generated IP's
generate function, we can make common IP management util that controls
all the IP generation.

Signed-off-by: Eunchan Kim <eunchan@opentitan.org>
diff --git a/util/topgen.py b/util/topgen.py
index cda9547..e2651c2 100755
--- a/util/topgen.py
+++ b/util/topgen.py
@@ -63,31 +63,21 @@
             log.error("Elaboration failed." + repr(xbar))
 
         try:
-            out_rtl, out_pkg, out_core = tlgen.generate(
-                xbar, "top_" + top["name"])
+            results = tlgen.generate(xbar, "top_" + top["name"])
         except:  # noqa: E722
             log.error(exceptions.text_error_template().render())
 
-        rtl_path = out_path / 'ip/xbar_{}/rtl/autogen'.format(obj["name"])
-        rtl_path.mkdir(parents=True, exist_ok=True)
+        ip_path = out_path / 'ip/xbar_{}'.format(obj["name"])
+
+        for filename, filecontent in results:
+            filepath = ip_path / filename
+            filepath.parent.mkdir(parents=True, exist_ok=True)
+            with filepath.open(mode='w', encoding='UTF-8') as fout:
+                fout.write(filecontent)
+
         dv_path = out_path / 'ip/xbar_{}/dv/autogen'.format(obj["name"])
         dv_path.mkdir(parents=True, exist_ok=True)
 
-        rtl_filename = "xbar_%s.sv" % (xbar.name)
-        rtl_filepath = rtl_path / rtl_filename
-        with rtl_filepath.open(mode='w', encoding='UTF-8') as fout:
-            fout.write(out_rtl)
-
-        pkg_filename = "tl_%s_pkg.sv" % (xbar.name)
-        pkg_filepath = rtl_path / pkg_filename
-        with pkg_filepath.open(mode='w', encoding='UTF-8') as fout:
-            fout.write(out_pkg)
-
-        core_filename = "xbar_%s.core" % (xbar.name)
-        core_filepath = rtl_path / core_filename
-        with core_filepath.open(mode='w', encoding='UTF-8') as fout:
-            fout.write(out_core)
-
         # generate testbench for xbar
         tlgen.generate_tb(xbar, dv_path, "top_" + top["name"])
 
@@ -602,7 +592,8 @@
 
     if n_wkups < 1:
         n_wkups = 1
-        log.warning("The design has no wakeup sources. Low power not supported")
+        log.warning(
+            "The design has no wakeup sources. Low power not supported")
 
     # Define target path
     rtl_path = out_path / 'ip/pwrmgr/rtl/autogen'