use of de.neemann.digital.builder.jedec.FuseMapFillerException in project Digital by hneemann.
the class Gal22v10JEDECExporter method writeTo.
@Override
public void writeTo(OutputStream out) throws FuseMapFillerException, IOException, PinMapException {
for (String in : builder.getInputs()) {
int i = pinMap.getInputFor(in);
if (i == 13)
filler.addVariable(21, new Variable(in));
else
filler.addVariable((i - 1) * 2, new Variable(in));
}
for (String o : builder.getOutputs()) {
int i = 23 - pinMap.getOutputFor(o);
filler.addVariableReverse(i * 2 + 1, new Variable(o));
}
for (String o : builder.getOutputs()) {
int olmc = 23 - pinMap.getOutputFor(o);
int offs = OE_FUSE_NUM_BY_OLMC[olmc];
// turn on OE
for (int j = 0; j < 44; j++) map.setFuse(offs + j);
// set olmc to active high
map.setFuse(S0 + olmc * 2);
if (builder.getCombinatorial().containsKey(o)) {
map.setFuse(S1 + olmc * 2);
filler.fillExpression(offs + 44, builder.getCombinatorial().get(o), PRODUCTS_BY_OLMC[olmc]);
} else if (builder.getRegistered().containsKey(o)) {
filler.fillExpression(offs + 44, builder.getRegistered().get(o), PRODUCTS_BY_OLMC[olmc]);
} else
throw new FuseMapFillerException("variable " + o + " not found!");
}
try (JedecWriter w = new JedecWriter(out)) {
w.println("Digital GAL22v10 assembler*").write(map);
}
}
use of de.neemann.digital.builder.jedec.FuseMapFillerException in project Digital by hneemann.
the class Gal16v8JEDECExporter method writeTo.
@Override
public void writeTo(OutputStream out) throws FuseMapFillerException, IOException, PinMapException {
boolean registered = !builder.getRegistered().isEmpty();
init(registered);
for (String in : builder.getInputs()) {
int i = pinMap.getInputFor(in) - 2;
filler.addVariable(i * 2, new Variable(in));
}
for (String o : builder.getOutputs()) {
int i = 19 - pinMap.getOutputFor(o);
filler.addVariable(i * 2 + 1, new Variable(o));
}
for (String o : builder.getOutputs()) {
int olmc = 19 - pinMap.getOutputFor(o);
int offs = olmc * 256;
// set XOR to compensate inverted driver
map.setFuse(XOR + olmc);
if (builder.getCombinatorial().containsKey(o)) {
if (registered) {
// turn on OE
for (int j = 0; j < 32; j++) map.setFuse(offs + j);
filler.fillExpression(offs + 32, builder.getCombinatorial().get(o), 7);
} else {
map.setFuse(AC1 + olmc, false);
filler.fillExpression(offs, builder.getCombinatorial().get(o), 8);
}
} else if (builder.getRegistered().containsKey(o)) {
// turn on register
map.setFuse(AC1 + olmc, false);
filler.fillExpression(offs, builder.getRegistered().get(o), 8);
} else
throw new FuseMapFillerException("variable " + o + " not found!");
}
try (JedecWriter w = new JedecWriter(out)) {
w.println("Digital GAL16v8 assembler*").write(map);
}
}
Aggregations