= GIET_VM / Mapping = [[PageOutline]] The GIET_VM is a fully '''static operating system''' supporting clusterized, shared address space, NUMA (Non Uniform memory Acces), many-cores architectures, contening MIPS32 processors. All software objects (user applications code and data, but also kernel code and critical kernel structures such as the page tables or the processors schedulers) are statically build and loaded from disk into physical memory by the bootloader in the boot phase. The main advantage of this static approach is to provide the system designed a full control on the placement of tasks on processors but also of the data (software objects) on the distributed physical memory banks. It allows optional replication of critical objects such as kernel code, or page tables. To control this mapping, the system designer must define a mapping, as described below. == __C mapping data structure__ == A dedicated C binary data structure, is used by the GIET_VM bootloader to map one or several multi-threaded user applications on a generic, shared address space multi-processors, multi-clusters architecture. The next section describes how this this C binary structure can be generated by the ''genmap'' tool from a source description using the PYTHON language. We describe in this section this C structure. The C mapping data structure contains the following informations: 1. It contains a description of the target, clusterized, hardware architecture, with the following constraints: The clusters are organised in a 2D mesh topology, and the number of clusters is variable (can be one). The number of processors per cluster is variable (can be one). The number of physical memory banks is variable (up to one physical memory bank per cluster. Most peripherals are ''external'' and localized in one specific I/O cluster. The physical address width is between 32 and 48 bits, and is the concatenation of 3 fields: the LSB field (32 bits) define a 4 Gbits physical address space inside a single cluster. The X and Y fields (up to 8 bits for each field) define the cluster coordinate. 2. It contains a description of the user applications to be launched on the platform. An user application is characterized by a a virtual address space, called a ''vspace''. An user application can be multi-threaded, and the number of parallel tasks sharing the same address space in a given application is variable (can be one). The GIET_VM provide a specific Multi-Writer/Multi-Reader communication middleware for send/receive inter-tasks communication. Each vspace contains a variable number of virtual segments, called ''vsegs''. The number of simultaneously mapped vspaces on a given architecture is variable (can be one). 3. It contains the mapping directives: The tasks are statically allocated to processors. The various software objects (user and kernel code segments, tasks stacks, tasks heaps, communication channels, etc.) are called ''vobjs'', and are statically placed on the distributed physical memory banks (called ''psegs''), using the page tables (one page table per vspace) that define the mapping of the vsegs on the psegs. The C binary mapping data structure is defined in the [source:soft/giet_vm/giet_xml/mapping_info.h mapping_info.h] file, and is organised as the concatenation of a fixed size header, and 11 variable size arrays: * mapping_cluster_t cluster[] * mapping_pseg_t pseg[] * mapping_vspace_t vspace[] * mapping_vseg_t vseg[] * mapping_vobj_t vobj[] * mapping_task_t task[] * mapping_proc_t proc[] * mapping_irq_t irq[] * mapping_coproc_t coproc[] * mapping_cp_port_t cp_port[] * mapping_periph_t periph[] The ''map.bin'' file must be stored on disk and will be loaded in memory by the GIET_VM bootloader in the ''seg_boot_mapping'' segment. == __Python Mapping General__ == A specific mapping requires at least two python files: * The '''arch.py''' file is attached to a given hardware architecture. It describes both the (possibly generic) hardware architectures, and the mapping of the kernel software objects on this hardware architecture. * The '''appli.py''' file is attached to a given user application. It describes both the application structure (tasks and communication channels), and the mapping of the application tasks and software objects on the architecture. The various Python Classes used by these these files are defined in the [source:soft/giet_vm/giet_python/mapping.py mapping.py] file. == Python Architecture description == To define an architecture, you must use the following constructors: === Construct mapping === The Mapping constructor build a mapping object and define the target architecture general parameters: || name || mapping name == architecture name || || x_size || number of clusters in a row of the 2D mesh || || y_size || number of clusters in a column of the 2D mesh || || nprocs || number of processors per cluster || || x_width || number of bits to encode X coordinate in paddr || || y_width || number of bits to encode Y coordinate in paddr || || p_width || number of bits to encode local processor index || || paddr_width || number of bits in physical address || || coherence || Boolean true if hardware cache coherence || || irq_per_proc || number of IRQ lines between XCU and one proc (GIET_VM use only one) || || use_ramdisk || Boolean true if the architecture contains a RamDisk || || x_io || io_cluster X coordinate || || y_io || io_cluster Y coordinate || || peri_increment || virtual address increment for peripherals replicated in all clusters || || reset_address || physical base address of the ROM containing the preloader code || || ram_base ||physical memory bank base address in cluster [0,0] || || ram_size || physical memory bank size in one cluster (bytes) || === Construct external peripherals === The ''mapping.addPeriph( )'' construct adds one peripheral, and the associated physical segment. It has the following arguments: || name || peripheral name || || base || peripheral segment physical base address || || size || peripheral segment size || || ptype || Peripheral type || || subtype || Peripheral subtype || || channels || number of channels for multi-channels peripherals || || arg || optionnal argument depending on peripheral type || The Peripheral types are defined in the [source:soft/giet_vm/giet_xml/mapping_info.h mapping_info.h] and [source:soft/giet_vm/giet_python/mapping.py mapping.py] files. === Construct physical memory banks === The ''mapping.addRam( )'' construct adds one physical memory bank, and the associated physical segment. It has the following arguments: == Application description : appli.py ===