Loading nbactions.xml +3 −3 Changes for nbactions.xml: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ <properties> <exec.vmArgs></exec.vmArgs> <exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args> <exec.appArgs>-t ../quantr-i/src -o ../quantr-i/src-output</exec.appArgs> <exec.appArgs>-t ../quantr-i/src/id.v -o ../quantr-i/src-output</exec.appArgs> <exec.mainClass>hk.quantr.verilogcompiler.VerilogCompiler</exec.mainClass> <exec.executable>java</exec.executable> </properties> Loading @@ -29,7 +29,7 @@ <properties> <exec.vmArgs>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs> <exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args> <exec.appArgs>-t ../quantr-i/src -o ../quantr-i/src-output</exec.appArgs> <exec.appArgs>-t ../quantr-i/src/id.v -o ../quantr-i/src-output</exec.appArgs> <exec.mainClass>hk.quantr.verilogcompiler.VerilogCompiler</exec.mainClass> <exec.executable>java</exec.executable> <jpda.listen>true</jpda.listen> Loading @@ -49,7 +49,7 @@ <exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args> <exec.mainClass>${packageClassName}</exec.mainClass> <exec.executable>java</exec.executable> <exec.appArgs>-t ../quantr-i/src -o ../quantr-i/src-output</exec.appArgs> <exec.appArgs>-t ../quantr-i/src/id.v -o ../quantr-i/src-output</exec.appArgs> </properties> </action> <action> Loading src/main/java/hk/quantr/verilogcompiler/VerilogHelper.java −11 Changes for src/main/java/hk/quantr/verilogcompiler/VerilogHelper.java: 0 added lines, 11 removed lines. Original line number Diff line number Diff line Loading @@ -301,19 +301,8 @@ public class VerilogHelper { System.out.println("-".repeat(100)); VerilogPreProcessorListener listener = new VerilogPreProcessorListener(tokenStream, sourceContent, ps); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); // StringBuilder sb = new StringBuilder(); // for (MacroListing m : macroListing) { // System.out.println(m); // if (m.type == Type.ORIGINAL || m.type == Type.PROFILING) { // sb.append(m.line); // sb.append("\n"); // } // } // return listener.rewriter.getText(); return sourceContent; } } src/main/java/hk/quantr/verilogcompiler/listener/preprocess/VerilogPreProcessorListener.java +3 −59 Changes for src/main/java/hk/quantr/verilogcompiler/listener/preprocess/VerilogPreProcessorListener.java: 3 added lines, 59 removed lines. Original line number Diff line number Diff line Loading @@ -35,65 +35,9 @@ public class VerilogPreProcessorListener extends VerilogParserBaseListener { // int noOfTab = StringUtils.countMatches(line, "\t"); int lineNo = ctx.stop.getLine() - 1; /* String prefix = ""; for (MacroListing temp : macroListing) { if (temp.secondLineNo == lineNo) { prefix = temp.line.replaceAll("[^\t]", " "); break; } }*/ // find macro uuid // String macroUUID = macroListing.get(lineNo).uuid; //// for (int z = 0; z < macroListing.size(); z++) { //// if (macroListing.get(z).type == Type.MACRO && macroListing.get(z).lineNo == lineNo) { //// macroUUID = macroListing.get(z).uuid; //// break; //// } //// } // // end find macro uuid // // if (macroUUID == null) { // System.out.println(""); // } // // // find macro uuid /*int macroLastLineNo = -1; int macroLastSecondLineNo = -1; for (int z = macroListing.size() - 1; z >= 0; z--) { if (macroListing.get(z).secondLineNo == lineNo) { macroLastLineNo = macroListing.get(z).lineNo; macroLastSecondLineNo = macroListing.get(z).secondLineNo; break; } } if (macroLastLineNo == -1) { System.out.println("shit"); }*/ // end find macro uuid // find original // if (ctx.variable_lvalue().getText().equals("logicout")){ // System.out.println(""); // } // int temp = lineNo; // while (macroListing.get(temp).type != Type.ORIGINAL) { // temp--; // } // end find original // macroListing.add(new MacroListing(macroLastLineNo, macroLastSecondLineNo, prefix + "$display(" + ctx.variable_lvalue().getText() + ");", MacroListing.Type.PROFILING, null)); // // add to macroListing // for (int z = macroListing.size() - 1; z >= 0; z--) { // int lineNo = ctx.stop.getLine() - 1; // if (macroListing.get(z).lineNo == lineNo) { // macroListing.add(z + 1, new MacroListing(lineNo, line + macroUUID + "$display(" + ctx.variable_lvalue().getText() + ");", MacroListing.Type.PROFILING, null)); // break; // } // } // // end add to macroListing // rewriter.insertAfter(ctx.stop, ";\n" + prefix + "$display(" + ctx.variable_lvalue().getText() + ")"); System.out.println(">>>>" + lineNo + " = " + ctx.getText()); MacroListing parentMacro = ps.getDeepestNode(lineNo); parentMacro.children.add(new MacroListing(parentMacro.parseNo + 1, lineNo, parentMacro.originalLineNo, "$display(" + ctx.variable_lvalue().getText() + ");", MacroListing.Type.PROFILING)); } @Override Loading src/main/java/hk/quantr/verilogcompiler/macro/ParseStructure.java +31 −24 Changes for src/main/java/hk/quantr/verilogcompiler/macro/ParseStructure.java: 31 added lines, 24 removed lines. Original line number Diff line number Diff line Loading @@ -15,14 +15,14 @@ public class ParseStructure { public ArrayList<MacroListing> macroListing = new ArrayList<>(); public Pair<String, Integer> macroListingToString(ArrayList<MacroListing> temp, int index) { public Pair<String, Integer> macroListingToString(ArrayList<MacroListing> macroListingPara, int index) { String s = ""; for (MacroListing macroListing : temp) { s += index + "\t(" + macroListing.parseNo + ")" + " ".repeat(macroListing.parseNo + 1) + macroListing + "\n"; for (MacroListing temp : macroListingPara) { s += index + "\t(" + temp.parseNo + ")" + " ".repeat(temp.parseNo + 1) + temp + "\n"; index++; if (macroListing.children.isEmpty()) { if (temp.children.isEmpty()) { } else { Pair<String, Integer> temp2 = macroListingToString(macroListing.children, index); Pair<String, Integer> temp2 = macroListingToString(temp.children, index); s += temp2.getLeft(); index = temp2.getRight(); } Loading @@ -35,25 +35,6 @@ public class ParseStructure { return macroListingToString(macroListing, 0).getLeft(); } // public MacroListing get(int lineNo, int parseNo) { // return get(macroListing, lineNo, parseNo); // } // // public MacroListing get(ArrayList<MacroListing> temp, int lineNo, int parseNo) { // for (int x = temp.size() - 1; x >= 0; x--) { //// System.out.println(">>>>>>> " + temp.get(x).lineNo + " = " + temp.get(x).parseNo + " : " + temp.get(x).line); // if (temp.get(x).lineNo == lineNo && temp.get(x).parseNo == parseNo) { // return temp.get(x); // } // if (!temp.get(x).children.isEmpty()) { // MacroListing temp2 = get(temp.get(x).children, lineNo, parseNo); // if (temp2 != null) { // return temp2; // } // } // } // return null; // } public MacroListing get(int lineNo, int parseNo) { return get(lineNo, parseNo, macroListing); } Loading @@ -72,4 +53,30 @@ public class ParseStructure { } return null; } private void addAll(ArrayList<MacroListing> result, ArrayList<MacroListing> temp) { for (MacroListing t : temp) { result.add(t); addAll(result, t.children); } } public ArrayList<MacroListing> fatternMacroListing() { ArrayList<MacroListing> result = new ArrayList<>(); addAll(result, macroListing); return result; } public MacroListing getDeepestNode(int lineNo) { MacroListing node = null; for (MacroListing macro : fatternMacroListing()) { if (macro.lineNo == lineNo && (node == null || macro.parseNo > node.parseNo)) { node = macro; } } if (node == null) { System.out.println(""); } return node; } } Loading
nbactions.xml +3 −3 Changes for nbactions.xml: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ <properties> <exec.vmArgs></exec.vmArgs> <exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args> <exec.appArgs>-t ../quantr-i/src -o ../quantr-i/src-output</exec.appArgs> <exec.appArgs>-t ../quantr-i/src/id.v -o ../quantr-i/src-output</exec.appArgs> <exec.mainClass>hk.quantr.verilogcompiler.VerilogCompiler</exec.mainClass> <exec.executable>java</exec.executable> </properties> Loading @@ -29,7 +29,7 @@ <properties> <exec.vmArgs>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs> <exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args> <exec.appArgs>-t ../quantr-i/src -o ../quantr-i/src-output</exec.appArgs> <exec.appArgs>-t ../quantr-i/src/id.v -o ../quantr-i/src-output</exec.appArgs> <exec.mainClass>hk.quantr.verilogcompiler.VerilogCompiler</exec.mainClass> <exec.executable>java</exec.executable> <jpda.listen>true</jpda.listen> Loading @@ -49,7 +49,7 @@ <exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args> <exec.mainClass>${packageClassName}</exec.mainClass> <exec.executable>java</exec.executable> <exec.appArgs>-t ../quantr-i/src -o ../quantr-i/src-output</exec.appArgs> <exec.appArgs>-t ../quantr-i/src/id.v -o ../quantr-i/src-output</exec.appArgs> </properties> </action> <action> Loading
src/main/java/hk/quantr/verilogcompiler/VerilogHelper.java −11 Changes for src/main/java/hk/quantr/verilogcompiler/VerilogHelper.java: 0 added lines, 11 removed lines. Original line number Diff line number Diff line Loading @@ -301,19 +301,8 @@ public class VerilogHelper { System.out.println("-".repeat(100)); VerilogPreProcessorListener listener = new VerilogPreProcessorListener(tokenStream, sourceContent, ps); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); // StringBuilder sb = new StringBuilder(); // for (MacroListing m : macroListing) { // System.out.println(m); // if (m.type == Type.ORIGINAL || m.type == Type.PROFILING) { // sb.append(m.line); // sb.append("\n"); // } // } // return listener.rewriter.getText(); return sourceContent; } }
src/main/java/hk/quantr/verilogcompiler/listener/preprocess/VerilogPreProcessorListener.java +3 −59 Changes for src/main/java/hk/quantr/verilogcompiler/listener/preprocess/VerilogPreProcessorListener.java: 3 added lines, 59 removed lines. Original line number Diff line number Diff line Loading @@ -35,65 +35,9 @@ public class VerilogPreProcessorListener extends VerilogParserBaseListener { // int noOfTab = StringUtils.countMatches(line, "\t"); int lineNo = ctx.stop.getLine() - 1; /* String prefix = ""; for (MacroListing temp : macroListing) { if (temp.secondLineNo == lineNo) { prefix = temp.line.replaceAll("[^\t]", " "); break; } }*/ // find macro uuid // String macroUUID = macroListing.get(lineNo).uuid; //// for (int z = 0; z < macroListing.size(); z++) { //// if (macroListing.get(z).type == Type.MACRO && macroListing.get(z).lineNo == lineNo) { //// macroUUID = macroListing.get(z).uuid; //// break; //// } //// } // // end find macro uuid // // if (macroUUID == null) { // System.out.println(""); // } // // // find macro uuid /*int macroLastLineNo = -1; int macroLastSecondLineNo = -1; for (int z = macroListing.size() - 1; z >= 0; z--) { if (macroListing.get(z).secondLineNo == lineNo) { macroLastLineNo = macroListing.get(z).lineNo; macroLastSecondLineNo = macroListing.get(z).secondLineNo; break; } } if (macroLastLineNo == -1) { System.out.println("shit"); }*/ // end find macro uuid // find original // if (ctx.variable_lvalue().getText().equals("logicout")){ // System.out.println(""); // } // int temp = lineNo; // while (macroListing.get(temp).type != Type.ORIGINAL) { // temp--; // } // end find original // macroListing.add(new MacroListing(macroLastLineNo, macroLastSecondLineNo, prefix + "$display(" + ctx.variable_lvalue().getText() + ");", MacroListing.Type.PROFILING, null)); // // add to macroListing // for (int z = macroListing.size() - 1; z >= 0; z--) { // int lineNo = ctx.stop.getLine() - 1; // if (macroListing.get(z).lineNo == lineNo) { // macroListing.add(z + 1, new MacroListing(lineNo, line + macroUUID + "$display(" + ctx.variable_lvalue().getText() + ");", MacroListing.Type.PROFILING, null)); // break; // } // } // // end add to macroListing // rewriter.insertAfter(ctx.stop, ";\n" + prefix + "$display(" + ctx.variable_lvalue().getText() + ")"); System.out.println(">>>>" + lineNo + " = " + ctx.getText()); MacroListing parentMacro = ps.getDeepestNode(lineNo); parentMacro.children.add(new MacroListing(parentMacro.parseNo + 1, lineNo, parentMacro.originalLineNo, "$display(" + ctx.variable_lvalue().getText() + ");", MacroListing.Type.PROFILING)); } @Override Loading
src/main/java/hk/quantr/verilogcompiler/macro/ParseStructure.java +31 −24 Changes for src/main/java/hk/quantr/verilogcompiler/macro/ParseStructure.java: 31 added lines, 24 removed lines. Original line number Diff line number Diff line Loading @@ -15,14 +15,14 @@ public class ParseStructure { public ArrayList<MacroListing> macroListing = new ArrayList<>(); public Pair<String, Integer> macroListingToString(ArrayList<MacroListing> temp, int index) { public Pair<String, Integer> macroListingToString(ArrayList<MacroListing> macroListingPara, int index) { String s = ""; for (MacroListing macroListing : temp) { s += index + "\t(" + macroListing.parseNo + ")" + " ".repeat(macroListing.parseNo + 1) + macroListing + "\n"; for (MacroListing temp : macroListingPara) { s += index + "\t(" + temp.parseNo + ")" + " ".repeat(temp.parseNo + 1) + temp + "\n"; index++; if (macroListing.children.isEmpty()) { if (temp.children.isEmpty()) { } else { Pair<String, Integer> temp2 = macroListingToString(macroListing.children, index); Pair<String, Integer> temp2 = macroListingToString(temp.children, index); s += temp2.getLeft(); index = temp2.getRight(); } Loading @@ -35,25 +35,6 @@ public class ParseStructure { return macroListingToString(macroListing, 0).getLeft(); } // public MacroListing get(int lineNo, int parseNo) { // return get(macroListing, lineNo, parseNo); // } // // public MacroListing get(ArrayList<MacroListing> temp, int lineNo, int parseNo) { // for (int x = temp.size() - 1; x >= 0; x--) { //// System.out.println(">>>>>>> " + temp.get(x).lineNo + " = " + temp.get(x).parseNo + " : " + temp.get(x).line); // if (temp.get(x).lineNo == lineNo && temp.get(x).parseNo == parseNo) { // return temp.get(x); // } // if (!temp.get(x).children.isEmpty()) { // MacroListing temp2 = get(temp.get(x).children, lineNo, parseNo); // if (temp2 != null) { // return temp2; // } // } // } // return null; // } public MacroListing get(int lineNo, int parseNo) { return get(lineNo, parseNo, macroListing); } Loading @@ -72,4 +53,30 @@ public class ParseStructure { } return null; } private void addAll(ArrayList<MacroListing> result, ArrayList<MacroListing> temp) { for (MacroListing t : temp) { result.add(t); addAll(result, t.children); } } public ArrayList<MacroListing> fatternMacroListing() { ArrayList<MacroListing> result = new ArrayList<>(); addAll(result, macroListing); return result; } public MacroListing getDeepestNode(int lineNo) { MacroListing node = null; for (MacroListing macro : fatternMacroListing()) { if (macro.lineNo == lineNo && (node == null || macro.parseNo > node.parseNo)) { node = macro; } } if (node == null) { System.out.println(""); } return node; } }