use of de.neemann.digital.core.memory.DataField in project Digital by hneemann.
the class ROMManger method applyTo.
/**
* Applies the available roms to the model
*
* @param model the mode to use
*/
public void applyTo(Model model) {
for (Node n : model.findNode(n -> n instanceof ROMInterface)) {
ROMInterface rom = (ROMInterface) n;
DataField data = roms.get(rom.getLabel());
if (data != null)
rom.setData(data);
}
}
use of de.neemann.digital.core.memory.DataField in project Digital by hneemann.
the class CircuitTest method test64Bit.
public void test64Bit() throws IOException {
Circuit c = createCircuit();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
c.save(baos);
// check ROM
c = Circuit.loadCircuit(new ByteArrayInputStream(baos.toByteArray()), new ShapeFactory(new ElementLibrary()));
VisualElement rom = c.getElements().get(0);
DataField d = rom.getElementAttributes().get(Keys.DATA);
assertEquals(0xffff0000ffff0000L, d.getDataWord(0));
assertEquals(0x8fff0000ffff0000L, d.getDataWord(1));
// check input
VisualElement in = c.getElements().get(1);
assertEquals(0x8fff0000ffff0000L, in.getElementAttributes().get(Keys.INPUT_DEFAULT).getValue());
}
Aggregations