[dvsim] migrate testplanner into dvsim codebase

Signed-off-by: Udi Jonnalagadda <udij@google.com>
diff --git a/doc/ug/dv_methodology.md b/doc/ug/dv_methodology.md
index 70e4ff7..7157ed2 100644
--- a/doc/ug/dv_methodology.md
+++ b/doc/ug/dv_methodology.md
@@ -61,7 +61,7 @@
 *  Annotate the nightly regression results to allow us to track our progress towards executing the testplan
   *  this feature is not yet available and is [under active development](#pending-work-items)
 
-The [testplanner]({{< relref "util/testplanner/README.md" >}}) tool provides some additional information on the Hjson testplan anatomy and some of the features and constructs supported.
+The [testplanner]({{< relref "util/dvsim/testplanner/README.md" >}}) tool provides some additional information on the Hjson testplan anatomy and some of the features and constructs supported.
 The [build_docs]({{< relref "README.md#documentation" >}}) tool works in conjunction with the `testplanner` tool to enable its insertion into the DV plan as a table.
 
 ### DV Plan
diff --git a/doc/ug/getting_started_dv.md b/doc/ug/getting_started_dv.md
index 3e67ef2..724aaf5 100644
--- a/doc/ug/getting_started_dv.md
+++ b/doc/ug/getting_started_dv.md
@@ -36,7 +36,7 @@
 However, it is expected to list all the verification components needed and depict the planned testbench as a block diagram.
 Under the 'design verification' directory in the OpenTitan team drive, some sample testbench block diagrams are available in the `.svg` format, which can be used as a template.
 The Hjson testplan on the other hand, is required to be completed.
-Please refer to the [testplanner tool]({{< relref "util/testplanner/README.md" >}}) documentation for additional details on how to write the Hjson testplan.
+Please refer to the [testplanner tool]({{< relref "util/dvsim/testplanner/README.md" >}}) documentation for additional details on how to write the Hjson testplan.
 Once done, these documents are to be reviewed with the designer(s) and other project members for completeness and clarity.
 
 ## UVM RAL Model
diff --git a/util/_index.md b/util/_index.md
index ebace13..51dc61f 100644
--- a/util/_index.md
+++ b/util/_index.md
@@ -12,7 +12,7 @@
 * FPGA splice utility [README]({{< relref "util/fpga/README.md" >}})
 * `reggen.py` register generator tool [README]({{< relref "util/reggen/README.md" >}})
 * `spitest.py` script for interacting with SPI device code [README]({{< relref "util/simplespi/README.md" >}})
-* `testplanner.py` utility for generating verification testplans from Hjson descriptors [README]({{< relref "util/testplanner/README.md" >}})
+* `testplanner.py` utility for generating verification testplans from Hjson descriptors [README]({{< relref "util/dvsim/testplanner/README.md" >}})
 * `tlgen.py` utility for TileLink bus matrix [README]({{< relref "util/tlgen/README.md" >}})
 * `uvmdvgen.py` utility for generating testbenches for comportable IP [README]({{< relref "util/uvmdvgen/README.md" >}})
 * `fpvgen.py` utility for generating FPV testbenches for comportable IP [README]({{< relref "util/fpvgen/README.md" >}})
diff --git a/util/build_docs.py b/util/build_docs.py
index b14dae7..bf40267 100755
--- a/util/build_docs.py
+++ b/util/build_docs.py
@@ -28,7 +28,7 @@
 import reggen.gen_html as gen_html
 import reggen.validate as validate
 import reggen.gen_selfdoc as reggen_selfdoc
-import testplanner.testplan_utils as testplan_utils
+import dvsim.testplanner.testplan_utils as testplan_utils
 import tlgen
 
 USAGE = """
@@ -85,7 +85,7 @@
         "hw/ip/usbdev/data/usbdev_testplan.hjson",
         "hw/ip/tlul/data/tlul_testplan.hjson",
         "hw/top_earlgrey/data/standalone_sw_testplan.hjson",
-        "util/testplanner/examples/foo_testplan.hjson",
+        "util/dvsim/testplanner/examples/foo_testplan.hjson",
     ],
 
     # Pre-generated utility selfdoc
diff --git a/util/dvsim/Deploy.py b/util/dvsim/Deploy.py
index 065bfb4..e61e687 100644
--- a/util/dvsim/Deploy.py
+++ b/util/dvsim/Deploy.py
@@ -16,7 +16,7 @@
 import hjson
 from tabulate import tabulate
 
-from .utils import *
+from utils import *
 
 
 class Deploy():
diff --git a/util/dvsim/FlowCfg.py b/util/dvsim/FlowCfg.py
index 6e438f8..5fc91d2 100644
--- a/util/dvsim/FlowCfg.py
+++ b/util/dvsim/FlowCfg.py
@@ -12,8 +12,8 @@
 
 import hjson
 
-from .Deploy import *
-from .utils import *
+from Deploy import *
+from utils import *
 
 
 # Interface class for extensions.
diff --git a/util/dvsim/LintCfg.py b/util/dvsim/LintCfg.py
index 4adfd1e..da1f1cb 100644
--- a/util/dvsim/LintCfg.py
+++ b/util/dvsim/LintCfg.py
@@ -11,10 +11,10 @@
 
 from tabulate import tabulate
 
-from .Deploy import *
-from .Modes import *
-from .OneShotCfg import OneShotCfg
-from .utils import *
+from Deploy import *
+from Modes import *
+from OneShotCfg import OneShotCfg
+from utils import *
 
 
 # helper function for printing messages
diff --git a/util/dvsim/Modes.py b/util/dvsim/Modes.py
index 795dcfa..3a757c9 100644
--- a/util/dvsim/Modes.py
+++ b/util/dvsim/Modes.py
@@ -12,7 +12,7 @@
 
 import hjson
 
-from .utils import *
+from utils import *
 
 
 class Modes():
diff --git a/util/dvsim/OneShotCfg.py b/util/dvsim/OneShotCfg.py
index cc78d8c..766ff98 100644
--- a/util/dvsim/OneShotCfg.py
+++ b/util/dvsim/OneShotCfg.py
@@ -8,10 +8,10 @@
 import logging as log
 import sys
 
-from .Deploy import *
-from .FlowCfg import FlowCfg
-from .Modes import *
-from .utils import *
+from Deploy import *
+from FlowCfg import FlowCfg
+from Modes import *
+from utils import *
 
 
 class OneShotCfg(FlowCfg):
diff --git a/util/dvsim/SimCfg.py b/util/dvsim/SimCfg.py
index 6cf16da..969263d 100644
--- a/util/dvsim/SimCfg.py
+++ b/util/dvsim/SimCfg.py
@@ -10,10 +10,10 @@
 
 from testplanner import class_defs, testplan_utils
 
-from .Deploy import *
-from .FlowCfg import FlowCfg
-from .Modes import *
-from .utils import *
+from Deploy import *
+from FlowCfg import FlowCfg
+from Modes import *
+from utils import *
 
 
 class SimCfg(FlowCfg):
diff --git a/util/dvsim.py b/util/dvsim/dvsim.py
similarity index 99%
rename from util/dvsim.py
rename to util/dvsim/dvsim.py
index 2670306..431fe94 100755
--- a/util/dvsim.py
+++ b/util/dvsim/dvsim.py
@@ -20,7 +20,10 @@
 import sys
 from pathlib import Path
 
-from dvsim import Deploy, LintCfg, SimCfg, utils
+import Deploy
+import LintCfg
+import SimCfg
+import utils
 
 # TODO: add dvsim_cfg.hjson to retrieve this info
 version = 0.1
diff --git a/util/testplanner.py b/util/dvsim/testplanner.py
similarity index 100%
rename from util/testplanner.py
rename to util/dvsim/testplanner.py
diff --git a/util/testplanner/README.md b/util/dvsim/testplanner/README.md
similarity index 93%
rename from util/testplanner/README.md
rename to util/dvsim/testplanner/README.md
index 6d76d00..c663166 100644
--- a/util/testplanner/README.md
+++ b/util/dvsim/testplanner/README.md
@@ -92,7 +92,7 @@
 example of this is running the automated UVM RAL CSR tests, which applies to
 almost all DUTs. This can be done using the `import_testplans` key:
 ```hjson
-  import_testplans: ["util/testplanner/examples/common_testplan.hjson",
+  import_testplans: ["util/dvsim/testplanner/examples/common_testplan.hjson",
                      "hw/dv/tools/csr_testplan.hjson"]
 ```
 
@@ -162,7 +162,7 @@
 
 ### Example sources
 
-The following examples provided within `util/testplanner/examples` can be used as
+The following examples provided within `util/dvsim/testplanner/examples` can be used as
 a starting point.
 * **`foo_testplan.hjson`**: DUT testplan
 * **`common_testplan.hjson`**: shared testplan imported within the DUT testplan
@@ -188,22 +188,22 @@
 
 Generate the testplan table in HTML to stdout:
 ```console
-$ util/testplanner.py testplanner/examples/foo_testplan.hjson
+$ util/dvsim/testplanner.py testplanner/examples/foo_testplan.hjson
 ```
 
 Generate the testplan table in HTML to a file:
 ```console
-$ util/testplanner.py testplanner/examples/foo_testplan.hjson -o /tmp/foo_testplan_table.html
+$ util/dvsim/testplanner.py testplanner/examples/foo_testplan.hjson -o /tmp/foo_testplan_table.html
 ```
 
 Generate regression results table in HTML to stdout:
 ```console
-$ util/testplanner.py testplanner/examples/foo_testplan.hjson -r testplanner/examples/foo_regr_results.hjson
+$ util/dvsim/testplanner.py testplanner/examples/foo_testplan.hjson -r testplanner/examples/foo_regr_results.hjson
 ```
 
 Generate regression results table in HTML to a file:
 ```console
-$ util/testplanner.py testplanner/examples/foo_testplan.hjson \
+$ util/dvsim/testplanner.py testplanner/examples/foo_testplan.hjson \
     -r testplanner/examples/foo_regr_results.hjson -o /tmp/foo_regr_results.html
 ```
 
diff --git a/util/testplanner/__init__.py b/util/dvsim/testplanner/__init__.py
similarity index 100%
rename from util/testplanner/__init__.py
rename to util/dvsim/testplanner/__init__.py
diff --git a/util/testplanner/class_defs.py b/util/dvsim/testplanner/class_defs.py
similarity index 100%
rename from util/testplanner/class_defs.py
rename to util/dvsim/testplanner/class_defs.py
diff --git a/util/testplanner/examples/common_testplan.hjson b/util/dvsim/testplanner/examples/common_testplan.hjson
similarity index 100%
rename from util/testplanner/examples/common_testplan.hjson
rename to util/dvsim/testplanner/examples/common_testplan.hjson
diff --git a/util/dvsim/testplanner/examples/foo_dv_plan.md b/util/dvsim/testplanner/examples/foo_dv_plan.md
new file mode 100644
index 0000000..3ae4d28
--- /dev/null
+++ b/util/dvsim/testplanner/examples/foo_dv_plan.md
@@ -0,0 +1,7 @@
+---
+title: "FOO DV plan"
+---
+
+# Testplan
+
+{{< testplan "util/dvsim/testplanner/examples/foo_testplan.hjson" >}}
diff --git a/util/testplanner/examples/foo_regr_results.hjson b/util/dvsim/testplanner/examples/foo_regr_results.hjson
similarity index 100%
rename from util/testplanner/examples/foo_regr_results.hjson
rename to util/dvsim/testplanner/examples/foo_regr_results.hjson
diff --git a/util/testplanner/examples/foo_testplan.hjson b/util/dvsim/testplanner/examples/foo_testplan.hjson
similarity index 96%
rename from util/testplanner/examples/foo_testplan.hjson
rename to util/dvsim/testplanner/examples/foo_testplan.hjson
index ea2ff2d..10afb7e 100644
--- a/util/testplanner/examples/foo_testplan.hjson
+++ b/util/dvsim/testplanner/examples/foo_testplan.hjson
@@ -10,7 +10,7 @@
   // paths are relative to repository top
   // all key_value pairs in this file other than 'import_testplans' and 'entries'
   // can be used for wildcard substitutions in imported testplans
-  import_testplans: ["util/testplanner/examples/common_testplan.hjson"]
+  import_testplans: ["util/dvsim/testplanner/examples/common_testplan.hjson"]
   entries: [
     {
       // name of the testplan entry - should be unique
diff --git a/util/testplanner/testplan_utils.py b/util/dvsim/testplanner/testplan_utils.py
similarity index 99%
rename from util/testplanner/testplan_utils.py
rename to util/dvsim/testplanner/testplan_utils.py
index 9e8a836..c4f8042 100644
--- a/util/testplanner/testplan_utils.py
+++ b/util/dvsim/testplanner/testplan_utils.py
@@ -20,7 +20,7 @@
 def parse_testplan(filename):
     '''Parse testplan Hjson file into a datastructure'''
     self_path = os.path.dirname(os.path.realpath(__file__))
-    repo_root = os.path.abspath(os.path.join(self_path, os.pardir, os.pardir))
+    repo_root = os.path.abspath(os.path.join(self_path, os.pardir, os.pardir, os.pardir))
 
     name = ""
     imported_testplans = []
diff --git a/util/testplanner/examples/foo_dv_plan.md b/util/testplanner/examples/foo_dv_plan.md
deleted file mode 100644
index 3982ef4..0000000
--- a/util/testplanner/examples/foo_dv_plan.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-title: "FOO DV plan"
----
-
-# Testplan
-
-{{< testplan "util/testplanner/examples/foo_testplan.hjson" >}}