------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a GNU GPL real time scheduling analysis tool. -- This program provides services to automatically check performances -- of real time architectures. -- -- Copyright (C) 2002-2010, by Frank Singhoff, Alain Plantec, Jerome Legrand -- -- The Cheddar project was started in 2002 by -- the LISyC Team, University of Western Britanny. -- -- Since 2008, Ellidiss technologies also contributes to the development of -- Cheddar and provides industrial support. -- -- 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: 431 $ -- $Date: 2011-04-24 13:35:23 +0200 (dim., 24 avr. 2011) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.Text_IO; use Ada.Text_IO; with Sax.Readers; use Sax.Readers; with Sax.Exceptions; use Sax.Exceptions; with Sax.Locators; use Sax.Locators; with Sax.Attributes; use Sax.Attributes; with Unicode.CES; use Unicode.CES; with Unicode; use Unicode; with Offsets; use Offsets; use Offsets.Offsets_Table_Package; with Parameters; use Parameters; use Parameters.User_Defined_Parameters_Table_Package; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Strings; use Strings; with Unbounded_Strings; use Unbounded_Strings; with Dependencies; use Dependencies; with Resources; use Resources; use Resources.resource_accesses; with Resource_Set; use Resource_Set; use Resource_Set.Generic_Resource_Set; with Event_Analyzer_Set; use Event_Analyzer_Set; use Event_Analyzer_Set.Generic_Event_Analyzer_Set; with Address_Spaces; use Address_Spaces; with Address_Space_Set; use Address_Space_Set; use Address_Space_Set.Generic_Address_Space_Set; with Processors; use Processors; with core_units; use core_units; use core_units.Core_Units_Table_Package; with Queueing_Systems; use Queueing_Systems; with Time_Unit_Events; use Time_Unit_Events; use Time_Unit_Events.Time_Unit_Package; with Scheduling_Analysis; use Scheduling_Analysis; with Scheduler_Interface; use Scheduler_Interface; with Processor_Interface; use Processor_Interface; with Task_Dependencies; use Task_Dependencies; with Network_Set; use Network_Set; with Ada.Strings.Maps; use Ada.Strings.Maps; with Networks; use Networks; use Networks.Positions_Table_Package; use Network_Set.Generic_Network_Set; with Debug; use Debug; with xml_architecture_io;use xml_architecture_io; with xml_architecture_parser_interface;use xml_architecture_parser_interface; with tasks; use tasks; use tasks.Generic_Task_List_Package; with task_Set; use task_Set; with Task_Groups; use task_groups; with Task_Group_Set; use Task_Group_Set; use task_Set.Generic_task_Set; with buffers; use buffers; use buffers.buffer_roles_package; with buffer_set; use buffer_set; use buffer_set.generic_buffer_set; with dependencies; use dependencies; with messages; use messages; with message_set; use message_set; with resource_set; use resource_set; with deployments; use deployments; with deployment_set; use deployment_set; use deployment_Set.Generic_deployment_Set; with objects; use objects; use objects.Generic_Object_Set_Package; with CFGs; use CFGs; with CFG_Set; use CFG_Set; with CFG_Nodes; use CFG_Nodes; with CFG_Nodes; use CFG_Nodes.CFG_Nodes_Table_Package; with CFG_Node_Set.Basic_Block_Set; use CFG_Node_Set.Basic_Block_Set; with CFG_Node_Set; use CFG_Node_Set; with Basic_Blocks; use Basic_Blocks; with CFG_Edges; use CFG_Edges; with CFG_Edges; use CFG_Edges.CFG_Edges_Table_Package; with CFG_Edge_Set; use CFG_Edge_Set; with Caches; use Caches; with Caches; use Caches.Cache_Blocks_Table_Package; with Cache_Set; use Cache_Set; with Cache_Block_Set; use Cache_Block_Set; with Cache_Access_Profile_Set; use Cache_Access_Profile_Set; package body Xml_generic_Parsers.architecture is -------------------------------------------------------------------- -- Global variable of the parser -------------------------------------------------------------------- -- Variable used by the XML parser to store content of XML tag -- component_id : unbounded_string; component_ref : unbounded_string; as1 : Address_space_io; co1 : core_unit_io; mco1 : multi_cores_processor_io; nco1 : mono_core_processor_io; ta1 : parametric_task_io; ft1 : frame_task_io; tg1 : Generic_Task_Group_io; re1 : pcp_resource_io; bu1 : buffer_io; dep1 : dependency_io; me1 : periodic_message_io; sb1 : static_deployment_io; db1 : dynamic_deployment_io; sched1 : scheduling_parameters_io; ea1 : Event_Analyzer_io; noc1 : noc_network_io; icache_i : Instruction_Cache_io; dcache_i : Data_Cache_io; cache_block_i : Cache_Block_io; cfg_i : cfg_io; cfg_node_i : CFG_Node_io; cfg_edge_i : CFG_Edge_io; basic_block_i : Basic_Block_io; cache_access_profile_i : Cache_Access_Profile_io; -- Store all offset of a task -- an_offset_type : offset_type_io; an_offset : offsets_table; -- Store parameters of a NOC -- positions : positions_Table; a_position : position_io; -- Store parameters of a message or a task -- param : User_Defined_Parameters_Table; a_param : parameter_io; -- Store the list of critical section of a resource entity -- a_critical_section : critical_section_io; a_critical_section_List : resource_accesses_Table; -- Store buffer users for buffer entities -- a_buffer_role : buffer_role_io; roles : buffer_roles_Table; -- Store the list of task of a group of task entity -- a_task_list : Generic_Task_List; -- Store the Task sets of deployment entities -- consumer_entities_set : Generic_Objects_Set; resource_entities_set : Generic_Objects_Set; -- Variable to store indexes of indexed_table entities -- Index_value : unbounded_string; -- Variables to allocate entities -- entity1 : Generic_object_Ptr; core1 : Core_Unit_Ptr; address_space1 : Address_Space_Ptr; processor1 : Generic_Processor_Ptr; a_core_unit_table : Core_Units_Table; task1 : generic_task_ptr; task_group1 : generic_task_group_ptr; resource1 : generic_resource_ptr; buffer1 : buffer_ptr; message1 : generic_message_ptr; cache1 : generic_cache_ptr; cfg1 : CFG_Ptr; cfg_node1 : CFG_Node_Ptr; cfg_edge1 : CFG_Edge_Ptr; cache_access_profile1 : Cache_Access_Profile_Ptr; cache_block1 : Cache_Block_Ptr; a_cfg_nodes_table : CFG_Nodes_Table; a_cfg_edges_table : CFG_Edges_Table; a_cache_blocks_table : Cache_Blocks_Table; ucbs_table : Cache_Blocks_Table; ecbs_table : Cache_Blocks_Table; -- Indicate when where we are during the parsing -- xml_unit : xml_units := core_units_xml; xml_unit_attribute : xml_units; -------------------------------------------------------------------- -- XML parser for record like entity of the Cheddar Meta model -------------------------------------------------------------------- -- consumer_entities and resource_entities -- procedure Start_Element( Handler: in out Xml_Generic_Parser; obj : in out Generic_Objects_Set; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := ""; Atts : Sax.Attributes.Attributes'Class) is begin if To_String (To_Lower (Qname)) = "consumer_entities" then initialize(obj); xml_unit := consumer_entities_xml; end if; end Start_Element; procedure Start_Element2( Handler: in out Xml_Generic_Parser; obj : in out Generic_Objects_Set; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := ""; Atts : Sax.Attributes.Attributes'Class) is begin if To_String (To_Lower (Qname)) = "resource_entities" then initialize(obj); xml_unit := resource_entities_xml; end if; end Start_Element2; -- Buffer records -- procedure Start_Element( Handler: in out Xml_Generic_Parser; obj : in out buffer_roles_table; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := ""; Atts : Sax.Attributes.Attributes'Class) is begin if To_String (To_Lower (Qname)) = "roles" then initialize(obj); end if; end Start_Element; procedure End_Element( Handler : in out Xml_generic_parser; obj : in out buffer_role_io; obj_table : in out buffer_roles_table; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := "") is item : buffer_role; begin End_Element(handler, obj, namespace_uri, local_name, qname); if To_String (To_Lower (Qname)) = "buffer_role" then item.the_role:=obj.the_role; item.size:=obj.size; item.time:=obj.time; item.timeout:=obj.timeout; item.amplitude_function := obj.amplitude_function; Put_Debug("======" & obj.amplitude_function); add(obj_table, index_value, item); end if; end End_Element; -- Position records -- procedure Start_Element( Handler: in out Xml_Generic_Parser; obj : in out positions_table; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := ""; Atts : Sax.Attributes.Attributes'Class) is begin if To_String (To_Lower (Qname)) = "processor_positions" then initialize(obj); end if; end Start_Element; procedure End_Element( Handler : in out Xml_generic_parser; obj : in out position_io; obj_table : in out positions_table; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := "") is item : position; begin End_Element(handler, obj, namespace_uri, local_name, qname); if To_String (To_Lower (Qname)) = "position" then item.x:=obj.x; item.y:=obj.y; add(obj_table, index_value, item); end if; end End_Element; -- Resource records -- procedure Start_Element( Handler: in out Xml_Generic_Parser; obj : in out resource_accesses_table; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := ""; Atts : Sax.Attributes.Attributes'Class) is begin if To_String (To_Lower (Qname)) = "critical_sections" then initialize(obj); end if; end Start_Element; procedure End_Element( Handler : in out Xml_generic_parser; obj : in out critical_section_io; obj_table : in out resource_accesses_table; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := "") is item : critical_section; begin End_Element(handler, obj, namespace_uri, local_name, qname); if To_String (To_Lower (Qname)) = "critical_section" then item.task_end:=obj.task_end; item.task_begin:=obj.task_begin; add(obj_table, index_value, item); end if; end End_Element; -- Offset records -- procedure Start_Element( Handler: in out Xml_Generic_Parser; obj : in out Offsets_table; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := ""; Atts : Sax.Attributes.Attributes'Class) is begin if To_String (To_Lower (Qname)) = "offsets" then initialize(obj); end if; end Start_Element; procedure End_Element( Handler : in out Xml_generic_parser; obj : in out Offset_type_io; obj_table : in out Offsets_table; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := "") is item : Offset_Type; begin End_Element(handler, obj, namespace_uri, local_name, qname); if To_String (To_Lower (Qname)) = "offset_type" then item.activation:=obj.activation; item.offset_value:=obj.offset_value; add(obj_table, item); end if; end End_Element; -- User defined parameter records -- procedure Start_Element( Handler: in out Xml_Generic_Parser; obj : in out User_Defined_Parameters_Table; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := ""; Atts : Sax.Attributes.Attributes'Class) is begin if To_String (To_Lower (Qname)) = "parameters" then initialize(obj); end if; end Start_Element; procedure End_Element( Handler : in out Xml_generic_parser; obj : in out parameter_io; obj_table : in out User_Defined_Parameters_Table; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := "") is item : parameter_ptr; begin End_Element(handler, obj, namespace_uri, local_name, qname); if To_String (To_Lower (Qname)) = "parameter" then if obj.type_of_parameter = double_parameter then item:= new parameter(double_parameter); item.double_value:=obj.double_value; end if; if obj.type_of_parameter = integer_parameter then item:= new parameter(integer_parameter); item.integer_value:=obj.integer_value; end if; if obj.type_of_parameter = string_parameter then item:= new parameter(string_parameter); item.string_value:=obj.string_value; end if; if obj.type_of_parameter = boolean_parameter then item:= new parameter(boolean_parameter); item.boolean_value:=obj.boolean_value; end if; item.parameter_name:=obj.parameter_name; add(obj_table, item); end if; end End_Element; -- Task list -- procedure Start_Element( Handler: in out Xml_Generic_Parser; obj : in out Generic_Task_List; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := ""; Atts : Sax.Attributes.Attributes'Class) is use Generic_Task_List_Package; begin if To_String (To_Lower (Qname)) = "task_list" then initialize(obj); end if; end Start_Element; -- Initialize all data -- procedure Initialize (Handler : in out Xml_architecture_Parser) is begin initialize(as1); initialize(co1); initialize(mco1); initialize(nco1); initialize(ta1); initialize(ft1); initialize(noc1); initialize(tg1); initialize(re1); initialize(bu1); initialize(me1); initialize(dep1); initialize(sched1); initialize(ea1); initialize(sb1); initialize(db1); Initialize(icache_i); Initialize(dcache_i); Initialize(cfg_i); Initialize(cfg_node_i); Initialize(cfg_edge_i); Initialize(basic_block_i); Initialize(cache_block_i); Initialize(cache_access_profile_i); initialize(a_core_unit_table); initialize(an_offset_type); initialize(an_offset); initialize(param); initialize(a_param); initialize(a_position); initialize(positions); initialize(a_critical_section); initialize(a_critical_section_list); initialize(A_Task_List); initialize(a_buffer_role); initialize(roles); initialize(consumer_entities_set); initialize(resource_entities_set); Initialize(a_cfg_nodes_table); Initialize(a_cfg_edges_table); Initialize(a_cache_blocks_table); Initialize(ucbs_table); Initialize(ecbs_table); handler.current_parameter:=1; end Initialize; procedure Start_Document (Handler : in out Xml_architecture_Parser) is begin Initialize (Handler); Initialize (Handler.Parsed_System); end Start_Document; procedure Start_Element (Handler : in out Xml_architecture_Parser; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := ""; Atts : Sax.Attributes.Attributes'Class) is begin handler.current_parameter:=1; if (To_String (To_Lower (Qname)) = "tasks") then xml_unit:=tasks_xml; end if; if (To_String (To_Lower (Qname)) = "task_groups") then xml_unit:=task_groups_xml; end if; if (To_String (To_Lower (Qname)) = "core_units") then xml_unit:=core_units_xml; end if; if (To_String (To_Lower (Qname)) = "processors") then xml_unit:=processors_xml; end if; if (To_String (To_Lower (Qname)) = "address_spaces") then xml_unit:=address_spaces_xml; end if; if (To_String (To_Lower (Qname)) = "buffers") then xml_unit:=buffers_xml; end if; if (To_String (To_Lower (Qname)) = "resources") then xml_unit:=resources_xml; end if; if (To_String (To_Lower (Qname)) = "dependencies") then xml_unit:=dependencies_xml; end if; if (To_String (To_Lower (Qname)) = "networks") then xml_unit:=networks_xml; end if; if (To_String (To_Lower (Qname)) = "messages") then xml_unit:=messages_xml; end if; if (To_String (To_Lower (Qname)) = "deployments") then xml_unit:=deployments_xml; end if; if (To_String (To_Lower (Qname)) = "event_analyzers") then xml_unit:=event_analyzers_xml; end if; if (To_String (To_Lower (Qname)) = "consumer_entities") then xml_unit:= consumer_entities_xml; end if; if (To_String (To_Lower (Qname)) = "resource_entities") then xml_unit:= resource_entities_xml; end if; if (To_String (To_Lower (Qname)) = "caches") then xml_unit:= caches_xml; end if; if (To_String (To_Lower (Qname)) = "cache_blocks" AND xml_unit /= caches_xml) then xml_unit := cache_blocks_xml; end if; if (To_String (To_Lower (Qname)) = "cfg_nodes") then xml_unit:= cfg_nodes_xml; end if; if (To_String (To_Lower (Qname)) = "cfg_edges") then xml_unit:= cfg_edges_xml; end if; if (To_String (To_Lower (Qname)) = "cfgs") then xml_unit:= cfgs_xml; end if; if (To_String (To_Lower (Qname)) = "cache_access_profiles") then xml_unit:= cache_access_profile_xml; end if; if (To_String (To_Lower (Qname)) = "ucbs") then xml_unit_attribute := ucbs_xml; end if; if (To_String (To_Lower (Qname)) = "ecbs") then xml_unit_attribute := ecbs_xml; end if; start_element(xml_generic_parser(handler), nco1, namespace_uri,local_name,qname,atts); Start_Element(xml_generic_parser(handler), component_ref, component_id, namespace_uri, local_name, qname, atts); Start_Element(xml_generic_parser(handler), nco1, namespace_uri, local_name, qname, atts); start_element(xml_generic_parser(handler), a_task_list, namespace_uri,local_name,qname,atts); Start_Element(xml_generic_parser(handler), an_offset, namespace_uri, local_name, qname, atts); Start_Element(xml_generic_parser(handler), a_critical_section_list, namespace_uri, local_name, qname, atts); Start_Element(xml_generic_parser(handler), positions, namespace_uri, local_name, qname, atts); Start_Element(xml_generic_parser(handler), a_task_list, namespace_uri, local_name, qname, atts); Start_Element(xml_generic_parser(handler), roles, namespace_uri, local_name, qname, atts); Start_Element(xml_generic_parser(handler), consumer_entities_set, namespace_uri, local_name, qname, atts); Start_Element2(xml_generic_parser(handler), resource_entities_set, namespace_uri, local_name, qname, atts); Start_Element(xml_generic_parser(handler), dep1, namespace_uri, local_name, qname, atts); Start_Element(xml_generic_parser(handler), param, namespace_uri, local_name, qname, atts); end Start_Element; procedure End_Element (Handler : in out Xml_architecture_Parser; Namespace_Uri : Unicode.CES.Byte_Sequence := ""; Local_Name : Unicode.CES.Byte_Sequence := ""; Qname : Unicode.CES.Byte_Sequence := "") is period : Integer; Task_Iterator : Generic_Task_Iterator; A_Task : Generic_Task_Ptr; use Generic_Task_List_Package; -- Variables are not used. -- a_processor : generic_processor_ptr; -- a_cache : generic_cache_ptr; -- an_address_space : address_space_ptr; -- a_network : network_ptr; begin ------------------------------ -- Parse component attributes ------------------------------ end_element(xml_generic_parser(handler), ea1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), sched1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), as1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), co1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), nco1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), mco1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), ta1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), ft1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), tg1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), re1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), bu1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), dep1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), sb1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), noc1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), db1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), me1, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), icache_i, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), dcache_i, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), cache_block_i, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), cfg_i, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), cfg_node_i, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), cfg_edge_i, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), basic_block_i, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), cache_access_profile_i, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), index_value, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), an_offset_type, an_offset, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), a_critical_section, a_critical_section_list, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), a_position, positions, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), a_buffer_role, roles, namespace_uri,local_name,qname); end_element(xml_generic_parser(handler), a_param, param, namespace_uri,local_name,qname); ------------------------------ -- Parse Deployment ------------------------------ if (xml_unit = consumer_entities_xml) or (xml_unit = resource_entities_xml) then if (To_string(To_lower (Qname)) = "multi_cores_processor") or (To_String (To_Lower (Qname)) = "mono_core_processor") then Put_Debug ("Add processor ref " & component_ref); entity1 := Generic_object_Ptr(Search_Processor_by_id(Handler.Parsed_System.processors, component_ref)); if (xml_unit = resource_entities_xml) then add(resource_entities_set, entity1); else add(consumer_entities_set, entity1); end if; end if; if To_String (To_Lower (Qname)) = "core_unit" then Put_Debug ("Add core unit ref " & component_ref); entity1:=generic_object_ptr(search_core_unit_by_id(Handler.Parsed_System.core_units, component_ref)); if (xml_unit = resource_entities_xml) then add(resource_entities_set, entity1); else add(consumer_entities_set, entity1); end if; end if; if (To_String (To_Lower (Qname)) = "periodic_task") or (To_String (To_Lower (Qname)) = "aperiodic_task") or (To_String (To_Lower (Qname)) = "sporadic_task") or (To_String (To_Lower (Qname)) = "parametric_task") or (To_String (To_Lower (Qname)) = "scheduling_task") or (To_String (To_Lower (Qname)) = "poisson_task") or (To_String (To_Lower (Qname)) = "frame_task") then Put_Debug ("Add task ref " & component_ref); entity1:=Generic_object_Ptr(Search_Task_by_id(Handler.Parsed_System.Tasks, component_ref)); if (xml_unit = resource_entities_xml) then add(resource_entities_set, entity1); else add(consumer_entities_set, entity1); end if; end if; if (To_String (To_Lower (Qname)) = "np_resource") or (To_String (To_Lower (Qname)) = "pip_resource") or (To_String (To_Lower (Qname)) = "pcp_resource") or (To_String (To_Lower (Qname)) = "ipcp_resource") then Put_Debug ("Add resource ref " & component_ref); entity1:=generic_object_ptr(search_resource_by_id(handler.parsed_system.resources, component_ref)); if (xml_unit = resource_entities_xml) then add(resource_entities_set, entity1); else add(consumer_entities_set, entity1); end if; end if; if To_String (To_Lower (Qname)) = "static_deployment" then Put_Debug ("Add static deployment " & sb1.name & " " & component_id); Add_deployment (Handler.Parsed_System.deployments, sb1.name, resource_entities_set, consumer_entities_set, sb1.allocation_description); sb1.cheddar_private_id:=component_id; Initialize (Handler); end if; if To_String (To_Lower (Qname)) = "dynamic_deployment" then Put_Debug ("Add dynamic deployment " & db1.name & " " & component_id); Add_deployment (Handler.Parsed_System.deployments, db1.name, resource_entities_set, consumer_entities_set, empty_string, sched1.capacity, sched1.period, sched1.priority, sched1.preemptive_type, sched1.quantum, sched1.user_defined_scheduler_source_file_name, sched1.scheduler_type, sched1.automaton_name); db1.cheddar_private_id:=component_id; Initialize (Handler); end if; end if; ------------------------------ -- Parse Software components ------------------------------ if (To_String (To_Lower (Qname)) = "event_analyzer") then Add_event_analyzer (Handler.Parsed_System.event_analyzers, ea1.Name, ea1.event_analyzer_source_file_name); ea1.cheddar_private_id:=component_id; Initialize (Handler); end if; if ( To_String (To_Lower (Qname)) = "generic_network" or To_String (To_Lower (Qname)) = "noc_network" ) then if xml_unit=networks_xml then Put_Debug ("Add network " & noc1.name & " " & component_id); Add_network (Handler.Parsed_System.networks, noc1.Name, noc1.network_architecture_type, noc1.network_delay, noc1.Routing_Protocol, positions); noc1.cheddar_private_id:=component_id; Initialize (Handler); end if; end if; if (To_String (To_Lower (Qname)) = "periodic_message") or (To_String (To_Lower (Qname)) = "aperiodic_message") then Put_Debug ("Add message " & me1.name & " " & component_id); Add_Message (Handler.Parsed_System.messages, message1, me1.Name, me1.size, me1.Period, me1.Deadline, me1.Jitter, Param, me1.response_time, me1.communication_time); message1.cheddar_private_id:=component_id; Initialize (Handler); end if; if (To_String (To_Lower (Qname)) = "transaction_task_group") or (To_String (To_Lower (Qname)) = "multiframe_task_group") then Put_Debug ("Add task group " & tg1.Name & " " & component_id); Add_Task_Group (Handler.Parsed_System.task_groups, task_group1, tg1.Name, tg1.task_group_type, tg1.Start_Time, tg1.Period, tg1.Deadline, tg1.Jitter, tg1.Priority, tg1.Criticality); task_group1.cheddar_private_id := component_id; if not is_empty (a_task_list) then reset_head_iterator (a_task_list, Task_Iterator); loop current_element (task_group1.task_list, A_Task, Task_Iterator); Add_Task_To_Group(task_group1, A_Task); exit when is_tail_element (a_task_list, Task_Iterator); next_element (a_task_list, Task_Iterator); end loop; end if; Initialize(Handler); end if; if (xml_unit = tasks_xml) then if (To_String (To_Lower (Qname)) = "periodic_task") or (To_String (To_Lower (Qname)) = "aperiodic_task") or (To_String (To_Lower (Qname)) = "sporadic_task") or (To_String (To_Lower (Qname)) = "parametric_task") or (To_String (To_Lower (Qname)) = "scheduling_task") or (To_String (To_Lower (Qname)) = "poisson_task") or (To_String (To_Lower (Qname)) = "frame_task") then Put_Debug ("Add task " & ta1.Name & " " & component_id); if (To_String (To_Lower (Qname)) = "frame_task") then period := ft1.interarrival; else period := ta1.period; end if; Check_entity_location(handler.parsed_system, ta1.name, ta1.cpu_name, ta1.Address_Space_Name); -- a_processor:=search_processor(handler.parsed_system.processors, ta1.Cpu_Name); -- an_address_space:=search_address_space(handler.parsed_system.address_spaces, ta1.address_space_Name); Add_Task (Handler.Parsed_System.tasks, task1, ta1.Name, ta1.Cpu_Name, ta1.Address_Space_Name, ta1.Task_Type, ta1.Start_Time, ta1.Capacity, period, ta1.Deadline, ta1.Jitter, ta1.Blocking_Time, ta1.Priority, ta1.Criticality, ta1.Policy, an_Offset, ta1.Stack_Memory_Size, ta1.Text_Memory_Size, Param, ta1.activation_Rule, ta1.Seed, ta1.Predictable, ta1.Context_Switch_Overhead, ta1.every, ta1.cache_access_profile_name, ta1.cfg_name); Put_Debug ("Added task " & ta1.Name & " " & component_id); -- task1.cheddar_private_id:=component_id; Initialize (Handler); end if; end if; if (xml_unit = task_groups_xml) then if (To_String (To_Lower (Qname)) = "periodic_task") or (To_String (To_Lower (Qname)) = "aperiodic_task") or (To_String (To_Lower (Qname)) = "sporadic_task") or (To_String (To_Lower (Qname)) = "parametric_task") or (To_String (To_Lower (Qname)) = "scheduling_task") or (To_String (To_Lower (Qname)) = "poisson_task") or (To_String (To_Lower (Qname)) = "frame_task") then Put_Debug ("Add task ref " & component_ref); task1 := Generic_Task_Ptr(search_task_by_id(Handler.Parsed_System.tasks, component_ref)); add_tail(a_task_list, task1); end if; end if; if (To_String (To_Lower (Qname)) = "buffer") then Put_Debug ("Add buffer " & bu1.name & " " & component_id); check_task_buffer_roles(Handler.Parsed_System.tasks, bu1.name, roles); Check_entity_location(handler.parsed_system, bu1.name, bu1.cpu_name, bu1.Address_Space_Name); -- a_processor:=search_processor(handler.parsed_system.processors, bu1.Cpu_Name); -- an_address_space:=search_address_space(handler.parsed_system.address_spaces, bu1.address_space_Name); Add_Buffer (Handler.Parsed_System.Buffers, buffer1, bu1.Name, bu1.buffer_size, bu1.Cpu_Name, bu1.Address_Space_Name, bu1.queueing_system_type, roles, bu1.buffer_initial_data_size); Put_Debug ("Added buffer " & bu1.name & " " & component_id); buffer1.cheddar_private_id:=component_id; Initialize(Handler); end if; if (xml_unit = resources_xml) then if (To_String (To_Lower (Qname)) = "np_resource") or (To_String (To_Lower (Qname)) = "pip_resource") or (To_String (To_Lower (Qname)) = "pcp_resource") or (To_String (To_Lower (Qname)) = "ipcp_resource") then Put_Debug ("Add resource " & re1.name & " " & component_id); check_task_critical_sections(Handler.Parsed_System.tasks, re1.name, re1.cpu_name, a_critical_section_list); Check_entity_location(handler.parsed_system, re1.name, re1.cpu_name, re1.Address_Space_Name); -- a_processor:=search_processor(handler.parsed_system.processors, re1.Cpu_Name); -- an_address_space:=search_address_space(handler.parsed_system.address_spaces, re1.address_space_Name); Add_Resource (Handler.Parsed_System.Resources, resource1, re1.Name, re1.State, re1.address, re1.size, re1.Cpu_Name, re1.Address_Space_Name, re1.Protocol, a_critical_section_List, re1.Priority, re1.priority_assignment); resource1.cheddar_private_id:=component_id; Initialize(Handler); end if; end if; if (To_String (To_Lower (Qname)) = "address_space") then Put_Debug ("Add address space " & as1.name & " " & component_id); -- a_processor:=search_processor(handler.parsed_system.processors, as1.Cpu_Name); Check_hierarchical_schedulers(handler.parsed_system, as1.name, as1.cpu_name, sched1.scheduler_type); Add_Address_Space (Handler.Parsed_System.Address_Spaces, address_space1, as1.name, as1.cpu_name, as1.text_memory_size, as1.stack_memory_size, as1.data_memory_size, as1.heap_memory_size, sched1.preemptive_type, sched1.quantum, sched1.user_defined_scheduler_source_file_name, sched1.scheduler_type, sched1.automaton_name); address_space1.cheddar_private_id:=component_id; Initialize (Handler); end if; if (To_String (To_Lower (Qname)) = "dependency") then Put_Debug ("Add a dependency " & dep1.type_of_dependency'img); case dep1.type_of_dependency is when precedence_dependency => add_one_task_dependency_precedence(Handler.Parsed_System.dependencies, search_task_by_id(Handler.Parsed_System.tasks, dep1.precedence_source), search_task_by_id(Handler.Parsed_System.tasks, dep1.precedence_sink)); when queueing_buffer_dependency => add_one_task_dependency_queueing_buffer(Handler.Parsed_System.dependencies, search_task_by_id(Handler.Parsed_System.tasks, dep1.buffer_dependent_task), search_buffer_by_id(Handler.Parsed_System.buffers, dep1.buffer_dependency_object), dep1.buffer_orientation); when black_board_Buffer_dependency => add_one_task_dependency_black_board_buffer(Handler.Parsed_System.dependencies, search_task_by_id(Handler.Parsed_System.tasks, dep1.black_board_dependent_task), search_buffer_by_id(Handler.Parsed_System.buffers, dep1.black_board_dependency_object), dep1.black_board_orientation); when asynchronous_communication_dependency => add_one_task_dependency_asynchronous_communication(Handler.Parsed_System.dependencies, search_task_by_id(Handler.Parsed_System.tasks, dep1.asynchronous_communication_dependent_task), search_message_by_id(Handler.Parsed_System.messages, dep1.asynchronous_communication_dependency_object), dep1.asynchronous_communication_orientation); when time_triggered_communication_dependency => add_one_task_dependency_time_triggered(Handler.Parsed_System.dependencies, search_task_by_id(Handler.Parsed_System.tasks, dep1.time_triggered_communication_source), search_task_by_id(Handler.Parsed_System.tasks, dep1.time_triggered_communication_sink), dep1.timing_property); when resource_dependency => Add_One_Task_Dependency_resource(Handler.Parsed_System.dependencies, search_task_by_id(Handler.Parsed_System.tasks, dep1.resource_dependency_task), search_resource_by_id(Handler.Parsed_System.resources, dep1.resource_dependency_resource)); end case; Initialize (Handler); end if; if (xml_unit = cache_access_profile_xml AND xml_unit_attribute = ucbs_xml) then if (To_String (To_Lower (Qname)) = "cache_block") then Put_Debug ("Add cache block ref: " & cache_block_i.name & " " & component_ref); cache_block1 := Search_Cache_Block_By_Id(Handler.Parsed_System.Cache_Blocks, component_ref); Add(ucbs_table, cache_block1); end if; end if; if (xml_unit = cache_access_profile_xml AND xml_unit_attribute = ecbs_xml) then if (To_String (To_Lower (Qname)) = "cache_block") then Put_Debug ("Add cache block ref: " & cache_block_i.name & " " & component_ref); cache_block1 := Search_Cache_Block_By_Id(Handler.Parsed_System.Cache_Blocks, component_ref); Add(ecbs_table, cache_block1); end if; end if; if (xml_unit = cache_access_profile_xml) then if (To_String (To_Lower (Qname)) = "cache_access_profile") then Put_Debug ("Add cache access profile: " & cache_access_profile_i.name & " " & component_id); Add_Cache_Access_Profile(my_cache_access_profiles => Handler.Parsed_System.Cache_Access_Profiles, a_cache_access_profile => cache_access_profile1, name => cache_access_profile_i.name, ucbs => ucbs_table, ecbs => ecbs_table); cache_access_profile1.cheddar_private_id := component_id; Initialize (Handler); end if; end if; if (xml_unit = cfg_nodes_xml) then if (To_String (To_lower (QName)) = "cfg_node") then Put_Debug ("Add CFG Node " & cfg_node_i.name & " " & component_id); Add_CFG_Node(my_cfg_nodes => Handler.Parsed_System.CFG_Nodes, a_cfg_node => cfg_node1, name => cfg_node_i.name, node_type => cfg_node_i.node_type, graph_type => cfg_node_i.graph_type); cfg_node1.cheddar_private_id := component_id; Initialize (Handler); end if; if (To_String (To_lower (QName)) = "basic_block") then Put_Debug ("Add Basic Block " & basic_block_i.name & " " & component_id); Add_CFG_Node(my_cfg_nodes => Handler.Parsed_System.CFG_Nodes, a_cfg_node => cfg_node1, name => basic_block_i.name, node_type => basic_block_i.node_type, graph_type => basic_block_i.graph_type, instruction_offset => basic_block_i.instruction_offset, instruction_capacity => basic_block_i.instruction_capacity, data_offset => basic_block_i.data_offset, data_capacity => basic_block_i.data_capacity, loop_bound => basic_block_i.loop_bound); cfg_node1.cheddar_private_id := component_id; Initialize (Handler); end if; end if; if (xml_unit = cfg_edges_xml) then if (To_String (To_lower (QName)) = "cfg_edge") then Put_Debug ("Add CFG Edge " & component_id); Add_CFG_Edge(my_cfg_edges => Handler.Parsed_System.CFG_Edges, a_cfg_edge => cfg_edge1, name => cfg_edge_i.name, node => cfg_edge_i.node, next_node => cfg_edge_i.next_node); cfg_edge1.cheddar_private_id := component_id; Initialize (Handler); end if; end if; if (xml_unit = cfgs_xml) then if (To_String (To_lower (QName)) = "cfg_node") then Put_Debug ("Add CFG Node to CFG " & component_id); cfg_node1 := Search_CFG_Node_By_Id(my_cfg_nodes => Handler.Parsed_System.CFG_Nodes, id => component_ref); add(a_cfg_nodes_table,cfg_node1); end if; if (To_String (To_lower (QName)) = "basic_block") then Put_Debug ("Add Basic Block to CFG " & component_id); cfg_node1 := Search_CFG_Node_By_Id(my_cfg_nodes => Handler.Parsed_System.CFG_Nodes, id => component_ref); add(a_cfg_nodes_table,cfg_node1); end if; if (To_String (To_lower (QName)) = "cfg_edge") then Put_Debug ("Add CFG Edge to CFG" & component_id); cfg_edge1 := Search_CFG_Edge_By_Id(my_cfg_edges => Handler.Parsed_System.CFG_Edges, id => component_ref); add(a_cfg_edges_table,cfg_edge1); end if; if (To_String (To_lower (QName)) = "cfg") then Put_Debug ("Add CFG " & cfg_i.name & " " & component_id); Add_CFG(my_cfgs => Handler.Parsed_System.CFGs, a_cfg => cfg1, name => cfg_i.name, cfg_nodes_tbl => a_cfg_nodes_table, cfg_edges_tbl => a_cfg_edges_table); cfg1.cheddar_private_id := component_id; Initialize (Handler); end if; end if; ------------------------------ -- Parse Hardware components ------------------------------ if (xml_unit = core_units_xml) then if (To_String (To_Lower (Qname)) = "core_unit") then Put_Debug ("Add core unit " & co1.name & " " & component_id); -- if co1.l1_cache_system_name/=empty_string then -- a_cache:=search_cache(handler.parsed_system.caches, co1.l1_cache_system_name); -- end if; Add_core_unit (Handler.Parsed_System.Core_units, core_unit_ptr(core1), co1.name, sched1.preemptive_type, sched1.quantum, co1.speed, sched1.capacity, sched1.period, sched1.priority, sched1.user_defined_scheduler_source_file_name, sched1.scheduler_type, sched1.automaton_name, co1.l1_cache_system_name, sched1.start_time); core1.cheddar_private_id:=component_id; Initialize (Handler); end if; end if; if (xml_unit = processors_xml) then if (To_String (To_Lower (Qname)) = "core_unit") then Put_Debug ("Add core unit ref " & component_ref ); core1:=search_core_unit_by_id(Handler.Parsed_System.core_units, component_ref); add(a_core_unit_table, core_unit_ptr(core1)); end if; if (To_String (To_Lower (Qname)) = "mono_core_processor") then -- Find corresponding core unit -- Put_Debug ("Add monocore processor " & nco1.name & " " & component_id); core1:=search_core_unit_by_id(Handler.Parsed_System.core_units, nco1.core); -- if nco1.network_name/=empty_string then -- a_network:=search_network(handler.parsed_system.networks, nco1.network_name); -- end if; Add_Processor (Handler.Parsed_System.Processors, processor1, nco1.name, core_unit_ptr(core1)); processor1.cheddar_private_id:=component_id; Initialize (Handler); end if; if (To_String (To_Lower (Qname)) = "multi_cores_processor") then Put_Debug ("Add multicore processor " & mco1.name & " " & component_id); -- if mco1.network_name/=empty_string then -- a_network:=search_network(handler.parsed_system.networks, nco1.network_name); -- end if; Add_Processor (Handler.Parsed_System.Processors, processor1, mco1.name, a_core_unit_table, mco1.migration_type, mco1.processor_type); processor1.cheddar_private_id:=component_id; Initialize (Handler); end if; end if; if (xml_unit = cache_blocks_xml) then if (To_String (To_lower (QName)) = "cache_block") then Add_Cache_Block(my_cache_blocks => Handler.Parsed_System.Cache_Blocks, a_cache_block => cache_block1, name => cache_block_i.name, cache_block_number => cache_block_i.cache_block_number); cache_block1.cheddar_private_id := component_id; Initialize(Handler); end if; end if; if (xml_unit = caches_xml) then if (To_String (To_Lower (Qname)) = "cache_block") then cache_block1 := Search_Cache_Block_By_Id(Handler.Parsed_System.Cache_Blocks, component_ref); Add(a_cache_blocks_table, cache_block1); end if; if (To_String (To_Lower (Qname)) = "instruction_cache") then Put_Debug ("Add cache " & icache_i.name & " " & component_id); Add_Cache(my_caches => Handler.Parsed_System.Caches, a_cache => cache1, name => icache_i.name, cache_size => icache_i.cache_size, line_size => icache_i.line_size, associativity => icache_i.associativity, block_reload_time => icache_i.block_reload_time, coherence_protocol => icache_i.coherence_protocol, replacement_policy => icache_i.replacement_policy, cache_category => icache_i.cache_category, a_cache_blocks_table => a_cache_blocks_table); cache1.cache_blocks := a_cache_blocks_table; cache1.cheddar_private_id:=component_id; Initialize (Handler); end if; if (To_String (To_Lower (Qname)) = "data_cache") then Put_Debug ("Add cache " & dcache_i.name & " " & component_id); Add_Cache(my_caches => Handler.Parsed_System.Caches, a_cache => cache1, name => dcache_i.name, cache_size => dcache_i.cache_size, line_size => dcache_i.line_size, associativity => dcache_i.associativity, block_reload_time => dcache_i.block_reload_time, coherence_protocol => dcache_i.coherence_protocol, replacement_policy => dcache_i.replacement_policy, cache_category => dcache_i.cache_category, a_cache_blocks_table => a_cache_blocks_table); cache1.cheddar_private_id:=component_id; Initialize (Handler); end if; end if; end End_Element; function Get_Parsed_System (Handler : in Xml_architecture_Parser) return System is begin return Handler.Parsed_System; end Get_Parsed_System; end Xml_generic_Parsers.architecture;