Skip to content

Commit

Permalink
[util/topgen/templates] Wrap RACL policy arrays
Browse files Browse the repository at this point in the history
Signed-off-by: Pirmin Vogel <[email protected]>
  • Loading branch information
vogelpi authored and Razer6 committed Feb 3, 2025
1 parent 5de8e0e commit 67fe8e5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
32 changes: 24 additions & 8 deletions hw/top_darjeeling/rtl/autogen/top_racl_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ package top_racl_pkg;
* WDATA: ALL_RD_WR (Idx 0)
* RDATA: ALL_RD_WR (Idx 0)
*/
parameter int unsigned RACL_POLICY_SEL_MBX0_SOC [4] = '{0, 0, 0, 0};
parameter int unsigned RACL_POLICY_SEL_MBX0_SOC [4] = '{
0, 0, 0, 0
};
parameter int unsigned RACL_POLICY_SEL_MBX0_SOC_WIN_WDATA = 0;
parameter int unsigned RACL_POLICY_SEL_MBX0_SOC_WIN_RDATA = 0;

Expand All @@ -170,7 +172,9 @@ package top_racl_pkg;
* WDATA: ALL_RD_WR (Idx 0)
* RDATA: ALL_RD_WR (Idx 0)
*/
parameter int unsigned RACL_POLICY_SEL_MBX1_SOC [4] = '{0, 0, 0, 0};
parameter int unsigned RACL_POLICY_SEL_MBX1_SOC [4] = '{
0, 0, 0, 0
};
parameter int unsigned RACL_POLICY_SEL_MBX1_SOC_WIN_WDATA = 0;
parameter int unsigned RACL_POLICY_SEL_MBX1_SOC_WIN_RDATA = 0;

Expand All @@ -187,7 +191,9 @@ package top_racl_pkg;
* WDATA: ALL_RD_WR (Idx 0)
* RDATA: ALL_RD_WR (Idx 0)
*/
parameter int unsigned RACL_POLICY_SEL_MBX2_SOC [4] = '{0, 0, 0, 0};
parameter int unsigned RACL_POLICY_SEL_MBX2_SOC [4] = '{
0, 0, 0, 0
};
parameter int unsigned RACL_POLICY_SEL_MBX2_SOC_WIN_WDATA = 0;
parameter int unsigned RACL_POLICY_SEL_MBX2_SOC_WIN_RDATA = 0;

Expand All @@ -204,7 +210,9 @@ package top_racl_pkg;
* WDATA: ALL_RD_WR (Idx 0)
* RDATA: ALL_RD_WR (Idx 0)
*/
parameter int unsigned RACL_POLICY_SEL_MBX4_SOC [4] = '{0, 0, 0, 0};
parameter int unsigned RACL_POLICY_SEL_MBX4_SOC [4] = '{
0, 0, 0, 0
};
parameter int unsigned RACL_POLICY_SEL_MBX4_SOC_WIN_WDATA = 0;
parameter int unsigned RACL_POLICY_SEL_MBX4_SOC_WIN_RDATA = 0;

Expand All @@ -221,7 +229,9 @@ package top_racl_pkg;
* WDATA: ALL_RD_WR (Idx 0)
* RDATA: ALL_RD_WR (Idx 0)
*/
parameter int unsigned RACL_POLICY_SEL_MBX5_SOC [4] = '{0, 0, 0, 0};
parameter int unsigned RACL_POLICY_SEL_MBX5_SOC [4] = '{
0, 0, 0, 0
};
parameter int unsigned RACL_POLICY_SEL_MBX5_SOC_WIN_WDATA = 0;
parameter int unsigned RACL_POLICY_SEL_MBX5_SOC_WIN_RDATA = 0;

Expand All @@ -238,7 +248,9 @@ package top_racl_pkg;
* WDATA: ALL_RD_WR (Idx 0)
* RDATA: ALL_RD_WR (Idx 0)
*/
parameter int unsigned RACL_POLICY_SEL_MBX_JTAG_SOC [4] = '{0, 0, 0, 0};
parameter int unsigned RACL_POLICY_SEL_MBX_JTAG_SOC [4] = '{
0, 0, 0, 0
};
parameter int unsigned RACL_POLICY_SEL_MBX_JTAG_SOC_WIN_WDATA = 0;
parameter int unsigned RACL_POLICY_SEL_MBX_JTAG_SOC_WIN_RDATA = 0;

Expand All @@ -255,7 +267,9 @@ package top_racl_pkg;
* WDATA: SOC_ROT (Idx 2)
* RDATA: SOC_ROT (Idx 2)
*/
parameter int unsigned RACL_POLICY_SEL_MBX_PCIE0_SOC [4] = '{2, 2, 2, 2};
parameter int unsigned RACL_POLICY_SEL_MBX_PCIE0_SOC [4] = '{
2, 2, 2, 2
};
parameter int unsigned RACL_POLICY_SEL_MBX_PCIE0_SOC_WIN_WDATA = 2;
parameter int unsigned RACL_POLICY_SEL_MBX_PCIE0_SOC_WIN_RDATA = 2;

Expand All @@ -272,7 +286,9 @@ package top_racl_pkg;
* WDATA: SOC_ROT (Idx 2)
* RDATA: SOC_ROT (Idx 2)
*/
parameter int unsigned RACL_POLICY_SEL_MBX_PCIE1_SOC [4] = '{2, 2, 2, 2};
parameter int unsigned RACL_POLICY_SEL_MBX_PCIE1_SOC [4] = '{
2, 2, 2, 2
};
parameter int unsigned RACL_POLICY_SEL_MBX_PCIE1_SOC_WIN_WDATA = 2;
parameter int unsigned RACL_POLICY_SEL_MBX_PCIE1_SOC_WIN_RDATA = 2;

Expand Down
8 changes: 6 additions & 2 deletions util/topgen/templates/toplevel_racl_pkg.sv.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
${gencmd}
<% import textwrap %>\
<% racl_role_vec_len = 2 ** racl_config['nr_role_bits'] %>\

package top_racl_pkg;
Expand Down Expand Up @@ -164,8 +165,11 @@ package top_racl_pkg;
% endif
*/
<% policy_sel_name = f"RACL_POLICY_SEL_{m['name'].upper()}{group_suffix}{if_suffix}" %>\
<% policy_sel_value = "'{" + ", ".join(map(str, reversed(register_mapping.values()))) + "};" %>\
parameter int unsigned ${policy_sel_name} [${len(register_mapping)}] = ${policy_sel_value}
<% policy_sel_value = ", ".join(map(str, reversed(register_mapping.values())))%>\
<% policy_sel_value = "\n ".join(textwrap.wrap(policy_sel_value, 94))%>\
parameter int unsigned ${policy_sel_name} [${len(register_mapping)}] = '{
${policy_sel_value}
};
% for window_name, policy_idx in window_mapping.items():
parameter int unsigned ${policy_sel_name}_WIN_${window_name.upper()} = ${policy_idx};
% endfor
Expand Down

0 comments on commit 67fe8e5

Please sign in to comment.