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.Os_Lib; with Objects; use Objects; with Memories; use Memories; use Memories.Memories_Table_Package; with Memory_set; use Memory_set; with Tasks; use Tasks; with Task_Set; use Task_Set; with Systems; use Systems; with Processors; use Processors; with Processor_Set; use Processor_Set; 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 batteries; use batteries; with battery_set; use battery_set; with Processor_Interface; use Processor_Interface; with Scheduler_Interface; use Scheduler_Interface; 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 priority_assignment.rm; use priority_assignment.rm; procedure Generate_amc_monocore is sys : System; a_core : Core_Unit_Ptr; a_processor : Generic_Processor_Ptr; msg : Unbounded_String; Feasibility_Interval : Double; validate : Boolean; Actual_CPU_Usage : Float :=0.0; N_Tasks : Integer := 8; N_Different_Periods : Integer :=0; Threshold_Quality : Natural :=0; N_High_Tasks : Natural := 0; N_Medium_Tasks : Natural := 0; first_time : Boolean := True; u_values : random_tools.float_array (0 .. 7); tab_criticality : integer_array (1 .. 8) := (2,2,2,2,1,1,0,0); cpu_utilization_values : float_array(1 .. 8):= (20.0,30.0,40.0,50.0,60.0,70.0,80.0,90.0); coefficients : array (1 .. 3) of coefficient := (20,50,80); file1 : Unbounded_string; file2 : Unbounded_string; file3 : Unbounded_string; seed : Natural := 0; cpu_used_factor : Float := 1.0; begin -- Parse command line if Argument_Count /= 6 then Put ("Usage: " & Command_Name & " "); Put_Line ("N_Tasks N_Different_Periods threshold N_High_Tasks N_Medium_Tasks Filename"); GNAT.OS_Lib.OS_Exit (1); else N_Tasks := Natural'Value(Argument(1)); N_Different_Periods := Natural'Value(Argument(2)); Threshold_Quality := Natural'Value(Argument(3)); N_High_Tasks := Natural'Value(Argument(4)); N_Medium_Tasks := Natural'Value(Argument(5)); end if; u_values := gen_uunifast_with_limited_utilization(N_Tasks, cpu_utilization_values(1)/100.0); -- iterate on coefficient for coef of coefficients loop cpu_used_factor := 1.0; -- Remove the space in front of the number of coefficient file1 := To_Unbounded_String(integer(coef)'img); Delete(file1,1,1); for Target_Cpu_Usage of cpu_utilization_values loop -- Remove the space in front of the number of CPU utilization file2 := To_Unbounded_String(integer(Target_Cpu_Usage)'img); Delete(file2,1,1); -- initialize the seed value seed := 0; --for coefficient in coefficients loop for iter in 1 .. 100 loop -- Initialize the System and the Cheddar framework -- Call_Framework.initialize (False); Initialize (sys); Actual_CPU_Usage := 0.0; -- Adding Cores, Processor and address_space -- Add_core_unit (sys.Core_units, a_core, to_unbounded_string("c1"), preemptive, 0, 1, 0, 0, 0, To_Unbounded_String (""), To_Unbounded_String (""), MIXED_CRITICALITY_AMC_PROTOCOL, no_memories, empty_string, empty_string, 0, Threshold_Quality); Add_Processor (sys.Processors, a_processor, To_Unbounded_String ("processor1"), A_Core); Add_Address_Space (sys.Address_Spaces, To_Unbounded_String ("addr1"), To_Unbounded_String ("processor1"), 0, 0, 0, 0); Create_Mixedcriticality_Independant_Periodic_Taskset_System (Sys, Actual_CPU_Usage, N_Tasks, Target_Cpu_Usage, 1.0,1.0, true, N_Different_Periods, N_High_Tasks, N_Medium_Tasks, coef, Sched_Fifo, first_time, u_values, tab_criticality, cpu_used_factor, seed); first_time := false; set_priority_mixedcriticality_rm(sys.tasks, to_unbounded_string("processor1")); Calculate_feasibility_interval (sys, a_processor, validate, Feasibility_Interval, msg); -- Remove the space in front of the number of iteration file3 := To_Unbounded_String(integer(iter)'img); if iter < 10 then Replace_Element(file3,1,'0'); else Delete(file3,1,1); end if; -- declare File_Name : String := Argument(6) & "_coef_" & To_String(file1) & "_cpu_" & to_String(file2) & "_iter" & To_String(file3) & ".xmlv3"; begin write_to_xml_file (sys, File_Name); end; seed := seed + 1; end loop; cpu_used_factor := cpu_used_factor + 0.5; end loop; end loop; end Generate_amc_monocore;