Start of public OpenTitan development history
Code contributors:
Alex Bradbury <asb@lowrisc.org>
Cindy Chen <chencindy@google.com>
Eunchan Kim <eunchan@google.com>
Gaurang Chitroda <gaurangg@google.com>
Mark Hayter <mark.hayter@gmail.com>
Michael Schaffner <msf@google.com>
Miguel Osorio <miguelosorio@google.com>
Nils Graf <nilsg@google.com>
Philipp Wagner <phw@lowrisc.org>
Pirmin Vogel <vogelpi@lowrisc.org>
Ram Babu Penugonda <rampenugonda@google.com>
Scott Johnson <scottdj@google.com>
Shail Kushwah <kushwahs@google.com>
Srikrishna Iyer <sriyer@google.com>
Steve Nelson <Steve.Nelson@wdc.com>
Tao Liu <taliu@google.com>
Timothy Chen <timothytim@google.com>
Tobias Wölfel <tobias.woelfel@mailbox.org>
Weicai Yang <weicai@google.com>
diff --git a/util/uvmdvgen/gen_agent.py b/util/uvmdvgen/gen_agent.py
new file mode 100644
index 0000000..afb848a
--- /dev/null
+++ b/util/uvmdvgen/gen_agent.py
@@ -0,0 +1,59 @@
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+"""Generate SystemVerilog UVM agent extended freom our DV lib
+"""
+
+import os
+
+from mako.template import Template
+from pkg_resources import resource_filename
+
+
+def gen_agent(name, has_separate_host_device_driver, root_dir):
+ # set sub name
+ agent_dir = root_dir + "/" + name + "_agent"
+
+ # yapf: disable
+ # 4-tuple - path, ip name, class name, file ext
+ agent_srcs = [(agent_dir, name + '_', 'if', '.sv'),
+ (agent_dir, name + '_', 'item', '.sv'),
+ (agent_dir, name + '_', 'agent_cfg', '.sv'),
+ (agent_dir, name + '_', 'agent_cov', '.sv'),
+ (agent_dir, name + '_', 'monitor', '.sv'),
+ (agent_dir, name + '_', 'driver', '.sv'),
+ (agent_dir, name + '_', 'host_driver', '.sv'),
+ (agent_dir, name + '_', 'device_driver', '.sv'),
+ (agent_dir, name + '_', 'agent_pkg', '.sv'),
+ (agent_dir, name + '_', 'agent', '.sv'),
+ (agent_dir, name + '_', 'agent', '.core'),
+ (agent_dir, "", 'README', '.md'),
+ (agent_dir + "/seq_lib", name + '_', 'seq_list', '.sv'),
+ (agent_dir + "/seq_lib", name + '_', 'base_seq', '.sv')]
+ # yapf: enable
+
+ for tup in agent_srcs:
+ path_dir = tup[0]
+ src_prefix = tup[1]
+ src = tup[2]
+ src_suffix = tup[3]
+
+ if has_separate_host_device_driver:
+ if src == "driver": continue
+ else:
+ if src == "host_driver": continue
+ if src == "device_driver": continue
+
+ ftpl = src + src_suffix + '.tpl'
+ fname = src_prefix + src + src_suffix
+
+ # read template
+ tpl = Template(filename=resource_filename('uvmdvgen', ftpl))
+
+ if not os.path.exists(path_dir): os.system("mkdir -p " + path_dir)
+ with open(path_dir + "/" + fname, 'w') as fout:
+ fout.write(
+ tpl.render(
+ name=name,
+ has_separate_host_device_driver=
+ has_separate_host_device_driver))