| summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'ast-to-instr/src/VHDLNode.java')
| -rw-r--r-- | ast-to-instr/src/VHDLNode.java | 122 |
1 files changed, 84 insertions, 38 deletions
diff --git a/ast-to-instr/src/VHDLNode.java b/ast-to-instr/src/VHDLNode.java index 970be9a..b05f08c 100644 --- a/ast-to-instr/src/VHDLNode.java +++ b/ast-to-instr/src/VHDLNode.java @@ -1,70 +1,116 @@ import org.w3c.dom.Node; +import java.util.ArrayList; +import java.util.List; + import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathExpression; public abstract class VHDLNode extends ParsableXML { - /** Static *****************************************************************/ - private static XPathExpression XPE_FIND_EXPR_NAMED_ENTITIES; + protected final IDs next_node; + protected final int depth; + protected final String[] attributes; + protected final OutputFile output; - static + public VHDLNode + ( + final OutputFile output, + final IDs parent_id, + final Node xml_node, + final IDs next_node, + final int depth, + final String[] attributes + ) { - XPE_FIND_EXPR_NAMED_ENTITIES = - XMLManager.compile_or_die - ( - ".//named_entity" - ); + super(parent_id, xml_node); + + this.output = output; + this.next_node = next_node; + this.depth = depth; + this.attributes = attributes; } - protected void handle_expression + protected void handle_read_expr_predicates ( final IDs local_id, - final Node expression_start + final Node expr_node ) throws XPathExpressionException { - final String ref; + final List<IDs> elements; + final StringBuilder structure; + final int elements_count; - ref = XMLManager.get_attribute(expression_start, "ref"); + elements = new ArrayList<IDs>(); + structure = new StringBuilder(); - if (!Main.node_is_function_or_literal(ref)) + Expressions.process(elements, structure, expr_node); + + Predicates.add_entry + ( + output, + "is_read_structure", + local_id, + Strings.get_id_from_string + ( + structure.toString() + ) + ); + + elements_count = elements.size(); + + for (int i = 0; i < elements_count; ++i) { Predicates.add_entry ( output, - "expr_reads", + "is_read_element", local_id, - Waveforms.get_associated_waveform_id - ( - IDs.get_id_from_xml_id(ref, (String) null) - ) + Strings.get_id_from_string(Integer.toString(i)), + elements.get(i) ); } } - /** Non-Static *************************************************************/ - protected final IDs next_node; - protected final int depth; - protected final String[] attributes; - protected final OutputFile output; - - public VHDLNode + protected void handle_written_expr_predicates ( - final OutputFile output, - final IDs parent_id, - final Node xml_node, - final IDs next_node, - final int depth, - final String[] attributes + final IDs local_id, + final Node expr_node ) + throws XPathExpressionException { - super(parent_id, xml_node); + final List<IDs> elements; + final StringBuilder structure; + final int elements_count; - this.output = output; - this.next_node = next_node; - this.depth = depth; - this.attributes = attributes; - } + elements = new ArrayList<IDs>(); + structure = new StringBuilder(); + Expressions.process(elements, structure, expr_node); + + Predicates.add_entry + ( + output, + "is_written_structure", + local_id, + Strings.get_id_from_string + ( + structure.toString() + ) + ); + + elements_count = elements.size(); + + for (int i = 0; i < elements_count; ++i) + { + Predicates.add_entry + ( + output, + "is_written_element", + local_id, + Strings.get_id_from_string(Integer.toString(i)), + elements.get(i) + ); + } + } } |


