Skip to content

Commit bb2ffda

Browse files
committed
[hw,ac_range_check,dv] Templify the DV code for ipgen generation
Signed-off-by: Robert Schilling <[email protected]>
1 parent ee10258 commit bb2ffda

20 files changed

+151
-151
lines changed

hw/ip_templates/ac_range_check/dv/README.md.tpl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ${"###"} Block diagram
2323

2424
${"###"} Top level testbench
2525
Top level testbench is located at `hw/top_${topname}/ip_autogen/ac_range_check/dv/tb/tb.sv`.
26-
It instantiates the `ac_range_check` DUT module `hw/ip/ac_range_check/rtl/ac_range_check.sv`.
26+
It instantiates the `ac_range_check` DUT module `hw/ip/ac_range_check/rtl/${module_instance_name}.sv`.
2727
In addition, the testbench instantiates the following interfaces, connects them to the DUT and sets their handle into `uvm_config_db`:
2828
* [Clock and reset interface](../../../../dv/sv/common_ifs/README.md)
2929
* [Reset shadowed interface](../../../../dv/sv/common_ifs/README.md) // TODO add something in this doc about this interface.
@@ -43,7 +43,7 @@ ${"###"} Compile-time configurations
4343
[list compile time configurations, if any and what are they used for]
4444

4545
${"###"} Global types & methods
46-
All common types and methods defined at the package level can be found in `ac_range_check_env_pkg`.
46+
All common types and methods defined at the package level can be found in `${module_instance_name}_env_pkg`.
4747
Some of them in use are:
4848
```systemverilog
4949
[list a few parameters, types & methods; no need to mention all]
@@ -77,7 +77,7 @@ This helps increase the likelihood of hitting the design corners that would othe
7777
This object aims to provide such run-time controls.
7878

7979
${"####"} Env cfg
80-
The `ac_range_check_env_cfg`, environment configuration object provides access to the following elements:
80+
The `${module_instance_name}_env_cfg`, environment configuration object provides access to the following elements:
8181
* Build-time controls to configure the UVM environment composition during the `build_phase`
8282
* Downstream agent configuration objects for ease of lookup from any environment component
8383
* This includes the `tl_agent_cfg` objects for both TL interfaces
@@ -89,11 +89,11 @@ By housing all of the above, all pertinent information is more easily shared wit
8989

9090
${"###"} Stimulus strategy
9191
${"####"} Test sequences
92-
All test sequences reside in `hw/top_${topname}/ip_autogen/ac_range_check/dv/env/seq_lib`.
93-
The `ac_range_check_base_vseq` virtual sequence is extended from `cip_base_vseq` and serves as a starting point.
94-
All test sequences are extended from `ac_range_check_base_vseq`.
92+
All test sequences reside in `hw/top_${topname}/ip_autogen/${module_instance_name}/dv/env/seq_lib`.
93+
The `${module_instance_name}_base_vseq` virtual sequence is extended from `cip_base_vseq` and serves as a starting point.
94+
All test sequences are extended from `${module_instance_name}_base_vseq`.
9595
It provides commonly used handles, variables, functions and tasks that the test sequences can simple use / call.
96-
Some of the most commonly used tasks / functions are as follows: From `hw/top_${topname}/ip_autogen/ac_range_check/dv/env/seq/ac_range_check_base_vseq.sv`,
96+
Some of the most commonly used tasks / functions are as follows: From `hw/top_${topname}/ip_autogen/${module_instance_name}/dv/env/seq/${module_instance_name}_base_vseq.sv`,
9797
* task 1:
9898
* task 2:
9999

@@ -111,7 +111,7 @@ It creates the following analysis ports to retrieve the data monitored by corres
111111
<!-- explain inputs monitored, flow of data and outputs checked -->
112112

113113
${"####"} Assertions
114-
* TLUL assertions: The `hw/top_${topname}/ip_autogen/ac_range_check/dv/sva/ac_range_check_bind.sv` binds the `tlul_assert` [assertions](../../../../ip/tlul/doc/TlulProtocolChecker.md) to the IP to ensure TileLink interface protocol compliance.
114+
* TLUL assertions: The `hw/top_${topname}/ip_autogen/${module_instance_name}/dv/sva/${module_instance_name}_bind.sv` binds the `tlul_assert` [assertions](../../../../ip/tlul/doc/TlulProtocolChecker.md) to the IP to ensure TileLink interface protocol compliance.
115115
* Unknown checks on DUT outputs: The RTL has assertions to ensure all outputs are initialized to known values after coming out of reset.
116116
* assert prop 1:
117117
* assert prop 2:
@@ -122,7 +122,7 @@ Please take a look at the link for detailed information on the usage, capabiliti
122122
Here's how to run a smoke test:
123123
```console
124124
$ cd $REPO_TOP
125-
$ ./util/dvsim/dvsim.py hw/top_${topname}/ip_autogen/ac_range_check/dv/ac_range_check_sim_cfg.hjson -i ac_range_check_smoke
125+
$ ./util/dvsim/dvsim.py hw/top_${topname}/ip_autogen/${module_instance_name}/dv/${module_instance_name}_sim_cfg.hjson -i ac_range_check_smoke
126126
```
127127

128128
${"##"} Testplan

hw/ip_templates/ac_range_check/dv/ac_range_check_sim.core.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ CAPI=2:
33
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
44
# SPDX-License-Identifier: Apache-2.0
55
name: ${instance_vlnv(f"lowrisc:dv:{module_instance_name}_sim:0.1")}
6-
description: "AC_RANGE_CHECK DV sim target"
6+
description: "${module_instance_name.upper()} DV sim target"
77
filesets:
88
files_rtl:
99
depend:
@@ -13,8 +13,8 @@ filesets:
1313

1414
files_dv:
1515
depend:
16-
- ${instance_vlnv("lowrisc:dv:ac_range_check_test")}
17-
- ${instance_vlnv("lowrisc:dv:ac_range_check_sva")}
16+
- ${instance_vlnv(f"lowrisc:dv:{module_instance_name}_test")}
17+
- ${instance_vlnv(f"lowrisc:dv:{module_instance_name}_sva")}
1818
files:
1919
- tb/tb.sv
2020
file_type: systemVerilogSource

hw/ip_templates/ac_range_check/dv/ac_range_check_sim_cfg.hjson.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
tool: xcelium
1616

1717
// Fusesoc core file used for building the file list.
18-
fusesoc_core: ${instance_vlnv("lowrisc:dv:ac_range_check_sim:0.1")}
18+
fusesoc_core: ${instance_vlnv(f"lowrisc:dv:{module_instance_name}_sim:0.1")}
1919

2020
// Testplan hjson file.
2121
testplan: "{self_dir}/../data/${module_instance_name}_testplan.hjson"
@@ -33,7 +33,7 @@
3333
"{proj_root}/hw/dv/tools/dvsim/tests/stress_tests.hjson"]
3434

3535
// Add additional tops for simulation.
36-
sim_tops: ["ac_range_check_bind"]
36+
sim_tops: ["${module_instance_name}_bind"]
3737

3838
// Default iterations for all tests - each test entry can override this.
3939
reseed: 50

hw/ip_templates/ac_range_check/dv/env/ac_range_check_env.core.tpl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ CAPI=2:
22
# Copyright lowRISC contributors (OpenTitan project).
33
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
44
# SPDX-License-Identifier: Apache-2.0
5-
name: ${instance_vlnv("lowrisc:dv:ac_range_check_env:0.1")}
6-
description: "AC_RANGE_CHECK DV UVM environment"
5+
name: ${instance_vlnv(f"lowrisc:dv:{module_instance_name}_env:0.1")}
6+
description: "${module_instance_name.upper()} DV UVM environment"
77
filesets:
88
files_dv:
99
depend:
@@ -12,24 +12,24 @@ filesets:
1212
- lowrisc:dv:dv_base_reg
1313
- lowrisc:dv:dv_lib
1414
files:
15-
- ac_range_check_env_pkg.sv
15+
- ${module_instance_name}_env_pkg.sv
1616
- ac_range_check_dut_cfg.sv: {is_include_file: true}
17-
- ac_range_check_env_cfg.sv: {is_include_file: true}
18-
- ac_range_check_env_cov.sv: {is_include_file: true}
19-
- ac_range_check_virtual_sequencer.sv: {is_include_file: true}
20-
- ac_range_check_scoreboard.sv: {is_include_file: true}
21-
- ac_range_check_env.sv: {is_include_file: true}
22-
- seq_lib/ac_range_check_vseq_list.sv: {is_include_file: true}
23-
- seq_lib/ac_range_check_base_vseq.sv: {is_include_file: true}
24-
- seq_lib/ac_range_check_common_vseq.sv: {is_include_file: true}
25-
- seq_lib/ac_range_check_smoke_vseq.sv: {is_include_file: true}
17+
- ${module_instance_name}_env_cfg.sv: {is_include_file: true}
18+
- ${module_instance_name}_env_cov.sv: {is_include_file: true}
19+
- ${module_instance_name}_virtual_sequencer.sv: {is_include_file: true}
20+
- ${module_instance_name}_scoreboard.sv: {is_include_file: true}
21+
- ${module_instance_name}_env.sv: {is_include_file: true}
22+
- seq_lib/${module_instance_name}_vseq_list.sv: {is_include_file: true}
23+
- seq_lib/${module_instance_name}_base_vseq.sv: {is_include_file: true}
24+
- seq_lib/${module_instance_name}_common_vseq.sv: {is_include_file: true}
25+
- seq_lib/${module_instance_name}_smoke_vseq.sv: {is_include_file: true}
2626
file_type: systemVerilogSource
2727

2828
generate:
2929
ral:
3030
generator: ralgen
3131
parameters:
32-
name: ac_range_check
32+
name: ${module_instance_name}
3333
ip_hjson: ../../data/${module_instance_name}.hjson
3434

3535
targets:

hw/ip_templates/ac_range_check/dv/env/ac_range_check_env.sv renamed to hw/ip_templates/ac_range_check/dv/env/ac_range_check_env.sv.tpl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
33
// SPDX-License-Identifier: Apache-2.0
44

5-
class ac_range_check_env extends cip_base_env #(
6-
.CFG_T (ac_range_check_env_cfg),
7-
.COV_T (ac_range_check_env_cov),
8-
.VIRTUAL_SEQUENCER_T(ac_range_check_virtual_sequencer),
9-
.SCOREBOARD_T (ac_range_check_scoreboard)
5+
class ${module_instance_name}_env extends cip_base_env #(
6+
.CFG_T (${module_instance_name}_env_cfg),
7+
.COV_T (${module_instance_name}_env_cov),
8+
.VIRTUAL_SEQUENCER_T(${module_instance_name}_virtual_sequencer),
9+
.SCOREBOARD_T (${module_instance_name}_scoreboard)
1010
);
11-
`uvm_component_utils(ac_range_check_env)
11+
`uvm_component_utils(${module_instance_name}_env)
1212

1313
tl_agent tl_unfilt_agt;
1414
tl_agent tl_filt_agt;
@@ -17,14 +17,14 @@ class ac_range_check_env extends cip_base_env #(
1717
extern function new(string name="", uvm_component parent=null);
1818
extern function void build_phase(uvm_phase phase);
1919
extern function void connect_phase(uvm_phase phase);
20-
endclass : ac_range_check_env
20+
endclass : ${module_instance_name}_env
2121

2222

23-
function ac_range_check_env::new(string name="", uvm_component parent=null);
23+
function ${module_instance_name}_env::new(string name="", uvm_component parent=null);
2424
super.new(name, parent);
2525
endfunction : new
2626

27-
function void ac_range_check_env::build_phase(uvm_phase phase);
27+
function void ${module_instance_name}_env::build_phase(uvm_phase phase);
2828
super.build_phase(phase);
2929

3030
// Create Unfiltered TL agent
@@ -38,7 +38,7 @@ function void ac_range_check_env::build_phase(uvm_phase phase);
3838
cfg.tl_filt_agt_cfg.en_cov = cfg.en_cov;
3939
endfunction : build_phase
4040

41-
function void ac_range_check_env::connect_phase(uvm_phase phase);
41+
function void ${module_instance_name}_env::connect_phase(uvm_phase phase);
4242
super.connect_phase(phase);
4343
if (cfg.en_scb) begin
4444
tl_unfilt_agt.monitor.a_chan_port.connect(scoreboard.tl_unfilt_a_chan_fifo.analysis_export);

hw/ip_templates/ac_range_check/dv/env/ac_range_check_env_cfg.sv renamed to hw/ip_templates/ac_range_check/dv/env/ac_range_check_env_cfg.sv.tpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
33
// SPDX-License-Identifier: Apache-2.0
44

5-
class ac_range_check_env_cfg extends cip_base_env_cfg #(.RAL_T(ac_range_check_reg_block));
5+
class ${module_instance_name}_env_cfg extends cip_base_env_cfg #(.RAL_T(${module_instance_name}_reg_block));
66

77
// External component config objects
88
rand tl_agent_cfg tl_unfilt_agt_cfg;
99
rand tl_agent_cfg tl_filt_agt_cfg;
1010

11-
`uvm_object_utils_begin(ac_range_check_env_cfg)
11+
`uvm_object_utils_begin(${module_instance_name}_env_cfg)
1212
`uvm_field_object(tl_unfilt_agt_cfg, UVM_DEFAULT)
1313
`uvm_field_object(tl_filt_agt_cfg, UVM_DEFAULT)
1414
`uvm_object_utils_end
@@ -18,15 +18,15 @@ class ac_range_check_env_cfg extends cip_base_env_cfg #(.RAL_T(ac_range_check_re
1818

1919
// Class specific methods
2020
extern function void initialize(bit [31:0] csr_base_addr = '1);
21-
endclass : ac_range_check_env_cfg
21+
endclass : ${module_instance_name}_env_cfg
2222

2323

24-
function ac_range_check_env_cfg::new(string name="");
24+
function ${module_instance_name}_env_cfg::new(string name="");
2525
super.new(name);
2626
endfunction : new
2727

28-
function void ac_range_check_env_cfg::initialize(bit [31:0] csr_base_addr = '1);
29-
list_of_alerts = ac_range_check_env_pkg::LIST_OF_ALERTS;
28+
function void ${module_instance_name}_env_cfg::initialize(bit [31:0] csr_base_addr = '1);
29+
list_of_alerts = ${module_instance_name}_env_pkg::LIST_OF_ALERTS;
3030
super.initialize(csr_base_addr);
3131

3232
// Set shadow register error status

hw/ip_templates/ac_range_check/dv/env/ac_range_check_env_cov.sv renamed to hw/ip_templates/ac_range_check/dv/env/ac_range_check_env_cov.sv.tpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@
88
* Covergroups may also be wrapped inside helper classes if needed.
99
*/
1010

11-
class ac_range_check_env_cov extends cip_base_env_cov #(.CFG_T(ac_range_check_env_cfg));
12-
`uvm_component_utils(ac_range_check_env_cov)
11+
class ${module_instance_name}_env_cov extends cip_base_env_cov #(.CFG_T(${module_instance_name}_env_cfg));
12+
`uvm_component_utils(${module_instance_name}_env_cov)
1313

1414
// The base class provides the following handles for use:
15-
// ac_range_check_env_cfg: cfg
15+
// ${module_instance_name}_env_cfg: cfg
1616

1717
// Covergroups
1818
// TODO MVy [add covergroups here]
1919

2020
// Standard SV/UVM methods
2121
extern function new(string name, uvm_component parent);
2222
extern function void build_phase(uvm_phase phase);
23-
endclass : ac_range_check_env_cov
23+
endclass : ${module_instance_name}_env_cov
2424

2525

26-
function ac_range_check_env_cov::new(string name, uvm_component parent);
26+
function ${module_instance_name}_env_cov::new(string name, uvm_component parent);
2727
super.new(name, parent);
2828
// TODO MVy [instantiate covergroups here]
2929
endfunction : new
3030

31-
function void ac_range_check_env_cov::build_phase(uvm_phase phase);
31+
function void ${module_instance_name}_env_cov::build_phase(uvm_phase phase);
3232
super.build_phase(phase);
3333
// TODO MVy [or instantiate covergroups here]
3434
// Please instantiate sticky_intr_cov array of objects for all interrupts that are sticky

hw/ip_templates/ac_range_check/dv/env/ac_range_check_env_pkg.sv.tpl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
33
// SPDX-License-Identifier: Apache-2.0
44

5-
package ac_range_check_env_pkg;
5+
package ${module_instance_name}_env_pkg;
66
// Dep packages
77
import uvm_pkg::*;
88
import top_pkg::*;
@@ -12,7 +12,7 @@ package ac_range_check_env_pkg;
1212
import cip_base_pkg::*;
1313
import dv_base_reg_pkg::*;
1414
import csr_utils_pkg::*;
15-
import ac_range_check_ral_pkg::*;
15+
import ${module_instance_name}_ral_pkg::*;
1616

1717
// Macro includes
1818
`include "uvm_macros.svh"
@@ -81,10 +81,10 @@ package ac_range_check_env_pkg;
8181

8282
// Package sources
8383
`include "ac_range_check_dut_cfg.sv"
84-
`include "ac_range_check_env_cfg.sv"
85-
`include "ac_range_check_env_cov.sv"
86-
`include "ac_range_check_virtual_sequencer.sv"
87-
`include "ac_range_check_scoreboard.sv"
88-
`include "ac_range_check_env.sv"
89-
`include "ac_range_check_vseq_list.sv"
90-
endpackage : ac_range_check_env_pkg
84+
`include "${module_instance_name}_env_cfg.sv"
85+
`include "${module_instance_name}_env_cov.sv"
86+
`include "${module_instance_name}_virtual_sequencer.sv"
87+
`include "${module_instance_name}_scoreboard.sv"
88+
`include "${module_instance_name}_env.sv"
89+
`include "${module_instance_name}_vseq_list.sv"
90+
endpackage : ${module_instance_name}_env_pkg

0 commit comments

Comments
 (0)