mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-13 23:06:22 -04:00
improved the vhdl test bench creator
This commit is contained in:
parent
e152fbbef1
commit
e30051936a
@ -69,11 +69,12 @@ public class VHDLTestBenchCreator {
|
|||||||
if (p > 0)
|
if (p > 0)
|
||||||
filename = filename.substring(0, p);
|
filename = filename.substring(0, p);
|
||||||
|
|
||||||
|
VHDLRenaming renaming = new VHDLRenaming();
|
||||||
for (ElementAttributes tc : testCases) {
|
for (ElementAttributes tc : testCases) {
|
||||||
String testName = tc.getLabel();
|
String testName = tc.getLabel();
|
||||||
if (testName.length() > 0)
|
if (testName.length() > 0) {
|
||||||
testName = filename + "_" + testName + "_tb";
|
testName = filename + "_" + renaming.checkName(testName) + "_tb";
|
||||||
else
|
} else
|
||||||
testName = filename + "_tb";
|
testName = filename + "_tb";
|
||||||
|
|
||||||
File f = new File(file.getParentFile(), testName + ".vhdl");
|
File f = new File(file.getParentFile(), testName + ".vhdl");
|
||||||
@ -179,7 +180,12 @@ public class VHDLTestBenchCreator {
|
|||||||
.print(" AND patterns(").print(loopVar).print(").").print(p.getName()).print(" = ")
|
.print(" AND patterns(").print(loopVar).print(").").print(p.getName()).print(" = ")
|
||||||
.print(getSimpleValue(p.getBits(), 'Z'))
|
.print(getSimpleValue(p.getBits(), 'Z'))
|
||||||
.print(")").eol();
|
.print(")").eol();
|
||||||
out.inc().print("report \"wrong value for ").print(p.getName()).print(" ").print(loopVar).print("=\" & integer'image(").print(loopVar).println(") severity error;").dec();
|
out.inc().print("report \"wrong value for ").print(p.getName()).print(", ").print(loopVar).print("=\" & integer'image(").print(loopVar).println(")")
|
||||||
|
.print(" & \", expected \"")
|
||||||
|
.print(" & ").print(convertFunc(p)).print("(patterns(").print(loopVar).print(").").print(p.getName()).print(")")
|
||||||
|
.print(" & \", found \"")
|
||||||
|
.print(" & ").print(convertFunc(p)).print("(").print(p.getName()).print(")")
|
||||||
|
.print(" severity error;").dec();
|
||||||
}
|
}
|
||||||
|
|
||||||
out.dec().println("end loop;");
|
out.dec().println("end loop;");
|
||||||
@ -188,6 +194,12 @@ public class VHDLTestBenchCreator {
|
|||||||
out.dec().println("end behav;");
|
out.dec().println("end behav;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String convertFunc(HDLPort p) {
|
||||||
|
if (p.getBits()>1)
|
||||||
|
return "to_hstring";
|
||||||
|
return "std_logic'image";
|
||||||
|
}
|
||||||
|
|
||||||
private boolean loopVarExists(String loopVar, ArrayList<HDLPort> ports) {
|
private boolean loopVarExists(String loopVar, ArrayList<HDLPort> ports) {
|
||||||
for (HDLPort p : ports)
|
for (HDLPort p : ports)
|
||||||
if (p.getName().equalsIgnoreCase(loopVar))
|
if (p.getName().equalsIgnoreCase(loopVar))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user