The address map defines how the 32-bit memory space of X-ALP is partitioned into regions. The generator uses it to build the AXI bus, place the peripherals, and produce consistent hardware constants, linker scripts and software headers. Although the bus uses 64-bit addresses, all regions must fit in the first 4 GiB.
The default address map is defined in configs/soc.py. A custom one can be created through the Python configuration.
The address map is represented by the {py:class}~xheep_gen.address_map.address_map.AddressMap class, which contains an ordered collection of {py:class}~xheep_gen.address_map.address_region.AddressRegion objects. Each region has:
name: a unique identifier for the region;start_address: the first byte of the region;length: the size of the region in bytes.
Regions must not overlap and must end before 0xFFFF_FFFF. Adjacent regions are valid.
address_map = AddressMap()
address_map.add_region(AddressRegion("debug", start_address=0x00000000, length=0x00100000))
address_map.add_region(AddressRegion("peripheral_domain", start_address=0x20000000, length=0x00100000))
address_map.add_region(AddressRegion("ext_slaves", start_address=0xF0000000, length=0x01000000))
soc.set_address_map(address_map)Each region becomes a slave of the bus, with these exceptions:
- a region with the same name as a peripheral domain becomes that domain. The peripherals inside it have offsets relative to the start of the domain, so they do not appear in the address map (see Peripheral Configuration);
- the memory subsystem regions (the LLC scratchpad and cached region) are not part of the address map: the LLC places them from its own parameters (see Memory Configuration).
The debug region is kept at 0x0000_0000: it holds the debug module, and the extrom memory of the linker scripts.
Regions can be retrieved by name with {py:meth}~xheep_gen.address_map.address_map.AddressMap.get_region, and the full list with {py:meth}~xheep_gen.address_map.address_map.AddressMap.get_regions. In the templates, the final addresses are available through the derived bus, e.g. xalp.bus().get_axi_addr_rules() and xalp.bus().get_reg_slaves().
In software, the generated core_v_mcu.h header defines <NAME>_START_ADDRESS, <NAME>_SIZE and <NAME>_END_ADDRESS for every slave, e.g. UART_START_ADDRESS or EXT_SLAVES_START_ADDRESS.
The following tables are generated by make mcu-gen from docs/addressmap.md.tpl for the default configuration.
:start-line: 2