Skip to content

Commit 0ca3b9f

Browse files
Razer6rswarbrick
authored andcommitted
[topgen] All RACL configs are relative to the top HJSON
Signed-off-by: Robert Schilling <[email protected]>
1 parent c7d7697 commit 0ca3b9f

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

hw/top_darjeeling/data/autogen/top_darjeeling.gen.hjson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
type: top
1414
rnd_cnst_seed: 1017106219537032642877583828875051302543807092889754935647094601236425074047
1515
datawidth: "32"
16-
racl_config: top_darjeeling/data/racl/racl.hjson
16+
racl_config: racl/racl.hjson
1717
power:
1818
{
1919
domains:

hw/top_darjeeling/data/top_darjeeling.hjson

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
datawidth: "32",
1717

1818
// Enable RACL on Darjeeling based on the following configuration
19-
racl_config: 'top_darjeeling/data/racl/racl.hjson'
19+
racl_config: 'racl/racl.hjson'
2020

2121
// Power information for the design
2222
power: {
@@ -901,7 +901,7 @@
901901
soc: {soc_mbx: "0x01465000"},
902902
},
903903
racl_mappings: {
904-
soc: 'top_darjeeling/data/racl/all_rd_wr_mapping.hjson'
904+
soc: 'racl/all_rd_wr_mapping.hjson'
905905
}
906906
},
907907
{ name: "mbx1",
@@ -914,7 +914,7 @@
914914
soc: {soc_mbx: "0x01465100"},
915915
},
916916
racl_mappings: {
917-
soc: 'top_darjeeling/data/racl/all_rd_wr_mapping.hjson'
917+
soc: 'racl/all_rd_wr_mapping.hjson'
918918
}
919919
},
920920
{ name: "mbx2",
@@ -927,7 +927,7 @@
927927
soc: {soc_mbx: "0x01465200"},
928928
},
929929
racl_mappings: {
930-
soc: 'top_darjeeling/data/racl/all_rd_wr_mapping.hjson'
930+
soc: 'racl/all_rd_wr_mapping.hjson'
931931
}
932932
},
933933
{ name: "mbx3",
@@ -950,7 +950,7 @@
950950
soc: {soc_mbx: "0x01465400"},
951951
},
952952
racl_mappings: {
953-
soc: 'top_darjeeling/data/racl/all_rd_wr_mapping.hjson'
953+
soc: 'racl/all_rd_wr_mapping.hjson'
954954
}
955955
},
956956
{ name: "mbx5",
@@ -963,7 +963,7 @@
963963
soc: {soc_mbx: "0x01465500"},
964964
},
965965
racl_mappings: {
966-
soc: 'top_darjeeling/data/racl/all_rd_wr_mapping.hjson'
966+
soc: 'racl/all_rd_wr_mapping.hjson'
967967
}
968968
},
969969
{ name: "mbx6",
@@ -986,7 +986,7 @@
986986
soc: {soc_dbg: "0x1000"},
987987
},
988988
racl_mappings: {
989-
soc: 'top_darjeeling/data/racl/all_rd_wr_mapping.hjson'
989+
soc: 'racl/all_rd_wr_mapping.hjson'
990990
}
991991
},
992992
{ name: "mbx_pcie0",
@@ -999,7 +999,7 @@
999999
soc: {soc_mbx: "0x01460100"},
10001000
},
10011001
racl_mappings: {
1002-
soc: 'top_darjeeling/data/racl/soc_rot_mapping.hjson'
1002+
soc: 'racl/soc_rot_mapping.hjson'
10031003
}
10041004
},
10051005
{ name: "mbx_pcie1",
@@ -1012,7 +1012,7 @@
10121012
soc: {soc_mbx: "0x01460200"},
10131013
},
10141014
racl_mappings: {
1015-
soc: 'top_darjeeling/data/racl/soc_rot_mapping.hjson'
1015+
soc: 'racl/soc_rot_mapping.hjson'
10161016
}
10171017
},
10181018
{ name: "soc_dbg_ctrl",
@@ -1049,7 +1049,7 @@
10491049
num_ranges: 32
10501050
}
10511051
attr: "ipgen",
1052-
racl_mapping: 'top_darjeeling/data/racl/soc_rot_mapping.hjson'
1052+
racl_mapping: 'racl/soc_rot_mapping.hjson'
10531053
},
10541054
{ name: "rv_core_ibex",
10551055
type: "rv_core_ibex",

util/topgen.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,8 +1530,13 @@ def main():
15301530
log.info("Generation pass {}".format(pass_idx + 1))
15311531
# Use the same seed for each pass to have stable random constants.
15321532
secure_prng.reseed(topcfg["rnd_cnst_seed"])
1533+
# Insert the config file path of the HJSON to allow parsing files relative
1534+
# the config directory
1535+
cfg_copy["cfg_path"] = Path(args.topcfg).parent
15331536
completecfg, name_to_block, name_to_hjson = _process_top(
15341537
cfg_copy, args, cfg_path, out_path_gen, alias_cfgs)
1538+
# Delete config path before dumping, not needed
1539+
del completecfg["cfg_path"]
15351540
dump_path = Path(f"/tmp/top{topname}cfg_{pass_idx}.hjson")
15361541
_dump_cfg(dump_path, completecfg)
15371542
if pass_idx > 0 and filecmp.cmp(

util/topgen/merge.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ def amend_racl(top_cfg: OrderedDict,
14501450
return
14511451

14521452
# Read the top-level RACL information
1453-
top_cfg['racl'] = parse_racl_config(top_cfg['racl_config'])
1453+
top_cfg["racl"] = parse_racl_config(top_cfg["cfg_path"] / top_cfg["racl_config"])
14541454

14551455
# Generate the RACL mappings for all subscribing IPs
14561456
for m in top_cfg['module']:
@@ -1467,8 +1467,8 @@ def amend_racl(top_cfg: OrderedDict,
14671467
# once and need no further updates.
14681468
continue
14691469
parsed_register_mapping, parsed_window_mapping, racl_group, _ = (
1470-
parse_racl_mapping(top_cfg['racl'], mapping_path, if_name,
1471-
block))
1470+
parse_racl_mapping(top_cfg["racl"], top_cfg["cfg_path"] / mapping_path,
1471+
if_name, block))
14721472
m['racl_mappings'][if_name] = {
14731473
'racl_group': racl_group,
14741474
'register_mapping': parsed_register_mapping,

util/topgen/validate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
'l',
8686
'list of wakeup requests each holding name, width, and module'
8787
],
88+
'cfg_path': ['s', 'Path to the folder of the toplevel HJSON file']
8889
}
8990

9091
pinmux_required = {

0 commit comments

Comments
 (0)