| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-07-21 16:50:25 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-07-21 16:50:25 +0200 | 
| commit | d05bd3592050a9496dd87bcd8a49f8fdc8b6b58d (patch) | |
| tree | 13ce81449e21c48621ae0ef4dd0f451b72f1c37a | |
| parent | 0aa91fb542bd4e2bec97de98ab819ddd6ccbb698 (diff) | |
Adds output support.
| -rw-r--r-- | ast-to-instr/src/Functions.java | 21 | ||||
| -rw-r--r-- | ast-to-instr/src/IDs.java | 65 | ||||
| -rw-r--r-- | ast-to-instr/src/Main.java | 26 | ||||
| -rw-r--r-- | ast-to-instr/src/OutputFile.java | 129 | ||||
| -rw-r--r-- | ast-to-instr/src/Outputs.java | 4 | ||||
| -rw-r--r-- | ast-to-instr/src/Parameters.java | 5 | ||||
| -rw-r--r-- | ast-to-instr/src/Predicates.java | 21 | ||||
| -rw-r--r-- | ast-to-instr/src/Strings.java | 35 | ||||
| -rw-r--r-- | ast-to-instr/src/VHDLArchitecture.java | 42 | ||||
| -rw-r--r-- | ast-to-instr/src/VHDLCSNode.java | 15 | ||||
| -rw-r--r-- | ast-to-instr/src/VHDLISNode.java | 13 | ||||
| -rw-r--r-- | ast-to-instr/src/VHDLNode.java | 3 | ||||
| -rw-r--r-- | ast-to-instr/src/VHDLProcess.java | 6 | ||||
| -rw-r--r-- | ast-to-instr/src/VHDLSSASNode.java | 12 | ||||
| -rw-r--r-- | ast-to-instr/src/VHDLSSCNode.java | 39 | ||||
| -rw-r--r-- | ast-to-instr/src/VHDLWNode.java | 10 | ||||
| -rw-r--r-- | ast-to-instr/src/Waveforms.java | 10 | 
17 files changed, 390 insertions, 66 deletions
| diff --git a/ast-to-instr/src/Functions.java b/ast-to-instr/src/Functions.java index b500f21..d4d0593 100644 --- a/ast-to-instr/src/Functions.java +++ b/ast-to-instr/src/Functions.java @@ -6,15 +6,26 @@ public class Functions        final IDs... params     )     { -      System.out.print("[FUN] ("); -      System.out.print(function_name); +      add_entry(Main.get_main_output(), function_name, params); +   } + +   public static void add_entry +   ( +      final OutputFile output, +      final String function_name, +      final IDs... params +   ) +   { +      output.write("(set_function "); + +      output.write(function_name);        for (final IDs param: params)        { -         System.out.print(" " + param.get_value()); +         output.write(" " + param.get_value());        } -      System.out.println(")"); -      /* TODO */ +      output.write(")"); +      output.insert_newline();     }  } diff --git a/ast-to-instr/src/IDs.java b/ast-to-instr/src/IDs.java index ed37917..836b9a6 100644 --- a/ast-to-instr/src/IDs.java +++ b/ast-to-instr/src/IDs.java @@ -7,7 +7,7 @@ public class IDs  {     /** Static *****************************************************************/     private static final Map<String, IDs> FROM_XML; -   private static final Collection<IDs> ALL_IDS; +   private static final OutputFile XML_MAP_OUTPUT;     private static int next_id;     static @@ -15,12 +15,29 @@ public class IDs        next_id = 0;        FROM_XML = new HashMap<String, IDs>(); -      ALL_IDS = new ArrayList<IDs>(); + +      /* TODO: filename as a param? */ +      XML_MAP_OUTPUT = OutputFile.new_output_file("xml_to_instr.map");     } +   public static IDs get_id_from_xml_id +   ( +      final String xml_id, +      final String type +   ) +   { +      return +         get_id_from_xml_id +         ( +            Main.get_main_output(), +            xml_id, +            type +         ); +   }     public static IDs get_id_from_xml_id     ( +      final OutputFile output,        final String xml_id,        final String type     ) @@ -31,15 +48,24 @@ public class IDs        if (result == null)        { -         result = generate_new_id(type); +         result = generate_new_id(output, type);           FROM_XML.put(xml_id, result); + +         XML_MAP_OUTPUT.write("(xml->instr "); +         XML_MAP_OUTPUT.write(xml_id); +         XML_MAP_OUTPUT.write(" "); +         XML_MAP_OUTPUT.write(Integer.toString(result.get_value())); +         XML_MAP_OUTPUT.write(")"); +         XML_MAP_OUTPUT.insert_newline(); +        }        else if ((result.type == null) && (type != null))        {           /* This allows us to get an ID from a simple reference. */ -         /* TODO: Don't forget to report any (type == null) at the end. */           result.type = type; + +         result.add_to_output(output);        }        return result; @@ -50,23 +76,22 @@ public class IDs        final String type     )     { +      return generate_new_id(Main.get_main_output(), type); +   } + +   public static IDs generate_new_id +   ( +      final OutputFile output, +      final String type +   ) +   {        final IDs result;        result = new IDs(type); -      ALL_IDS.add(result); - -      /* TODO: remove, it's for debug. */        if (type != null)        { -         System.out.println -         ( -            "[ID] (" -            + result.get_type() -            + " " -            + result.get_value() -            + ")" -         ); +         result.add_to_output(output);        }        return result; @@ -94,4 +119,14 @@ public class IDs     {        return value;     } + +   private void add_to_output (final OutputFile output) +   { +      output.write("(add_element "); +      output.write(type); +      output.write(" "); +      output.write(Integer.toString(value)); +      output.write(")"); +      output.insert_newline(); +   }  } diff --git a/ast-to-instr/src/Main.java b/ast-to-instr/src/Main.java index e0bc301..5bc45a0 100644 --- a/ast-to-instr/src/Main.java +++ b/ast-to-instr/src/Main.java @@ -13,7 +13,8 @@ public class Main  {     private static final XPathExpression XPE_FIND_ALL_VHDL_FILES;     private static Parameters PARAMETERS; -   private static Document root; +   private static Document XML_ROOT; +   private static OutputFile MAIN_OUTPUT;     static     { @@ -38,7 +39,7 @@ public class Main        try        { -         root = XMLManager.get_document(PARAMETERS.get_xml_file()); +         XML_ROOT = XMLManager.get_document(PARAMETERS.get_xml_file());        }        catch (final Exception e)        { @@ -54,6 +55,12 @@ public class Main           return;        } +      MAIN_OUTPUT = +         OutputFile.new_output_file +         ( +            PARAMETERS.get_main_output_filename() +         ); +        try        {           vhdl_files = @@ -61,7 +68,7 @@ public class Main              (                 (NodeList) XPE_FIND_ALL_VHDL_FILES.evaluate                 ( -                  root, +                  XML_ROOT,                    XPathConstants.NODESET                 )              ); @@ -79,6 +86,8 @@ public class Main        }        parse_content(vhdl_files); + +      OutputFile.close_all();     }     private static void parse_content (final Collection<Node> vhdl_files) @@ -90,7 +99,6 @@ public class Main        for (final Node f: vhdl_files)        { -         System.out.println("New VHDL file in the waiting list.");           waiting_list.push(new VHDLFile(null, f));        } @@ -100,7 +108,6 @@ public class Main           try           { -            System.out.println("Parsing XML...");              waiting_list.pop().parse(waiting_list);           }           catch (final XPathExpressionException xpee) @@ -135,7 +142,7 @@ public class Main        n =           (Node) xpe_find_el_from_id.evaluate           ( -            root, +            XML_ROOT,              XPathConstants.NODE           ); @@ -160,6 +167,11 @@ public class Main     public static Document get_xml_root ()     { -      return root; +      return XML_ROOT; +   } + +   public static OutputFile get_main_output () +   { +      return MAIN_OUTPUT;     }  } diff --git a/ast-to-instr/src/OutputFile.java b/ast-to-instr/src/OutputFile.java new file mode 100644 index 0000000..42a6ad5 --- /dev/null +++ b/ast-to-instr/src/OutputFile.java @@ -0,0 +1,129 @@ +import java.util.ArrayList; +import java.util.Collection; + +import java.io.File; +import java.io.FileWriter; +import java.io.BufferedWriter; + +public class OutputFile +{ +   private static Collection<OutputFile> ALL_OUTPUT_FILES; + +   static +   { +      ALL_OUTPUT_FILES = new ArrayList<OutputFile>(); +   } + +   public static void close_all () +   { +      for (final OutputFile f: ALL_OUTPUT_FILES) +      { +         f.close(); +      } +   } + +   public static OutputFile new_output_file (final String filename) +   { +      final OutputFile result; + +      result = new OutputFile(filename); + +      ALL_OUTPUT_FILES.add(result); + +      return result; +   } + +   /** Non-Static *************************************************************/ +   private final String filename; +   private final BufferedWriter buffered_writer; + +   private OutputFile (final String filename) +   { +      BufferedWriter bf; + +      this.filename = filename; + +      try +      { +         bf = new BufferedWriter(new FileWriter(new File(filename))); +      } +      catch (final Exception e) +      { +         bf = null; + +         System.err.println +         ( +            "[F] Could not create new output file \"" +            + filename +            + "\":" +         ); + +         e.printStackTrace(); + +         System.exit(-1); +      } + +      buffered_writer = bf; +   } + +   public void write (final String data) +   { +      try +      { +         buffered_writer.write(data); +      } +      catch (final Exception e) +      { +         System.err.println +         ( +            "[F] Could not write to output file \"" +            + filename +            + "\":" +         ); + +         e.printStackTrace(); + +         System.exit(-1); +      } +   } + +   public void insert_newline () +   { +      try +      { +         buffered_writer.newLine(); +      } +      catch (final Exception e) +      { +         System.err.println +         ( +            "[F] Could not write to output file \"" +            + filename +            + "\":" +         ); + +         e.printStackTrace(); + +         System.exit(-1); +      } +   } + +   private void close () +   { +      try +      { +         buffered_writer.close(); +      } +      catch (final Exception e) +      { +         System.err.println +         ( +            "[E] Could not properly close output file \"" +            + filename +            + "\":" +         ); + +         e.printStackTrace(); +      } +   } +} diff --git a/ast-to-instr/src/Outputs.java b/ast-to-instr/src/Outputs.java deleted file mode 100644 index 0878d93..0000000 --- a/ast-to-instr/src/Outputs.java +++ /dev/null @@ -1,4 +0,0 @@ -public class Outputs -{ -   /* TODO */ -} diff --git a/ast-to-instr/src/Parameters.java b/ast-to-instr/src/Parameters.java index 70d716f..0407bb4 100644 --- a/ast-to-instr/src/Parameters.java +++ b/ast-to-instr/src/Parameters.java @@ -41,6 +41,11 @@ public class Parameters        return xml_file;     } +   public String get_main_output_filename() +   { +      return "structural.mod"; +   } +     public boolean are_valid ()     {        return are_valid; diff --git a/ast-to-instr/src/Predicates.java b/ast-to-instr/src/Predicates.java index 9d4c308..e157ca1 100644 --- a/ast-to-instr/src/Predicates.java +++ b/ast-to-instr/src/Predicates.java @@ -6,15 +6,26 @@ public class Predicates        final IDs... params     )     { -      System.out.print("[PRE] ("); -      System.out.print(predicate_name); +      add_entry(Main.get_main_output(), predicate_name, params); +   } + +   public static void add_entry +   ( +      final OutputFile output, +      final String predicate_name, +      final IDs... params +   ) +   { +      output.write("("); + +      output.write(predicate_name);        for (final IDs param: params)        { -         System.out.print(" " + param.get_value()); +         output.write(" " + param.get_value());        } -      System.out.println(")"); -      /* TODO */ +      output.write(")"); +      output.insert_newline();     }  } diff --git a/ast-to-instr/src/Strings.java b/ast-to-instr/src/Strings.java index 5657cac..67189ad 100644 --- a/ast-to-instr/src/Strings.java +++ b/ast-to-instr/src/Strings.java @@ -4,15 +4,31 @@ import java.util.HashMap;  public class Strings  {     private static final Map<String, IDs> TO_ID; +   private static final OutputFile STRING_MAP_OUTPUT;     static     {        TO_ID = new HashMap<String, IDs>(); + +      /* TODO: filename as a param? */ +      STRING_MAP_OUTPUT = OutputFile.new_output_file("string_to_instr.map");     }     private Strings () {} /* Utility class. */ -   public static IDs get_id_from_string (String string) +   public static IDs get_id_from_string +   ( +      String string +   ) +   { +      return get_id_from_string(Main.get_main_output(), string); +   } + +   public static IDs get_id_from_string +   ( +      final OutputFile output, +      String string +   )     {        IDs result; @@ -21,19 +37,16 @@ public class Strings        if (result == null)        { -         result = IDs.generate_new_id("string"); +         result = IDs.generate_new_id(output, "string");           TO_ID.put(string, result); -         /* TODO: remove, it's for debug. */ -         System.out.println -         ( -            "[STR] (\"" -            + string -            + "\"->" -            + result.get_value() -            + ")" -         ); +         STRING_MAP_OUTPUT.write("(string->instr \""); +         STRING_MAP_OUTPUT.write(string); +         STRING_MAP_OUTPUT.write("\" "); +         STRING_MAP_OUTPUT.write(Integer.toString(result.get_value())); +         STRING_MAP_OUTPUT.write(")"); +         STRING_MAP_OUTPUT.insert_newline();        }        return result; diff --git a/ast-to-instr/src/VHDLArchitecture.java b/ast-to-instr/src/VHDLArchitecture.java index c6014a8..9d559de 100644 --- a/ast-to-instr/src/VHDLArchitecture.java +++ b/ast-to-instr/src/VHDLArchitecture.java @@ -9,12 +9,19 @@ import java.util.Stack;  public class VHDLArchitecture extends ParsableXML  { +   private static final XPathExpression XPE_FIND_ENTITY_NAME;     private static final XPathExpression XPE_FIND_SIGNALS;     private static final XPathExpression XPE_FIND_PROCESSES;     private static final XPathExpression XPE_FIND_COMPONENTS;     static     { +      XPE_FIND_ENTITY_NAME = +         XMLManager.compile_or_die +         ( +            "./entity_name/named_entity" +         ); +        XPE_FIND_SIGNALS =           XMLManager.compile_or_die           ( @@ -94,8 +101,41 @@ public class VHDLArchitecture extends ParsableXML     (        final IDs local_id     ) +   throws XPathExpressionException     { -      /* TODO */ +      final Node entity_name; + +      entity_name = +         (Node) XPE_FIND_ENTITY_NAME.evaluate +         ( +            xml_node, +            XPathConstants.NODE +         ); + +      if (entity_name == (Node) null) +      { +         System.err.println +         ( +            "[W] Could not find entity the associated with architecture " +            + local_id +            + " (XML ID: " +            + XMLManager.get_attribute(xml_node, "id") +            + ")." +         ); + +         return; +      } + +      Predicates.add_entry +      ( +         "is_architecture_of", +         local_id, +         IDs.get_id_from_xml_id +         ( +            XMLManager.get_attribute(entity_name, "ref"), +            "entity" +         ) +      );     } diff --git a/ast-to-instr/src/VHDLCSNode.java b/ast-to-instr/src/VHDLCSNode.java index 05a7450..4ba6631 100644 --- a/ast-to-instr/src/VHDLCSNode.java +++ b/ast-to-instr/src/VHDLCSNode.java @@ -38,6 +38,7 @@ public class VHDLCSNode extends VHDLNode     public VHDLCSNode     ( +      final OutputFile output,        final IDs parent_id,        final Node xml_node,        final IDs next_node, @@ -47,6 +48,7 @@ public class VHDLCSNode extends VHDLNode     {        super        ( +         output,           parent_id,           xml_node,           next_node, @@ -67,7 +69,7 @@ public class VHDLCSNode extends VHDLNode        xml_id = XMLManager.get_attribute(xml_node, "id"); -      local_id = IDs.get_id_from_xml_id(xml_id, "node"); +      local_id = IDs.get_id_from_xml_id(output, xml_id, "node");        /** Functions ***********************************************************/        handle_function_label(local_id); @@ -94,10 +96,12 @@ public class VHDLCSNode extends VHDLNode     {        Functions.add_entry        ( +         output,           "label",           local_id,           Strings.get_id_from_string           ( +            output,              XMLManager.get_attribute(xml_node, "label")           )        ); @@ -110,6 +114,7 @@ public class VHDLCSNode extends VHDLNode     {        Functions.add_entry        ( +         output,           "kind",           local_id,           Strings.get_id_from_string("case") @@ -123,6 +128,7 @@ public class VHDLCSNode extends VHDLNode     {        Functions.add_entry        ( +         output,           "depth",           local_id,           Strings.get_id_from_string @@ -152,6 +158,7 @@ public class VHDLCSNode extends VHDLNode        {           Predicates.add_entry           ( +            output,              "has_option",              local_id,              Strings.get_id_from_string(s) @@ -187,6 +194,7 @@ public class VHDLCSNode extends VHDLNode           {              Predicates.add_entry              ( +               output,                 "expr_reads",                 local_id,                 Waveforms.get_associated_waveform_id @@ -218,7 +226,6 @@ public class VHDLCSNode extends VHDLNode              XPathConstants.NODESET           ); -        when_branches_length = when_branches.getLength();        for (int i = 0; i < when_branches_length; ++i) @@ -227,6 +234,7 @@ public class VHDLCSNode extends VHDLNode           (              new VHDLWNode              ( +               output,                 parent_id,                 when_branches.item(i),                 next_node, @@ -259,6 +267,7 @@ public class VHDLCSNode extends VHDLNode           {              Predicates.add_entry              ( +               output,                 "is_final",                 local_id              ); @@ -267,6 +276,7 @@ public class VHDLCSNode extends VHDLNode           {              Predicates.add_entry              ( +               output,                 "node_connect",                 local_id,                 next_node @@ -279,6 +289,7 @@ public class VHDLCSNode extends VHDLNode           (              new VHDLWNode              ( +               output,                 parent_id,                 others_branch,                 next_node, diff --git a/ast-to-instr/src/VHDLISNode.java b/ast-to-instr/src/VHDLISNode.java index bb16e1b..3819153 100644 --- a/ast-to-instr/src/VHDLISNode.java +++ b/ast-to-instr/src/VHDLISNode.java @@ -37,6 +37,7 @@ public class VHDLISNode extends VHDLNode     public VHDLISNode     ( +      final OutputFile output,        final IDs parent_id,        final Node xml_node,        final IDs next_node, @@ -46,6 +47,7 @@ public class VHDLISNode extends VHDLNode     {        super        ( +         output,           parent_id,           xml_node,           next_node, @@ -66,7 +68,7 @@ public class VHDLISNode extends VHDLNode        xml_id = XMLManager.get_attribute(xml_node, "id"); -      local_id = IDs.get_id_from_xml_id(xml_id, "node"); +      local_id = IDs.get_id_from_xml_id(output, xml_id, "node");        /** Functions ***********************************************************/        handle_function_label(local_id); @@ -93,6 +95,7 @@ public class VHDLISNode extends VHDLNode     {        Functions.add_entry        ( +         output,           "label",           local_id,           Strings.get_id_from_string @@ -109,6 +112,7 @@ public class VHDLISNode extends VHDLNode     {        Functions.add_entry        ( +         output,           "kind",           local_id,           Strings.get_id_from_string("if") @@ -122,6 +126,7 @@ public class VHDLISNode extends VHDLNode     {        Functions.add_entry        ( +         output,           "depth",           local_id,           Strings.get_id_from_string @@ -151,6 +156,7 @@ public class VHDLISNode extends VHDLNode        {           Predicates.add_entry           ( +            output,              "has_option",              local_id,              Strings.get_id_from_string(s) @@ -186,6 +192,7 @@ public class VHDLISNode extends VHDLNode           {              Predicates.add_entry              ( +               output,                 "expr_reads",                 local_id,                 Waveforms.get_associated_waveform_id @@ -220,6 +227,7 @@ public class VHDLISNode extends VHDLNode        (           new VHDLSSCNode           ( +            output,              parent_id,              true_branch,              local_id, @@ -252,6 +260,7 @@ public class VHDLISNode extends VHDLNode           {              Predicates.add_entry              ( +               output,                 "is_final",                 local_id              ); @@ -260,6 +269,7 @@ public class VHDLISNode extends VHDLNode           {              Predicates.add_entry              ( +               output,                 "node_connect",                 local_id,                 next_node @@ -272,6 +282,7 @@ public class VHDLISNode extends VHDLNode           (              new VHDLSSCNode              ( +               output,                 parent_id,                 else_branch,                 local_id, diff --git a/ast-to-instr/src/VHDLNode.java b/ast-to-instr/src/VHDLNode.java index 1774672..cb3fb4d 100644 --- a/ast-to-instr/src/VHDLNode.java +++ b/ast-to-instr/src/VHDLNode.java @@ -5,9 +5,11 @@ public abstract class VHDLNode extends ParsableXML     protected final IDs next_node;     protected final int depth;     protected final String[] attributes; +   protected final OutputFile output;     public VHDLNode     ( +      final OutputFile output,        final IDs parent_id,        final Node xml_node,        final IDs next_node, @@ -17,6 +19,7 @@ public abstract class VHDLNode extends ParsableXML     {        super(parent_id, xml_node); +      this.output = output;        this.next_node = next_node;        this.depth = depth;        this.attributes = attributes; diff --git a/ast-to-instr/src/VHDLProcess.java b/ast-to-instr/src/VHDLProcess.java index 0e26cce..1146f3f 100644 --- a/ast-to-instr/src/VHDLProcess.java +++ b/ast-to-instr/src/VHDLProcess.java @@ -478,6 +478,12 @@ public class VHDLProcess extends ParsableXML        (           new VHDLSSCNode           ( +            OutputFile.new_output_file +            ( +               "cfg_" /* TODO: Prefix as parameter? */ +               + Integer.toString(local_id.get_value()) +               + ".mod" /* TODO: Suffix as parameter? */ +            ),              local_id,              start_node,              null, /* There is nothing before this sequence. */ diff --git a/ast-to-instr/src/VHDLSSASNode.java b/ast-to-instr/src/VHDLSSASNode.java index 6cff44d..2ee2fda 100644 --- a/ast-to-instr/src/VHDLSSASNode.java +++ b/ast-to-instr/src/VHDLSSASNode.java @@ -31,6 +31,7 @@ public class VHDLSSASNode extends VHDLNode     public VHDLSSASNode     ( +      final OutputFile output,        final IDs parent_id,        final Node xml_node,        final IDs next_node, @@ -40,6 +41,7 @@ public class VHDLSSASNode extends VHDLNode     {        super        ( +         output,           parent_id,           xml_node,           next_node, @@ -60,7 +62,7 @@ public class VHDLSSASNode extends VHDLNode        xml_id = XMLManager.get_attribute(xml_node, "id"); -      local_id = IDs.get_id_from_xml_id(xml_id, "node"); +      local_id = IDs.get_id_from_xml_id(output, xml_id, "node");        /** Functions ***********************************************************/        handle_function_label(local_id); @@ -87,6 +89,7 @@ public class VHDLSSASNode extends VHDLNode     {        Functions.add_entry        ( +         output,           "label",           local_id,           Strings.get_id_from_string @@ -103,6 +106,7 @@ public class VHDLSSASNode extends VHDLNode     {        Functions.add_entry        ( +         output,           "kind",           local_id,           Strings.get_id_from_string("signal_assignement") @@ -116,6 +120,7 @@ public class VHDLSSASNode extends VHDLNode     {        Functions.add_entry        ( +         output,           "depth",           local_id,           Strings.get_id_from_string @@ -145,6 +150,7 @@ public class VHDLSSASNode extends VHDLNode        {           Predicates.add_entry           ( +            output,              "has_option",              local_id,              Strings.get_id_from_string(s) @@ -180,6 +186,7 @@ public class VHDLSSASNode extends VHDLNode           {              Predicates.add_entry              ( +               output,                 "expr_reads",                 local_id,                 Waveforms.get_associated_waveform_id @@ -250,6 +257,7 @@ public class VHDLSSASNode extends VHDLNode        Predicates.add_entry        ( +         output,           "expr_writes",           local_id,           Waveforms.get_associated_waveform_id @@ -275,6 +283,7 @@ public class VHDLSSASNode extends VHDLNode        {           Predicates.add_entry           ( +            output,              "is_final",              local_id           ); @@ -283,6 +292,7 @@ public class VHDLSSASNode extends VHDLNode        {           Predicates.add_entry           ( +            output,              "node_connect",              local_id,              next_node diff --git a/ast-to-instr/src/VHDLSSCNode.java b/ast-to-instr/src/VHDLSSCNode.java index 8fb620b..34c4f7d 100644 --- a/ast-to-instr/src/VHDLSSCNode.java +++ b/ast-to-instr/src/VHDLSSCNode.java @@ -21,6 +21,7 @@ public class VHDLSSCNode extends VHDLNode     public VHDLSSCNode     ( +      final OutputFile output,        final IDs parent_id,        final Node xml_node,        final IDs prev_node, /* can't simply forward ref to SSC */ @@ -31,6 +32,7 @@ public class VHDLSSCNode extends VHDLNode     {        super        ( +         output,           parent_id,           xml_node,           next_node, @@ -68,6 +70,7 @@ public class VHDLSSCNode extends VHDLNode           next_node =              IDs.get_id_from_xml_id              ( +               output,                 XMLManager.get_attribute                 (                    sub_nodes.item(i + 1), @@ -108,15 +111,42 @@ public class VHDLSSCNode extends VHDLNode        if (node_kind.equals("if_statement"))        { -         return new VHDLISNode(parent_id, node, next_node, depth, attributes); +         return +            new VHDLISNode +            ( +               output, +               parent_id, +               node, +               next_node, +               depth, +               attributes +            );        }        else if (node_kind.equals("simple_signal_assignment_statement"))        { -         return new VHDLSSASNode(parent_id, node, next_node, depth, attributes); +         return +            new VHDLSSASNode +            ( +               output, +               parent_id, +               node, +               next_node, +               depth, +               attributes +            );        }        else if (node_kind.equals("case_statement"))        { -         return new VHDLCSNode(parent_id, node, next_node, depth, attributes); +         return +            new VHDLCSNode +            ( +               output, +               parent_id, +               node, +               next_node, +               depth, +               attributes +            );        }        System.err.println @@ -141,6 +171,7 @@ public class VHDLSSCNode extends VHDLNode        first_node_id =           IDs.get_id_from_xml_id           ( +            output,              XMLManager.get_attribute              (                 first_node, @@ -154,6 +185,7 @@ public class VHDLSSCNode extends VHDLNode           /* First node of the process */           Predicates.add_entry           ( +            output,              "is_start_node",              first_node_id,              parent_id @@ -164,6 +196,7 @@ public class VHDLSSCNode extends VHDLNode           /* First node of the process */           Predicates.add_entry           ( +            output,              "connect_to",              prev_node,              first_node_id diff --git a/ast-to-instr/src/VHDLWNode.java b/ast-to-instr/src/VHDLWNode.java index b32d2a4..06a903c 100644 --- a/ast-to-instr/src/VHDLWNode.java +++ b/ast-to-instr/src/VHDLWNode.java @@ -30,6 +30,7 @@ public class VHDLWNode extends VHDLNode     public VHDLWNode     ( +      final OutputFile output,        final IDs parent_id,        final Node xml_node,        final IDs next_node, @@ -39,6 +40,7 @@ public class VHDLWNode extends VHDLNode     {        super        ( +         output,           parent_id,           xml_node,           next_node, @@ -59,7 +61,7 @@ public class VHDLWNode extends VHDLNode        xml_id = XMLManager.get_attribute(xml_node, "id"); -      local_id = IDs.get_id_from_xml_id(xml_id, "node"); +      local_id = IDs.get_id_from_xml_id(output, xml_id, "node");        /** Functions ***********************************************************/        handle_function_label(local_id); @@ -85,6 +87,7 @@ public class VHDLWNode extends VHDLNode     {        Functions.add_entry        ( +         output,           "label",           local_id,           Strings.get_id_from_string("") @@ -98,6 +101,7 @@ public class VHDLWNode extends VHDLNode     {        Functions.add_entry        ( +         output,           "kind",           local_id,           Strings.get_id_from_string("when") @@ -111,6 +115,7 @@ public class VHDLWNode extends VHDLNode     {        Functions.add_entry        ( +         output,           "depth",           local_id,           Strings.get_id_from_string @@ -140,6 +145,7 @@ public class VHDLWNode extends VHDLNode        {           Predicates.add_entry           ( +            output,              "has_option",              local_id,              Strings.get_id_from_string(s) @@ -175,6 +181,7 @@ public class VHDLWNode extends VHDLNode           {              Predicates.add_entry              ( +               output,                 "expr_reads",                 local_id,                 Waveforms.get_associated_waveform_id @@ -210,6 +217,7 @@ public class VHDLWNode extends VHDLNode        (           new VHDLSSCNode           ( +            output,              parent_id,              body,              local_id, diff --git a/ast-to-instr/src/Waveforms.java b/ast-to-instr/src/Waveforms.java index 7e86904..753bae3 100644 --- a/ast-to-instr/src/Waveforms.java +++ b/ast-to-instr/src/Waveforms.java @@ -23,16 +23,6 @@ public class Waveforms           result = IDs.generate_new_id("waveform");           TO_WAVEFORM.put(source, result); - -         /* TODO: remove, it's for debug. */ -         System.out.println -         ( -            "[WFM] (" -            + source.get_value() -            + "->" -            + result.get_value() -            + ")" -         );        }        return result; | 


