------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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-2023, Frank Singhoff, Alain Plantec, Jerome Legrand, -- Hai Nam Tran, Stephane Rubini -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR 6285, Université 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 README.md -- -- 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: 4589 $ -- $Date: 2023-09-29 16:02:19 +0200 (ven. 29 sept. 2023) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.Exceptions; use Ada.Exceptions; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Text_IO; use Ada.Text_IO; with Ada.Command_Line; use Ada.Command_Line; with GNAT.Command_Line; with GNAT.OS_Lib; use GNAT.OS_Lib; with call_framework; use call_framework; with call_framework_interface; use call_framework_interface; use call_framework_interface.framework_response_package; use call_framework_interface.framework_request_package; with framework; use framework; with call_scheduling_framework; use call_scheduling_framework; with multiprocessor_services; use multiprocessor_services; with multiprocessor_services_interface; use multiprocessor_services_interface; use multiprocessor_services_interface.scheduling_result_per_processor_package; with Objects; use Objects; with Tasks; use Tasks; with Task_Set; use Task_Set; use task_set.generic_task_set; with Systems; use Systems; with Processors; use Processors; with Processor_Set; use Processor_Set; with Messages; use Messages; with Message_Set; use Message_Set; with Dependencies; use Dependencies; with networks; use networks; with Address_Spaces; use Address_Spaces; with Address_Space_Set; use Address_Space_Set; with Core_Units; use Core_Units; use Core_Units.Core_Units_Table_Package; with processor_set; use processor_set; use processor_set.generic_processor_set; with parameters; use parameters; with parameters.extended; use parameters.extended; use parameters.framework_parameters_table_package; with systems; use systems; with Processor_Interface; use Processor_Interface; with Scheduler_Interface; use Scheduler_Interface; with version; use version; with unbounded_strings; use unbounded_strings; use unbounded_strings.strings_table_package; use unbounded_strings.unbounded_string_list_package; with Random_Tools; use Random_Tools; with architecture_factory; use architecture_factory; with unbounded_strings; use unbounded_strings; with call_framework; use call_framework; with feasibility_test.feasibility_interval; use feasibility_test.feasibility_interval; with doubles; use doubles; with scheduling_analysis; use scheduling_analysis; with scheduling_analysis.extended; use scheduling_analysis.extended; with scheduling_analysis.extended.task_analysis; use scheduling_analysis.extended.task_analysis; use scheduling_analysis.extended.task_occurence_table_package; with time_unit_events; use time_unit_events; use time_unit_events.time_unit_lists_package; use time_unit_events.time_unit_package; procedure amanite is -- A set of variables required to call the framework -- response_list : framework_response_table; request_list : framework_request_table; a_request : framework_request; a_param : parameter_ptr; sys : System; project_file_dir_list : unbounded_string_list; project_file_list : unbounded_string_list; msg : Unbounded_String; Feasibility_Interval : Double; validate : Boolean; a_processor : Generic_Processor_Ptr; Output_EV_File_Name : Unbounded_String; F : File_Type; i : integer := 1; my_iterator_t : tasks_iterator; my_iterator_p : processors_iterator; my_iterator_m : messages_iterator; a_task : generic_task_ptr; a_message : generic_message_ptr; --a_msg : periodic_message_ptr; type Dependency_Array is array(1..10) of Dependency_Ptr; My_Dependencies : Dependency_Array; type noc_array is array(1..10) of NOC_Network; my_noc : noc_array; type generic_net_array is array(1..3) of Generic_Network; generic_net : generic_net_array; type bus_net_array is array(1..4) of Bus_Network; bus_net: bus_net_array; type position_net_array is array(1..2) of Position; pos_net:position_net_array; type spacewire_net_array is array (1..10) of Spacewire_Network; space_net: spacewire_net_array; procedure compute_scheduling is begin a_processor := search_processor (sys.processors, to_unbounded_string ("E1")); Calculate_feasibility_interval (sys, a_processor, validate, Feasibility_Interval, msg); Put_Line ("Feasibility_Interval : " & Feasibility_Interval'Img); -- Compute the scheduling on the period given by the argument -- initialize (response_list); initialize (request_list); initialize (a_request); -- Simulation protocol selection a_request.statement := scheduling_simulation_time_line; a_param := new parameter (integer_parameter); a_param.parameter_name := To_Unbounded_String ("period"); a_param.integer_value := integer (feasibility_interval); add (a_request.param, a_param); a_param := new parameter (boolean_parameter); a_param.parameter_name := To_Unbounded_String ("schedule_with_offsets"); a_param.boolean_value := True; add (a_request.param, a_param); a_param := new parameter (boolean_parameter); a_param.parameter_name := To_Unbounded_String ("schedule_with_precedencies"); a_param.boolean_value := True; add (a_request.param, a_param); a_param := new parameter (boolean_parameter); a_param.parameter_name := To_Unbounded_String ("schedule_with_resources"); a_param.boolean_value := True; add (a_request.param, a_param); a_param := new parameter (boolean_parameter); a_param.parameter_name := To_Unbounded_String ("schedule_with_jitters"); a_param.boolean_value := False; add (a_request.param, a_param); a_param := new parameter (boolean_parameter); a_param.parameter_name := To_Unbounded_String ("minimize_preemption"); a_param.boolean_value := False; add (a_request.param, a_param); a_param := new parameter (boolean_parameter); a_param.parameter_name := To_Unbounded_String ("discard_missed_deadline"); a_param.boolean_value := False; add (a_request.param, a_param); a_param := new parameter (integer_parameter); a_param.parameter_name := To_Unbounded_String ("seed_value"); a_param.integer_value := 0; add (a_request.param, a_param); a_param := new parameter (boolean_parameter); a_param.parameter_name := To_Unbounded_String ("predictable"); a_param.boolean_value := True; add (a_request.param, a_param); add (request_list, a_request); sequential_framework_request (sys, request_list, response_list); initialize (a_request); initialize (a_request.param); initialize (response_list); initialize (request_list); a_param := new parameter (boolean_parameter); a_param.parameter_name := To_Unbounded_String ("worst_case"); a_param.boolean_value := True; add (a_request.param, a_param); a_param := new parameter (boolean_parameter); a_param.parameter_name := To_Unbounded_String ("best_case"); a_param.boolean_value := True; add (a_request.param, a_param); a_param := new parameter (boolean_parameter); a_param.parameter_name := To_Unbounded_String ("average_case"); a_param.boolean_value := True; add (a_request.param, a_param); a_request.target := a_processor.name; a_request.statement := scheduling_simulation_response_time; add (request_list, a_request); sequential_framework_request (sys, request_list, response_list); for j in 0 .. response_list.nb_entries - 1 loop Put_Line (To_String (response_list.entries (j).title)); Put_Line (To_String (response_list.entries (j).text)); end loop; Put_Line("Export event table"); Write_To_Xml_File (framework.Sched, Sys, Output_EV_File_Name); end compute_scheduling; begin -- Initialize the Cheddar framework -- call_framework.initialize (False); -- Parse command line -- if Argument_Count /= 1 then Put ("Usage: " & Command_Name & " "); Put_Line ("InputFilename"); GNAT.OS_Lib.OS_Exit (1); end if; -- Read the XML project file -- initialize (project_file_list); declare File_Name : String := Argument (1); begin Output_EV_File_Name := File_Name & to_unbounded_string(".schedule"); systems.read_from_xml_file (sys, project_file_dir_list, file_name); end; -- Compute_Scheduling; -- -- Afficher le contenu du modele Cheddar --Afficher les tasks if not is_empty (sys.tasks) then reset_iterator (sys.tasks, my_iterator_t); loop current_element (sys.tasks, a_task, my_iterator_t); put_line("task name : " & to_string(a_task.name)); put_line("task capacity : " & natural'image(a_task.capacity)); put_line("task deadline : " & natural'image(a_task.deadline)); put_line("task cpu_name : " & to_string(a_task.cpu_name)); exit when is_last_element (sys.tasks, my_iterator_t); next_element (sys.tasks, my_iterator_t); end loop; end if; --Afficher les processors if not is_empty (sys.processors) then reset_iterator (sys.processors, my_iterator_p); loop current_element (sys.processors, a_processor, my_iterator_p); put_line("processor name: " & to_string(a_processor.name)); put_line("processor Type: "& Processors_type'image(a_processor.processor_type)); exit when is_last_element (sys.processors, my_iterator_p); next_element (sys.processors, my_iterator_p); end loop; end if ; -- Afficher les messages if not is_empty (sys.messages) then reset_iterator (sys.messages, my_iterator_m); loop current_element (sys.messages, a_message, my_iterator_m); put_line("Message Type: " & Messages_Type'image(a_message.message_type)); put_line("deadline: "& natural'image(a_message.deadline)); put_line("size: "& natural'image(a_message.size)); put_line("response_time: "& natural'image(a_message.response_time)); put_line("communication_time: "& natural'image(a_message.communication_time)); --put_line("period: "& natural'image(a_msg.period)); --put_line("Jitter: "& natural'image(a_msg.jitter)); exit when is_last_element (sys.messages, my_iterator_m); next_element (sys.messages, my_iterator_m); end loop; end if; --Afficher les dependenciess for I in My_Dependencies'Range loop Initialize(My_Dependencies(I)); end loop; for I in My_Dependencies'range loop Put(My_dependencies(I)); end loop; -- Affichez les networks for I in my_noc'range loop Put(my_noc(I)); end loop; for I in generic_net'range loop put(generic_net(I)); end loop; for I in bus_net'range loop put(bus_net(I)); end loop; for I in pos_net'range loop put(pos_net(I)); end loop; for I in space_net'range loop put(space_net(I)); end loop; end amanite;