Skip to content

Commit

Permalink
[topgen] Assign incmomg LPGs to the internal LPG vectors
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Schilling <[email protected]>
  • Loading branch information
Razer6 authored and vogelpi committed Jan 10, 2025
1 parent 56024b2 commit 00318d0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
9 changes: 8 additions & 1 deletion hw/top_darjeeling/templates/toplevel.sv.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import topgen.lib as lib
from reggen.params import Parameter
from topgen.clocks import Clocks
from topgen.resets import Resets
from topgen.merge import is_unmanaged_reset
from topgen.merge import is_unmanaged_reset, get_alerts_with_unique_lpg_idx

num_mio_inputs = top['pinmux']['io_counts']['muxed']['inouts'] + \
top['pinmux']['io_counts']['muxed']['inputs']
Expand Down Expand Up @@ -421,6 +421,13 @@ for rst in output_rsts:
assign lpg_cg_en[${k}] = ${cg_en};
assign lpg_rst_en[${k}] = ${rst_en};
% endfor
% for alert_group, alerts in top['incoming_alert'].items():
% for unique_alert_lpg_entry in get_alerts_with_unique_lpg_idx(alerts):
<% k += 1 %>\
assign lpg_cg_en[${k}] = incoming_lpg_cg_en_${alert_group}_i[${unique_alert_lpg_entry["lpg_idx"]}];
assign lpg_rst_en[${k}] = incoming_lpg_rst_en_${alert_group}_i[${unique_alert_lpg_entry["lpg_idx"]}];
% endfor
% endfor

% for alert_group, lpgs in top['outgoing_alert_lpgs'].items():
// Outgoing LPGs for alert group ${alert_group}
Expand Down
9 changes: 8 additions & 1 deletion hw/top_earlgrey/templates/toplevel.sv.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import topgen.lib as lib
from reggen.params import Parameter
from topgen.clocks import Clocks
from topgen.resets import Resets
from topgen.merge import is_unmanaged_reset
from topgen.merge import is_unmanaged_reset, get_alerts_with_unique_lpg_idx

num_mio_inputs = top['pinmux']['io_counts']['muxed']['inouts'] + \
top['pinmux']['io_counts']['muxed']['inputs']
Expand Down Expand Up @@ -440,6 +440,13 @@ for rst in output_rsts:
assign lpg_cg_en[${k}] = ${cg_en};
assign lpg_rst_en[${k}] = ${rst_en};
% endfor
% for alert_group, alerts in top['incoming_alert'].items():
% for unique_alert_lpg_entry in get_alerts_with_unique_lpg_idx(alerts):
<% k += 1 %>\
assign lpg_cg_en[${k}] = incoming_lpg_cg_en_${alert_group}_i[${unique_alert_lpg_entry["lpg_idx"]}];
assign lpg_rst_en[${k}] = incoming_lpg_rst_en_${alert_group}_i[${unique_alert_lpg_entry["lpg_idx"]}];
% endfor
% endfor

% for alert_group, lpgs in top['outgoing_alert_lpgs'].items():
// Outgoing LPGs for alert group ${alert_group}
Expand Down
11 changes: 11 additions & 0 deletions util/topgen/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,17 @@ def amend_resets(top, name_to_block):
top["resets"] = top_resets


def get_alerts_with_unique_lpg_idx(incoming_alerts: List[Dict]):
unique_lpgs = set()
result = []

for alert in incoming_alerts:
if alert['lpg_idx'] not in unique_lpgs:
unique_lpgs.add(alert['lpg_idx'])
result.append(alert)
return result


def create_alert_lpgs(top, name_to_block: Dict[str, IpBlock]):
'''Loop over modules and determine number of unique LPGs'''
lpg_dict = {}
Expand Down

0 comments on commit 00318d0

Please sign in to comment.