wishbone.bus.Interface: add support for LOCK_IO signal.
authorwhitequark <whitequark@whitequark.org>
Sat, 26 Oct 2019 02:40:18 +0000 (02:40 +0000)
committerwhitequark <whitequark@whitequark.org>
Sat, 26 Oct 2019 02:40:18 +0000 (02:40 +0000)
nmigen_soc/test/test_wishbone_bus.py
nmigen_soc/wishbone/bus.py

index 00da53012c51bb942962df4a358be76f297374b3..4380d21b1dba9d5f0099628c1d5b75daa2aaea5f 100644 (file)
@@ -44,7 +44,7 @@ class InterfaceTestCase(unittest.TestCase):
 
     def test_optional(self):
         iface = Interface(addr_width=32, data_width=32,
-                          optional={"rty", "err", "stall", "cti", "bte"})
+                          optional={"rty", "err", "stall", "lock", "cti", "bte"})
         self.assertEqual(iface.layout, Layout.cast([
             ("adr",   32, DIR_FANOUT),
             ("dat_w", 32, DIR_FANOUT),
@@ -57,6 +57,7 @@ class InterfaceTestCase(unittest.TestCase):
             ("err",   1,  DIR_FANIN),
             ("rty",   1,  DIR_FANIN),
             ("stall", 1,  DIR_FANIN),
+            ("lock",  1,  DIR_FANOUT),
             ("cti",   CycleType,    DIR_FANOUT),
             ("bte",   BurstTypeExt, DIR_FANOUT),
         ]))
index 5ee845fe5e090b13aaee46246331a051bd05da38..b73598f8c8887ef2fd4fc4c936ddb18afa604d33 100644 (file)
@@ -80,6 +80,8 @@ class Interface(Record):
         Optional. Corresponds to Wishbone signal ``RTY_I`` (initiator) or ``RTY_O`` (target).
     stall : Signal()
         Optional. Corresponds to Wishbone signal ``STALL_I`` (initiator) or ``STALL_O`` (target).
+    lock : Signal()
+        Optional. Corresponds to Wishbone signal ``LOCK_O`` (initiator) or ``LOCK_I`` (target).
     cti : Signal()
         Optional. Corresponds to Wishbone signal ``CTI_O`` (initiator) or ``CTI_I`` (target).
     bte : Signal()
@@ -110,7 +112,7 @@ class Interface(Record):
                                      alignment=alignment)
 
         optional = set(optional)
-        unknown  = optional - {"rty", "err", "stall", "cti", "bte"}
+        unknown  = optional - {"rty", "err", "stall", "lock", "cti", "bte"}
         if unknown:
             raise ValueError("Optional signal(s) {} are not supported"
                              .format(", ".join(map(repr, unknown))))
@@ -130,6 +132,8 @@ class Interface(Record):
             layout += [("rty", 1, Direction.FANIN)]
         if "stall" in optional:
             layout += [("stall", 1, Direction.FANIN)]
+        if "lock" in optional:
+            layout += [("lock",  1, Direction.FANOUT)]
         if "cti" in optional:
             layout += [("cti", CycleType,    Direction.FANOUT)]
         if "bte" in optional: