soc/integration/builder: avoid try/except on LiteDRAM import, just check if SoC has...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 31 Dec 2019 08:58:26 +0000 (09:58 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 31 Dec 2019 08:58:26 +0000 (09:58 +0100)
litex/soc/integration/builder.py

index 665528a80ecd4d6db33b46bb7219e463819bad65..49951d986bd8f69e685336877d6f6774c8c6c061 100644 (file)
@@ -16,15 +16,6 @@ import shutil
 from litex.build.tools import write_to_file
 from litex.soc.integration import cpu_interface, soc_core
 
-try:
-    from litex.soc.integration import soc_sdram
-    from litedram.init import get_sdram_phy_c_header
-except ImportError:
-    class soc_sdram:
-        class SoCSDRAM:
-            pass
-
-
 __all__ = ["soc_software_packages", "soc_directory",
            "Builder", "builder_args", "builder_argdict"]
 
@@ -127,13 +118,12 @@ class Builder:
             cpu_interface.get_git_header()
         )
 
-        if isinstance(self.soc, soc_sdram.SoCSDRAM):
-            if hasattr(self.soc, "sdram"):
-                write_to_file(
-                    os.path.join(generated_dir, "sdram_phy.h"),
-                    get_sdram_phy_c_header(
-                        self.soc.sdram.controller.settings.phy,
-                        self.soc.sdram.controller.settings.timing))
+        if hasattr(self.soc, "sdram"):
+            from litedram.init import get_sdram_phy_c_header
+            write_to_file(os.path.join(generated_dir, "sdram_phy.h"),
+                get_sdram_phy_c_header(
+                    self.soc.sdram.controller.settings.phy,
+                    self.soc.sdram.controller.settings.timing))
 
     def _generate_csr_map(self, csr_json=None, csr_csv=None):
         if csr_json is not None: