[dv/uvmdvgen] update dvsim and remove Makefile From PR #1855, when generate dv using uvmdvgen, there are some old comments and code still using make. This PR updates the uvmdvgen templates by: 1. Remove the Makefile.tpl 2. Update command from make to dvsim Signed-off-by: Cindy Chen <chencindy@google.com>
diff --git a/util/uvmdvgen/Makefile.tpl b/util/uvmdvgen/Makefile.tpl deleted file mode 100644 index 48b652d..0000000 --- a/util/uvmdvgen/Makefile.tpl +++ /dev/null
@@ -1,46 +0,0 @@ -# Copyright lowRISC contributors. -# Licensed under the Apache License, Version 2.0, see LICENSE for details. -# SPDX-License-Identifier: Apache-2.0 -${'####################################################################################################'} -${'## Copyright lowRISC contributors. ##'} -${'## Licensed under the Apache License, Version 2.0, see LICENSE for details. ##'} -${'## SPDX-License-Identifier: Apache-2.0 ##'} -${'####################################################################################################'} -${'## Entry point test Makefile for building and running tests. ##'} -${'## These are generic set of option groups that apply to all testbenches. ##'} -${'## This flow requires the following options to be set: ##'} -${'## DV_DIR - current dv directory that contains the test Makefile ##'} -${'## DUT_TOP - top level dut module name ##'} -${'## TB_TOP - top level tb module name ##'} -${'## DOTF - .f file used for compilation ##'} -${'## COMPILE_KEY - compile option set ##'} -${'## TEST_NAME - name of the test to run - this is supplied on the command line ##'} -${'####################################################################################################'} -DV_DIR := ${'$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))'} -export DUT_TOP := ${name} -export TB_TOP := tb -FUSESOC_CORE := ${vendor}:dv:${name}_sim:0.1 -COMPILE_KEY ?= default - -# Add coverage exclusion file below -COV_IP_EXCL ?= - -${'####################################################################################################'} -${'## A D D I N D I V I D U A L T E S T S B E L O W ##'} -${'####################################################################################################'} -TEST_NAME ?= ${name}_sanity -UVM_TEST ?= ${name}_base_test -UVM_TEST_SEQ ?= ${name}_base_vseq - -# common tests/seqs -include ${'$'}{DV_DIR}/../../../dv/tools/common_tests.mk - -ifeq (${'$'}{TEST_NAME},${name}_sanity) - UVM_TEST_SEQ = ${name}_sanity_vseq -endif - -${'####################################################################################################'} -${'## Include the tool Makefile below ##'} -${'## Dont add anything else below it! ##'} -${'####################################################################################################'} -include ${'$'}{DV_DIR}/../../../dv/tools/Makefile
diff --git a/util/uvmdvgen/README.md b/util/uvmdvgen/README.md index 2144943..b60bd87 100644 --- a/util/uvmdvgen/README.md +++ b/util/uvmdvgen/README.md
@@ -24,7 +24,7 @@ $ util/uvmdvgen/uvmdvgen.py -h usage: uvmdvgen.py [-h] [-a] [-s] [-e] [-c] [-hr] [-hi] [-ha] [-ea agt1 agt2 [agt1 agt2 ...]] [-ao [hw/dv/sv]] - [-eo [hw/ip/<ip>]] [-m] [-v VENDOR] + [-eo [hw/ip/<ip>]] [-v VENDOR] [ip/block name] Command-line tool to autogenerate boilerplate DV testbench code extended from @@ -69,11 +69,6 @@ doc directories). Under dv, it creates 3 sub- directories - env, tb and tests to place all of the testbench sources. (default set to './<name>') - -m, --add-makefile Tests are now run with dvsim.py tool that requires a - hjson based sim cfg. Setting this option will also - result in the Makefile to be auto-generated (which is - the older way of building and running sims going - through deprecation). -v VENDOR, --vendor VENDOR Name of the vendor / entity developing the testbench. This is used to set the VLNV of the FuesSoC core @@ -294,13 +289,6 @@ and DV dependencies to construct the complete filelist to pass to simulator's build step. -* `Makefile` - - This is the simulation Makefile that is used as the starting point for - building and running tests using the [make flow]({{< relref "hw/dv/tools/README.md" >}}). - It already includes the sanity and CSR suite of tests to allow users to start - running tests right away. - * `i2c_host_dv_plan.md` This is the initial DV plan document that will describe the entire testbench. This
diff --git a/util/uvmdvgen/gen_env.py b/util/uvmdvgen/gen_env.py index fe60f5a..a4fe3ad 100644 --- a/util/uvmdvgen/gen_env.py +++ b/util/uvmdvgen/gen_env.py
@@ -5,6 +5,7 @@ """ import os +import logging as log from mako.template import Template from pkg_resources import resource_filename @@ -12,7 +13,7 @@ def gen_env(name, is_cip, has_ral, has_interrupts, has_alerts, env_agents, - root_dir, add_makefile, vendor): + root_dir, vendor): # yapf: disable # 4-tuple - sub-path, ip name, class name, file ext env_srcs = [('dv/env', name + '_', 'env_cfg', '.sv'), @@ -28,12 +29,11 @@ ('dv/env/seq_lib', name + '_', 'vseq_list', '.sv'), ('dv', '', 'tb', '.sv'), ('dv/sva', name + '_', 'bind', '.sv'), - ('dv/sva', name + '_', 'sva', '.core'), + ('dv/sva', name + '_', 'sva', '.core'), ('dv/tests', name + '_', 'base_test', '.sv'), ('dv/tests', name + '_', 'test_pkg', '.sv'), ('dv/tests', name + '_', 'test', '.core'), ('dv/cov', '', '', ''), - ('dv', '', 'Makefile', ''), ('dv', name + '_', 'sim_cfg', '.hjson'), ('doc/dv_plan', '', 'index', '.md'), ('doc', '', 'checklist', '.md'), @@ -54,18 +54,18 @@ src = tup[2] src_suffix = tup[3] - # Skip Makefile - if src == 'Makefile' and not add_makefile: continue - ftpl = src + src_suffix + '.tpl' file_name = src_prefix + src + src_suffix - if not os.path.exists(path_dir): os.system("mkdir -p " + path_dir) - if file_name == "": continue + if not os.path.exists(path_dir): + os.system("mkdir -p " + path_dir) + if file_name == "": + continue # Skip the checklist if it already exists. file_path = os.path.join(path_dir, file_name) - if src == 'checklist' and os.path.exists(file_path): continue + if src == 'checklist' and os.path.exists(file_path): + continue # read template tpl = Template(filename=resource_filename('uvmdvgen', ftpl)) @@ -81,5 +81,5 @@ has_alerts=has_alerts, env_agents=env_agents, vendor=vendor)) - except: - log.error(exceptions.text_error_template().render()) + except Exception as e: + log.error(e.text_error_template().render())
diff --git a/util/uvmdvgen/index.md.tpl b/util/uvmdvgen/index.md.tpl index 4880d04..78b4e85 100644 --- a/util/uvmdvgen/index.md.tpl +++ b/util/uvmdvgen/index.md.tpl
@@ -78,7 +78,7 @@ ${'###'} UVM RAL Model The ${name.upper()} RAL model is created with the [`ralgen`]({{< relref "hw/dv/tools/ralgen/README.md" >}}) FuseSoC generator script automatically when the simulation is at the build stage. -It can be created manually (separately) by running `make` in the the `hw/` area. +It can be created manually by invoking [`regtool`]({{< relref "util/reggen/README.md" >}}): % endif ${'###'} Reference models @@ -119,8 +119,7 @@ Please take a look at the link for detailed information on the usage, capabilities, features and known issues. Here's how to run a basic sanity test: ```console -$ cd hw/ip/${name}/dv -$ make TEST_NAME=${name}_sanity +$ $REPO_TOP/util/dvsim/dvsim.py $REPO_TOP/hw/ip/${name}/dv/${name}_sim_cfg.hjson -i ${name}_sanity ``` ${'##'} Testplan
diff --git a/util/uvmdvgen/uvmdvgen.py b/util/uvmdvgen/uvmdvgen.py index 8e2b5c4..9773581 100755 --- a/util/uvmdvgen/uvmdvgen.py +++ b/util/uvmdvgen/uvmdvgen.py
@@ -5,8 +5,6 @@ r"""Command-line tool to autogenerate boilerplate DV testbench code extended from dv_lib / cip_lib """ import argparse -import os -import sys import gen_agent import gen_env @@ -107,17 +105,6 @@ ) parser.add_argument( - "-m", - "--add-makefile", - default=False, - action='store_true', - help= - """Tests are now run with dvsim.py tool that requires a hjson based sim cfg. - Setting this option will also result in the Makefile to be auto-generated (which is - the older way of building and running sims going through deprecation).""" - ) - - parser.add_argument( "-v", "--vendor", default=VENDOR_DEFAULT, @@ -126,8 +113,10 @@ of the FuesSoC core files.""") args = parser.parse_args() - if not args.agent_outdir: args.agent_outdir = args.name - if not args.env_outdir: args.env_outdir = args.name + if not args.agent_outdir: + args.agent_outdir = args.name + if not args.env_outdir: + args.env_outdir = args.name # The has_ral option must be set if either is_cip or has_interrupts is set, # as both require use of a RAL model. As such, it is disallowed to not have @@ -142,10 +131,11 @@ args.agent_outdir, args.vendor) if args.gen_env: - if not args.env_agents: args.env_agents = [] + if not args.env_agents: + args.env_agents = [] gen_env.gen_env(args.name, args.is_cip, args.has_ral, args.has_interrupts, args.has_alerts, args.env_agents, - args.env_outdir, args.add_makefile, args.vendor) + args.env_outdir, args.vendor) if __name__ == '__main__':