From 4f935714de39d65d586b8b01efae322b04bd3db1 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 4 Mar 2020 16:27:11 +0100 Subject: [PATCH] soc/doc: remove soc.get_csr_regions support. Now that SoC documentation is integrated in LiteX, this is no longer needed. --- litex/soc/doc/__init__.py | 24 ++++++++---------------- litex/soc/doc/csr.py | 7 +++++-- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/litex/soc/doc/__init__.py b/litex/soc/doc/__init__.py index 2a1274bfa..09949544f 100644 --- a/litex/soc/doc/__init__.py +++ b/litex/soc/doc/__init__.py @@ -80,26 +80,18 @@ def generate_docs(soc, base_dir, project_name="LiteX SoC Project", # DocumentedCSRs. documented_regions = [] seen_modules = set() - regions = [] - - # Previously, litex contained a function to gather csr regions. - if hasattr(soc, "get_csr_regions"): - regions = soc.get_csr_regions() - else: - # Now we just access the regions directly. - for region_name, region in soc.csr_regions.items(): - regions.append((region_name, region.origin, - region.busword, region.obj)) - - for csr_region in regions: + for name, region in soc.csr.regions.items(): module = None - if hasattr(soc, csr_region[0]): - module = getattr(soc, csr_region[0]) + if hasattr(soc, name): + module = getattr(soc, name) seen_modules.add(module) submodules = gather_submodules(module) - documented_region = DocumentedCSRRegion( - csr_region, module, submodules, csr_data_width=soc.csr_data_width) + name = name, + region = region, + module = module, + submodules = submodules, + csr_data_width = soc.csr.data_width) if documented_region.name in interrupts: documented_region.document_interrupt( soc, submodules, interrupts[documented_region.name]) diff --git a/litex/soc/doc/csr.py b/litex/soc/doc/csr.py index 7ef618871..ffaecda5a 100644 --- a/litex/soc/doc/csr.py +++ b/litex/soc/doc/csr.py @@ -51,8 +51,11 @@ class DocumentedCSR: f.description = self.trim(f.description) class DocumentedCSRRegion: - def __init__(self, csr_region, module=None, submodules=[], csr_data_width=8): - (self.name, self.origin, self.busword, self.raw_csrs) = csr_region + def __init__(self, name, region, module=None, submodules=[], csr_data_width=8): + self.name = name + self.origin = region.origin + self.busword = region.busword + self.raw_csrs = region.obj self.current_address = self.origin self.sections = [] self.csrs = []