mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-15 07:48:29 -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.*;
|
||||||
import de.neemann.digital.hdl.model2.expression.ExprConstant;
|
import de.neemann.digital.hdl.model2.expression.ExprConstant;
|
||||||
|
import de.neemann.digital.hdl.model2.expression.ExprVar;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -54,6 +55,8 @@ public class MergeConstants implements Optimization {
|
|||||||
for (HDLPort p : ins.toArray(new HDLPort[ins.size()]))
|
for (HDLPort p : ins.toArray(new HDLPort[ins.size()]))
|
||||||
p.setNet(usedNet);
|
p.setNet(usedNet);
|
||||||
|
|
||||||
|
circuit.replaceNetByExpression(obsoleteNet, new ExprVar(usedNet));
|
||||||
|
|
||||||
circuit.removeNet(obsoleteNet);
|
circuit.removeNet(obsoleteNet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,9 @@ public class CodePrinter implements Closeable {
|
|||||||
* @throws IOException IOException
|
* @throws IOException IOException
|
||||||
*/
|
*/
|
||||||
public CodePrinter print(String str) throws IOException {
|
public CodePrinter print(String str) throws IOException {
|
||||||
|
if (str == null)
|
||||||
|
str = "null";
|
||||||
|
|
||||||
for (int i = 0; i < str.length(); i++)
|
for (int i = 0; i < str.length(); i++)
|
||||||
print(str.charAt(i));
|
print(str.charAt(i));
|
||||||
return this;
|
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 {
|
public void testGHDLInSimulator() throws Exception {
|
||||||
try {
|
try {
|
||||||
ProcessStarter.start(null, GHDL, "--help");
|
ProcessStarter.start(null, GHDL, "--help");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user