Remove classes for read and write ports, add parameter check to gramNativePort
authorJean THOMAS <git0@pub.jeanthomas.me>
Tue, 28 Jul 2020 15:47:49 +0000 (17:47 +0200)
committerJean THOMAS <git0@pub.jeanthomas.me>
Tue, 28 Jul 2020 15:47:49 +0000 (17:47 +0200)
gram/common.py

index fe31422f4e5b476a1541a84b8d4b61d1763c2eb2..3da6c7d9816f29c74c41da46546db0f84687a4bd 100644 (file)
@@ -181,6 +181,9 @@ class gramNativePort(Settings):
     def __init__(self, mode, address_width, data_width, clock_domain="sync", id=0):
         self.set_attributes(locals())
 
+        if mode not in ["both", "read", "write"]:
+            raise ValueError("mode must be either both/read/write, not {!r}".format(mode))
+
         self.lock = Signal()
 
         self.cmd = stream.Endpoint(cmd_description(address_width))
@@ -204,16 +207,6 @@ class gramNativePort(Settings):
             return self.cmd.addr[:cba_shift]
 
 
-class gramNativeWritePort(gramNativePort):
-    def __init__(self, *args, **kwargs):
-        gramNativePort.__init__(self, "write", *args, **kwargs)
-
-
-class gramNativeReadPort(gramNativePort):
-    def __init__(self, *args, **kwargs):
-        gramNativePort.__init__(self, "read", *args, **kwargs)
-
-
 # Timing Controllers -------------------------------------------------------------------------------
 
 class tXXDController(Elaboratable):