use of de.neemann.digital.hdl.model2.HDLException in project Digital by hneemann.
the class ReplaceOneToMany method replace.
private void replace(HDLNodeSplitterOneToMany n, ArrayList<HDLNodeAssignment> newNodes) throws HDLException {
final HDLPort inPort = n.getInputs().get(0);
HDLNet inNet = inPort.getNet();
inPort.setNet(null);
int i = 0;
for (Splitter.Port p : n.getOutputSplit()) {
final HDLPort outPort = n.getOutputs().get(i);
if (outPort.getNet() != null) {
ExprVarRange exp = new ExprVarRange(inNet, p.getPos() + p.getBits() - 1, p.getPos());
HDLNodeAssignment node = new HDLNodeAssignment("splitter", null, null);
node.setExpression(exp);
node.addPort(new HDLPort("in", inNet, HDLPort.Direction.IN, inPort.getBits()));
node.addPort(outPort);
newNodes.add(node);
}
i++;
}
}
use of de.neemann.digital.hdl.model2.HDLException in project Digital by hneemann.
the class VHDLGenerator method export.
/**
* Exports the given circuit
*
* @param circuit the circuit to export
* @return this for chained calls
* @throws IOException IOException
*/
public VHDLGenerator export(Circuit circuit) throws IOException {
try {
if (!circuit.getAttributes().get(Keys.ROMMANAGER).isEmpty())
throw new HDLException(Lang.get("err_centralDefinedRomsAreNotSupported"));
BoardInterface board = BoardProvider.getInstance().getBoard(circuit);
HDLClockIntegrator clockIntegrator = null;
if (board != null && useClockIntegration)
clockIntegrator = board.getClockIntegrator();
HDLModel model = new HDLModel(library).create(circuit, clockIntegrator);
for (HDLCircuit hdlCircuit : model) hdlCircuit.applyDefaultOptimizations();
model.renameLabels(new VHDLRenaming());
out.println("-- generated by Digital. Don't modify this file!");
out.println("-- Any changes will be lost if this file is regenerated.");
new VHDLCreator(out).printHDLCircuit(model.getMain());
File outFile = out.getFile();
if (outFile != null) {
testBenches = new VHDLTestBenchCreator(circuit, model).write(outFile).getTestFileWritten();
if (board != null)
board.writeFiles(outFile, model);
}
return this;
} catch (PinException | NodeException | HDLException | HGSEvalException e) {
throw new IOException(Lang.get("err_vhdlExporting"), e);
}
}
Aggregations