Skip to content

Commit

Permalink
lint: Python sources
Browse files Browse the repository at this point in the history
  • Loading branch information
fischeti committed Feb 4, 2025
1 parent ca45762 commit f9fb1c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions util/clustergen.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# Regex to find hex numbers with optional underscores
HEX_PATTERN = re.compile(r"0x[0-9a-fA-F]+(?:_[0-9a-fA-F]+)*")


def preprocess_hex_in_hjson(text):
""" Converts hex numbers (e.g., 0x8000_0000) to decimal before parsing HJSON. """
def hex_to_decimal(match):
Expand Down
6 changes: 4 additions & 2 deletions util/clustergen/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ def gen_pma_cfg(self):
pma_cfg = PMACfg()
for region in self.cfg['external_addr_regions']:
if region["cacheable"]:
pma_cfg.add_region_length(PMA.CACHED, region['address'], region['length'], self.cfg['cluster']['addr_width'])
pma_cfg.add_region_length(PMA.CACHED, region['address'], region['length'],
self.cfg['cluster']['addr_width'])
# Populate the list of cached regions
self.cfg['pmas'] = dict()
self.cfg['pmas']['cached'] = list()
Expand Down Expand Up @@ -295,7 +296,8 @@ def gen_mask(c, s):
if ssr['pointer_width'] is None:
ssr['pointer_width'] = 10 + clog2(self.cfg['cluster']['tcdm']['size'])
if ssr['index_width'] is None:
ssr['index_width'] = ssr['pointer_width'] - clog2(self.cfg['cluster']['data_width']/8)
ssr['index_width'] = ssr['pointer_width']
- clog2(self.cfg['cluster']['data_width']/8)
# Sort SSRs by register indices (required by decoding logic)
core['ssrs'].sort(key=lambda x: x['reg_idx'])
# Minimum 1 element to avoid illegal ranges (Xssr prevents generation)
Expand Down

0 comments on commit f9fb1c7

Please sign in to comment.