soc/interconnect/axi: data/address length cleanup
authorGabriel L. Somlo <gsomlo@gmail.com>
Wed, 27 Mar 2019 20:38:25 +0000 (16:38 -0400)
committerGabriel L. Somlo <gsomlo@gmail.com>
Wed, 27 Mar 2019 20:52:52 +0000 (16:52 -0400)
Instead of hard-coding data and address width to 32, assert that
the AXI and Wishbone interfaces have *matching* address and data
widths.

litex/soc/interconnect/axi.py

index a110c36d2f7b277b4300d6d6a31b77b8f3ae413e..17d431e647ac37580e0d8b553fbe150c80cdde89 100644 (file)
@@ -60,12 +60,12 @@ class AXIInterface(Record):
 
 class AXI2Wishbone(Module):
     def __init__(self, axi, wishbone, base_address):
-        assert axi.data_width    == 32
-        assert axi.address_width == 32
+        assert axi.data_width    == len(wishbone.dat_r)
+        assert axi.address_width == len(wishbone.adr) + 2
 
         _data       = Signal(axi.data_width)
-        _read_addr  = Signal(32)
-        _write_addr = Signal(32)
+        _read_addr  = Signal(axi.address_width)
+        _write_addr = Signal(axi.address_width)
 
         self.comb += _read_addr.eq(axi.ar.addr - base_address)
         self.comb += _write_addr.eq(axi.aw.addr - base_address)