From 72b3069a20b8573ceff73b27936a76213aacc344 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Thu, 20 Jul 2017 17:34:51 +0200 Subject: Adds Simple Signal Assignment Statement Node. --- ast-to-instr/src/VHDLISNode.java | 99 ++++++++++++++++++++++++++++++++++------ 1 file changed, 85 insertions(+), 14 deletions(-) (limited to 'ast-to-instr/src/VHDLISNode.java') diff --git a/ast-to-instr/src/VHDLISNode.java b/ast-to-instr/src/VHDLISNode.java index 5dedabf..66eb52a 100644 --- a/ast-to-instr/src/VHDLISNode.java +++ b/ast-to-instr/src/VHDLISNode.java @@ -74,11 +74,10 @@ public class VHDLISNode extends VHDLNode /** Predicates **********************************************************/ handle_predicate_has_option(local_id); handle_predicate_expr_reads(local_id); - handle_predicate_is_final(local_id); /** Children ************************************************************/ - result.add(handle_true_branch(local_id)); - result.add(handle_else_branch(local_id)); + result.addAll(handle_true_branch(local_id)); + result.addAll(handle_else_branch(local_id)); return result; } @@ -190,33 +189,105 @@ public class VHDLISNode extends VHDLNode local_id, Waveforms.get_associated_waveform_id ( - IDs.get_id_from_xml_id(ref, null) + IDs.get_id_from_xml_id(ref, (String) null) ) ); } } } - private void handle_predicate_is_final + /***************************************************************************/ + /** Children ***************************************************************/ + /***************************************************************************/ + private Collection handle_true_branch ( final IDs local_id ) + throws XPathExpressionException { - /* TODO */ - /* ((next_node == null) && !(has_else)) => is_final */ + final Collection result; + final Node true_branch; + + result = new ArrayList(); + + true_branch = + (Node) XPE_FIND_TRUE_BRANCH.evaluate + ( + xml_node, + XPathConstants.NODE + ); + + + result.add + ( + new VHDLSSCNode + ( + parent_id, + true_branch, + local_id, + next_node, + (depth + 1), + new String[] {"COND_WAS_TRUE"} + ) + ); + + return result; } - /***************************************************************************/ - /** Children ***************************************************************/ - /***************************************************************************/ - private Collection handle_true_branch + private Collection handle_else_branch ( final IDs local_id ) + throws XPathExpressionException { - /* TODO */ + final Collection result; + final Node else_branch; - return null; - } + result = new ArrayList(); + + else_branch = + (Node) XPE_FIND_TRUE_BRANCH.evaluate + ( + xml_node, + XPathConstants.NODE + ); + + if (else_branch == (Node) null) + { + if (next_node == (IDs) null) + { + Predicates.add_entry + ( + "is_final", + local_id + ); + } + else + { + Predicates.add_entry + ( + "node_connect", + local_id, + next_node + ); + } + } + else + { + result.add + ( + new VHDLSSCNode + ( + parent_id, + else_branch, + local_id, + next_node, + (depth + 1), + new String[] {"COND_WAS_FALSE"} + ) + ); + } + return result; + } } -- cgit v1.2.3-70-g09d2