Commit d2d7c636 authored by Andrey Filippov's avatar Andrey Filippov

Configuring tools for IVerilog & GTKWave + minor bug fixes

parent ed18a78f
...@@ -17,10 +17,12 @@ ...@@ -17,10 +17,12 @@
*******************************************************************************/ *******************************************************************************/
package com.elphel.vdt.core.tools.generators; package com.elphel.vdt.core.tools.generators;
//import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
//import org.eclipse.core.resources.IResource; //import org.eclipse.core.resources.IResource;
//import org.eclipse.ui.IPageLayout; //import org.eclipse.ui.IPageLayout;
import org.eclipse.core.runtime.Path;
import com.elphel.vdt.VDT; import com.elphel.vdt.VDT;
import com.elphel.vdt.ui.variables.SelectedResourceManager; import com.elphel.vdt.ui.variables.SelectedResourceManager;
...@@ -33,12 +35,10 @@ public class CurrentFileBaseGenerator extends AbstractGenerator { ...@@ -33,12 +35,10 @@ public class CurrentFileBaseGenerator extends AbstractGenerator {
protected String[] getStringValues() { protected String[] getStringValues() {
// IResource resource = SelectedResourceManager.getDefault().getSelectedResource(); // IResource resource = SelectedResourceManager.getDefault().getSelectedResource();
String fullName=SelectedResourceManager.getDefault().getChosenTarget(); String name=SelectedResourceManager.getDefault().getChosenShort(); // last segment of the file name
// if((resource != null) && (resource.getType() == IResource.FILE)) { if (name!=null){
// String fullName=((IFile)resource).getLocation().toOSString(); int dot = name.lastIndexOf('.');
if (fullName!=null){ return new String[] { (dot>=0)? name.substring(0, dot): name };
int dot = fullName.lastIndexOf('.');
return new String[] { (dot <0) ? fullName : fullName.substring(0, dot) };
} }
return new String[] { "" }; return new String[] { "" };
} }
......
...@@ -346,9 +346,9 @@ public class Parameter implements Cloneable, Updateable { ...@@ -346,9 +346,9 @@ public class Parameter implements Cloneable, Updateable {
} }
public List<String> getCurrentValue() { public List<String> getCurrentValue() {
if (id.equals("SimulationTopFile")){ // Andrey // if (id.equals("SimulationTopFile")){ // Andrey
System.out.println("getCurrentValue() SimulationTopFile, value="+currentValue); // System.out.println("getCurrentValue() SimulationTopFile, value="+currentValue);
} // }
if(currentValue.isEmpty()) if(currentValue.isEmpty())
return null; return null;
......
...@@ -64,6 +64,7 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe ...@@ -64,6 +64,7 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe
//Andrey //Andrey
private String fChosenTarget=null; // full path of the chosen (for action) resource or any string. Used to calculate CurrentFile, verilog file, ... private String fChosenTarget=null; // full path of the chosen (for action) resource or any string. Used to calculate CurrentFile, verilog file, ...
private String fChosenShort=null; // last segment of the chosen resource name
private IResource fChosenVerilogFile = null; // to keep fSelectedVerilogFile private IResource fChosenVerilogFile = null; // to keep fSelectedVerilogFile
private int fChosenAction=0; // Chosen variant of running the tool private int fChosenAction=0; // Chosen variant of running the tool
private long timestamp=0; private long timestamp=0;
...@@ -255,6 +256,11 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe ...@@ -255,6 +256,11 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe
fChosenVerilogFile=file; fChosenVerilogFile=file;
else if (fChosenVerilogFile==null) else if (fChosenVerilogFile==null)
fChosenVerilogFile=fSelectedVerilogFile; fChosenVerilogFile=fSelectedVerilogFile;
if (file!=null){
fChosenShort=file.getName(); // last segment
} else {
fChosenShort=fChosenTarget; // whatever
}
} }
public String setBuildStamp(){ public String setBuildStamp(){
...@@ -270,6 +276,9 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe ...@@ -270,6 +276,9 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe
public String getChosenTarget() { public String getChosenTarget() {
return fChosenTarget; return fChosenTarget;
} }
public String getChosenShort() {
return fChosenShort;
}
public IResource getChosenVerilogFile() { public IResource getChosenVerilogFile() {
return (fChosenVerilogFile!=null)?fChosenVerilogFile:fSelectedVerilogFile; return (fChosenVerilogFile!=null)?fChosenVerilogFile:fSelectedVerilogFile;
......
...@@ -522,7 +522,15 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -522,7 +522,15 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
enabled=(selectedItem != null); enabled=(selectedItem != null);
if (enabled && runFor[i].getCheckExistence()){ if (enabled && runFor[i].getCheckExistence()){
IPath path = new Path(name); IPath path = new Path(name);
IFile file = (path==null)?null:project.getFile(path); IFile file = null;
if (path!=null) {
try {
file = project.getFile(path);
} catch (IllegalArgumentException e) {
}
}
if (file==null){ if (file==null){
// System.out.println(name+" does not exist"); // System.out.println(name+" does not exist");
enabled=false; enabled=false;
......
...@@ -31,16 +31,6 @@ ...@@ -31,16 +31,6 @@
</typedef> </typedef>
<syntax name="QuotedFileListSyntax" format="--%%ParamName %(&quot;%%FileList&quot;%| %)" />
<syntax name="QuotedTopModuleSyntax" format="--%%ParamName=%%TopModule" />
<syntax name="QuotedTopModulesSyntax" format="--%%ParamName %(&quot;%%TopModules&quot;%| %)" />
<syntax name="QuotedSourceListSyntax" format="--%%ParamName %(&quot;%%SourceList&quot;%| %)" />
<syntax name="QuotedCurrentFileSyntax" format="--%%ParamName=&quot;%%CurrentFile&quot;" />
<syntax name="QuotedCurrentFileBaseSyntax" format="--%%ParamName=&quot;%%CurrentFileBase&quot;" />
<syntax name="QuotedProjectNameSyntax" format="--%%ParamName=&quot;%%ProjectName&quot;" />
<!-- Actually used --> <!-- Actually used -->
<syntax name="JustValueSyntax" format="%%ParamValue"></syntax> <syntax name="JustValueSyntax" format="%%ParamValue"></syntax>
<syntax name="TopModuleSyntax" format="-s%%TopModule" /> <syntax name="TopModuleSyntax" format="-s%%TopModule" />
...@@ -56,17 +46,21 @@ ...@@ -56,17 +46,21 @@
<syntax name="BuildStampSyntax" format="%%BuildStamp" /> <syntax name="BuildStampSyntax" format="%%BuildStamp" />
<syntax name="GrepFindSyntax" <syntax name="GrepFindSyntax"
format="| grep --line-buffered -E &quot;%%ParamValue&quot;" /> format="| { grep --line-buffered -E &quot;%%ParamValue&quot; || true; }" />
<syntax name="GrepSkipSyntax" <syntax name="GrepSkipSyntax"
format="| grep --line-buffered -v &quot;%%ParamValue&quot;" /> format="| { grep --line-buffered -v &quot;%%ParamValue&quot; || true; }" />
<syntax name="LogFileSyntax" format="| tee %%ParamName%%BuildStamp.log" /> <syntax name="LogFileSyntax" format="%%ParamValue-%%BuildStamp.log" />
<syntax name="OutputFileSyntax" format="%%ParamValue-%%BuildStamp.ivlg" />
<!-- typedef --> <syntax name="LxtFileSyntax" format="%%ParamValue-%%BuildStamp.lxt" />
<syntax name="LxtParamFileSyntax"
format="parameter lxtname=&quot;%%ParamValue-%%BuildStamp.lxt&quot;;" />
<!-- <syntax name="LxtParamFileSyntax" format="parameter lxtname=%%ParamValue;"
/> -->
<syntax name="IncludeParamSyntax" format="%(%%ParamValue%|\n%)" />
<typedef name="MyTypeList" list="true">
<paramtype kind="string" maxlength="256" sensitivity="sensitive" />
</typedef>
<!-- typedef -->
<typedef name="ExtraFilesType" list="true"> <typedef name="ExtraFilesType" list="true">
<paramtype kind="string" textkind="file" maxlength="256" <paramtype kind="string" textkind="file" maxlength="256"
...@@ -130,6 +124,8 @@ ...@@ -130,6 +124,8 @@
check-extension="false" check-existence="true" icon="iverilog.ico" /> check-extension="false" check-existence="true" icon="iverilog.ico" />
<action label="Simulate for" resource="%%SelectedFile" <action label="Simulate for" resource="%%SelectedFile"
check-extension="true" check-existence="true" /> check-extension="true" check-existence="true" />
<action label="Verify" resource="%%SelectedFile"
check-extension="true" check-existence="true" icon="newmod_wiz.gif" />
<action label="Empty" resource="" icon="sample.gif" /> <action label="Empty" resource="" icon="sample.gif" />
<action label="Just try for" resource="%%OS" /> <action label="Just try for" resource="%%OS" />
</action-menu> </action-menu>
...@@ -147,22 +143,22 @@ ...@@ -147,22 +143,22 @@
format="exeFileSyntax" default="/usr/bin/iverilog" readonly="false" format="exeFileSyntax" default="/usr/bin/iverilog" readonly="false"
visible="true" /> visible="true" />
<parameter id="Param_TopModule" label="Param_TopModule" <parameter id="Param_TopModule" label="Top module extracted from the chosen target file"
type="StringType" format="TopModuleSyntax" default="%%TopModule" type="StringType" format="TopModuleSyntax" default="%%TopModule"
readonly="true" visible="true" /> readonly="true" visible="true" />
<parameter id="TopModulesOther" type="StringListType" <parameter id="TopModulesOther" type="StringListType"
format="TopModulesOtherSyntax" default="" omit="" format="TopModulesOtherSyntax" default="" omit=""
label="Select top modules (not referenced by other modules)" label="Select top modules not referenced by the chosen target"
readonly="false" visible="true" /> readonly="false" visible="true" />
<parameter id="ModuleLibrary" type="ModuleLibraryType" <parameter id="ModuleLibrary" type="ModuleLibraryType"
format="ModuleLibrarySyntax" default="" label="Select libraries to include" format="ModuleLibrarySyntax" default="" label="Select additional libraries to include"
omit="" readonly="false" visible="true" /> omit="" readonly="false" visible="true" />
<parameter id="ExtraFiles" type="ExtraFilesType" format="ExtraFilesSyntax" <parameter id="ExtraFiles" type="ExtraFilesType" format="ExtraFilesSyntax"
default="" label="Select extra files to include" readonly="false" default="" label="Select additional files to include" readonly="false"
visible="true" /> visible="true" />
...@@ -172,24 +168,14 @@ ...@@ -172,24 +168,14 @@
<parameter id="NoSpecify" outid="no-specify" type="NoSpecifyType" <parameter id="NoSpecify" outid="no-specify" type="NoSpecifyType"
format="g_ParamSyntax" default="true" label="Use no-specify" /> format="g_ParamSyntax" default="true" label="Use no-specify" />
<!-- --> <!-- -->
<parameter id="SourceList" type="MyTypeList" format="SourceListSyntax"
default="" readonly="true" visible="false" />
<!-- --> <!-- -->
<parameter id="v" type="SwitchType" format="SwitchSyntax" <parameter id="v" type="SwitchType" format="SwitchSyntax"
default="true" label="Verbose" /> default="true" label="Verbose" />
<parameter id="Param_SourceList" label="Param_SourceList" <parameter id="Param_SourceList" label="Param_SourceList"
type="MyTypeList" format="SourceListSyntax" default="" readonly="true" type="StringListType" format="SourceListSyntax" default="" readonly="true"
visible="true" /> visible="true" />
<parameter id="Filter_String" label="Filter_String" type="StringType"
format="JustValueSyntax"
default="2&gt;&amp;1 | tee %LogFile | grep --line-buffered -E 'error|warning' | grep --line-buffered -v &quot;(null):0&quot;"
readonly="false" visible="true" />
<parameter id="DbgCurrentFile" label="DbgCurrentFile" type="StringType" <parameter id="DbgCurrentFile" label="DbgCurrentFile" type="StringType"
format="DbgCurrentFileSyntax" default="" readonly="false" visible="true" /> format="DbgCurrentFileSyntax" default="" readonly="false" visible="true" />
...@@ -197,12 +183,6 @@ ...@@ -197,12 +183,6 @@
type="StringType" format="DbgChosenActionIndexSyntax" default="" type="StringType" format="DbgChosenActionIndexSyntax" default=""
readonly="false" visible="true" /> readonly="false" visible="true" />
<!-- intentional error below - duplicate -->
<parameter id="ShowNoProblem" type="BoolYesNo" format="None" <parameter id="ShowNoProblem" type="BoolYesNo" format="None"
default="false" label="Show output with no errors/warnings" /> default="false" label="Show output with no errors/warnings" />
...@@ -212,14 +192,33 @@ ...@@ -212,14 +192,33 @@
<parameter id="RemoveBugs" type="BoolYesNo" format="None" <parameter id="RemoveBugs" type="BoolYesNo" format="None"
default="false" label="Remove buggy simulator output" /> default="false" label="Remove buggy simulator output" />
<parameter id="SaveLogs" type="BoolYesNo" format="None" <parameter id="SaveLogsPreprocessor" type="BoolYesNo"
format="None" default="false" label="Save simulator preprocessor log output" />
<parameter id="SaveLogsSimulator" type="BoolYesNo" format="None"
default="false" label="Save simulator log output" /> default="false" label="Save simulator log output" />
<parameter id="ShowWaves" type="BoolYesNo" format="None"
default="true" label="Show simulation result in waveform viewer" />
<!-- Advanced Section --> <!-- Advanced Section -->
<parameter id="LogFile" label="Simulator log file prefix" <parameter id="LogFile" label="Simulator log file prefix"
type="StringType" default="iverilog" format="LogFileSyntax" readonly="false" /> type="StringType" default="%%CurrentFileBase" format="LogFileSyntax"
readonly="false" />
<parameter id="OutFile" label="Simulator intermediate file prefix"
type="StringType" default="%%CurrentFileBase" format="OutputFileSyntax"
readonly="false" />
<parameter id="LxtDumpFile" label="Simulator LXT dump file prefix"
type="StringType" default="%%CurrentFileBase" format="LxtFileSyntax"
readonly="false" />
<parameter id="GTKWaveSavFile" label="GTKWave sav file"
type="FileType" default="%%CurrentFileBase.sav" format="ValueSyntax"
omit="" readonly="false" />
<parameter id="GrepFindErr" label="Grep pattern for errors only" <parameter id="GrepFindErr" label="Grep pattern for errors only"
type="StringType" format="GrepFindSyntax" default="error" readonly="false" type="StringType" format="GrepFindSyntax" default="error" readonly="false"
...@@ -232,39 +231,93 @@ ...@@ -232,39 +231,93 @@
<parameter id="GrepSkip1" label="Grep skip pattern" type="StringType" <parameter id="GrepSkip1" label="Grep skip pattern" type="StringType"
format="GrepSkipSyntax" default="(null)" readonly="false" visible="true" /> format="GrepSkipSyntax" default="(null)" readonly="false" visible="true" />
<parameter id="Param_1" label="Param_1" type="StringType"
format="JustValueSyntax" default="" omit="" readonly="false" visible="true" />
<parameter id="Param_2" label="Param_2" type="StringType"
format="JustValueSyntax" default="" omit="" readonly="false" visible="true" />
<parameter id="Param_3" label="Param_3" type="StringType"
format="JustValueSyntax" default="" omit="" readonly="false" visible="true" />
<parameter id="Param_4" label="Param_4" type="StringType"
format="JustValueSyntax" default="" omit="" readonly="false" visible="true" />
<parameter id="IVerilogOther" label="Other IVerilog options"
type="StringType" format="JustValueSyntax" default="" omit=""
readonly="false" visible="true" />
<parameter id="IncludeParametersList" type="StringListType"
format="IncludeParamSyntax" default="" omit=""
label="Verilog parameters definition to be included in the test fixture"
readonly="false" visible="true" />
<!-- Invisible parameters -->
<parameter id="IVerilogActionIndex" type="StringType"
format="JustValueSyntax" visible="false" default="%%ChosenActionIndex" />
<parameter id="SourceList" type="StringListType" format="SourceListSyntax"
default="" readonly="true" visible="false" />
<parameter id="iverilog_include_file" type="FileType"
default="IVERILOG_INCLUDE.v" format="JustValueSyntax" visible="false" />
<parameter id="LxtDumpFileParameter" type="StringType"
default="%LxtDumpFile" format="LxtParamFileSyntax" visible="false" />
<input> <input>
<group name="files" label="Files"> <group name="files" label="Files">
<!-- "SimulationTopFile" --> <!-- "SimulationTopFile" -->
"Param_PreExe"
"Param_Exe"
"Param_Shell_Options"
"Param_TopModule" "Param_TopModule"
"TopModulesOther" "TopModulesOther"
"ModuleLibrary"
"ExtraFiles" "ExtraFiles"
"ModuleLibrary"
"GTKWaveSavFile"
"IncludeParametersList"
</group> </group>
<group name="options" label="Options"> <group name="options" label="Options">
"ShowWaves"
"ShowNoProblem" "ShowNoProblem"
"ShowWarnings" "ShowWarnings"
"RemoveBugs" "RemoveBugs"
"SaveLogs" "SaveLogsPreprocessor"
"SaveLogsSimulator"
"v" "v"
"LegacyModel" "LegacyModel"
"NoSpecify" "NoSpecify"
</group> </group>
<group name="Advanced" label="Advanced"> <group name="Advanced" label="Advanced">
"Param_PreExe"
"Param_Exe"
"Param_Shell_Options"
"IVerilogOther"
"LogFile" "LogFile"
"OutFile"
"LxtDumpFile"
"GrepFindErr" "GrepFindErr"
"GrepFindErrWarn" "GrepFindErrWarn"
"GrepSkip1" "GrepSkip1"
"Param_1"
"Param_2"
"Param_3"
"Param_4"
</group> </group>
</input> </input>
<output> <output>
<line name="command_line" sep=" "> <line name="command_line" sep=" ">
"%Param_Shell_Options" "%Param_Shell_Options"
"%Param_PreExe" "%Param_PreExe"
"trap 'killall iverilog; ' EXIT;"
"echo 'current PID='$$;"
"%Param_Exe" "%Param_Exe"
"-o"
<if IVerilogActionIndex="2">
"/dev/null"
</if>
<if-not IVerilogActionIndex="2">
"%OutFile"
</if-not>
" -D IVERILOG"
"%IVerilogOther"
"%Param_TopModule" "%Param_TopModule"
"%TopModulesOther" "%TopModulesOther"
"%ModuleLibrary" "%ModuleLibrary"
...@@ -275,8 +328,9 @@ ...@@ -275,8 +328,9 @@
"%ExtraFiles" "%ExtraFiles"
<if ShowNoProblem="false"> <if ShowNoProblem="false">
"2&gt;&amp;1" "2&gt;&amp;1"
</if>if> </if>
<if SaveLogs="true"> <if SaveLogsPreprocessor="true">
"| tee"
"%LogFile" "%LogFile"
</if> </if>
<if ShowNoProblem="false"> <if ShowNoProblem="false">
...@@ -290,13 +344,58 @@ ...@@ -290,13 +344,58 @@
"%GrepSkip1" "%GrepSkip1"
</if> </if>
</if> </if>
"|| { echo '*** iverilog failed ***'; exit 1; } ;"
"trap '' EXIT;"
<if-not IVerilogActionIndex="2">
<!-- "time vvp -v" -->
"%Param_1"
"trap 'killall vvp; ' EXIT;"
"vvp -v"
"%Param_2"
"%OutFile"
"-lxt2 "
<if SaveLogsSimulator="true">
<if SaveLogsPreprocessor="true">
"| tee -a"
"%LogFile"
</if>
<if-not SaveLogsPreprocessor="true">
"| tee"
"%LogFile"
</if-not>
</if>
"|| { echo '*** vvp failed ***'; exit 1; } ;"
"trap '' EXIT;" <!-- no
trap for GTKWave -->
<!-- "%Param_2" -->
"%Param_3"
<if ShowWaves="true">
"gtkwave"
"%LxtDumpFile"
"%GTKWaveSavFile"
"&amp;"
</if>
"%Param_4"
</if-not>
</line>
<line name="IverilogIncludeFile" dest="iverilog_include_file"
sep="\n">
"%LxtDumpFileParameter"
"%IncludeParametersList"
</line> </line>
</output> </output>
</tool> </tool>
<!-- "echo %SimulationTopFile %%CurrentFile ;" --> <!-- "echo %SimulationTopFile %%CurrentFile ;" -->
<!-- "-s counter_tb" "%SourceList" --> <!-- "-s counter_tb" "%SourceList" -->
<!-- <parameter id = "xc_config_file" type = "Filename" default = "xc.cfg"
format = "Option" visible = "false" /> || { echo "iverilog failed"; exit
1; } ; time vvp -v x353mjpeg_test -lxt2 || { echo "vvp failed"; exit 1; }
; || { echo "iverilog failed"; exit 1; } time vvp -v x353mjpeg_test -lxt2
|| { echo "vvp failed"; exit 1; } gtkwave x353.lxt x353_1.sav & exit 0 -->
</vdt-project> </vdt-project>
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