[topgen/tlgen] Multi-tiered Xbar

The script is to support multi-tiered crossbars on top_earlgrey.

Now any crossbar can have connections to other crossbars. It is allowed
only one connection between two crossbars at this time.

If `xbar: "true"` is defined in the node, the tool does below:

- Recognize it as a crossbar connection
- Gather downstream addresses and calculate the common address range (*)
- If device is a port to another crossbar, the address steering compares
  list of address range not a single `address_from`, `address_to`

Signed-off-by: Eunchan Kim <eunchan@opentitan.org>
diff --git a/util/tlgen/lib.py b/util/tlgen/lib.py
new file mode 100644
index 0000000..528de26
--- /dev/null
+++ b/util/tlgen/lib.py
@@ -0,0 +1,21 @@
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+
+import math
+import logging as log
+
+
+def is_pow2(v):
+    """Return true if value is power of two
+    """
+    if not isinstance(v, int):
+        log.warning("is_pow2 received non-integer value {}".format(v))
+        return False
+    t = 1
+    while t <= v:
+        if t == v:
+            return True
+        t = t * 2
+
+    return False