| summaryrefslogtreecommitdiff | 
diff options
Diffstat (limited to 'ast-to-instr/src/VHDLProcess.java')
| -rw-r--r-- | ast-to-instr/src/VHDLProcess.java | 131 | 
1 files changed, 122 insertions, 9 deletions
| diff --git a/ast-to-instr/src/VHDLProcess.java b/ast-to-instr/src/VHDLProcess.java index a51816c..5d49b40 100644 --- a/ast-to-instr/src/VHDLProcess.java +++ b/ast-to-instr/src/VHDLProcess.java @@ -10,12 +10,29 @@ import java.util.Collection;  public class VHDLProcess extends ParsableXML  { -   private static final XPathExpression GET_ENTITIES; +   private static final XPathExpression XPE_FIND_SL_ELEMENTS; +   private static final XPathExpression XPE_FIND_NE_IN_PROCESS; +   private static final XPathExpression XPE_FIND_START_NODE;     static     { -      /* TODO */ -      GET_ENTITIES = null; +      XPE_FIND_SL_ELEMENTS = +         XMLManager.compile_or_die +         ( +            "(./sensitivity_list/el/named_entity | ./sensitivity_list/el[@ref])" +         ); + +      XPE_FIND_NE_IN_PROCESS = +         XMLManager.compile_or_die +         ( +            ".//*[@kind=\"simple_name\"]/named_entity" +         ); + +      XPE_FIND_START_NODE = +         XMLManager.compile_or_die +         ( +            "./sequential_statement_chain" +         );     }     public VHDLProcess @@ -67,7 +84,7 @@ public class VHDLProcess extends ParsableXML        handle_predicate_is_accessed_by(local_id);        /** Children ************************************************************/ -      result.addAll(handle_child_nodes(local_id)); +      result.addAll(handle_child_node(local_id));        return result;     } @@ -357,27 +374,123 @@ public class VHDLProcess extends ParsableXML     (        final IDs local_id     ) +   throws XPathExpressionException     { -      /* TODO */ +      final NodeList items; +      final int items_count; + +      items = +         (NodeList) XPE_FIND_SL_ELEMENTS.evaluate +         ( +            xml_node, +            XPathConstants.NODESET +         ); + +      items_count = items.getLength(); + +      for (int i = 0; i < items_count; ++i) +      { +         Predicates.add_entry +         ( +            "is_in_sensitivity_list", +            Waveforms.get_associated_waveform_id +            ( +               IDs.get_id_from_xml_id +               ( +                  XMLManager.get_attribute +                  ( +                     items.item(i), +                     "ref" +                  ), +                  null +               ) +            ), +            local_id +         ); +      }     }     private void handle_predicate_is_accessed_by     (        final IDs local_id     ) +   throws XPathExpressionException     { -      /* TODO */ +      final NodeList items; +      final int items_count; + +      items = +         (NodeList) XPE_FIND_SL_ELEMENTS.evaluate +         ( +            xml_node, +            XPathConstants.NODESET +         ); + +      items_count = items.getLength(); + +      for (int i = 0; i < items_count; ++i) +      { +         final String xml_id; + +         xml_id = +            XMLManager.get_attribute +            ( +               items.item(i), +               "ref" +            ); + +         if (!Main.node_is_function_or_literal(ref)) +         { +            Predicates.add_entry +            ( +               "is_accessed_by", +               Waveforms.get_associated_waveform_id +               ( +                  IDs.get_id_from_xml_id +                  ( +                     xml_id, +                     null +                  ) +               ), +               local_id +            ); +         } +      }     }     /***************************************************************************/     /** Children ***************************************************************/     /***************************************************************************/ -   private Collection<ParsableXML> handle_child_nodes +   private Collection<ParsableXML> handle_child_node     (        final IDs local_id     )     { -      /* TODO */ -      return null; +      final Node start_node; +      final Collection<ParsableXML> result; + +      start_node = +         (Node) XPE_FIND_START_NODE.evaluate +         ( +            xml_node, +            XPathConstants.NODE +         ); + +      result = new ArrayList<ParsableXML>(); + +      result.add +      ( +         new VHDLSSCNode +         ( +            local_id, +            start_node, +            null, /* There is nothing before this sequence. */ +            null, /* There is nothing after this sequence. */ +            0, /* Depth starts at zero. */ +            new String[0] /* No attributes. */ +         ) +      ); + +      return result;     }  } | 


