better handling of project name in TT2 files

This commit is contained in:
hneemann 2017-03-14 08:16:15 +01:00
parent c459bc6bf5
commit 0ec5abddbd
5 changed files with 10 additions and 31 deletions

View File

@ -9,21 +9,13 @@ import de.neemann.digital.builder.tt2.TT2Exporter;
*/
public class ATF1502TT2Exporter extends TT2Exporter {
/**
* Creates a new project name
*/
public ATF1502TT2Exporter() {
this(System.getProperty("user.name"));
}
/**
* Creates a new project name
*
* @param projectName user name
*/
public ATF1502TT2Exporter(String projectName) {
super();
setProjectName(projectName);
super(projectName);
getPinMapping().setAvailBidirectional(4, 5, 6, 8, 9, 11, 12, 14, 16, 17,
18, 19, 20, 21, 24, 25, 26, 27, 28,
29, 31, 33, 34, 36, 37, 38, 39, 40);

View File

@ -10,8 +10,8 @@ public class ATF1504TT2Exporter extends ATF1502TT2Exporter {
/**
* Creates a new project name
*/
public ATF1504TT2Exporter() {
super();
public ATF1504TT2Exporter(String projectName) {
super(projectName);
setDevice("f1504ispplcc44");
}

View File

@ -32,7 +32,7 @@ public class TT2Exporter implements ExpressionExporter<TT2Exporter> {
/**
* Creates a new instance
*/
public TT2Exporter() {
public TT2Exporter(String projectName) {
builder = new BuilderCollector() {
@Override
public BuilderCollector addCombinatorial(String name, Expression expression) throws BuilderException {
@ -44,7 +44,7 @@ public class TT2Exporter implements ExpressionExporter<TT2Exporter> {
};
pinMap = new PinMap();
device = "f1502ispplcc44";
projectName = "unknown";
this.projectName = projectName;
clockPin = 43;
}
@ -64,17 +64,6 @@ public class TT2Exporter implements ExpressionExporter<TT2Exporter> {
return this;
}
/**
* Sets the project name used
*
* @param projectName the project name
* @return this for chained calls
*/
public TT2Exporter setProjectName(String projectName) {
this.projectName = projectName;
return this;
}
/**
* Sets the device name used
*
@ -103,8 +92,6 @@ public class TT2Exporter implements ExpressionExporter<TT2Exporter> {
line("#$ TOOL CUPL");
line("# Berkeley PLA format generated using Digital");
line("#$ TITLE " + projectName);
line("#$ MODULE " + projectName);
line("#$ JEDECFILE " + projectName);
line("#$ DEVICE " + device);
assignPinsAndNodes();
//line("#$ PINS " + getPins());

View File

@ -438,7 +438,7 @@ public class TableDialog extends JDialog {
@Override
public void actionPerformed(ActionEvent actionEvent) {
createHardware(
new ExpressionToFileExporter(new ATF1502TT2Exporter())
new ExpressionToFileExporter(new ATF1502TT2Exporter(filename.getName()))
.addProcessingStep(new StartATF1502Fitter(TableDialog.this))
.addProcessingStep(new CreateCHN("ATF1502AS")), filename, "tt2");
}
@ -456,7 +456,7 @@ public class TableDialog extends JDialog {
@Override
public void actionPerformed(ActionEvent actionEvent) {
createHardware(
new ExpressionToFileExporter(new ATF1504TT2Exporter())
new ExpressionToFileExporter(new ATF1504TT2Exporter(filename.getName()))
.addProcessingStep(new StartATF1504Fitter(TableDialog.this))
.addProcessingStep(new CreateCHN("ATF1504AS")), filename, "tt2");
}

View File

@ -15,7 +15,7 @@ import static de.neemann.digital.analyse.expression.Variable.v;
public class TT2ExporterTest extends TestCase {
public void testCombinatorial() throws Exception {
TT2Exporter tt2 = new TT2Exporter();
TT2Exporter tt2 = new TT2Exporter("unknown");
tt2.getPinMapping().setAvailBidirectional(4,5,6,8,20,21);
tt2.getBuilder().addCombinatorial("Y", and(v("A"), v("B")));
tt2.getBuilder().addCombinatorial("X", or(v("A1"), v("B1")));
@ -44,7 +44,7 @@ public class TT2ExporterTest extends TestCase {
}
public void testSequential() throws Exception {
TT2Exporter tt2 = new TT2Exporter();
TT2Exporter tt2 = new TT2Exporter("unknown");
tt2.getPinMapping().setAvailBidirectional(4,5,6,8,20,21);
tt2.getBuilder().addSequential("Yn", and(v("A"), not(v("Yn"))));
tt2.getPinMapping().parseString("Yn=5");
@ -72,7 +72,7 @@ public class TT2ExporterTest extends TestCase {
}
public void testSequential2() throws Exception {
TT2Exporter tt2 = new TT2Exporter();
TT2Exporter tt2 = new TT2Exporter("unknown");
tt2.getPinMapping().setAvailBidirectional(4,5,6,8,20,21);
tt2.getBuilder().addSequential("Yn", and(v("A"), not(v("Yn"))));
tt2.getBuilder().addSequential("Xn", or(v("B"), not(v("Xn"))));