Search in sources :

Example 1 with HGSEvalException

use of de.neemann.digital.hdl.hgs.HGSEvalException in project Digital by hneemann.

the class ReferenceToStruct method set.

@Override
public void set(Context context, Object value) throws HGSEvalException {
    final HGSMap hgsMap = Value.toMap(parent.get(context));
    if (hgsMap.hgsMapGet(name) == null)
        throw new HGSEvalException("Value '" + name + "' not declared in struct!");
    hgsMap.hgsMapPut(name, value);
}
Also used : HGSMap(de.neemann.digital.hdl.hgs.HGSMap) HGSEvalException(de.neemann.digital.hdl.hgs.HGSEvalException)

Example 2 with HGSEvalException

use of de.neemann.digital.hdl.hgs.HGSEvalException 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);
    }
}
Also used : HDLModel(de.neemann.digital.hdl.model2.HDLModel) NodeException(de.neemann.digital.core.NodeException) HDLCircuit(de.neemann.digital.hdl.model2.HDLCircuit) IOException(java.io.IOException) HDLClockIntegrator(de.neemann.digital.hdl.model2.clock.HDLClockIntegrator) BoardInterface(de.neemann.digital.hdl.vhdl2.boards.BoardInterface) HDLException(de.neemann.digital.hdl.model2.HDLException) PinException(de.neemann.digital.draw.elements.PinException) File(java.io.File) HGSEvalException(de.neemann.digital.hdl.hgs.HGSEvalException)

Example 3 with HGSEvalException

use of de.neemann.digital.hdl.hgs.HGSEvalException in project Digital by hneemann.

the class ReferenceToStruct method declareVar.

@Override
public void declareVar(Context context, Object initial) throws HGSEvalException {
    final HGSMap hgsMap = Value.toMap(parent.get(context));
    if (hgsMap.hgsMapGet(name) != null)
        throw new HGSEvalException("Value '" + name + "' redeclared in struct!");
    hgsMap.hgsMapPut(name, initial);
}
Also used : HGSMap(de.neemann.digital.hdl.hgs.HGSMap) HGSEvalException(de.neemann.digital.hdl.hgs.HGSEvalException)

Aggregations

HGSEvalException (de.neemann.digital.hdl.hgs.HGSEvalException)3 HGSMap (de.neemann.digital.hdl.hgs.HGSMap)2 NodeException (de.neemann.digital.core.NodeException)1 PinException (de.neemann.digital.draw.elements.PinException)1 HDLCircuit (de.neemann.digital.hdl.model2.HDLCircuit)1 HDLException (de.neemann.digital.hdl.model2.HDLException)1 HDLModel (de.neemann.digital.hdl.model2.HDLModel)1 HDLClockIntegrator (de.neemann.digital.hdl.model2.clock.HDLClockIntegrator)1 BoardInterface (de.neemann.digital.hdl.vhdl2.boards.BoardInterface)1 File (java.io.File)1 IOException (java.io.IOException)1