diff --git a/src/main/java/de/neemann/digital/hdl/boards/ISE.java b/src/main/java/de/neemann/digital/hdl/boards/ISE.java
index 49f45f59c..98332bafd 100644
--- a/src/main/java/de/neemann/digital/hdl/boards/ISE.java
+++ b/src/main/java/de/neemann/digital/hdl/boards/ISE.java
@@ -17,6 +17,35 @@ import java.io.*;
* Up to now only the constraints files containing the pin assignments and project file is created
*/
public abstract class ISE implements BoardInterface {
+ private static final String ISE_PROJECT_TPLT =
+ "\n"
+ + "\n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + "\n";
@Override
public void writeFiles(File path, HDLModel model) throws IOException {
@@ -79,29 +108,10 @@ public abstract class ISE implements BoardInterface {
}
}
- private String loadISEProjectTemplate() throws IOException {
- String fileName = "boards/ISEProjectTplt.xml";
- InputStream in = getClass().getClassLoader().getResourceAsStream(fileName);
- if (in == null) {
- throw new IOException("file not present: " + fileName);
- }
-
- BufferedReader r = new BufferedReader(new InputStreamReader(in));
- StringBuilder sb = new StringBuilder();
- String str;
-
- while ((str = r.readLine()) != null) {
- sb.append(str).append("\n");
- }
-
- return sb.toString();
- }
-
private void writeISEProject(BufferedWriter w, File project, File srcFile, File constraints) throws IOException {
- String iseProjectTplt = loadISEProjectTemplate();
BoardInformation bi = getBoardInfo();
- w.write(String.format(iseProjectTplt, "../" + srcFile.getName(),
+ w.write(String.format(ISE_PROJECT_TPLT, "../" + srcFile.getName(),
"../" + constraints.getName(), bi.getFamily(), bi.getCode(), bi.getPkg()));
}
diff --git a/src/main/resources/boards/ISEProjectTplt.xml b/src/main/resources/boards/ISEProjectTplt.xml
deleted file mode 100644
index 7d6733a83..000000000
--- a/src/main/resources/boards/ISEProjectTplt.xml
+++ /dev/null
@@ -1,355 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/test/java/de/neemann/digital/hdl/boards/ISEProjectGeneratorTest.java b/src/test/java/de/neemann/digital/hdl/boards/ISEProjectGeneratorTest.java
new file mode 100644
index 000000000..e2cca461b
--- /dev/null
+++ b/src/test/java/de/neemann/digital/hdl/boards/ISEProjectGeneratorTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2018 Ivan Deras.
+ * Use of this source code is governed by the GPL v3 license
+ * that can be found in the LICENSE file.
+ */
+package de.neemann.digital.hdl.boards;
+
+import de.neemann.digital.core.NodeException;
+import de.neemann.digital.draw.elements.PinException;
+import de.neemann.digital.draw.library.ElementNotFoundException;
+import de.neemann.digital.hdl.model2.HDLException;
+import de.neemann.digital.hdl.model2.HDLModel;
+import de.neemann.digital.integration.ToBreakRunner;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import junit.framework.TestCase;
+
+public class ISEProjectGeneratorTest extends TestCase {
+
+ public void testISEProjectExport() throws IOException, PinException, NodeException, ElementNotFoundException, HDLException {
+ HDLModel m = createModel("dig/hdl/model2/clock_mimasv1.dig");
+ MimasV1Board b = new MimasV1Board();
+ File dir = Files.createTempDirectory("digital_verilog_" + getTime() + "_").toFile();
+ File file = new File(dir, "clock_mimasv1.v");
+
+ System.out.println(dir.getAbsolutePath());
+ b.writeFiles(file, m);
+ File iseProjectFile = new File(dir, "clock_mimasv1_ise" + File.separator + "clock_mimasv1.xise");
+ String output = readAllFile(iseProjectFile);
+
+ assertEquals( "\n"
+ + "\n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + "\n", output);
+ }
+
+ private String readAllFile(File f) throws FileNotFoundException, IOException {
+ BufferedReader r = new BufferedReader(new FileReader(f));
+ StringBuilder sb = new StringBuilder();
+ String str;
+
+ while ((str = r.readLine()) != null) {
+ sb.append(str).append("\n");
+ }
+
+ return sb.toString();
+ }
+
+ HDLModel createModel(String filePath) throws IOException, PinException, NodeException, ElementNotFoundException, HDLException {
+ ToBreakRunner br = new ToBreakRunner(filePath);
+
+ HDLModel m = new HDLModel(br.getLibrary());
+
+ return m.create(br.getCircuit(), null);
+ }
+
+ private String getTime() {
+ DateFormat f = new SimpleDateFormat("YY-MM-dd_HH-mm_ss");
+ return f.format(new Date());
+ }
+}
diff --git a/src/test/java/de/neemann/digital/hdl/verilog2/DescriptionTest.java b/src/test/java/de/neemann/digital/hdl/verilog2/DescriptionTest.java
index afac24635..0e5b7102e 100644
--- a/src/test/java/de/neemann/digital/hdl/verilog2/DescriptionTest.java
+++ b/src/test/java/de/neemann/digital/hdl/verilog2/DescriptionTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 Helmut Neemann.
+ * Copyright (c) 2018 Ivan Deras.
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
diff --git a/src/test/java/de/neemann/digital/hdl/verilog2/VerilogGeneratorTest.java b/src/test/java/de/neemann/digital/hdl/verilog2/VerilogGeneratorTest.java
index f9c708857..58bcac51f 100644
--- a/src/test/java/de/neemann/digital/hdl/verilog2/VerilogGeneratorTest.java
+++ b/src/test/java/de/neemann/digital/hdl/verilog2/VerilogGeneratorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 Helmut Neemann.
+ * Copyright (c) 2018 Ivan Deras.
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
diff --git a/src/test/java/de/neemann/digital/hdl/verilog2/VerilogRenamingTest.java b/src/test/java/de/neemann/digital/hdl/verilog2/VerilogRenamingTest.java
index ef57da076..958c6fd1c 100644
--- a/src/test/java/de/neemann/digital/hdl/verilog2/VerilogRenamingTest.java
+++ b/src/test/java/de/neemann/digital/hdl/verilog2/VerilogRenamingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 Helmut Neemann.
+ * Copyright (c) 2018 Ivan Deras.
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
diff --git a/src/test/java/de/neemann/digital/hdl/verilog2/VerilogSimulatorTest.java b/src/test/java/de/neemann/digital/hdl/verilog2/VerilogSimulatorTest.java
index b7859d5d2..1d58c3285 100644
--- a/src/test/java/de/neemann/digital/hdl/verilog2/VerilogSimulatorTest.java
+++ b/src/test/java/de/neemann/digital/hdl/verilog2/VerilogSimulatorTest.java
@@ -53,7 +53,7 @@ public class VerilogSimulatorTest extends TestCase {
File examples = new File(Resources.getRoot(), "/dig/hdl");
try {
int tested = new FileScanner(this::checkVerilogExport).noOutput().scan(examples);
- assertEquals(46, tested);
+ assertEquals(47, tested);
} catch (FileScanner.SkipAllException e) {
// if iverilog is not installed its also ok
}
diff --git a/src/test/java/de/neemann/digital/hdl/vhdl2/VHDLSimulatorTest.java b/src/test/java/de/neemann/digital/hdl/vhdl2/VHDLSimulatorTest.java
index a570bd2d0..fe799f209 100644
--- a/src/test/java/de/neemann/digital/hdl/vhdl2/VHDLSimulatorTest.java
+++ b/src/test/java/de/neemann/digital/hdl/vhdl2/VHDLSimulatorTest.java
@@ -58,7 +58,7 @@ public class VHDLSimulatorTest extends TestCase {
File examples = new File(Resources.getRoot(), "/dig/hdl");
try {
int tested = new FileScanner(this::checkVHDLExport).noOutput().scan(examples);
- assertEquals(46, tested);
+ assertEquals(47, tested);
} catch (FileScanner.SkipAllException e) {
// if ghdl is not installed its also ok
}
diff --git a/src/test/resources/dig/hdl/model2/clock_mimasv1.dig b/src/test/resources/dig/hdl/model2/clock_mimasv1.dig
new file mode 100644
index 000000000..2b3478c3a
--- /dev/null
+++ b/src/test/resources/dig/hdl/model2/clock_mimasv1.dig
@@ -0,0 +1,95 @@
+
+
+ 1
+
+
+
+ D_FF
+
+
+
+
+ In
+
+
+ Label
+ A
+
+
+ pinNumber
+ P124
+
+
+
+
+
+ Text
+
+
+ Description
+ Board: MimasV1
+
+
+
+
+
+ Clock
+
+
+ runRealTime
+ true
+
+
+ Label
+ C
+
+
+ Frequency
+ 1000000
+
+
+ pinNumber
+ P126
+
+
+
+
+
+ Out
+
+
+ Label
+ X
+
+
+ pinNumber
+ P119
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file