------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a GNU GPL real-time scheduling analysis tool. -- This program provides services to automatically check schedulability and -- other performance criteria of real-time architecture models. -- -- Copyright (C) 2002-2020, Frank Singhoff, Alain Plantec, Jerome Legrand, -- Hai Nam Tran, Stephane Rubini -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR CNRS 6285, Universite de Bretagne Occidentale -- -- Cheddar has been published in the "Agence de Protection des Programmes/France" in 2008. -- Since 2008, Ellidiss technologies also contributes to the development of -- Cheddar and provides industrial support. -- -- The full list of contributors and sponsors can be found in AUTHORS.txt and SPONSORS.txt -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- Contact : cheddar@listes.univ-brest.fr -- ------------------------------------------------------------------------------ -- Last update : -- $Rev$ -- $Date$ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with unbounded_strings; use unbounded_strings; with Framework_Config; use Framework_Config; with Scheduler_Interface; use Scheduler_Interface; with Processors; use Processors; with memories; use memories; use memories.Memories_Table_Package; with core_units; use core_units; with processor_interface; use processor_interface; with caches; use caches; with sets; with Ada.Numerics.Aux; use Ada.Numerics.Aux; package Processor_Set is ---------------------------------------------------------- -- Definition of a set ---------------------------------------------------------- package Generic_Processor_Set is new Sets ( Max_Element => Framework_Config.Max_Processors, Element => Generic_Processor_Ptr, Free => Free, Copy => Copy, Put => Put, xml_string => XML_String, xml_ref_string => XML_ref_String); use Generic_Processor_Set; type Processors_Set is new Generic_Processor_Set.set with private; subtype Processors_Range is Generic_Processor_Set.element_range; subtype Processors_Iterator is Generic_Processor_Set.iterator; package Generic_core_unit_Set is new Sets ( Max_Element => Framework_Config.Max_Core_Units, Element => Core_Unit_Ptr, Free => Free, Copy => Copy, Put => Put, xml_string => XML_String, xml_ref_string => XML_ref_String); use Generic_core_unit_Set; type core_units_Set is new Generic_core_unit_Set.set with private; subtype core_units_Range is Generic_core_unit_Set.element_range; subtype core_units_Iterator is Generic_core_unit_Set.iterator; ---------------------------------------------------------- -- Exceptions defined in the set package ---------------------------------------------------------- -- Raised when a given processor/core unit is not in a processor/core unit --set -- Processor_Not_Found : exception; core_unit_Not_Found : exception; -- Raised when parameters provided to Add_processor are wrong -- Invalid_Parameter : exception; -- Raised when the scheduler code of a parametric scheduler -- does not have a right syntax -- Scheduler_Syntax_Error : exception; ---------------------------------------------------------- -- I/O operations ---------------------------------------------------------- function Export_Aadl_Implementations (My_Processors : in Processors_Set) return Unbounded_String; function Export_Aadl_Declarations (My_Processors : in Processors_Set; Number_Of_Ht : in Natural) return Unbounded_String; ---------------------------------------------------------- -- Procedure to proceed modification on a set ---------------------------------------------------------- procedure Check_core_unit (Name : in Unbounded_String; Is_Preemptive : in Preemptives_Type; Quantum : in Integer; speed : in Integer; capacity : in Integer; period : in Integer; priority : in Integer; File_Name : in Unbounded_String; A_Scheduler : in Schedulers_Type; automaton_name : in Unbounded_String := empty_string; l1_cache : in Unbounded_String := empty_string; start_time : in integer :=0); procedure Add_core_unit (My_core_units : in out core_units_Set; A_core_unit : in out Core_Unit_Ptr; Name : in Unbounded_String; Is_Preemptive : in Preemptives_Type; Quantum : in Integer; speed : in Integer; capacity : in Integer; period : in Integer; priority : in Integer; File_Name : in Unbounded_String; A_Scheduler : in Schedulers_Type; Mem : in Memories_Table; automaton_name : in Unbounded_String := empty_string; l1_cache : in Unbounded_String := empty_string; start_time : in integer :=0 ); procedure Add_core_unit (My_core_units : in out core_units_Set; Name : in Unbounded_String; Is_Preemptive : in Preemptives_Type; Quantum : in Integer; speed : in Integer; capacity : in Integer; period : in Integer; priority : in Integer; File_Name : in Unbounded_String; A_Scheduler : in Schedulers_Type; Mem : in Memories_Table; automaton_name : in Unbounded_String := empty_string; l1_cache : in Unbounded_String := empty_string; start_time : in integer :=0 ); -------------------------------------------- -- Create a monocore processor -- procedure Add_Processor (My_Processors : in out Processors_Set; A_Processor : in out Generic_Processor_Ptr; Name : in Unbounded_String; a_Core : in Core_Unit_Ptr); procedure Add_Processor (My_Processors : in out Processors_Set; Name : in Unbounded_String; a_Core : in Core_Unit_Ptr); -- Check a monocore processor -- procedure Check_Processor (My_Processors : in Processors_Set; Name : in Unbounded_String; a_Core : in Core_Unit_Ptr); -- Create a multicore processor -- procedure Add_Processor (My_Processors : in out Processors_Set; A_Processor : in out Generic_Processor_Ptr; Name : in Unbounded_String; Cores : in Core_Units_Table; a_migration : migrations_type := job_level_migration_type; a_processor_type : processors_type := identical_multicores_type); procedure Add_Processor (My_Processors : in out Processors_Set; Name : in Unbounded_String; Cores : in Core_Units_Table; a_migration : migrations_type := job_level_migration_type; a_processor_type : processors_type := identical_multicores_type); -- Check a multicore processor -- procedure Check_processor (My_Processors : in Processors_Set; Name : in Unbounded_String; Cores : in Core_Units_Table; a_migration : migrations_type; a_processor_type : processors_type); -- Check if processor entities make references to core or -- procedure Check_entity_referencing_core_unit (My_Processors : in Processors_Set; a_core_unit : in core_unit_ptr); procedure Check_entity_referencing_cache (My_Processors : in Processors_Set; a_cache : in generic_cache_ptr); procedure Check_entity_referencing_cache (My_cores : in core_units_Set; a_cache : in generic_cache_ptr); --------------------------------------------- -- Delete subprograms --------------------------------------------- -- Delete all processors using the core 'a_core_unit' -- procedure Delete_core_unit (My_Processors : in Processors_Set; a_core_unit : in core_unit_ptr); --------------------------------------------------------------- -- subprograms to handle cores of processors --------------------------------------------------------------- -- return a core from a processor (any of the core set) -- function get_a_core (a_processor : Generic_Processor_Ptr) return Core_Unit_ptr; -- build a table of core units for any processor type (both monocore or -- multicore) -- function build_core_table (a_processor : Generic_Processor_Ptr) return Core_Units_Table; ------------------------------------------------------ -- Read information from a set ------------------------------------------------------ -- Get the processor pointer of the processor named "Name" -- function Search_Processor (My_Processors : in Processors_Set; Name : in Unbounded_String) return Generic_Processor_Ptr; -- Get the core unit pointer of the core unit named "Name" -- function Search_core_unit (My_core_units : in core_units_Set; Name : in Unbounded_String) return Core_Unit_Ptr; -- Get the core unit pointer of the core unit with a given id -- function Search_core_unit_by_id (My_core_units : in core_units_Set; id : in Unbounded_String) return Core_Unit_Ptr; -- Get the processor with a given id -- function Search_processor_by_id (My_Processors : in Processors_Set; id : in Unbounded_String) return Generic_Processor_Ptr; function Processor_Is_Present (My_Processors : in Processors_Set; Name : in Unbounded_String) return Boolean; function Core_Is_Present (My_Cores : in core_units_Set; Name : in Unbounded_String) return Boolean; private type Processors_Set is new Generic_Processor_Set.set with null record; type core_units_Set is new Generic_core_unit_Set.set with null record; end Processor_Set;