Search in sources :

Example 1 with ROM

use of de.neemann.digital.core.memory.ROM in project Digital by hneemann.

the class TestProcessor method createProcessor.

private ToBreakRunner createProcessor(String program, String processor) throws IOException, PinException, NodeException, ElementNotFoundException {
    ToBreakRunner runner = new ToBreakRunner(processor, false);
    Model model = runner.getModel();
    ROM rom = null;
    for (ROM r : model.findNode(ROM.class)) {
        if (r.isProgramMemory())
            rom = r;
    }
    assertNotNull(rom);
    rom.setData(new DataField(new File(Resources.getRoot(), program)));
    runner.getModel().init(true);
    return runner;
}
Also used : ROM(de.neemann.digital.core.memory.ROM) DataField(de.neemann.digital.core.memory.DataField) Model(de.neemann.digital.core.Model) File(java.io.File)

Example 2 with ROM

use of de.neemann.digital.core.memory.ROM in project Digital by hneemann.

the class RomLoader method preInit.

@Override
public void preInit(Model model) throws NodeException {
    List<ROM> roms = model.findNode(ROM.class, ROM::isProgramMemory);
    if (roms.isEmpty())
        throw new NodeException(Lang.get("msg_noRomFound"));
    if (roms.size() > 1)
        throw new NodeException(Lang.get("msg_moreThenOneRomFound"));
    try {
        roms.get(0).setData(new DataField(romHex));
        roms.get(0).provideRomAdress(model);
    } catch (IOException e) {
        throw new NodeException(e.getMessage());
    }
}
Also used : ROM(de.neemann.digital.core.memory.ROM) DataField(de.neemann.digital.core.memory.DataField) NodeException(de.neemann.digital.core.NodeException) IOException(java.io.IOException)

Aggregations

DataField (de.neemann.digital.core.memory.DataField)2 ROM (de.neemann.digital.core.memory.ROM)2 Model (de.neemann.digital.core.Model)1 NodeException (de.neemann.digital.core.NodeException)1 File (java.io.File)1 IOException (java.io.IOException)1