Commit 8bd2c99b authored by Andrey Filippov's avatar Andrey Filippov

Working on per-tool defines adn closures

parent b0a62607
...@@ -27,7 +27,9 @@ ...@@ -27,7 +27,9 @@
package com.elphel.vdt; package com.elphel.vdt;
import java.util.ArrayList; import java.util.ArrayList;
//import java.util.HashMap;
import java.util.List; import java.util.List;
//import java.util.Map;
import com.elphel.vdt.ui.variables.SelectedResourceManager; import com.elphel.vdt.ui.variables.SelectedResourceManager;
import com.elphel.vdt.veditor.VerilogPlugin; import com.elphel.vdt.veditor.VerilogPlugin;
...@@ -185,25 +187,53 @@ public class VerilogUtils { ...@@ -185,25 +187,53 @@ public class VerilogUtils {
return outlineDatabase.getClosureSorted(topFiles); return outlineDatabase.getClosureSorted(topFiles);
} // getDependencies() } // getDependencies()
public static IFile[] getDependencies(IFile topFile) { public static IFile[] getDependencies(IFile topFile, String toolDefine) {
return getDependencies(new IFile [] {topFile}); /// System.out.println("===VerilogUtils.getDependencies("+topFile+")");
IProject project = topFile.getProject();
if (toolDefine != null) {
OutlineDatabase outlineDatabase=new OutlineDatabase(project); // new OutlineDatabase just for this scan
outlineDatabase.scanFilesWithDefine(topFile,toolDefine);
// System.out.println("-->>>VerilogUtils.getDependencies number of files="+outlineDatabase.getDatabaseFileList().length);
// for (int i=0; i<outlineDatabase.getDatabaseFileList().length; i++){
// System.out.println(i+": "+outlineDatabase.getDatabaseFileList()[i]);
// }
IFile[] topFiles = {topFile};
return outlineDatabase.getClosureSorted(topFiles);
} else {
/// System.out.println("===---VerilogUtils.getDependencies("+topFile+") - using editor depends");
return getDependencies(new IFile [] {topFile});
}
} }
/** /**
* Returns included files dependency closure for given verilog file. * Returns included files dependency closure for given verilog file.
*/ */
public static IFile[] getIncludedDependencies(IFile topFile, String toolDefine) {
// System.out.println("===VerilogUtils.getIncludedDependencies("+topFile+", "+toolDefine+")");
IProject project = topFile.getProject();
if (toolDefine != null) {
OutlineDatabase outlineDatabase=new OutlineDatabase(project); // new OutlineDatabase just for this scan
outlineDatabase.scanFilesWithDefine(topFile,toolDefine);
// System.out.println("-->>>VerilogUtils.getDependencies number of files="+outlineDatabase.getDatabaseFileList().length);
// for (int i=0; i<outlineDatabase.getDatabaseFileList().length; i++){
// System.out.println(i+": "+outlineDatabase.getDatabaseFileList()[i]);
// }
IFile[] topFiles = {topFile};
return outlineDatabase.getClosureIncludes(topFiles);
} else {
return getIncludedDependencies(new IFile [] {topFile});
}
}
public static IFile[] getIncludedDependencies(IFile [] topFiles) { public static IFile[] getIncludedDependencies(IFile [] topFiles) {
if (topFiles==null) return null; if (topFiles==null) return null;
IProject project = topFiles[0].getProject(); IProject project = topFiles[0].getProject();
OutlineDatabase outlineDatabase=getVeditorOutlineDatabase(project); OutlineDatabase outlineDatabase=getVeditorOutlineDatabase(project);
return outlineDatabase.getCLosureIncludes(topFiles); return outlineDatabase.getClosureIncludes(topFiles);
} // getDependencies() } // getDependencies()
public static IFile[] getIncludedDependencies(IFile topFile) {
return getIncludedDependencies(new IFile [] {topFile});
}
/* for now all modules, including library ones */ /* for now all modules, including library ones */
public static OutlineElement[] getModuleListVeditor(IProject project) { public static OutlineElement[] getModuleListVeditor(IProject project) {
......
...@@ -66,7 +66,7 @@ import com.elphel.vdt.ui.MessageUI; ...@@ -66,7 +66,7 @@ import com.elphel.vdt.ui.MessageUI;
import com.elphel.vdt.ui.dialogs.PackageLocationDialog; import com.elphel.vdt.ui.dialogs.PackageLocationDialog;
import com.elphel.vdt.ui.dialogs.ToolLocationDialog; import com.elphel.vdt.ui.dialogs.ToolLocationDialog;
import com.elphel.vdt.ui.preferences.PreferencePage; import com.elphel.vdt.ui.preferences.PreferencePage;
import com.elphel.vdt.ui.views.DesignFlowView; //import com.elphel.vdt.ui.views.DesignFlowView;
/** /**
* Support for launching verilog development tools programmatically. * Support for launching verilog development tools programmatically.
...@@ -133,9 +133,10 @@ public class LaunchCore { ...@@ -133,9 +133,10 @@ public class LaunchCore {
public static void updateLaunchConfiguration( ILaunchConfigurationWorkingCopy workingCopy public static void updateLaunchConfiguration( ILaunchConfigurationWorkingCopy workingCopy
, Tool tool ) throws CoreException , Tool tool ) throws CoreException
{ {
for (Iterator i = tool.getParams().iterator(); i.hasNext(); ) {
Parameter param = (Parameter)i.next(); for (Iterator<Parameter> i = tool.getParams().iterator(); i.hasNext(); ) {
Parameter param = i.next();
String valueAttrName = LaunchCore.getValueAttributeName(param); String valueAttrName = LaunchCore.getValueAttributeName(param);
if(param.getType().isList()) if(param.getType().isList())
...@@ -158,7 +159,8 @@ public class LaunchCore { ...@@ -158,7 +159,8 @@ public class LaunchCore {
workingCopy.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true); workingCopy.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true);
} // updateLaunchConfiguration() } // updateLaunchConfiguration()
public static void updateContextOptions(Tool tool, IProject project) throws ToolException, CoreException { public static void updateContextOptions(Tool tool, IProject project) throws ToolException, CoreException {
tool.setTreeReparse(true);
PackageContext packageContext = tool.getParentPackage(); PackageContext packageContext = tool.getParentPackage();
if (packageContext != null) { if (packageContext != null) {
OptionsCore.doLoadContextOptions(packageContext); OptionsCore.doLoadContextOptions(packageContext);
......
...@@ -144,13 +144,14 @@ public class VDTLaunchUtil { ...@@ -144,13 +144,14 @@ public class VDTLaunchUtil {
*/ */
// public static List<String> getArguments(ILaunchConfiguration configuration) throws CoreException { // public static List<String> getArguments(ILaunchConfiguration configuration) throws CoreException {
public static BuildParamsItem[] getArguments(ILaunchConfiguration configuration) throws CoreException { public static BuildParamsItem[] getArguments(ILaunchConfiguration configuration) throws CoreException {
Tool tool = obtainTool(configuration); Tool tool = obtainTool(configuration);
tool.setTreeReparse(true);
// Replaces tool parameter values with the ones passed through configuration, then uses tool.buildParams; // Replaces tool parameter values with the ones passed through configuration, then uses tool.buildParams;
// that causes conflicts in multi-threaded operation. Or is it just a working copy? // that causes conflicts in multi-threaded operation. Or is it just a working copy?
for (Iterator i = tool.getParams().iterator(); i.hasNext(); ) { for (Iterator<Parameter> i = tool.getParams().iterator(); i.hasNext(); ) {
Parameter param = (Parameter)i.next(); Parameter param = i.next();
String valueAttrName = LaunchCore.getValueAttributeName(param); // "ATTR_VALUE_" + toolParameter.getID(); String valueAttrName = LaunchCore.getValueAttributeName(param); // "ATTR_VALUE_" + toolParameter.getID();
try { try {
if(param.getType().isList()) { if(param.getType().isList()) {
...@@ -169,8 +170,8 @@ public class VDTLaunchUtil { ...@@ -169,8 +170,8 @@ public class VDTLaunchUtil {
try { try {
String location = getWorkingDirectory(configuration); String location = getWorkingDirectory(configuration);
tool.setWorkingDirectory(location); tool.setWorkingDirectory(location);
BuildParamsItem[] paramItemsArray = tool.buildParams(); BuildParamsItem[] paramItemsArray = tool.buildParams();
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) { if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) {
System.out.println("called tool.buildParams() here (from VDTLaunchUtils.java)"); System.out.println("called tool.buildParams() here (from VDTLaunchUtils.java)");
...@@ -204,7 +205,17 @@ public class VDTLaunchUtil { ...@@ -204,7 +205,17 @@ public class VDTLaunchUtil {
Tool tool = obtainTool(configuration); Tool tool = obtainTool(configuration);
return tool.getName(); return tool.getName();
} }
public static String getToolDefine(ILaunchConfiguration configuration) throws CoreException {
Tool tool = obtainTool(configuration);
return tool.getDefine();
}
public static String getToolTopFile(ILaunchConfiguration configuration) throws CoreException {
Tool tool = obtainTool(configuration);
return tool.getTopFile();
}
public static String getPatternWarnings(ILaunchConfiguration configuration) throws CoreException { public static String getPatternWarnings(ILaunchConfiguration configuration) throws CoreException {
Tool tool = obtainTool(configuration); Tool tool = obtainTool(configuration);
...@@ -249,7 +260,7 @@ public class VDTLaunchUtil { ...@@ -249,7 +260,7 @@ public class VDTLaunchUtil {
// return resources; // return resources;
// return parseVerilogFile(resource); // return parseVerilogFile(resource);
if (resource instanceof IFile) { if (resource instanceof IFile) {
List<String> resourcesLocation = getVerilogFileDependencies((IFile)resource); List<String> resourcesLocation = getVerilogFileDependencies((IFile)resource, getToolDefine(configuration));
// resourcesLocation.add(resource.getLocation().toOSString()); // resourcesLocation.add(resource.getLocation().toOSString());
return resourcesLocation; return resourcesLocation;
} }
...@@ -258,13 +269,13 @@ public class VDTLaunchUtil { ...@@ -258,13 +269,13 @@ public class VDTLaunchUtil {
return null; return null;
} // getResources() } // getResources()
private static List<String> getVerilogFileDependencies(IFile file) throws CoreException { private static List<String> getVerilogFileDependencies(IFile file, String toolDefine) throws CoreException {
// StackTraceElement frame = new Exception().getStackTrace()[0]; // StackTraceElement frame = new Exception().getStackTrace()[0];
// System.out.println("*** Broken core/tools/generators in "+frame.getFileName()+":"+frame.getLineNumber()); // System.out.println("*** Broken core/tools/generators in "+frame.getFileName()+":"+frame.getLineNumber());
// return null; // return null;
IFile[] dependencies = VerilogUtils.getDependencies(file); IFile[] dependencies = VerilogUtils.getDependencies(file, toolDefine);
List<String> dependenciesLocation = new ArrayList<String>(); List<String> dependenciesLocation = new ArrayList<String>();
if(dependencies != null) { if(dependencies != null) {
...@@ -273,7 +284,7 @@ public class VDTLaunchUtil { ...@@ -273,7 +284,7 @@ public class VDTLaunchUtil {
// System.out.println(" "+dependencies[i].getName()); // System.out.println(" "+dependencies[i].getName());
} }
} }
dependencies = VerilogUtils.getIncludedDependencies(file); dependencies = VerilogUtils.getIncludedDependencies(file, toolDefine);
if(dependencies != null) { if(dependencies != null) {
for (int i=0; i < dependencies.length; i++) { for (int i=0; i < dependencies.length; i++) {
dependenciesLocation.add(dependencies[i].getLocation().toOSString()); dependenciesLocation.add(dependencies[i].getLocation().toOSString());
......
...@@ -146,7 +146,10 @@ public class XMLConfig extends Config { ...@@ -146,7 +146,10 @@ public class XMLConfig extends Config {
static final String CONTEXT_TOOL_AUTOSAVE = "autosave"; // Parameter name of boolean type that controls automatic save after success static final String CONTEXT_TOOL_AUTOSAVE = "autosave"; // Parameter name of boolean type that controls automatic save after success
static final String CONTEXT_TOOL_ABSTRACT = "abstract"; // true for the prototype tools used only for inheritance by others static final String CONTEXT_TOOL_ABSTRACT = "abstract"; // true for the prototype tools used only for inheritance by others
static final String CONTEXT_TOOL_PRIORITY = "priority"; // lower the value, first to run among otherwise equivalent report tools (taht do not change state) static final String CONTEXT_TOOL_PRIORITY = "priority"; // lower the value, first to run among otherwise equivalent report tools (taht do not change state)
static final String CONTEXT_TOOL_TOP_FILE = "top-file"; // Top file for this tool
static final String CONTEXT_TOOL_DEFINE = "define"; // Tool-specific define used to resolve dependencies
static final String CONTEXT_LINEBLOCK_TAG = "line"; static final String CONTEXT_LINEBLOCK_TAG = "line";
static final String CONTEXT_LINEBLOCK_NAME_ATTR = "name"; static final String CONTEXT_LINEBLOCK_NAME_ATTR = "name";
...@@ -664,6 +667,8 @@ public class XMLConfig extends Config { ...@@ -664,6 +667,8 @@ public class XMLConfig extends Config {
String priorityString = getAttributeValue(contextNode, CONTEXT_TOOL_PRIORITY); String priorityString = getAttributeValue(contextNode, CONTEXT_TOOL_PRIORITY);
String topFile = getAttributeValue(contextNode, CONTEXT_TOOL_TOP_FILE);
String toolDefine = getAttributeValue(contextNode, CONTEXT_TOOL_DEFINE);
double priority=Double.NaN;; double priority=Double.NaN;;
if (priorityString!=null){ if (priorityString!=null){
...@@ -734,7 +739,9 @@ public class XMLConfig extends Config { ...@@ -734,7 +739,9 @@ public class XMLConfig extends Config {
saveString, saveString,
autoSaveString, autoSaveString,
isAbstract, isAbstract,
priority, priority,
topFile,
toolDefine,
null, null,
null, null,
null); null);
......
...@@ -67,13 +67,13 @@ public abstract class Context { ...@@ -67,13 +67,13 @@ public abstract class Context {
protected List<CommandLinesBlock> commandLinesBlocks; protected List<CommandLinesBlock> commandLinesBlocks;
protected List<ParamGroup> visibleParamGroups = new ArrayList<ParamGroup>(); protected List<ParamGroup> visibleParamGroups = new ArrayList<ParamGroup>();
protected Config config; protected Config config;
protected boolean needsReparse;
private StringConditionParser conditionParser = new StringConditionParser(this); private StringConditionParser conditionParser = new StringConditionParser(this);
private List<String> createdControlFiles = new ArrayList<String>(); private List<String> createdControlFiles = new ArrayList<String>();
private boolean initialized = false; private boolean initialized = false;
private String workingDirectory; private String workingDirectory;
private String version; private String version;
private Context context=null; // private Context context=null;
private int currentHash; // calculated during buildparam from non-parser command blocks and command files. private int currentHash; // calculated during buildparam from non-parser command blocks and command files.
protected Context(String name, protected Context(String name,
String controlInterfaceName, String controlInterfaceName,
...@@ -91,8 +91,18 @@ public abstract class Context { ...@@ -91,8 +91,18 @@ public abstract class Context {
this.commandLinesBlocks = commandLinesBlocks; this.commandLinesBlocks = commandLinesBlocks;
this.inputDialogLabel = inputDialogLabel; this.inputDialogLabel = inputDialogLabel;
this.paramGroups = paramGroups; this.paramGroups = paramGroups;
this.paramContainer = new ParameterContainer(params); this.paramContainer = new ParameterContainer(params);
this.needsReparse = false;
} }
// Tree needed to be reparsed for closure rebuild (slow)
public boolean needsTreeReparse(){
return needsReparse;
}
public void setTreeReparse(boolean needsReparse){
// System.out.println("Tool.setTreeReparse("+needsReparse+") - "+getName());
this.needsReparse = needsReparse;
}
/** /**
* Generated hashcode for the last run of buildParams() - includes command files and non-parser command lines * Generated hashcode for the last run of buildParams() - includes command files and non-parser command lines
......
...@@ -76,24 +76,34 @@ public class FilteredIncludesListGenerator extends AbstractGenerator { ...@@ -76,24 +76,34 @@ public class FilteredIncludesListGenerator extends AbstractGenerator {
protected String[] getStringValues() { protected String[] getStringValues() {
String ignoreFilter= SelectedResourceManager.getDefault().getFilter(); // old version String ignoreFilter= SelectedResourceManager.getDefault().getFilter(); // old version
String topFile = null;
// System.out.println("FilteredIncludesListGenerator(), tool0="+((tool0==null)?null:(tool0.getName()+tool0.getIgnoreFilter()))); String toolDefine = null;
// System.out.print("FilteredIncludesListGenerator(): ");
if (topProcessor!=null){ if (topProcessor!=null){
Tool tool=topProcessor.getCurrentTool(); Tool tool=topProcessor.getCurrentTool();
// System.out.println(", tool="+tool+" tool name="+((tool!=null)?tool.getName():null));
if (tool != null) { if (tool != null) {
ignoreFilter=tool.getIgnoreFilter(); ignoreFilter=tool.getIgnoreFilter();
// System.out.println(" tool="+tool.getName()+", ignoreFilter="+ignoreFilter); topFile = tool.getTopFile();
toolDefine = tool.getDefine();
} else { } else {
System.out.println("FilteredIncludesListGenerator(): topProcessor.getCurrentTool() is null"); System.out.println("FilteredIncludesListGenerator(): topProcessor.getCurrentTool() is null");
} }
if ((toolDefine == null) || (toolDefine == "")) {
if ((topFile == null ) || (topFile == "")) toolDefine = null; // no need to reparse tree for this tool
else toolDefine = ""; // reparse for this tool - top file may have different defines
}
if (!tool.needsTreeReparse()) toolDefine = null;
} else { } else {
System.out.println("FilteredIncludesListGenerator(): topProcessor is null"); System.out.println("FilteredIncludesListGenerator(): topProcessor is null");
} }
String[] file_names = null; String[] file_names = null;
IResource resource = SelectedResourceManager.getDefault().getChosenVerilogFile(); IResource resource = SelectedResourceManager.getDefault().getChosenVerilogFile();
if ((topFile != null) && (topFile !="") && (resource !=null)) {
IResource resource1 = resource.getProject().getFile(topFile);
if ((resource1 != null) && (resource1.getType() == IResource.FILE)){
resource = resource1;
// System.out.println("resource1="+resource1);
}
}
Pattern ignorePattern = null; Pattern ignorePattern = null;
if (ignoreFilter!=null){ if (ignoreFilter!=null){
try { try {
...@@ -105,7 +115,7 @@ public class FilteredIncludesListGenerator extends AbstractGenerator { ...@@ -105,7 +115,7 @@ public class FilteredIncludesListGenerator extends AbstractGenerator {
} }
if (resource != null && resource.getType() == IResource.FILE) { if (resource != null && resource.getType() == IResource.FILE) {
IFile[] files = VerilogUtils.getIncludedDependencies((IFile)resource); // returned just the same x353_1.tf IFile[] files = VerilogUtils.getIncludedDependencies((IFile)resource, toolDefine); // returned just the same x353_1.tf
List<String> fileList=new ArrayList<String>(); List<String> fileList=new ArrayList<String>();
for (int i=0; i < files.length; i++) { for (int i=0; i < files.length; i++) {
String fileName=files[i].getProjectRelativePath().toOSString(); //.getName(); String fileName=files[i].getProjectRelativePath().toOSString(); //.getName();
......
...@@ -68,6 +68,7 @@ public class FilteredSourceListGenerator extends AbstractGenerator { ...@@ -68,6 +68,7 @@ public class FilteredSourceListGenerator extends AbstractGenerator {
FormatProcessor topProcessor) FormatProcessor topProcessor)
{ {
super(prefix, suffix, separator, topProcessor ); super(prefix, suffix, separator, topProcessor );
// System.out.println("FilteredSourceListGenerator( "+prefix+","+suffix+", "+separator+",.prefix..)");
} }
public String getName() { public String getName() {
...@@ -76,16 +77,22 @@ public class FilteredSourceListGenerator extends AbstractGenerator { ...@@ -76,16 +77,22 @@ public class FilteredSourceListGenerator extends AbstractGenerator {
protected String[] getStringValues() { protected String[] getStringValues() {
String ignoreFilter= SelectedResourceManager.getDefault().getFilter(); // old version String ignoreFilter= SelectedResourceManager.getDefault().getFilter(); // old version
String topFile = null;
// System.out.println("FilteredSourceListGenerator(), tool0="+((tool0==null)?null:(tool0.getName()+tool0.getIgnoreFilter()))); String toolDefine = null;
// System.out.print("FilteredSourceListGenerator(): ");
if (topProcessor!=null){ if (topProcessor!=null){
Tool tool=topProcessor.getCurrentTool(); Tool tool=topProcessor.getCurrentTool();
// System.out.println(", tool="+tool+" tool name="+((tool!=null)?tool.getName():null)); // System.out.println(", tool="+tool+" tool name="+((tool!=null)?tool.getName():null));
if (tool != null) { if (tool != null) {
ignoreFilter=tool.getIgnoreFilter(); ignoreFilter=tool.getIgnoreFilter();
// System.out.println(" tool="+tool.getName()+", ignoreFilter="+ignoreFilter); // System.out.println("FilteredSourceListGenerator().getStringValue(): tool="+tool.getName()+", ignoreFilter="+ignoreFilter);
topFile = tool.getTopFile();
toolDefine = tool.getDefine();
if ((toolDefine == null) || (toolDefine == "")) {
if ((topFile == null ) || (topFile == "")) toolDefine = null; // no need to reparse tree for this tool
else toolDefine = ""; // reparse for this tool - top file may have different defines
}
if (!tool.needsTreeReparse()) toolDefine = null;
// System.out.println("topFile="+topFile+ " toolDefine="+toolDefine);
} else { } else {
System.out.println("FilteredSourceListGenerator(): topProcessor.getCurrentTool() is null"); System.out.println("FilteredSourceListGenerator(): topProcessor.getCurrentTool() is null");
} }
...@@ -94,6 +101,13 @@ public class FilteredSourceListGenerator extends AbstractGenerator { ...@@ -94,6 +101,13 @@ public class FilteredSourceListGenerator extends AbstractGenerator {
} }
String[] file_names = null; String[] file_names = null;
IResource resource = SelectedResourceManager.getDefault().getChosenVerilogFile(); IResource resource = SelectedResourceManager.getDefault().getChosenVerilogFile();
if ((topFile != null) && (topFile !="") && (resource !=null)) {
IResource resource1 = resource.getProject().getFile(topFile);
if ((resource1 != null) && (resource1.getType() == IResource.FILE)){
resource = resource1;
// System.out.println("resource1="+resource1);
}
}
Pattern ignorePattern = null; Pattern ignorePattern = null;
if (ignoreFilter!=null){ if (ignoreFilter!=null){
try { try {
...@@ -104,8 +118,10 @@ public class FilteredSourceListGenerator extends AbstractGenerator { ...@@ -104,8 +118,10 @@ public class FilteredSourceListGenerator extends AbstractGenerator {
} }
} }
if (resource != null && resource.getType() == IResource.FILE) { if (resource != null && resource.getType() == IResource.FILE) {
IFile[] files = VerilogUtils.getDependencies((IFile)resource); // returned just the same x353_1.tf IFile[] files = VerilogUtils.getDependencies((IFile)resource, toolDefine); // returned just the same x353_1.tf
// System.out.println("FilteredSourceListGenerator(): resource = "+resource);
List<String> fileList=new ArrayList<String>(); List<String> fileList=new ArrayList<String>();
for (int i=0; i < files.length; i++) { for (int i=0; i < files.length; i++) {
String fileName=files[i].getProjectRelativePath().toOSString(); //.getName(); String fileName=files[i].getProjectRelativePath().toOSString(); //.getName();
......
...@@ -31,8 +31,10 @@ import org.eclipse.core.resources.IFile; ...@@ -31,8 +31,10 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
//import com.elphel.vdt.VDT; //import com.elphel.vdt.VDT;
import com.elphel.vdt.VerilogUtils; import com.elphel.vdt.VerilogUtils;
import com.elphel.vdt.core.tools.params.Tool;
//import com.elphel.vdt.core.verilog.VerilogUtils; //import com.elphel.vdt.core.verilog.VerilogUtils;
import com.elphel.vdt.ui.variables.SelectedResourceManager; import com.elphel.vdt.ui.variables.SelectedResourceManager;
...@@ -61,11 +63,21 @@ public class IncludesListGenerator extends AbstractGenerator { ...@@ -61,11 +63,21 @@ public class IncludesListGenerator extends AbstractGenerator {
} }
protected String[] getStringValues() { protected String[] getStringValues() {
String[] file_names = null; String[] file_names = null;
String toolName = null;
if (topProcessor!=null){
Tool tool=topProcessor.getCurrentTool();
if (tool != null) toolName=tool.getName();
}
// IResource resource = SelectedResourceManager.getDefault().getSelectedVerilogFile(); // IResource resource = SelectedResourceManager.getDefault().getSelectedVerilogFile();
IResource resource = SelectedResourceManager.getDefault().getChosenVerilogFile(); IResource resource = SelectedResourceManager.getDefault().getChosenVerilogFile();
if (resource != null && resource.getType() == IResource.FILE) { if (resource != null && resource.getType() == IResource.FILE) {
IFile[] files = VerilogUtils.getDependencies((IFile)resource); // returned just the same x353_1.tf
// Should it be
// IFile[] files = VerilogUtils.getIncludedDependencies((IFile)resource); // returned just the same x353_1.tf
IFile[] files = VerilogUtils.getDependencies((IFile)resource, toolName); // returned just the same x353_1.tf
file_names = new String[files.length]; file_names = new String[files.length];
for (int i=0; i < files.length; i++) for (int i=0; i < files.length; i++)
file_names[i] = files[i].getProjectRelativePath().toOSString(); //.getName(); file_names[i] = files[i].getProjectRelativePath().toOSString(); //.getName();
......
...@@ -32,7 +32,8 @@ import org.eclipse.core.resources.IResource; ...@@ -32,7 +32,8 @@ import org.eclipse.core.resources.IResource;
//import com.elphel.vdt.VDT; //import com.elphel.vdt.VDT;
import com.elphel.vdt.VerilogUtils; import com.elphel.vdt.VerilogUtils;
import com.elphel.vdt.core.tools.params.Tool;
//import com.elphel.vdt.core.verilog.VerilogUtils; //import com.elphel.vdt.core.verilog.VerilogUtils;
import com.elphel.vdt.ui.variables.SelectedResourceManager; import com.elphel.vdt.ui.variables.SelectedResourceManager;
...@@ -63,9 +64,15 @@ public class SourceListGenerator extends AbstractGenerator { ...@@ -63,9 +64,15 @@ public class SourceListGenerator extends AbstractGenerator {
protected String[] getStringValues() { protected String[] getStringValues() {
String[] file_names = null; String[] file_names = null;
// IResource resource = SelectedResourceManager.getDefault().getSelectedVerilogFile(); // IResource resource = SelectedResourceManager.getDefault().getSelectedVerilogFile();
IResource resource = SelectedResourceManager.getDefault().getChosenVerilogFile(); IResource resource = SelectedResourceManager.getDefault().getChosenVerilogFile();
String toolName = null;
if (topProcessor!=null){
Tool tool=topProcessor.getCurrentTool();
if (tool != null) toolName=tool.getName();
}
if (resource != null && resource.getType() == IResource.FILE) { if (resource != null && resource.getType() == IResource.FILE) {
IFile[] files = VerilogUtils.getDependencies((IFile)resource); // returned just the same x353_1.tf IFile[] files = VerilogUtils.getDependencies((IFile)resource, toolName); // returned just the same x353_1.tf
file_names = new String[files.length]; file_names = new String[files.length];
for (int i=0; i < files.length; i++) for (int i=0; i < files.length; i++)
file_names[i] = files[i].getProjectRelativePath().toOSString(); //.getName(); file_names[i] = files[i].getProjectRelativePath().toOSString(); //.getName();
......
...@@ -28,12 +28,12 @@ package com.elphel.vdt.core.tools.params; ...@@ -28,12 +28,12 @@ package com.elphel.vdt.core.tools.params;
import java.util.*; import java.util.*;
import java.io.*; import java.io.*;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.QualifiedName; import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.ui.IMemento; import org.eclipse.ui.IMemento;
import com.elphel.vdt.VDT; import com.elphel.vdt.VDT;
import com.elphel.vdt.core.launching.ToolLogFile; import com.elphel.vdt.core.launching.ToolLogFile;
import com.elphel.vdt.core.options.OptionsCore; import com.elphel.vdt.core.options.OptionsCore;
...@@ -160,7 +160,10 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -160,7 +160,10 @@ public class Tool extends Context implements Cloneable, Inheritable {
private TOOL_MODE lastRunMode; // last running (not STOP) mode private TOOL_MODE lastRunMode; // last running (not STOP) mode
private int lastRunHash; // hash code of the last run private int lastRunHash; // hash code of the last run
private ToolWaitingArguments toolWaitingArguments; // save here launch parameters when tool need to wait for other tools to run/get restored private ToolWaitingArguments toolWaitingArguments; // save here launch parameters when tool need to wait for other tools to run/get restored
private double priority; // the lower the earlier tool will run among those with the same dependencies private double priority; // the lower the earlier tool will run among those with the same dependencies
private String topFile; // Tool-specific project top file (may be different for different tools)
private String toolDefine; // Tool-specific define that may be used to distinguish for closure
private static void DEBUG_PRINT(String msg){ private static void DEBUG_PRINT(String msg){
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) { if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println(msg); System.out.println(msg);
...@@ -192,7 +195,11 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -192,7 +195,11 @@ public class Tool extends Context implements Cloneable, Inheritable {
String saveString, // name of tool that saves the state of this tool run String saveString, // name of tool that saves the state of this tool run
String autoSaveString, // name of boolean that turns on/off auto-save after the tool run String autoSaveString, // name of boolean that turns on/off auto-save after the tool run
boolean abstractTool, boolean abstractTool,
double priority, double priority,
String topFile,
String toolDefine,
/* never used ??? */ /* never used ??? */
List<Parameter> params, List<Parameter> params,
List<ParamGroup> paramGroups, List<ParamGroup> paramGroups,
...@@ -233,8 +240,12 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -233,8 +240,12 @@ public class Tool extends Context implements Cloneable, Inheritable {
this.saveString= saveString; // name of tool that saves the state of this tool run this.saveString= saveString; // name of tool that saves the state of this tool run
this.autoSaveString= autoSaveString; // name of boolean that turns on/off auto-save after the tool run this.autoSaveString= autoSaveString; // name of boolean that turns on/off auto-save after the tool run
this.abstractTool= abstractTool; this.abstractTool= abstractTool;
this.priority = priority; this.priority = priority;
this.topFile = topFile;
this.toolDefine = toolDefine;
disabled=null; disabled=null;
restoreTool=null; restoreTool=null;
result=null; result=null;
...@@ -559,7 +570,11 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -559,7 +570,11 @@ public class Tool extends Context implements Cloneable, Inheritable {
if (restoreString== null) restoreString = baseTool.restoreString; if (restoreString== null) restoreString = baseTool.restoreString;
if (saveString== null) saveString = baseTool.saveString; if (saveString== null) saveString = baseTool.saveString;
if (autoSaveString== null) autoSaveString = baseTool.autoSaveString; if (autoSaveString== null) autoSaveString = baseTool.autoSaveString;
// System.out.println("copyBaseAttributes(), tool="+getName());
if (topFile== null) topFile = baseTool.topFile;
if (toolDefine== null) toolDefine = baseTool.toolDefine;
// System.out.println("copyBaseAttributes(), tool="+getName());
if (Double.isNaN(priority)) priority= baseTool.priority; if (Double.isNaN(priority)) priority= baseTool.priority;
// What about output lines attributes? // What about output lines attributes?
...@@ -656,7 +671,8 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -656,7 +671,8 @@ public class Tool extends Context implements Cloneable, Inheritable {
} }
} }
public List<String> getDependFiles(){ public List<String> getDependFiles(){
DEBUG_PRINT("------ getDependFiles()"); DEBUG_PRINT("------ getDependFiles()");
setTreeReparse(true); // Set actual dependence
if ((dependFiles == null) || (dependFiles.size()==0)) return null; if ((dependFiles == null) || (dependFiles.size()==0)) return null;
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
for (Iterator<Parameter> iter= dependFiles.iterator(); iter.hasNext();) { for (Iterator<Parameter> iter= dependFiles.iterator(); iter.hasNext();) {
...@@ -669,6 +685,9 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -669,6 +685,9 @@ public class Tool extends Context implements Cloneable, Inheritable {
} }
// list.addAll(vList); // list.addAll(vList);
} }
}
for (String item:list){
System.out.println("-----> "+getName()+".getDependFiles()->"+item);
} }
return list; return list;
} }
...@@ -1334,29 +1353,42 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -1334,29 +1353,42 @@ public class Tool extends Context implements Cloneable, Inheritable {
} }
return actualActions; return actualActions;
} }
// Should be called after getMenuActions to have updateContextOptions() already ran // Should be called after getMenuActions to have updateContextOptions() already ran
public String getIgnoreFilter(){ // calculate and get
if (ignoreFilter==null) return null; private String parseParameterString(String par){
FormatProcessor topProcessor=new FormatProcessor(this); if (par==null) return null;
FormatProcessor processor = new FormatProcessor( FormatProcessor topProcessor=new FormatProcessor(this);
new Recognizer[] { FormatProcessor processor = new FormatProcessor(
new ContextParamRecognizer(this,topProcessor), new Recognizer[] {
new SimpleGeneratorRecognizer(true,topProcessor) // in menuMode new ContextParamRecognizer(this,topProcessor),
// new SimpleGeneratorRecognizer(false) // in menuMode new SimpleGeneratorRecognizer(true,topProcessor) // in menuMode
},topProcessor); // null for topFormatProcessor - this generator can not reference other parameters // new SimpleGeneratorRecognizer(false) // in menuMode
List<String> results=null; },topProcessor); // null for topFormatProcessor - this generator can not reference other parameters
try { List<String> results=null;
results=processor.process(ignoreFilter); try {
} catch (ToolException e) { results=processor.process(par);
return null; } catch (ToolException e) {
} return null;
if ((results == null) || (results.size()==0)) return null; }
return results.get(0); if ((results == null) || (results.size()==0)) return null;
return results.get(0);
}
public String getIgnoreFilter(){ // calculate and get
return parseParameterString (this.ignoreFilter);
} }
public String getTopFile(){
return parseParameterString (this.topFile);
}
public String getDefine(){
return parseParameterString (this.toolDefine);
}
// private void updateContextOptions (IProject project){ // private void updateContextOptions (IProject project){
public void updateContextOptions (IProject project){ // public to be able to update parameters before setting "dirty" flags public void updateContextOptions (IProject project){ // public to be able to update parameters before setting "dirty" flags
DEBUG_PRINT("~~~updateContextOptions(project) for tool "+getName()); DEBUG_PRINT("~~~updateContextOptions(project) for tool "+getName());
setTreeReparse(false);
PackageContext packageContext = getParentPackage(); PackageContext packageContext = getParentPackage();
if (packageContext != null) { if (packageContext != null) {
OptionsCore.doLoadContextOptions(packageContext); OptionsCore.doLoadContextOptions(packageContext);
...@@ -1465,9 +1497,12 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -1465,9 +1497,12 @@ public class Tool extends Context implements Cloneable, Inheritable {
return buildParams(false); return buildParams(false);
} }
public BuildParamsItem[] buildParams(boolean dryRun) throws ToolException { public BuildParamsItem[] buildParams(boolean dryRun) throws ToolException {
DEBUG_PRINT("buildParams("+dryRun+"): tool "+getName()+" state="+getState()+" dirty="+isDirty()+" hashMatch()="+hashMatch()+" pinned="+isPinned());
DEBUG_PRINT("buildParams("+dryRun+"): tool "+getName()+" state="+getState()+" dirty="+isDirty()+" hashMatch()="+hashMatch()+" pinned="+isPinned());
setTreeReparse(!dryRun);
if(parentPackage != null) if(parentPackage != null)
parentPackage.buildParams(); parentPackage.buildParams();
......
...@@ -1071,7 +1071,8 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -1071,7 +1071,8 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
private int openToolPropertiesDialog(DesignMenuModel.Item item) { private int openToolPropertiesDialog(DesignMenuModel.Item item) {
Shell shell = VerilogPlugin.getActiveWorkbenchShell(); Shell shell = VerilogPlugin.getActiveWorkbenchShell();
Context context = item.getTool(); Context context = item.getTool();
context.setTreeReparse(true);
ContextOptionsDialog dialog = new ContextOptionsDialog( shell ContextOptionsDialog dialog = new ContextOptionsDialog( shell
, context , context
, selectedResource.getProject() ); , selectedResource.getProject() );
......
...@@ -167,6 +167,19 @@ endmodule ...@@ -167,6 +167,19 @@ endmodule
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt; . * along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt; .
*
* Additional permission under GNU GPL version 3 section 7:
* If you modify this Program, or any covered work, by linking or combining it
* with independent modules provided by the FPGA vendor only (this permission
* does not extend to any 3-rd party modules, "soft cores" or macros) under
* different license terms solely for the purpose of generating binary "bitstream"
* files and/or simulating the code, the copyright holders of this Program give
* you the right to distribute the covered work without those independent modules
* as long as the source code for them is available from the FPGA vendor free of
* charge, and there is no dependence on any encrypted modules for simulating of
* the combined code. This permission applies to you if the distributed code
* contains all the components and scripts required to completely simulate it
* with at least one of the Free Software programs.
*******************************************************************************/ *******************************************************************************/
`timescale 1ns/1ps `timescale 1ns/1ps
......
...@@ -95,7 +95,10 @@ ...@@ -95,7 +95,10 @@
package="FPGA_package" package="FPGA_package"
interface="IVerilog" errors="(.*):([0-9]+): [a-z_\- ]*error: (.*)" interface="IVerilog" errors="(.*):([0-9]+): [a-z_\- ]*error: (.*)"
warnings="(.*):([0-9]+): [a-z_\- ]*warning: (.*)" warnings="(.*):([0-9]+): [a-z_\- ]*warning: (.*)"
info="(.*):([0-9]+): [a-z_\- ]*sorry: (.*)"> info="(.*):([0-9]+): [a-z_\- ]*sorry: (.*)"
top-file="%IcarusTopFile"
define="IVERILOG"
>
<extensions-list> <extensions-list>
<extension mask="v" /> <extension mask="v" />
...@@ -103,7 +106,7 @@ ...@@ -103,7 +106,7 @@
</extensions-list> </extensions-list>
<action-menu> <action-menu>
<action label="Simulate project " resource="%SimulationTopFile" <action label="Simulate project " resource="%IcarusTopFile"
check-extension="false" check-existence="true" icon="iverilog.ico" /> check-extension="false" check-existence="true" icon="iverilog.ico" />
<action label="Simulate selected" resource="%%SelectedFile" <action label="Simulate selected" resource="%%SelectedFile"
check-extension="true" check-existence="true" icon="iverilog_pointer.png" /> check-extension="true" check-existence="true" icon="iverilog_pointer.png" />
...@@ -113,6 +116,12 @@ ...@@ -113,6 +116,12 @@
<action label="Just try for" resource="%%OS" /> --> <action label="Just try for" resource="%%OS" /> -->
</action-menu> </action-menu>
<parameter id="IcarusTopFile"
label="Simulation top file" tooltip="IVerilog simulator top file"
default="%SimulationTopFile"
type="String" format="CopyValue" />
<parameter id="Param_Shell_Options" label="Param_Shell_Options" <parameter id="Param_Shell_Options" label="Param_Shell_Options"
type="String" format="CopyValue" default="-c" readonly="false" type="String" format="CopyValue" default="-c" readonly="false"
visible="true" /> visible="true" />
...@@ -284,6 +293,7 @@ ...@@ -284,6 +293,7 @@
<input> <input>
<group name="files" label="Files"> <group name="files" label="Files">
<!-- "SimulationTopFile" --> <!-- "SimulationTopFile" -->
"IcarusTopFile"
"Param_TopModule" "Param_TopModule"
"TopModulesOther" "TopModulesOther"
"ExtraFiles" "ExtraFiles"
......
...@@ -89,7 +89,9 @@ ...@@ -89,7 +89,9 @@
disable="DisableVivadoSynth" disable="DisableVivadoSynth"
autosave="AutosaveVivadoSynthesis" autosave="AutosaveVivadoSynthesis"
save="SaveVivadoSynthesis" save="SaveVivadoSynthesis"
inherits="VivadoToolPrototype" inherits="VivadoToolPrototype"
top-file="%VivadoTopFile"
define="%VivadoDefine"
> >
<extensions-list> <extensions-list>
...@@ -109,6 +111,16 @@ ...@@ -109,6 +111,16 @@
<depends files="FilteredIncludesListPar"/> <depends files="FilteredIncludesListPar"/>
<depends files="ConstraintsFiles"/> <depends files="ConstraintsFiles"/>
</depends-list> </depends-list>
<parameter id="VivadoTopFile"
label="Synthesis top file" tooltip="Synthesis Verilog top file"
default="%ImplementationTopFile"
type="String" format="CopyValue" />
<parameter id="VivadoDefine"
label="Synthesis define" tooltip="`define specific to this tool"
default="VIVADO_SYNTHESIS"
type="String" format="CopyValue" />
<parameter id="ConstraintsFiles" type="Filelist" format="ParamListSyntax" <parameter id="ConstraintsFiles" type="Filelist" format="ParamListSyntax"
default="" label="Constraints files" tooltip="Select constraint files to load to Vivado" readonly="false" default="" label="Constraints files" tooltip="Select constraint files to load to Vivado" readonly="false"
...@@ -227,7 +239,9 @@ ...@@ -227,7 +239,9 @@
visible="false" type="Filelist" format="None"/> visible="false" type="Filelist" format="None"/>
<input> <input>
<group name="General"> <group name="General">
"VivadoTopFile"
"VivadoDefine"
"FilteredSourceListPar" "FilteredSourceListPar"
"FilteredIncludesListPar" "FilteredIncludesListPar"
"ConstraintsFiles" "ConstraintsFiles"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment