- # CSR
- self.submodules.csrbankarray = csr_bus.CSRBankArray(self,
- self.get_csr_dev_address,
- data_width=self.csr_data_width, address_width=self.csr_address_width)
- if self.csr_expose:
- self.submodules.csrcon = csr_bus.InterconnectShared(
- [self.csr, self.wishbone2csr.csr], self.csrbankarray.get_buses())
- else:
- self.submodules.csrcon = csr_bus.Interconnect(
- self.wishbone2csr.csr, self.csrbankarray.get_buses())
- for name, csrs, mapaddr, rmap in self.csrbankarray.banks:
- self.check_csr_range(name, 0x800*mapaddr)
- self.add_csr_region(name, (self.mem_map["csr"] + 0x800*mapaddr) | self.shadow_base, self.csr_data_width, csrs)
- for name, memory, mapaddr, mmap in self.csrbankarray.srams:
- self.check_csr_range(name, 0x800*mapaddr)
- self.add_csr_region(name + "_" + memory.name_override, (self.mem_map["csr"] + 0x800*mapaddr) | self.shadow_base, self.csr_data_width, memory)
- for name, constant in self.csrbankarray.constants:
- self._constants.append(((name + "_" + constant.name).upper(), constant.value.value))
- for name, value in sorted(self.config.items(), key=itemgetter(0)):
- self._constants.append(("CONFIG_" + name.upper(), value))
-
- # Interrupts
- if hasattr(self, "cpu"):
- if hasattr(self.cpu, "interrupt"):
- for _name, _id in sorted(self.soc_interrupt_map.items()):
- if _name in self.cpu.reserved_interrupts.keys():
- continue
- if hasattr(self, _name):
- module = getattr(self, _name)
- assert hasattr(module, 'ev'), "Submodule %s does not have EventManager (xx.ev) module" % _name
- self.comb += self.cpu.interrupt[_id].eq(module.ev.irq)
+ # CSR
+ self.submodules.csrbankarray = csr_bus.CSRBankArray(self,
+ self.get_csr_dev_address,
+ data_width=self.csr_data_width, address_width=self.csr_address_width)
+ self.submodules.csrcon = csr_bus.InterconnectShared(
+ self._csr_masters, self.csrbankarray.get_buses())
+ for name, csrs, mapaddr, rmap in self.csrbankarray.banks:
+ self.check_csr_range(name, 0x800*mapaddr)
+ self.add_csr_region(name, (self.soc_mem_map["csr"] + 0x800*mapaddr) | self.shadow_base, self.csr_data_width, csrs)
+ for name, memory, mapaddr, mmap in self.csrbankarray.srams:
+ self.check_csr_range(name, 0x800*mapaddr)
+ self.add_csr_region(name + "_" + memory.name_override, (self.soc_mem_map["csr"] + 0x800*mapaddr) | self.shadow_base, self.csr_data_width, memory)
+ for name, constant in self.csrbankarray.constants:
+ self._constants.append(((name + "_" + constant.name).upper(), constant.value.value))
+ for name, value in sorted(self.config.items(), key=itemgetter(0)):
+ self._constants.append(("CONFIG_" + name.upper(), value))
+
+ # Interrupts
+ if hasattr(self, "cpu"):
+ if hasattr(self.cpu, "interrupt"):
+ for _name, _id in sorted(self.soc_interrupt_map.items()):
+ if _name in self.cpu.reserved_interrupts.keys():
+ continue
+ if hasattr(self, _name):
+ module = getattr(self, _name)
+ assert hasattr(module, 'ev'), "Submodule %s does not have EventManager (xx.ev) module" % _name
+ self.comb += self.cpu.interrupt[_id].eq(module.ev.irq)