mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-14 23:36:27 -04:00
Fixed a bug in the HDL model const merger
This commit is contained in:
parent
63f38e6596
commit
53a4ffec96
@ -7,6 +7,7 @@ package de.neemann.digital.hdl.model2.optimizations;
|
||||
|
||||
import de.neemann.digital.hdl.model2.*;
|
||||
import de.neemann.digital.hdl.model2.expression.ExprConstant;
|
||||
import de.neemann.digital.hdl.model2.expression.ExprVar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -54,6 +55,8 @@ public class MergeConstants implements Optimization {
|
||||
for (HDLPort p : ins.toArray(new HDLPort[ins.size()]))
|
||||
p.setNet(usedNet);
|
||||
|
||||
circuit.replaceNetByExpression(obsoleteNet, new ExprVar(usedNet));
|
||||
|
||||
circuit.removeNet(obsoleteNet);
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,9 @@ public class CodePrinter implements Closeable {
|
||||
* @throws IOException IOException
|
||||
*/
|
||||
public CodePrinter print(String str) throws IOException {
|
||||
if (str == null)
|
||||
str = "null";
|
||||
|
||||
for (int i = 0; i < str.length(); i++)
|
||||
print(str.charAt(i));
|
||||
return this;
|
||||
|
@ -88,6 +88,18 @@ public class VHDLSimulatorTest extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testMultiplierInSimulator() throws Exception {
|
||||
File file = new File(Resources.getRoot(), "../../main/dig/combinatorial/Multiply8Bit.dig");
|
||||
try {
|
||||
checkVHDLExport(file);
|
||||
} catch (FileScanner.SkipAllException e) {
|
||||
// if ghdl is not installed its also ok
|
||||
} catch (Exception e) {
|
||||
System.out.println(ExceptionWithOrigin.getOriginOf(e));
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void testGHDLInSimulator() throws Exception {
|
||||
try {
|
||||
ProcessStarter.start(null, GHDL, "--help");
|
||||
|
Loading…
x
Reference in New Issue
Block a user