Skip to content

Commit eea55ea

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

21 files changed

+148
-148
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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_dut_cfg.sv renamed to hw/ip_templates/ac_range_check/dv/env/ac_range_check_dut_cfg.sv.tpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// repeating the variable declaration multiple times. On the other hand, their constraints must not
77
// be contained in this file, but directly in the files where they are needed as this may lead to
88
// some conflicts.
9-
class ac_range_check_dut_cfg extends uvm_object;
9+
class ${module_instance_name}_dut_cfg extends uvm_object;
1010
rand tl_main_vars_t tl_main_vars;
1111
rand bit [TL_DW-1:0] range_base[NUM_RANGES]; // Granularity is 32-bit words, 2-LSBs are ignored
1212
rand bit [TL_DW-1:0] range_limit[NUM_RANGES]; // Granularity is 32-bit words, 2-LSBs are ignored
@@ -19,25 +19,25 @@ class ac_range_check_dut_cfg extends uvm_object;
1919
extern function void do_print(uvm_printer printer);
2020

2121
// UVM Factory Registration Macro
22-
`uvm_object_utils_begin (ac_range_check_dut_cfg)
22+
`uvm_object_utils_begin (${module_instance_name}_dut_cfg)
2323
`uvm_field_sarray_int(range_base, UVM_DEFAULT)
2424
`uvm_field_sarray_int(range_limit, UVM_DEFAULT)
2525
`uvm_object_utils_end
26-
endclass : ac_range_check_dut_cfg
26+
endclass : ${module_instance_name}_dut_cfg
2727

2828

29-
function ac_range_check_dut_cfg::new(string name="");
29+
function ${module_instance_name}_dut_cfg::new(string name="");
3030
super.new(name);
3131
endfunction : new
3232

33-
function void ac_range_check_dut_cfg::post_randomize();
33+
function void ${module_instance_name}_dut_cfg::post_randomize();
3434
if (uvm_top.get_report_verbosity_level() >= UVM_HIGH) begin
3535
this.print();
3636
end
3737
endfunction : post_randomize
3838

3939
// Some types are unsupported by the macros and have to be implemented manually
40-
function void ac_range_check_dut_cfg::do_print(uvm_printer printer);
40+
function void ${module_instance_name}_dut_cfg::do_print(uvm_printer printer);
4141
`uvm_info(this.get_name(), "do_print function has been called", UVM_DEBUG);
4242
super.do_print(printer);
4343

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,7 +2,7 @@ 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")}
5+
name: ${instance_vlnv(f"lowrisc:dv:{module_instance_name}_env:0.1")}
66
description: "AC_RANGE_CHECK DV UVM environment"
77
filesets:
88
files_dv:
@@ -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
16-
- 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}
15+
- ${module_instance_name}_env_pkg.sv
16+
- ${module_instance_name}_dut_cfg.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: 8 additions & 8 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),
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),
88
.VIRTUAL_SEQUENCER_T(ac_range_check_virtual_sequencer),
99
.SCOREBOARD_T (ac_range_check_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: 10 additions & 10 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"
@@ -80,11 +80,11 @@ package ac_range_check_env_pkg;
8080
endfunction : get_csr_idx
8181

8282
// Package sources
83-
`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
83+
`include "${module_instance_name}_dut_cfg.sv"
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)