mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-23 04:11:54 -04:00
Merge branch 'CUPL_Pins'
This commit is contained in:
commit
c81f9d8818
@ -6,7 +6,6 @@
|
|||||||
package de.neemann.digital.builder.ATF150x;
|
package de.neemann.digital.builder.ATF150x;
|
||||||
|
|
||||||
import de.neemann.digital.builder.Gal16v8.CuplExporter;
|
import de.neemann.digital.builder.Gal16v8.CuplExporter;
|
||||||
import de.neemann.digital.builder.PinMap;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
@ -38,8 +37,9 @@ public class ATF150xCuplExporter extends CuplExporter {
|
|||||||
* @param pins the bidirectional pins
|
* @param pins the bidirectional pins
|
||||||
*/
|
*/
|
||||||
public ATF150xCuplExporter(String username, Date date, String devName, int clockPin, int[] pins) {
|
public ATF150xCuplExporter(String username, Date date, String devName, int clockPin, int[] pins) {
|
||||||
super(username, date, devName, new PinMap()
|
super(username, date, devName);
|
||||||
.setAvailBidirectional(pins));
|
getPinMapping()
|
||||||
|
.setAvailBidirectional(pins);
|
||||||
setClockPin(clockPin);
|
setClockPin(clockPin);
|
||||||
setCreateNodes(true);
|
setCreateNodes(true);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import java.util.HashMap;
|
|||||||
*/
|
*/
|
||||||
public class CleanNameBuilder implements BuilderInterface<CleanNameBuilder> {
|
public class CleanNameBuilder implements BuilderInterface<CleanNameBuilder> {
|
||||||
|
|
||||||
private final BuilderInterface parent;
|
private BuilderInterface parent;
|
||||||
private final Filter filter;
|
private final Filter filter;
|
||||||
private final HashMap<String, String> nameMap;
|
private final HashMap<String, String> nameMap;
|
||||||
|
|
||||||
@ -93,6 +93,15 @@ public class CleanNameBuilder implements BuilderInterface<CleanNameBuilder> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the parent builder.
|
||||||
|
*
|
||||||
|
* @param parent the parents builder
|
||||||
|
*/
|
||||||
|
public void setParent(BuilderInterface parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter interface
|
* Filter interface
|
||||||
*/
|
*/
|
||||||
|
@ -34,7 +34,7 @@ public class CuplExporter implements ExpressionExporter<CuplExporter> {
|
|||||||
private final String username;
|
private final String username;
|
||||||
private final Date date;
|
private final Date date;
|
||||||
private final BuilderCollector builder;
|
private final BuilderCollector builder;
|
||||||
private final BuilderInterface cleanNameBuilder;
|
private final CleanNameBuilder cleanNameBuilder;
|
||||||
|
|
||||||
private final PinMap pinMap;
|
private final PinMap pinMap;
|
||||||
private final String devName;
|
private final String devName;
|
||||||
@ -57,9 +57,10 @@ public class CuplExporter implements ExpressionExporter<CuplExporter> {
|
|||||||
* @param date date
|
* @param date date
|
||||||
*/
|
*/
|
||||||
public CuplExporter(String username, Date date) {
|
public CuplExporter(String username, Date date) {
|
||||||
this(username, date, "g16v8a", new PinMap()
|
this(username, date, "g16v8a");
|
||||||
|
getPinMapping()
|
||||||
.setAvailInputs(2, 3, 4, 5, 6, 7, 8, 9)
|
.setAvailInputs(2, 3, 4, 5, 6, 7, 8, 9)
|
||||||
.setAvailOutputs(12, 13, 14, 15, 16, 17, 18, 19));
|
.setAvailOutputs(12, 13, 14, 15, 16, 17, 18, 19);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,15 +78,15 @@ public class CuplExporter implements ExpressionExporter<CuplExporter> {
|
|||||||
* @param username user name
|
* @param username user name
|
||||||
* @param date creation date
|
* @param date creation date
|
||||||
* @param devName device name
|
* @param devName device name
|
||||||
* @param pinMap the pin map to use
|
|
||||||
*/
|
*/
|
||||||
protected CuplExporter(String username, Date date, String devName, PinMap pinMap) {
|
protected CuplExporter(String username, Date date, String devName) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.date = date;
|
this.date = date;
|
||||||
this.devName = devName;
|
this.devName = devName;
|
||||||
this.pinMap = pinMap;
|
cleanNameBuilder = new CleanNameBuilder(null);
|
||||||
|
this.pinMap = cleanNameBuilder.createPinMap();
|
||||||
builder = new CuplBuilder(pinMap);
|
builder = new CuplBuilder(pinMap);
|
||||||
cleanNameBuilder = new CleanNameBuilder(builder);
|
cleanNameBuilder.setParent(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
package de.neemann.digital.builder.Gal22v10;
|
package de.neemann.digital.builder.Gal22v10;
|
||||||
|
|
||||||
import de.neemann.digital.builder.Gal16v8.CuplExporter;
|
import de.neemann.digital.builder.Gal16v8.CuplExporter;
|
||||||
import de.neemann.digital.builder.PinMap;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
@ -31,9 +30,10 @@ public class Gal22v10CuplExporter extends CuplExporter {
|
|||||||
* @param date date
|
* @param date date
|
||||||
*/
|
*/
|
||||||
public Gal22v10CuplExporter(String username, Date date) {
|
public Gal22v10CuplExporter(String username, Date date) {
|
||||||
super(username, date, "g22v10", new PinMap()
|
super(username, date, "g22v10");
|
||||||
|
getPinMapping()
|
||||||
.setAvailInputs(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13)
|
.setAvailInputs(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13)
|
||||||
.setAvailOutputs(14, 15, 16, 17, 18, 19, 20, 21, 22, 23));
|
.setAvailOutputs(14, 15, 16, 17, 18, 19, 20, 21, 22, 23);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -209,8 +209,32 @@ public class Gal16V8CuplExporterTest extends TestCase {
|
|||||||
"X = A;\r\n", cupl);
|
"X = A;\r\n", cupl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testCuplNames() throws IOException, ElementNotFoundException, PinException, NodeException, AnalyseException, BacktrackException, PinMapException, ExpressionException, FormatterException {
|
||||||
|
String cupl = createCupl("dig/GAL/Names.dig", 1, 2, 3, 4, 5);
|
||||||
|
assertEquals("Name test ;\r\n" +
|
||||||
|
"PartNo 00 ;\r\n" +
|
||||||
|
"Date unknownDate ;\r\n" +
|
||||||
|
"Revision 01 ;\r\n" +
|
||||||
|
"Designer nn ;\r\n" +
|
||||||
|
"Company unknown ;\r\n" +
|
||||||
|
"Assembly None ;\r\n" +
|
||||||
|
"Location unknown ;\r\n" +
|
||||||
|
"Device g16v8a ;\r\n" +
|
||||||
|
"\r\n" +
|
||||||
|
"/* inputs */\r\n" +
|
||||||
|
"PIN 5 = A;\r\n" +
|
||||||
|
"PIN 2 = A1;\r\n" +
|
||||||
|
"PIN 3 = B2;\r\n" +
|
||||||
|
"PIN 4 = C_2;\r\n" +
|
||||||
|
"\r\n" +
|
||||||
|
"/* outputs */\r\n" +
|
||||||
|
"PIN 1 = Y;\r\n" +
|
||||||
|
"\r\n" +
|
||||||
|
"/* combinatorial logic */\r\n" +
|
||||||
|
"Y = (A & C_2) # (A1 & B2);\r\n", cupl);
|
||||||
|
}
|
||||||
|
|
||||||
private String createCupl(String filename) throws IOException, PinException, NodeException, ElementNotFoundException, BacktrackException, AnalyseException, ExpressionException, FormatterException, PinMapException {
|
private String createCupl(String filename, int... pins) throws IOException, PinException, NodeException, ElementNotFoundException, BacktrackException, AnalyseException, ExpressionException, FormatterException, PinMapException {
|
||||||
File f = new File(Resources.getRoot(), filename);
|
File f = new File(Resources.getRoot(), filename);
|
||||||
ElementLibrary library = new ElementLibrary();
|
ElementLibrary library = new ElementLibrary();
|
||||||
Circuit c = Circuit.loadCircuit(f, new ShapeFactory(library));
|
Circuit c = Circuit.loadCircuit(f, new ShapeFactory(library));
|
||||||
@ -221,6 +245,7 @@ public class Gal16V8CuplExporterTest extends TestCase {
|
|||||||
new ExpressionCreator(t).create(expressions);
|
new ExpressionCreator(t).create(expressions);
|
||||||
|
|
||||||
CuplExporter cuplExporter = new CuplExporter("nn", null);
|
CuplExporter cuplExporter = new CuplExporter("nn", null);
|
||||||
|
cuplExporter.getPinMapping().setAvailBidirectional(pins);
|
||||||
cuplExporter.setProjectName("test");
|
cuplExporter.setProjectName("test");
|
||||||
final ModelAnalyserInfo modelAnalyzerInfo = t.getModelAnalyzerInfo();
|
final ModelAnalyserInfo modelAnalyzerInfo = t.getModelAnalyzerInfo();
|
||||||
if (modelAnalyzerInfo != null)
|
if (modelAnalyzerInfo != null)
|
||||||
|
154
src/test/resources/dig/GAL/Names.dig
Normal file
154
src/test/resources/dig/GAL/Names.dig
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<circuit>
|
||||||
|
<version>1</version>
|
||||||
|
<attributes/>
|
||||||
|
<visualElements>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>And</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>wideShape</string>
|
||||||
|
<boolean>true</boolean>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="420" y="160"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>And</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>wideShape</string>
|
||||||
|
<boolean>true</boolean>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="420" y="240"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Or</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>wideShape</string>
|
||||||
|
<boolean>true</boolean>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="540" y="200"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Out</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>Y</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>1</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="640" y="220"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>In</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>A-1</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>2</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="400" y="160"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>In</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>B^2</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>3</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="400" y="200"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>In</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>C_2</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>4</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="400" y="240"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>In</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>A</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>pinNumber</string>
|
||||||
|
<string>5</string>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="400" y="280"/>
|
||||||
|
</visualElement>
|
||||||
|
</visualElements>
|
||||||
|
<wires>
|
||||||
|
<wire>
|
||||||
|
<p1 x="520" y="240"/>
|
||||||
|
<p2 x="540" y="240"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="400" y="240"/>
|
||||||
|
<p2 x="420" y="240"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="400" y="160"/>
|
||||||
|
<p2 x="420" y="160"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="500" y="180"/>
|
||||||
|
<p2 x="520" y="180"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="500" y="260"/>
|
||||||
|
<p2 x="520" y="260"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="520" y="200"/>
|
||||||
|
<p2 x="540" y="200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="400" y="200"/>
|
||||||
|
<p2 x="420" y="200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="400" y="280"/>
|
||||||
|
<p2 x="420" y="280"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="620" y="220"/>
|
||||||
|
<p2 x="640" y="220"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="520" y="180"/>
|
||||||
|
<p2 x="520" y="200"/>
|
||||||
|
</wire>
|
||||||
|
<wire>
|
||||||
|
<p1 x="520" y="240"/>
|
||||||
|
<p2 x="520" y="260"/>
|
||||||
|
</wire>
|
||||||
|
</wires>
|
||||||
|
<measurementOrdering/>
|
||||||
|
</circuit>
|
Loading…
x
Reference in New Issue
Block a user