Bobby Bruce has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/69198?usp=email )

Change subject: stdlib,configs: Only import DRAMSys components if compiled
......................................................................

stdlib,configs: Only import DRAMSys components if compiled

DRAMSys is an optional add-on for gem5. The dramsys memory components
are therefore only functional when DRAMSys is properly incorporated.
This patch adds the necessary compilation guards.

The doc-strings in the example scripts are updated to make this clear.

Change-Id: I5649010943d9c1115676ae310af78f16104f56ca
---
M configs/example/gem5_library/dramsys/arm-hello-dramsys.py
M configs/example/gem5_library/dramsys/dramsys-traffic.py
M src/python/SConscript
M src/python/gem5/components/memory/__init__.py
4 files changed, 24 insertions(+), 6 deletions(-)



diff --git a/configs/example/gem5_library/dramsys/arm-hello-dramsys.py b/configs/example/gem5_library/dramsys/arm-hello-dramsys.py
index f8f2498..62a55e3 100644
--- a/configs/example/gem5_library/dramsys/arm-hello-dramsys.py
+++ b/configs/example/gem5_library/dramsys/arm-hello-dramsys.py
@@ -27,6 +27,10 @@
 """
 This gem5 configuation script creates a simple board to run an ARM
 "hello world" binary using the DRAMSys simulator.
+
+**Important Note**: DRAMSys must be compiled into the gem5 binary to use the
+DRRAMSys simulator. Please consult 'ext/dramsys/README' on how to compile
+correctly. If this is not done correctly this script will run with error.
 """

 from gem5.isas import ISA
diff --git a/configs/example/gem5_library/dramsys/dramsys-traffic.py b/configs/example/gem5_library/dramsys/dramsys-traffic.py
index 70d4cb4..ee9ad72 100644
--- a/configs/example/gem5_library/dramsys/dramsys-traffic.py
+++ b/configs/example/gem5_library/dramsys/dramsys-traffic.py
@@ -26,6 +26,10 @@
 """
 This script is used for running a traffic generator connected to the
 DRAMSys simulator.
+
+**Important Note**: DRAMSys must be compiled into the gem5 binary to use the
+DRRAMSys simulator. Please consult 'ext/dramsys/README' on how to compile
+correctly. If this is not done correctly this script will run with error.
 """
 import m5
 from gem5.components.memory import DRAMSysMem
diff --git a/src/python/SConscript b/src/python/SConscript
index a1b5818..3b00b34 100644
--- a/src/python/SConscript
+++ b/src/python/SConscript
@@ -170,7 +170,10 @@
 PySource('gem5.components.memory', 'gem5/components/memory/__init__.py')
PySource('gem5.components.memory', 'gem5/components/memory/abstract_memory_system.py')
 PySource('gem5.components.memory', 'gem5/components/memory/dramsim_3.py')
-PySource('gem5.components.memory', 'gem5/components/memory/dramsys.py')
+
+if env['HAVE_DRAMSYS']:
+    PySource('gem5.components.memory', 'gem5/components/memory/dramsys.py')
+
 PySource('gem5.components.memory', 'gem5/components/memory/simple.py')
 PySource('gem5.components.memory', 'gem5/components/memory/memory.py')
PySource('gem5.components.memory', 'gem5/components/memory/single_channel.py') diff --git a/src/python/gem5/components/memory/__init__.py b/src/python/gem5/components/memory/__init__.py
index 1c94a2c..9f13157 100644
--- a/src/python/gem5/components/memory/__init__.py
+++ b/src/python/gem5/components/memory/__init__.py
@@ -34,8 +34,15 @@
 from .multi_channel import DualChannelDDR4_2400
 from .multi_channel import DualChannelLPDDR3_1600
 from .hbm import HBM2Stack
-from .dramsys import DRAMSysMem
-from .dramsys import DRAMSys_DDR4_1866
-from .dramsys import DRAMSys_DDR3_1600
-from .dramsys import DRAMSys_LPDDR4_3200
-from .dramsys import DRAMSys_HBM2
+
+try:
+    from .dramsys import DRAMSysMem
+    from .dramsys import DRAMSys_DDR4_1866
+    from .dramsys import DRAMSys_DDR3_1600
+    from .dramsys import DRAMSys_LPDDR4_3200
+    from .dramsys import DRAMSys_HBM2
+except:
+ # In the case that DRAMSys is not compiled into the gem5 binary, importing + # DRAMSys components will fail. This try-exception statement is needed to
+    # ignore these imports in this case.
+    pass

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/69198?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I5649010943d9c1115676ae310af78f16104f56ca
Gerrit-Change-Number: 69198
Gerrit-PatchSet: 1
Gerrit-Owner: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to