====== Services & Capabilities ====== This page details what are Capabilities, Services, Client and Service Interface. The list of the available capabilities on the repository are presented on the [[services:services:list|available capabilities]] page. ===== Definition ===== Within the UNISIM environment, timing simulators are defined as a set of modules corresponding to the hardware blocks composing the simulated architecture. But some other kind of components can also be reused across simulator, while not corresponding to some hardware component, such as the //Elf Loader// allowing to load the simulated benchmark in a //user level-simulator//, the component performing the //system-call translation//, the one gathering some information about power consumption, and so on... We define as **Capabilities** all those functionalities beyond performance evaluation. In the figure below, the modules composing the simulator are in yellow, whereas the capabilities are in blue. {{ services:service_overview.png }} ===== Category of services ===== Services can be split into different sub-categories: * **Initialization services:** Those services are mostly used during the initialization phase of the simulator, before starting the main simulation loop. \\ __example:__ The //Loader services// for instance will load the simulated program to the main memory of the simulator. * **System Services:** System services are performing all the action related to the operating system in the case of //user-level simulation//, allowing to consider all the system related functionalities as external to the simulator. \\ __example:__ The //PowerPC Syscall translator service// translate the system calls of the PowerPC architecture to the host machine. This service is called each time a //syscall// instruction from the ISA is executed. * **Optional Services:** The optional services are providing an additional functionality that can be either turned on or off. \\ __example:__ The //debugger services// or the //power cache estimator// services are two optional services that will perform power estimation or step-by-step execution only if they are plugged. ===== Capabilities, Services, Clients & Interfaces ===== Let's consider the simple simulator below, composed of a //CPU module// connected to a //Memory module//, with a //Loader Capability// and a //Power PC System-Call Capability//. {{ services:service_without_connection.png }} A notion of Client / Server is associated with capabilities: * For instance, the //Loader Capability// needs to be able to write some data in the //Memory Module//. To do so the //Memory Module// should **serve** the //Loader Capability// with some methods allowing to directly write into the memory. \\ For those communications, the //Memory Module// is the **service** and the //Loader Capability// is the **client**. * When a syscall instruction is to be executed by the CPU, it relies on the //Syscall Module//. So the //Syscall Capability// should **serve** the //CPU Module// with some methods allowing to perform syscalls. \\ For those communications, the //Syscall Capability// is the **service** and the //CPU Module// is the **client**. * While executing a system call, the //Syscall Capability// may perform some memory accesses. To do so, the //Memory Module// should **serve** the //Syscall Capability// allowing to perform direct reads and write. \\ For those communications, the //Memory Module// is the **server** and the //Syscall Capability// is the **client**. The figure below summarize all those communications related to those Client / Service interactions: {{ services:service_with_connection.png }} A set of methods associated with a client / service interaction is called an **interface**. The figure above defines two different interfaces: * the //Syscall Interface// providing a ''PerformSyscall'' method. * the //ReadWrite Interface// providing a ''Read'' and a ''Write'' methods. Services and clients are indeed related to an interface, and should only communicate if they have a matching interface. In the example above: * The //CPU module// is a client for the //Syscall Interface//. * The //Syscall Capability// is a server for the //Syscall Interface//. * The //Memory Module// is a server for the //ReadWrite Interface//. * The //Loader Capability// and the //Syscall Capability// are client of the //ReadWrite Interface//.