adds options for iverilog; closes #655

This commit is contained in:
hneemann 2021-02-18 17:47:42 +01:00
parent dd28ea6309
commit ec00b4cd2a
6 changed files with 37 additions and 5 deletions

View File

@ -740,6 +740,12 @@ public final class Keys {
public static final Key<String> GHDL_OPTIONS
= new Key.LongString("ghdlOptions", "--std=08 --ieee=synopsys").setRows(3).setColumns(30).setPanelId("Options");
/**
* The iverilog options
*/
public static final Key<String> IVERILOG_OPTIONS
= new Key.LongString("iverilogOptions", "").setRows(3).setColumns(30).setPanelId("Options");
/**
* Path to iverilog installation directory
*/

View File

@ -47,7 +47,7 @@ public interface Application {
case GHDL:
return new ApplicationGHDL(attr);
case IVERILOG:
return new ApplicationIVerilog();
return new ApplicationIVerilog(attr);
default:
return null;
}

View File

@ -5,6 +5,7 @@
*/
package de.neemann.digital.core.extern;
import de.neemann.digital.core.element.ElementAttributes;
import de.neemann.digital.core.element.Keys;
import de.neemann.digital.core.extern.handler.ProcessInterface;
import de.neemann.digital.core.extern.handler.StdIOInterface;
@ -23,15 +24,19 @@ import java.util.LinkedList;
* See http://iverilog.icarus.com/
*/
public class ApplicationIVerilog extends ApplicationVerilogStdIO {
private final ElementAttributes attr;
private final boolean hasIverilog;
private String iverilogFolder;
private String iverilog;
private String vvp;
private final boolean hasIverilog;
/**
* Initialize a new instance
*
* @param attr the components attributes
*/
public ApplicationIVerilog() {
public ApplicationIVerilog(ElementAttributes attr) {
this.attr = attr;
iverilogFolder = "";
hasIverilog = findIVerilog();
}
@ -49,7 +54,15 @@ public class ApplicationIVerilog extends ApplicationVerilogStdIO {
file = createVerilogFile(label, code, inputs, outputs);
String testOutputName = label + ".out";
String m1 = ProcessStarter.start(file.getParentFile(), iverilog, "-tvvp", "-o" + testOutputName, file.getName());
ProcessStarter.start(file.getParentFile(), new Options()
.add(iverilog)
.add("-tvvp")
.add("-o")
.add(testOutputName)
.add(attr, Keys.IVERILOG_OPTIONS)
.add(file.getName())
.getArray()
);
ProcessBuilder pb = new ProcessBuilder(vvp, "-M", ivlModuleDir, testOutputName).redirectErrorStream(true).directory(file.getParentFile());
return new IVerilogProcessInterface(pb.start(), file.getParentFile());
} catch (IOException e) {
@ -87,7 +100,15 @@ public class ApplicationIVerilog extends ApplicationVerilogStdIO {
file = createVerilogFile(label, code, inputs, outputs);
String testOutputName = label + ".out";
return ProcessStarter.start(file.getParentFile(), iverilog, "-tvvp", "-o" + testOutputName, file.getName());
return ProcessStarter.start(file.getParentFile(), new Options()
.add(iverilog)
.add("-tvvp")
.add("-o")
.add(testOutputName)
.add(attr, Keys.IVERILOG_OPTIONS)
.add(file.getName())
.getArray()
);
} catch (IOException e) {
if (iverilogNotFound(e))
throw new IOException(Lang.get("err_iverilogNotInstalled"));

View File

@ -41,6 +41,7 @@ public class External extends Node implements Element {
.addAttribute(Keys.EXTERNAL_CODE)
.addAttribute(Keys.APPLICATION_TYPE)
.addAttribute(Keys.GHDL_OPTIONS)
.addAttribute(Keys.IVERILOG_OPTIONS)
.supportsHDL();
private final Application.Type type;

View File

@ -1481,6 +1481,8 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
</string>
<string name="key_ghdlOptions">GHDL Optionen</string>
<string name="key_ghdlOptions_tt">Optionen, die für alle Bearbeitungsschritte durch GHDL verwendet werden.</string>
<string name="key_iverilogOptions">IVerilog Optionen</string>
<string name="key_iverilogOptions_tt">Optionen, die für alle Bearbeitungsschritte durch IVerilog verwendet werden.</string>
<string name="key_iverilogPath">IVerilog</string>
<string name="key_iverilogPath_tt">Pfad zum Icarus-Verilog-Installationsordner. Nur notwendig, wenn Sie iverilog
verwenden möchten, um mit Verilog definierte Komponenten zu simulieren.

View File

@ -1472,6 +1472,8 @@
</string>
<string name="key_ghdlOptions">GHDL Options</string>
<string name="key_ghdlOptions_tt">Options that are used for all processing steps by GHDL.</string>
<string name="key_iverilogOptions">IVerilog Options</string>
<string name="key_iverilogOptions_tt">Options that are used for all processing steps by IVerilog.</string>
<string name="key_iverilogPath">IVerilog</string>
<string name="key_iverilogPath_tt">Path to the Icarus Verilog installation folder. Only necessary if you want to use