Search in sources :

Example 6 with DataField

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);
    }
}
Also used : DataField(de.neemann.digital.core.memory.DataField) Node(de.neemann.digital.core.Node)

Example 7 with DataField

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());
}
Also used : ElementLibrary(de.neemann.digital.draw.library.ElementLibrary) DataField(de.neemann.digital.core.memory.DataField) ShapeFactory(de.neemann.digital.draw.shapes.ShapeFactory)

Aggregations

DataField (de.neemann.digital.core.memory.DataField)7 ROM (de.neemann.digital.core.memory.ROM)2 Model (de.neemann.digital.core.Model)1 Node (de.neemann.digital.core.Node)1 NodeException (de.neemann.digital.core.NodeException)1 InValue (de.neemann.digital.core.io.InValue)1 RAMInterface (de.neemann.digital.core.memory.RAMInterface)1 IOState (de.neemann.digital.draw.elements.IOState)1 ElementLibrary (de.neemann.digital.draw.library.ElementLibrary)1 ShapeFactory (de.neemann.digital.draw.shapes.ShapeFactory)1 CircuitComponent (de.neemann.digital.gui.components.CircuitComponent)1 DataEditor (de.neemann.digital.gui.components.DataEditor)1 Sync (de.neemann.digital.gui.sync.Sync)1 Context (de.neemann.digital.hdl.hgs.Context)1 Parser (de.neemann.digital.hdl.hgs.Parser)1 File (java.io.File)1 IOException (java.io.IOException)1