diff --git a/hw/top_darjeeling/data/autogen/top_darjeeling.gen.hjson b/hw/top_darjeeling/data/autogen/top_darjeeling.gen.hjson index 226faefaad6a09..f2709b9387a7fd 100644 --- a/hw/top_darjeeling/data/autogen/top_darjeeling.gen.hjson +++ b/hw/top_darjeeling/data/autogen/top_darjeeling.gen.hjson @@ -454,6 +454,58 @@ { name: hart desc: The main address space, shared between the CPU and DM + subspaces: + [ + { + name: mmio + desc: MMIO region excludes any memory that is separate from the module configuration space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, spi_device memory, or usbdev memory are included. + nodes: + [ + uart0 + gpio + spi_device + i2c0 + rv_timer + otp_ctrl + lc_ctrl.regs + alert_handler + spi_host0 + pwrmgr_aon + rstmgr_aon + clkmgr_aon + pinmux_aon + aon_timer_aon + sensor_ctrl + soc_proxy.core + sram_ctrl_ret_aon + rv_dm.regs + rv_plic + aes + hmac + otbn + keymgr_dpe + csrng + edn0 + edn1 + sram_ctrl_main.regs + sram_ctrl_mbox.regs + rom_ctrl0.regs + rom_ctrl1.regs + dma + mbx0.core + mbx1.core + mbx2.core + mbx3.core + mbx4.core + mbx5.core + mbx6.core + mbx_jtag.core + mbx_pcie0.core + mbx_pcie1.core + rv_core_ibex + ] + } + ] } { name: soc_mbx @@ -3750,6 +3802,7 @@ ctn: { hart: 0x40000000 + cpu_visible: false } } attr: reggen_top @@ -4267,14 +4320,17 @@ mem: { hart: 0x00040000 + cpu_visible: false } regs: { hart: 0x21200000 + cpu_visible: false } dbg: { soc_dbg: 0x00000000 + cpu_visible: false } } param_decl: @@ -6092,6 +6148,7 @@ ram: { hart: 0x10000000 + cpu_visible: false } } memory: @@ -6299,6 +6356,7 @@ ram: { hart: 0x11000000 + cpu_visible: false } } memory: @@ -6490,6 +6548,7 @@ rom: { hart: 0x00008000 + cpu_visible: false } regs: { @@ -6672,6 +6731,7 @@ rom: { hart: 0x00020000 + cpu_visible: false } regs: { @@ -7022,6 +7082,7 @@ soc: { soc_mbx: 0x01465000 + cpu_visible: false } } clock_connections: @@ -7158,6 +7219,7 @@ soc: { soc_mbx: 0x01465100 + cpu_visible: false } } clock_connections: @@ -7294,6 +7356,7 @@ soc: { soc_mbx: 0x01465200 + cpu_visible: false } } clock_connections: @@ -7430,6 +7493,7 @@ soc: { soc_mbx: 0x01465300 + cpu_visible: false } } clock_connections: @@ -7566,6 +7630,7 @@ soc: { soc_mbx: 0x01465400 + cpu_visible: false } } clock_connections: @@ -7702,6 +7767,7 @@ soc: { soc_mbx: 0x01465500 + cpu_visible: false } } clock_connections: @@ -7838,6 +7904,7 @@ soc: { soc_mbx: 0x01465600 + cpu_visible: false } } clock_connections: @@ -7974,6 +8041,7 @@ soc: { soc_dbg: 0x1000 + cpu_visible: false } } clock_connections: @@ -8110,6 +8178,7 @@ soc: { soc_mbx: 0x01460100 + cpu_visible: false } } clock_connections: @@ -8246,6 +8315,7 @@ soc: { soc_mbx: 0x01460200 + cpu_visible: false } } clock_connections: @@ -9990,6 +10060,7 @@ base_addrs: { hart: 0x21200000 + cpu_visible: 0x0 } size_byte: 0x4 } @@ -10012,6 +10083,7 @@ base_addrs: { hart: 0x40000 + cpu_visible: 0x0 } size_byte: 0x1000 } @@ -10034,6 +10106,7 @@ base_addrs: { hart: 0x8000 + cpu_visible: 0x0 } size_byte: 0x8000 } @@ -10078,6 +10151,7 @@ base_addrs: { hart: 0x20000 + cpu_visible: 0x0 } size_byte: 0x10000 } @@ -10165,6 +10239,7 @@ base_addrs: { hart: 0x40000000 + cpu_visible: 0x0 } size_byte: 0x40000000 } @@ -10429,6 +10504,7 @@ base_addrs: { hart: 0x10000000 + cpu_visible: 0x0 } size_byte: 0x10000 } @@ -10471,6 +10547,7 @@ base_addrs: { hart: 0x11000000 + cpu_visible: 0x0 } size_byte: 0x1000 } @@ -12250,6 +12327,7 @@ base_addrs: { soc_mbx: 0x1465000 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -12272,6 +12350,7 @@ base_addrs: { soc_mbx: 0x1465100 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -12294,6 +12373,7 @@ base_addrs: { soc_mbx: 0x1465200 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -12316,6 +12396,7 @@ base_addrs: { soc_mbx: 0x1465300 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -12338,6 +12419,7 @@ base_addrs: { soc_mbx: 0x1465400 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -12360,6 +12442,7 @@ base_addrs: { soc_mbx: 0x1465500 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -12382,6 +12465,7 @@ base_addrs: { soc_mbx: 0x1465600 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -12404,6 +12488,7 @@ base_addrs: { soc_mbx: 0x1460100 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -12426,6 +12511,7 @@ base_addrs: { soc_mbx: 0x1460200 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -12635,6 +12721,7 @@ base_addrs: { soc_dbg: 0x0 + cpu_visible: 0x0 } size_byte: 0x200 } @@ -12656,6 +12743,7 @@ base_addrs: { soc_dbg: 0x1000 + cpu_visible: 0x0 } size_byte: 0x20 } diff --git a/hw/top_darjeeling/data/top_darjeeling.hjson b/hw/top_darjeeling/data/top_darjeeling.hjson index ec2c11cc675a83..94cb050e661554 100644 --- a/hw/top_darjeeling/data/top_darjeeling.hjson +++ b/hw/top_darjeeling/data/top_darjeeling.hjson @@ -166,7 +166,58 @@ // all peripherals, though not every peripheral will be accessible to every // host in that address space--Access privileges are separate from addresses. addr_spaces: [ - { name: "hart", desc: "The main address space, shared between the CPU and DM"}, + { name: "hart" + desc: "The main address space, shared between the CPU and DM" + subspaces: [ + { name: "mmio", + desc: "MMIO region excludes any memory that is separate from the module configuration space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, spi_device memory, or usbdev memory are included." + nodes: [ + "uart0", + "gpio", + "spi_device", + "i2c0", + "rv_timer", + "otp_ctrl", + "lc_ctrl.regs", + "alert_handler", + "spi_host0", + "pwrmgr_aon", + "rstmgr_aon", + "clkmgr_aon", + "pinmux_aon", + "aon_timer_aon", + "sensor_ctrl", + "soc_proxy.core", + "sram_ctrl_ret_aon", + "rv_dm.regs", + "rv_plic", + "aes", + "hmac", + "otbn", + "keymgr_dpe" + "csrng", + "edn0", + "edn1", + "sram_ctrl_main.regs", + "sram_ctrl_mbox.regs", + "rom_ctrl0.regs", + "rom_ctrl1.regs", + "dma", + "mbx0.core", + "mbx1.core", + "mbx2.core", + "mbx3.core", + "mbx4.core", + "mbx5.core", + "mbx6.core", + "mbx_jtag.core", + "mbx_pcie0.core", + "mbx_pcie1.core", + "rv_core_ibex", + ], + }, + ] + } { name: "soc_mbx", desc: "SoC address space for mailbox access"}, { name: "soc_dbg", desc: "SoC address space for debug module interfaces"}, ] @@ -526,7 +577,7 @@ domain: ["Aon", "0"], base_addrs: { core: {hart: "0x22030000"}, - ctn: {hart: "0x40000000"}, + ctn: {hart: "0x40000000", cpu_visible: false}, }, attr: "reggen_top", memory: { @@ -573,9 +624,9 @@ reset_connections: {rst_ni: "sys"}, // Note that this module also contains a bus host. base_addrs: { - mem: {hart: "0x00040000"}, - regs: {hart: "0x21200000"}, - dbg: {soc_dbg: "0x00000000"}, + mem: {hart: "0x00040000", cpu_visible: false}, + regs: {hart: "0x21200000", cpu_visible: false}, + dbg: {soc_dbg: "0x00000000", cpu_visible: false}, }, param_decl: { // NOTE THAT THIS IS A FEATURE FOR TEST CHIPS ONLY TO MITIGATE @@ -704,7 +755,7 @@ } base_addrs: { regs: {hart: "0x211c0000"}, - ram: {hart: "0x10000000"}, + ram: {hart: "0x10000000", cpu_visible: false}, }, // Memory regions must be associated with a dedicated // TL-UL device interface. @@ -729,7 +780,7 @@ } base_addrs: { regs: {hart: "0x211d0000"}, - ram: {hart: "0x11000000"}, + ram: {hart: "0x11000000", cpu_visible: false}, }, // Memory regions must be associated with a dedicated // TL-UL device interface. @@ -750,7 +801,7 @@ clock_group: "infra", reset_connections: {rst_ni: "lc"}, base_addrs: { - rom: {hart: "0x00008000"}, + rom: {hart: "0x00008000", cpu_visible: false}, regs: {hart: "0x211e0000"}, } memory: { @@ -776,7 +827,7 @@ // TODO(opentitan-integrated/issues/251): // This is not the final parameterization for Darjeeling. base_addrs: { - rom: {hart: "0x00020000"}, + rom: {hart: "0x00020000", cpu_visible: false}, regs: {hart: "0x211e1000"}, } memory: { @@ -808,7 +859,7 @@ reset_connections: {rst_ni: "lc"}, base_addrs: { core: {hart: "0x22000000"}, - soc: {soc_mbx: "0x01465000"}, + soc: {soc_mbx: "0x01465000", cpu_visible: false}, }, }, { name: "mbx1", @@ -818,7 +869,7 @@ reset_connections: {rst_ni: "lc"}, base_addrs: { core: {hart: "0x22000100"}, - soc: {soc_mbx: "0x01465100"}, + soc: {soc_mbx: "0x01465100", cpu_visible: false}, }, }, { name: "mbx2", @@ -828,7 +879,7 @@ reset_connections: {rst_ni: "lc"}, base_addrs: { core: {hart: "0x22000200"}, - soc: {soc_mbx: "0x01465200"}, + soc: {soc_mbx: "0x01465200", cpu_visible: false}, }, }, { name: "mbx3", @@ -838,7 +889,7 @@ reset_connections: {rst_ni: "lc"}, base_addrs: { core: {hart: "0x22000300"}, - soc: {soc_mbx: "0x01465300"}, + soc: {soc_mbx: "0x01465300", cpu_visible: false}, }, }, { name: "mbx4", @@ -848,7 +899,7 @@ reset_connections: {rst_ni: "lc"}, base_addrs: { core: {hart: "0x22000400"}, - soc: {soc_mbx: "0x01465400"}, + soc: {soc_mbx: "0x01465400", cpu_visible: false}, }, }, { name: "mbx5", @@ -858,7 +909,7 @@ reset_connections: {rst_ni: "lc"}, base_addrs: { core: {hart: "0x22000500"}, - soc: {soc_mbx: "0x01465500"}, + soc: {soc_mbx: "0x01465500", cpu_visible: false}, }, }, { name: "mbx6", @@ -868,7 +919,7 @@ reset_connections: {rst_ni: "lc"}, base_addrs: { core: {hart: "0x22000600"}, - soc: {soc_mbx: "0x01465600"}, + soc: {soc_mbx: "0x01465600", cpu_visible: false}, }, }, { name: "mbx_jtag", @@ -878,7 +929,7 @@ reset_connections: {rst_ni: "lc"}, base_addrs: { core: {hart: "0x22000800"}, - soc: {soc_dbg: "0x1000"}, + soc: {soc_dbg: "0x1000", cpu_visible: false}, }, }, { name: "mbx_pcie0", @@ -888,7 +939,7 @@ reset_connections: {rst_ni: "lc"}, base_addrs: { core: {hart: "0x22040000"}, - soc: {soc_mbx: "0x01460100"}, + soc: {soc_mbx: "0x01460100", cpu_visible: false}, }, }, { name: "mbx_pcie1", @@ -898,7 +949,7 @@ reset_connections: {rst_ni: "lc"}, base_addrs: { core: {hart: "0x22040100"}, - soc: {soc_mbx: "0x01460200"}, + soc: {soc_mbx: "0x01460200", cpu_visible: false}, }, }, { name: "rv_core_ibex", diff --git a/hw/top_darjeeling/ip/xbar_dbg/data/autogen/xbar_dbg.gen.hjson b/hw/top_darjeeling/ip/xbar_dbg/data/autogen/xbar_dbg.gen.hjson index fcd9f4222436ad..18feff182ce633 100644 --- a/hw/top_darjeeling/ip/xbar_dbg/data/autogen/xbar_dbg.gen.hjson +++ b/hw/top_darjeeling/ip/xbar_dbg/data/autogen/xbar_dbg.gen.hjson @@ -74,6 +74,7 @@ base_addrs: { soc_dbg: 0x0 + cpu_visible: 0x0 } size_byte: 0x200 } @@ -95,6 +96,7 @@ base_addrs: { soc_dbg: 0x1000 + cpu_visible: 0x0 } size_byte: 0x20 } diff --git a/hw/top_darjeeling/ip/xbar_main/data/autogen/xbar_main.gen.hjson b/hw/top_darjeeling/ip/xbar_main/data/autogen/xbar_main.gen.hjson index 40675ea7b5e81e..0f6b76df206f72 100644 --- a/hw/top_darjeeling/ip/xbar_main/data/autogen/xbar_main.gen.hjson +++ b/hw/top_darjeeling/ip/xbar_main/data/autogen/xbar_main.gen.hjson @@ -236,6 +236,7 @@ base_addrs: { hart: 0x21200000 + cpu_visible: 0x0 } size_byte: 0x4 } @@ -258,6 +259,7 @@ base_addrs: { hart: 0x40000 + cpu_visible: 0x0 } size_byte: 0x1000 } @@ -280,6 +282,7 @@ base_addrs: { hart: 0x8000 + cpu_visible: 0x0 } size_byte: 0x8000 } @@ -324,6 +327,7 @@ base_addrs: { hart: 0x20000 + cpu_visible: 0x0 } size_byte: 0x10000 } @@ -411,6 +415,7 @@ base_addrs: { hart: 0x40000000 + cpu_visible: 0x0 } size_byte: 0x40000000 } @@ -675,6 +680,7 @@ base_addrs: { hart: 0x10000000 + cpu_visible: 0x0 } size_byte: 0x10000 } @@ -717,6 +723,7 @@ base_addrs: { hart: 0x11000000 + cpu_visible: 0x0 } size_byte: 0x1000 } diff --git a/hw/top_darjeeling/ip/xbar_mbx/data/autogen/xbar_mbx.gen.hjson b/hw/top_darjeeling/ip/xbar_mbx/data/autogen/xbar_mbx.gen.hjson index 4677829be8c2f0..5e2b2467381797 100644 --- a/hw/top_darjeeling/ip/xbar_mbx/data/autogen/xbar_mbx.gen.hjson +++ b/hw/top_darjeeling/ip/xbar_mbx/data/autogen/xbar_mbx.gen.hjson @@ -74,6 +74,7 @@ base_addrs: { soc_mbx: 0x1465000 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -96,6 +97,7 @@ base_addrs: { soc_mbx: 0x1465100 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -118,6 +120,7 @@ base_addrs: { soc_mbx: 0x1465200 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -140,6 +143,7 @@ base_addrs: { soc_mbx: 0x1465300 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -162,6 +166,7 @@ base_addrs: { soc_mbx: 0x1465400 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -184,6 +189,7 @@ base_addrs: { soc_mbx: 0x1465500 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -206,6 +212,7 @@ base_addrs: { soc_mbx: 0x1465600 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -228,6 +235,7 @@ base_addrs: { soc_mbx: 0x1460100 + cpu_visible: 0x0 } size_byte: 0x20 } @@ -250,6 +258,7 @@ base_addrs: { soc_mbx: 0x1460200 + cpu_visible: 0x0 } size_byte: 0x20 } diff --git a/hw/top_darjeeling/sw/autogen/chip/top_darjeeling.rs b/hw/top_darjeeling/sw/autogen/chip/top_darjeeling.rs index 2798bf4982658f..bfcedb54025aee 100644 --- a/hw/top_darjeeling/sw/autogen/chip/top_darjeeling.rs +++ b/hw/top_darjeeling/sw/autogen/chip/top_darjeeling.rs @@ -2744,8 +2744,6 @@ pub enum TopDarjeelingHintableClocks { /// MMIO Region /// -/// MMIO region excludes any memory that is separate from the module -/// configuration space, i.e. ROM, main SRAM, and flash are excluded but -/// retention SRAM, spi_device memory, or usbdev memory are included. +/// MMIO region excludes any memory that is separate from the module configuration space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, spi_device memory, or usbdev memory are included. pub const TOP_DARJEELING_MMIO_BASE_ADDR: usize = 0x21100000; -pub const TOP_DARJEELING_MMIO_SIZE_BYTES: usize = 0xF400020; +pub const TOP_DARJEELING_MMIO_SIZE_BYTES: usize = 0xF501000; diff --git a/hw/top_darjeeling/sw/autogen/chip/top_darjeeling_memory.rs b/hw/top_darjeeling/sw/autogen/chip/top_darjeeling_memory.rs index 1216ec9816016f..3b50c0fece605d 100644 --- a/hw/top_darjeeling/sw/autogen/chip/top_darjeeling_memory.rs +++ b/hw/top_darjeeling/sw/autogen/chip/top_darjeeling_memory.rs @@ -733,8 +733,6 @@ pub const TOP_DARJEELING_RV_CORE_IBEX_CFG_SIZE_BYTES: usize = 0x800; /// MMIO Region /// -/// MMIO region excludes any memory that is separate from the module -/// configuration space, i.e. ROM, main SRAM, and flash are excluded but -/// retention SRAM, spi_device memory, or usbdev memory are included. +/// MMIO region excludes any memory that is separate from the module configuration space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, spi_device memory, or usbdev memory are included. pub const TOP_DARJEELING_MMIO_BASE_ADDR: usize = 0x21100000; -pub const TOP_DARJEELING_MMIO_SIZE_BYTES: usize = 0xF400020; +pub const TOP_DARJEELING_MMIO_SIZE_BYTES: usize = 0xF501000; diff --git a/hw/top_darjeeling/sw/autogen/top_darjeeling.h b/hw/top_darjeeling/sw/autogen/top_darjeeling.h index 391c067a9445f8..f2bc258bbd0f99 100644 --- a/hw/top_darjeeling/sw/autogen/top_darjeeling.h +++ b/hw/top_darjeeling/sw/autogen/top_darjeeling.h @@ -1674,9 +1674,7 @@ typedef enum top_darjeeling_hintable_clocks { /** * MMIO Region * - * MMIO region excludes any memory that is separate from the module - * configuration space, i.e. ROM, main SRAM, and flash are excluded but - * retention SRAM, spi_device memory, or usbdev memory are included. + * MMIO region excludes any memory that is separate from the module configuration space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, spi_device memory, or usbdev memory are included. */ #define TOP_DARJEELING_MMIO_BASE_ADDR 0x21100000u #define TOP_DARJEELING_MMIO_SIZE_BYTES 0xF501000u diff --git a/hw/top_darjeeling/sw/autogen/top_darjeeling_memory.h b/hw/top_darjeeling/sw/autogen/top_darjeeling_memory.h index 552e2be44067d7..153f3493f03d7b 100644 --- a/hw/top_darjeeling/sw/autogen/top_darjeeling_memory.h +++ b/hw/top_darjeeling/sw/autogen/top_darjeeling_memory.h @@ -982,9 +982,7 @@ /** * MMIO Region * - * MMIO region excludes any memory that is separate from the module - * configuration space, i.e. ROM, main SRAM, and flash are excluded but - * retention SRAM, spi_device memory, or usbdev memory are included. + * MMIO region excludes any memory that is separate from the module configuration space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, spi_device memory, or usbdev memory are included. */ #define TOP_DARJEELING_MMIO_BASE_ADDR 0x21100000 #define TOP_DARJEELING_MMIO_SIZE_BYTES 0xF501000 diff --git a/hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson b/hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson index c82d7060678c78..5da4e8c33339f1 100644 --- a/hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson +++ b/hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson @@ -524,6 +524,59 @@ { name: hart desc: The main address space, shared between the CPU and DM + subspaces: + [ + { + name: mmio + desc: MMIO region excludes any memory that is separate from the module configuration space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, spi_device memory, or usbdev memory are included. + nodes: + [ + uart0 + uart1 + uart2 + uart3 + gpio + spi_device + i2c0 + i2c1 + i2c2 + pattgen + rv_timer + otp_ctrl + lc_ctrl + alert_handler + spi_host0 + spi_host1 + usbdev + pwrmgr_aon + rstmgr_aon + clkmgr_aon + sysrst_ctrl_aon + adc_ctrl_aon + pwm_aon + pinmux_aon + aon_timer_aon + ast + sensor_ctrl + sram_ctrl_ret_aon + flash_ctrl.core + flash_ctrl.prim + rv_plic + aes + hmac + kmac + otbn + keymgr + csrng + entropy_src + edn0 + edn1 + sram_ctrl_main.regs + rom_ctrl0.regs + rv_core_ibex + ] + } + ] } ] module: @@ -5013,6 +5066,7 @@ mem: { hart: 0x20000000 + cpu_visible: false } } param_decl: @@ -5456,10 +5510,12 @@ mem: { hart: 0x00010000 + cpu_visible: false } regs: { hart: 0x41200000 + cpu_visible: false } } generate_dif: false @@ -7405,6 +7461,7 @@ ram: { hart: 0x10000000 + cpu_visible: false } } memory: @@ -7598,6 +7655,7 @@ rom: { hart: 0x00008000 + cpu_visible: false } regs: { @@ -9257,6 +9315,7 @@ base_addrs: { hart: 0x41200000 + cpu_visible: 0x0 } size_byte: 0x4 } @@ -9279,6 +9338,7 @@ base_addrs: { hart: 0x10000 + cpu_visible: 0x0 } size_byte: 0x1000 } @@ -9301,6 +9361,7 @@ base_addrs: { hart: 0x8000 + cpu_visible: 0x0 } size_byte: 0x8000 } @@ -9484,6 +9545,7 @@ base_addrs: { hart: 0x20000000 + cpu_visible: 0x0 } size_byte: 0x100000 } @@ -9769,6 +9831,7 @@ base_addrs: { hart: 0x10000000 + cpu_visible: 0x0 } size_byte: 0x20000 } diff --git a/hw/top_earlgrey/data/top_earlgrey.hjson b/hw/top_earlgrey/data/top_earlgrey.hjson index fe30cc4ed34803..d77713a21e3f45 100644 --- a/hw/top_earlgrey/data/top_earlgrey.hjson +++ b/hw/top_earlgrey/data/top_earlgrey.hjson @@ -171,7 +171,59 @@ // all peripherals, though not every peripheral will be accessible to every // host in that address space--Access privileges are separate from addresses. addr_spaces: [ - { name: "hart", desc: "The main address space, shared between the CPU and DM"}, + { name: "hart", + desc: "The main address space, shared between the CPU and DM" + subspaces: [ + { name: "mmio", + desc: "MMIO region excludes any memory that is separate from the module configuration space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, spi_device memory, or usbdev memory are included." + nodes: [ + "uart0", + "uart1", + "uart2", + "uart3", + "gpio" + "spi_device" + "i2c0" + "i2c1" + "i2c2" + "pattgen" + "rv_timer" + "otp_ctrl" + "lc_ctrl" + "alert_handler" + "spi_host0" + "spi_host1" + "usbdev" + "pwrmgr_aon" + "rstmgr_aon" + "clkmgr_aon" + "sysrst_ctrl_aon" + "adc_ctrl_aon" + "pwm_aon" + "pinmux_aon" + "aon_timer_aon" + "ast" + "sensor_ctrl" + "sram_ctrl_ret_aon" + "flash_ctrl.core" + "flash_ctrl.prim" + "rv_plic" + "aes", + "hmac", + "kmac", + "otbn", + "keymgr" + "csrng" + "entropy_src", + "edn0" + "edn1", + "sram_ctrl_main.regs" + "rom_ctrl0.regs", + "rv_core_ibex" + ] + } + ] + }, ] // `module` defines the peripherals. @@ -670,7 +722,7 @@ base_addrs: { core: {hart: "0x41000000"}, prim: {hart: "0x41008000"}, - mem: {hart: "0x20000000"} + mem: {hart: "0x20000000", cpu_visible: false} } param_decl: { ProgFifoDepth: "4", @@ -702,8 +754,8 @@ } // Note that this module also contains a bus host. base_addrs: { - mem: {hart: "0x00010000"}, - regs: {hart: "0x41200000"} + mem: {hart: "0x00010000", cpu_visible: false}, + regs: {hart: "0x41200000", cpu_visible: false} }, generate_dif: "False" }, @@ -833,7 +885,7 @@ } base_addrs: { regs: {hart: "0x411C0000"}, - ram: {hart: "0x10000000"} + ram: {hart: "0x10000000", cpu_visible: false} }, // Memory regions must be associated with a dedicated // TL-UL device interface. @@ -854,7 +906,7 @@ clock_group: "infra", reset_connections: {rst_ni: "lc"}, base_addrs: { - rom: {hart: "0x00008000"}, + rom: {hart: "0x00008000", cpu_visible: false}, regs: {hart: "0x411e0000"} } memory: { diff --git a/hw/top_earlgrey/ip/xbar_main/data/autogen/xbar_main.gen.hjson b/hw/top_earlgrey/ip/xbar_main/data/autogen/xbar_main.gen.hjson index 3d05eba5ec375c..e4b74214d8777a 100644 --- a/hw/top_earlgrey/ip/xbar_main/data/autogen/xbar_main.gen.hjson +++ b/hw/top_earlgrey/ip/xbar_main/data/autogen/xbar_main.gen.hjson @@ -177,6 +177,7 @@ base_addrs: { hart: 0x41200000 + cpu_visible: 0x0 } size_byte: 0x4 } @@ -199,6 +200,7 @@ base_addrs: { hart: 0x10000 + cpu_visible: 0x0 } size_byte: 0x1000 } @@ -221,6 +223,7 @@ base_addrs: { hart: 0x8000 + cpu_visible: 0x0 } size_byte: 0x8000 } @@ -404,6 +407,7 @@ base_addrs: { hart: 0x20000000 + cpu_visible: 0x0 } size_byte: 0x100000 } @@ -689,6 +693,7 @@ base_addrs: { hart: 0x10000000 + cpu_visible: 0x0 } size_byte: 0x20000 } diff --git a/hw/top_earlgrey/sw/autogen/chip/top_earlgrey.rs b/hw/top_earlgrey/sw/autogen/chip/top_earlgrey.rs index cbdd9578a8922c..8b4836209c704f 100644 --- a/hw/top_earlgrey/sw/autogen/chip/top_earlgrey.rs +++ b/hw/top_earlgrey/sw/autogen/chip/top_earlgrey.rs @@ -3180,8 +3180,6 @@ pub enum TopEarlgreyHintableClocks { /// MMIO Region /// -/// MMIO region excludes any memory that is separate from the module -/// configuration space, i.e. ROM, main SRAM, and flash are excluded but -/// retention SRAM, spi_device memory, or usbdev memory are included. +/// MMIO region excludes any memory that is separate from the module configuration space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, spi_device memory, or usbdev memory are included. pub const TOP_EARLGREY_MMIO_BASE_ADDR: usize = 0x40000000; pub const TOP_EARLGREY_MMIO_SIZE_BYTES: usize = 0x10000000; diff --git a/hw/top_earlgrey/sw/autogen/chip/top_earlgrey_memory.rs b/hw/top_earlgrey/sw/autogen/chip/top_earlgrey_memory.rs index cb7d88b7fe07ba..43ef62cb936766 100644 --- a/hw/top_earlgrey/sw/autogen/chip/top_earlgrey_memory.rs +++ b/hw/top_earlgrey/sw/autogen/chip/top_earlgrey_memory.rs @@ -690,8 +690,6 @@ pub const TOP_EARLGREY_RV_CORE_IBEX_CFG_SIZE_BYTES: usize = 0x800; /// MMIO Region /// -/// MMIO region excludes any memory that is separate from the module -/// configuration space, i.e. ROM, main SRAM, and flash are excluded but -/// retention SRAM, spi_device memory, or usbdev memory are included. +/// MMIO region excludes any memory that is separate from the module configuration space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, spi_device memory, or usbdev memory are included. pub const TOP_EARLGREY_MMIO_BASE_ADDR: usize = 0x40000000; pub const TOP_EARLGREY_MMIO_SIZE_BYTES: usize = 0x10000000; diff --git a/hw/top_earlgrey/sw/autogen/top_earlgrey.h b/hw/top_earlgrey/sw/autogen/top_earlgrey.h index ee2efcf2926382..b61976f52c3c91 100644 --- a/hw/top_earlgrey/sw/autogen/top_earlgrey.h +++ b/hw/top_earlgrey/sw/autogen/top_earlgrey.h @@ -1770,9 +1770,7 @@ typedef enum top_earlgrey_hintable_clocks { /** * MMIO Region * - * MMIO region excludes any memory that is separate from the module - * configuration space, i.e. ROM, main SRAM, and flash are excluded but - * retention SRAM, spi_device memory, or usbdev memory are included. + * MMIO region excludes any memory that is separate from the module configuration space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, spi_device memory, or usbdev memory are included. */ #define TOP_EARLGREY_MMIO_BASE_ADDR 0x40000000u #define TOP_EARLGREY_MMIO_SIZE_BYTES 0x10000000u diff --git a/hw/top_earlgrey/sw/autogen/top_earlgrey_memory.h b/hw/top_earlgrey/sw/autogen/top_earlgrey_memory.h index ee406dedc407cd..86cfd8cef36e68 100644 --- a/hw/top_earlgrey/sw/autogen/top_earlgrey_memory.h +++ b/hw/top_earlgrey/sw/autogen/top_earlgrey_memory.h @@ -916,9 +916,7 @@ /** * MMIO Region * - * MMIO region excludes any memory that is separate from the module - * configuration space, i.e. ROM, main SRAM, and flash are excluded but - * retention SRAM, spi_device memory, or usbdev memory are included. + * MMIO region excludes any memory that is separate from the module configuration space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, spi_device memory, or usbdev memory are included. */ #define TOP_EARLGREY_MMIO_BASE_ADDR 0x40000000 #define TOP_EARLGREY_MMIO_SIZE_BYTES 0x10000000 diff --git a/util/tlgen/validate.py b/util/tlgen/validate.py index 96893e6b2f78b7..d10e06d63a0b09 100644 --- a/util/tlgen/validate.py +++ b/util/tlgen/validate.py @@ -314,6 +314,9 @@ def validate(obj: OrderedDict) -> Xbar: # OrderedDict -> Xbar # ASID, but downstream xbar-to-xbar edges only support one ASID. for addr in nodeobj["addr_range"]: for asid, base_addr in addr["base_addrs"].items(): + if asid == "cpu_visible": + continue + addr_range = addr_ranges.setdefault(asid, []) address_from = int(base_addr, 0) size = int(addr["size_byte"], 0) diff --git a/util/topgen.py b/util/topgen.py index e442352d14d8dd..a877e981a1cc3f 100755 --- a/util/topgen.py +++ b/util/topgen.py @@ -7,6 +7,7 @@ import argparse import logging as log import shutil +import subprocess import sys import tempfile from collections import OrderedDict @@ -689,7 +690,7 @@ def generate_top_ral(topname: str, top: Dict[str, object], for if_name in block.reg_blocks.keys(): if_addr = { asid: int(addr, 0) - for (asid, addr) in module["base_addrs"][if_name].items() + for (asid, addr) in module["base_addrs"][if_name].items() if asid != "cpu_visible" } if_addrs[(inst_name, if_name)] = if_addr @@ -1349,21 +1350,25 @@ def render_template(template_path: str, rendered_path: Path, c_helper.header_macro_prefix = ( "OPENTITAN_" + str(rel_header_dir).replace("/", "_").upper()) + out_files = [] # "top_{topname}.h.tpl" -> "sw/autogen/top_{topname}.h" cheader_path = cformat_dir / f"top_{topname}.h" render_template(TOPGEN_TEMPLATE_PATH / "toplevel.h.tpl", cheader_path, helper=c_helper) + out_files.append(cheader_path) # Save the relative header path into `c_helper` rel_header_path = cheader_path.relative_to(root_paths[idx]) c_helper.header_path = str(rel_header_path) # "toplevel.c.tpl" -> "sw/autogen/top_{topname}.c" + c_path = cformat_dir / f"top_{topname}.c" render_template(TOPGEN_TEMPLATE_PATH / "toplevel.c.tpl", - cformat_dir / f"top_{topname}.c", + c_path, helper=c_helper) - + out_files.append(c_path) + # "toplevel_memory.ld.tpl" -> "sw/autogen/top_{topname}_memory.ld" render_template(TOPGEN_TEMPLATE_PATH / "toplevel_memory.ld.tpl", cformat_dir / f"top_{topname}_memory.ld", @@ -1374,6 +1379,17 @@ def render_template(template_path: str, rendered_path: Path, render_template(TOPGEN_TEMPLATE_PATH / "toplevel_memory.h.tpl", memory_cheader_path, helper=c_helper) + out_files.append(memory_cheader_path) + + # Format autogenerated file with clang-format. + try: + subprocess.check_call( + ["./bazelisk.sh", "run", "//quality:clang_format_fix", "--"] + out_files + ) + except subprocess.CalledProcessError: + log.error( + f"failed to format {out_files} with clang-format.") + sys.exit(1) # generate chip level xbar and alert_handler TB tb_files = [ diff --git a/util/topgen/c.py b/util/topgen/c.py index ad7f1c42f49fa6..aeb1d65c6d2253 100644 --- a/util/topgen/c.py +++ b/util/topgen/c.py @@ -10,32 +10,11 @@ from mako.template import Template from reggen.ip_block import IpBlock -from .lib import Name, get_base_and_size +from .lib import Name, get_base_and_size, MemoryRegion, init_subranges C_FILE_EXTENSIONS = (".c", ".h", ".cc", ".inc") -class MemoryRegion(object): - def __init__(self, name: Name, base_addr: int, size_bytes: int): - assert isinstance(base_addr, int) - self.name = name - self.base_addr = base_addr - self.size_bytes = size_bytes - self.size_words = (size_bytes + 3) // 4 - - def base_addr_name(self): - return self.name + Name(["base", "addr"]) - - def offset_name(self): - return self.name + Name(["offset"]) - - def size_bytes_name(self): - return self.name + Name(["size", "bytes"]) - - def size_words_name(self): - return self.name + Name(["size", "words"]) - - class CEnum(object): def __init__(self, name): self.name = name @@ -123,7 +102,7 @@ def __init__(self, top_info, name_to_block: Dict[str, IpBlock]): self._init_rstmgr_sw_rsts() self._init_pwrmgr_reset_requests() self._init_clkmgr_clocks() - self._init_mmio_region() + self.subranges = init_subranges(self.top, self._top_name, self.devices(), self.addr_space) def devices(self) -> List[Tuple[Tuple[str, Optional[str]], MemoryRegion]]: '''Return a list of MemoryRegion objects for devices on the bus @@ -510,30 +489,3 @@ def _init_clkmgr_clocks(self): self.clkmgr_gateable_clocks = gateable_clocks self.clkmgr_hintable_clocks = hintable_clocks - - def _init_mmio_region(self): - """ - Computes the bounds of the MMIO region. - - MMIO region excludes any memory that is separate from the module configuration - space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, - spi_device memory, or usbdev memory are included. - """ - memories = [region.base_addr for (_, region) in self.memories()] - # TODO(#14345): Remove the hardcoded "rv_dm" name check below. - # TODO: we need a cleaner way to define which buses are visible - # by the CPU and which ones are not. For now, exclude every - # interface with the name `dbg`, since that is attached to the - # debug bus which is not connected to the CPU LSU. - regions = [ - region for ((dev_name, if_name), region) in self.devices() - if (dev_name == "sram_ctrl_ret_aon" and if_name == 'ram') or - (region.base_addr not in memories and dev_name != "rv_dm" and - (if_name is None or if_name != 'dbg')) - ] - # Note: The memory interface of the retention RAM is in the MMIO address space, - # which we prefer since it reduces the number of ePMP regions we need. - mmio = range(min([r.base_addr for r in regions]), - max([r.base_addr + r.size_bytes for r in regions])) - self.mmio = MemoryRegion(self._top_name + Name(["mmio"]), mmio.start, - mmio.stop - mmio.start) diff --git a/util/topgen/lib.py b/util/topgen/lib.py index 9286ea806468ef..99068927cfc1f6 100644 --- a/util/topgen/lib.py +++ b/util/topgen/lib.py @@ -85,6 +85,27 @@ def remove_part(self, part_to_remove: str) -> "Name": return Name([p for p in self.parts if p != part_to_remove]) +class MemoryRegion(object): + def __init__(self, name: Name, base_addr: int, size_bytes: int): + assert isinstance(base_addr, int) + self.name = name + self.base_addr = base_addr + self.size_bytes = size_bytes + self.size_words = (size_bytes + 3) // 4 + + def base_addr_name(self): + return self.name + Name(["base", "addr"]) + + def offset_name(self): + return self.name + Name(["offset"]) + + def size_bytes_name(self): + return self.name + Name(["size", "bytes"]) + + def size_words_name(self): + return self.name + Name(["size", "words"]) + + def is_ipcfg(ip: Path) -> bool: # return bool log.info("IP Path: %s" % repr(ip)) ip_name = ip.parents[1].name @@ -566,3 +587,56 @@ def is_lc_ctrl(modules): return True return False + + +def get_addr_space(top, addr_space_name): + """Returns the address dict for a given address space name""" + for addr_space in top['addr_spaces']: + if addr_space['name'] == addr_space_name: + return addr_space + assert False, "Address space not found" + + +def get_device_ranges(devices, device_name): + ranges = {} + for (dev_name, if_name), range in devices: + if dev_name == device_name: + ranges[if_name] = range + return ranges + + +def init_subranges(top, top_name, devices, addr_space_name): + """ + Computes the bounds of the MMIO region. + + MMIO region excludes any memory that is separate from the module configuration + space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, + spi_device memory, or usbdev memory are included. + """ + subspace_regions = [] + addr_space = get_addr_space(top, addr_space_name) + for subspace in addr_space.get('subspaces', []): + regions = [] + for node in subspace['nodes']: + split_dev = node.rsplit('.', 1) + dev_name = split_dev[0] + if_name = None + if len(split_dev) > 1: + if_name = split_dev[1] + + ranges = get_device_ranges(devices, dev_name) + if if_name: + # Only a single interface + regions.append(ranges[if_name]) + else: + # All interfaces + regions += list(ranges.values()) + + subspace_range = range(min([r.base_addr for r in regions]), + max([r.base_addr + r.size_bytes for r in regions])) + + subspace_region = MemoryRegion(top_name + Name([subspace['name']]), subspace_range.start, + subspace_range.stop - subspace_range.start) + subspace_regions.append((subspace['name'], subspace['desc'], subspace_region)) + return subspace_regions + \ No newline at end of file diff --git a/util/topgen/rust.py b/util/topgen/rust.py index 6fe1e6e0fc554b..2b985f984b31e4 100644 --- a/util/topgen/rust.py +++ b/util/topgen/rust.py @@ -9,32 +9,11 @@ from mako.template import Template from reggen.ip_block import IpBlock -from .lib import Name, get_base_and_size +from .lib import Name, get_base_and_size, MemoryRegion, init_subranges RUST_FILE_EXTENSIONS = (".rs") -class MemoryRegion(object): - def __init__(self, name: Name, base_addr: int, size_bytes: int): - assert isinstance(base_addr, int) - self.name = name - self.base_addr = base_addr - self.size_bytes = size_bytes - self.size_words = (size_bytes + 3) // 4 - - def base_addr_name(self): - return self.name + Name(["base", "addr"]) - - def offset_name(self): - return self.name + Name(["offset"]) - - def size_bytes_name(self): - return self.name + Name(["size", "bytes"]) - - def size_words_name(self): - return self.name + Name(["size", "words"]) - - class RustEnum(object): def __init__(self, top_name, name, repr_type=None): self.name = top_name + name @@ -214,7 +193,7 @@ def __init__(self, top_info, name_to_block: Dict[str, IpBlock], version_stamp: D self._init_rstmgr_sw_rsts() self._init_pwrmgr_reset_requests() self._init_clkmgr_clocks() - self._init_mmio_region() + self.subranges = init_subranges(self.top, self._top_name, self.devices(), self.addr_space) def devices(self) -> List[Tuple[Tuple[str, Optional[str]], MemoryRegion]]: '''Return a list of MemoryRegion objects for devices on the bus @@ -597,29 +576,3 @@ def _init_clkmgr_clocks(self): self.clkmgr_gateable_clocks = gateable_clocks self.clkmgr_hintable_clocks = hintable_clocks - - def _init_mmio_region(self): - """ - Computes the bounds of the MMIO region. - - MMIO region excludes any memory that is separate from the module configuration - space, i.e. ROM, main SRAM, and flash are excluded but retention SRAM, - spi_device memory, or usbdev memory are included. - """ - memories = [region.base_addr for (_, region) in self.memories()] - # TODO(#14345): Remove the hardcoded "rv_dm" name check below. - # TODO: we need a cleaner way to define which buses are visible - # by the CPU and which ones are not. For now, exclude every - # interface with the name `dbg`, since that is attached to the - # debug bus which is not connected to the CPU LSU. - regions = [ - region for ((dev_name, if_name), region) in self.devices() - if region.base_addr not in memories and dev_name != "rv_dm" and - (if_name is None or if_name != 'dbg') - ] - # Note: The memory interface of the retention RAM is in the MMIO address space, - # which we prefer since it reduces the number of ePMP regions we need. - mmio = range(min([r.base_addr for r in regions]), - max([r.base_addr + r.size_bytes for r in regions])) - self.mmio = MemoryRegion(self._top_name + Name(["mmio"]), mmio.start, - mmio.stop - mmio.start) diff --git a/util/topgen/templates/toplevel.h.tpl b/util/topgen/templates/toplevel.h.tpl index 74b85614cd201b..35794acca6d19d 100644 --- a/util/topgen/templates/toplevel.h.tpl +++ b/util/topgen/templates/toplevel.h.tpl @@ -234,15 +234,15 @@ ${helper.clkmgr_gateable_clocks.render()} */ ${helper.clkmgr_hintable_clocks.render()} +% for (subspace_name, description, subspace_range) in helper.subranges: /** * MMIO Region * - * MMIO region excludes any memory that is separate from the module - * configuration space, i.e. ROM, main SRAM, and flash are excluded but - * retention SRAM, spi_device memory, or usbdev memory are included. + * ${description} */ -#define ${helper.mmio.base_addr_name().as_c_define()} ${"0x{:X}u".format(helper.mmio.base_addr)} -#define ${helper.mmio.size_bytes_name().as_c_define()} ${"0x{:X}u".format(helper.mmio.size_bytes)} +#define ${subspace_range.base_addr_name().as_c_define()} ${"0x{:X}u".format(subspace_range.base_addr)} +#define ${subspace_range.size_bytes_name().as_c_define()} ${"0x{:X}u".format(subspace_range.size_bytes)} +% endfor // Header Extern Guard #ifdef __cplusplus diff --git a/util/topgen/templates/toplevel.rs.tpl b/util/topgen/templates/toplevel.rs.tpl index 9971eead9efae6..ddd9e85b6f8f3d 100644 --- a/util/topgen/templates/toplevel.rs.tpl +++ b/util/topgen/templates/toplevel.rs.tpl @@ -171,10 +171,10 @@ ${helper.clkmgr_gateable_clocks.render()} /// but the clock manager is in control of whether the clock actually is stopped. ${helper.clkmgr_hintable_clocks.render()} +% for (subspace_name, description, subspace_range) in helper.subranges: /// MMIO Region /// -/// MMIO region excludes any memory that is separate from the module -/// configuration space, i.e. ROM, main SRAM, and flash are excluded but -/// retention SRAM, spi_device memory, or usbdev memory are included. -pub const ${helper.mmio.base_addr_name().as_rust_const()}: usize = ${"0x{:X}".format(helper.mmio.base_addr)}; -pub const ${helper.mmio.size_bytes_name().as_rust_const()}: usize = ${"0x{:X}".format(helper.mmio.size_bytes)}; +/// ${description} +pub const ${subspace_range.base_addr_name().as_rust_const()}: usize = ${"0x{:X}".format(subspace_range.base_addr)}; +pub const ${subspace_range.size_bytes_name().as_rust_const()}: usize = ${"0x{:X}".format(subspace_range.size_bytes)}; +% endfor diff --git a/util/topgen/templates/toplevel_memory.h.tpl b/util/topgen/templates/toplevel_memory.h.tpl index bd3c73e1117dd0..dd1654009e2062 100644 --- a/util/topgen/templates/toplevel_memory.h.tpl +++ b/util/topgen/templates/toplevel_memory.h.tpl @@ -100,15 +100,15 @@ #define ${size_bytes_name} ${hex_size_bytes} % endfor +% for (subspace_name, description, subspace_range) in helper.mmio: /** * MMIO Region * - * MMIO region excludes any memory that is separate from the module - * configuration space, i.e. ROM, main SRAM, and flash are excluded but - * retention SRAM, spi_device memory, or usbdev memory are included. + * ${description} */ -#define ${helper.mmio.base_addr_name().as_c_define()} ${"0x{:X}".format(helper.mmio.base_addr)} -#define ${helper.mmio.size_bytes_name().as_c_define()} ${"0x{:X}".format(helper.mmio.size_bytes)} +#define ${subspace_range.base_addr_name().as_c_define()} ${"0x{:X}".format(subspace_range.base_addr)} +#define ${subspace_range.size_bytes_name().as_c_define()} ${"0x{:X}".format(subspace_range.size_bytes)} +% endfor #endif // __ASSEMBLER__ diff --git a/util/topgen/templates/toplevel_memory.rs.tpl b/util/topgen/templates/toplevel_memory.rs.tpl index 0bf6e3097a1890..b813920e1ee0f5 100644 --- a/util/topgen/templates/toplevel_memory.rs.tpl +++ b/util/topgen/templates/toplevel_memory.rs.tpl @@ -70,10 +70,10 @@ pub const ${base_addr_name}: usize = ${hex_base_addr}; pub const ${size_bytes_name}: usize = ${hex_size_bytes}; % endfor +% for (subspace_name, description, subspace_range) in helper.subranges: /// MMIO Region /// -/// MMIO region excludes any memory that is separate from the module -/// configuration space, i.e. ROM, main SRAM, and flash are excluded but -/// retention SRAM, spi_device memory, or usbdev memory are included. -pub const ${helper.mmio.base_addr_name().as_c_define()}: usize = ${"0x{:X}".format(helper.mmio.base_addr)}; -pub const ${helper.mmio.size_bytes_name().as_c_define()}: usize = ${"0x{:X}".format(helper.mmio.size_bytes)}; +/// ${description} +pub const ${subspace_range.base_addr_name().as_c_define()}: usize = ${"0x{:X}".format(subspace_range.base_addr)}; +pub const ${subspace_range.size_bytes_name().as_c_define()}: usize = ${"0x{:X}".format(subspace_range.size_bytes)}; +% endfor diff --git a/util/topgen/validate.py b/util/topgen/validate.py index da214c72573209..e95664d2a36f3e 100644 --- a/util/topgen/validate.py +++ b/util/topgen/validate.py @@ -285,7 +285,10 @@ class Flash: max_pages_per_bank = 1024 def __init__(self, mem, base_addrs): - self.base_addrs = {asid: int(base, 16) for (asid, base) in base_addrs.items()} + self.base_addrs = { + asid: int(base, 16) + for (asid, base) in base_addrs.items() if asid != "cpu_visible" + } self.banks = mem.get('banks', 2) self.pages_per_bank = mem.get('pages_per_bank', 8) self.program_resolution = mem.get('program_resolution', 128)