litex-hub / litevideo

Small footprint and configurable video cores (Deprecated)
Other
70 stars 25 forks source link

Failing in dma.py with "ValueError: CSRField "ev_source" name is already used in CSR register" when using multiple slots #41

Open SOMO-Prevas opened 3 years ago

SOMO-Prevas commented 3 years ago

This seems to be caused by SlotArray not assigning unique names to the slots. Changing:

        slots = [_Slot(addr_bits, alignment_bits) for i in range(nslots)]
        for n, slot in enumerate(slots):
            setattr(self.submodules, "slot"+str(n), slot)
            setattr(self.ev, "slot"+str(n), slot.ev_source)
        self.ev.finalize()

to:

        slots = [_Slot(addr_bits, alignment_bits) for i in range(nslots)]
        for n, slot in enumerate(slots):
            setattr(slot.ev_source, "name", "slot"+str(n)) # To get unique name for each slot ev_source
            setattr(self.submodules, "slot"+str(n), slot)
            setattr(self.ev, "slot"+str(n), slot.ev_source)
        self.ev.finalize()

Seems to fix the issue.