import net.mograsim.logic.core.components.CoreClock;
import net.mograsim.logic.core.timeline.Timeline;
+import net.mograsim.logic.core.types.Bit;
import net.mograsim.logic.core.types.BitVector;
import net.mograsim.logic.model.am2900.components.ModelAm2900MainMemory;
import net.mograsim.logic.model.am2900.components.ModelAm2900MicroInstructionMemory;
import net.mograsim.logic.model.model.LogicModel;
import net.mograsim.logic.model.model.LogicModelModifiable;
+import net.mograsim.logic.model.model.components.ModelComponent;
import net.mograsim.logic.model.modeladapter.CoreModelParameters;
import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
import net.mograsim.machine.MachineDefinition;
import net.mograsim.machine.MainMemory;
import net.mograsim.machine.Register;
+import net.mograsim.machine.mi.MicroInstruction;
+import net.mograsim.machine.mi.MicroInstructionDefinition;
import net.mograsim.machine.mi.MicroInstructionMemory;
import net.mograsim.machine.mi.StandardMicroInstructionMemory;
+import net.mograsim.machine.mi.parameters.MicroInstructionParameter;
+import net.mograsim.machine.mi.parameters.ParameterClassification;
import net.mograsim.machine.standard.memory.WordAddressableMemory;
public class Am2900Machine implements Machine
{
private Am2900MachineDefinition machineDefinition;
private LogicModelModifiable logicModel;
+ private ModelComponent am2900;
private Timeline timeline;
private MainMemory mainMemory;
private MicroInstructionMemory instMemory;
private CoreClock clock;
- public Am2900Machine(Am2900MachineDefinition am2900MachineDefinition)
+ public Am2900Machine(LogicModelModifiable model, Am2900MachineDefinition am2900MachineDefinition)
{
this.machineDefinition = am2900MachineDefinition;
- logicModel = new LogicModelModifiable();
- IndirectModelComponentCreator.createComponent(logicModel,
+ this.logicModel = model;
+ this.am2900 = IndirectModelComponentCreator.createComponent(logicModel,
"resloader:Am2900Loader:jsonres:net/mograsim/logic/model/am2900/components/Am2900.json", "Am2900");
CoreModelParameters params = new CoreModelParameters();
params.gateProcessTime = 50;
@Override
public void reset()
{
- // TODO Auto-generated method stub
-
+ logicModel.getComponentByName("Am2900").setHighLevelState("c.out", BitVector.of(Bit.ZERO));
+ MicroInstructionDefinition muiDef = getDefinition().getMicroInstructionMemoryDefinition().getMicroInstructionDefinition();
+ ParameterClassification[] paramClassifications = muiDef.getParameterClassifications();
+ MicroInstructionParameter[] defaultParams = muiDef.createDefaultInstruction().getParameters();
+ defaultParams[19] = paramClassifications[19].parse("JZ");
+ MicroInstruction jzMI = MicroInstruction.create(defaultParams);
+ logicModel.getComponentByName("Am2900").setHighLevelState("muir_2.q", jzMI.toBitVector());
}
@Override
return logicModel;
}
+ public ModelComponent getAm2900()
+ {
+ return am2900;
+ }
+
@Override
public Timeline getTimeline()
{
{
return instMemory;
}
-
-}
+}
\ No newline at end of file
import java.util.Objects;
import java.util.Set;
+import net.mograsim.logic.model.model.LogicModelModifiable;
import net.mograsim.machine.ISASchema;
-import net.mograsim.machine.Machine;
import net.mograsim.machine.MachineDefinition;
import net.mograsim.machine.MachineRegistry;
-import net.mograsim.machine.MainMemoryDefinition;
import net.mograsim.machine.Register;
-import net.mograsim.machine.mi.MicroInstructionMemoryDefinition;
public class Am2900MachineDefinition implements MachineDefinition
{
- private MainMemoryDefinition memoryDefinition = new Am2900MainMemoryDefinition();
- private MicroInstructionMemoryDefinition microInstMemoryDefinition = new Am2900MicroInstructionMemoryDefinition();
+ private Am2900MainMemoryDefinition memoryDefinition = new Am2900MainMemoryDefinition();
+ private Am2900MicroInstructionMemoryDefinition microInstMemoryDefinition = new Am2900MicroInstructionMemoryDefinition();
private final static Am2900MachineDefinition instance = new Am2900MachineDefinition();
public static Am2900MachineDefinition getInstance()
}
@Override
- public Machine createNew()
+ public Am2900Machine createNew()
{
- return new Am2900Machine(this);
+ return createNew(new LogicModelModifiable());
+ }
+
+ public Am2900Machine createNew(LogicModelModifiable model)
+ {
+ return new Am2900Machine(model, this);
}
@Override
}
@Override
- public MainMemoryDefinition getMainMemoryDefinition()
+ public Am2900MainMemoryDefinition getMainMemoryDefinition()
{
return memoryDefinition;
}
@Override
- public MicroInstructionMemoryDefinition getMicroInstructionMemoryDefinition()
+ public Am2900MicroInstructionMemoryDefinition getMicroInstructionMemoryDefinition()
{
return microInstMemoryDefinition;
}
import net.mograsim.logic.model.SimpleLogicUIStandalone;
import net.mograsim.logic.model.am2900.Am2900Loader;
+import net.mograsim.logic.model.am2900.machine.Am2900MachineDefinition;
import net.mograsim.logic.model.model.LogicModelModifiable;
import net.mograsim.logic.model.model.components.ModelComponent;
import net.mograsim.logic.model.model.components.atomic.ModelBitDisplay;
import net.mograsim.logic.model.model.wires.ModelWire;
import net.mograsim.logic.model.model.wires.Pin;
import net.mograsim.logic.model.model.wires.PinUsage;
-import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
public class ModelComponentTestbench
{
public static void createTestbench(LogicModelModifiable model)
{
Am2900Loader.setup();
- ModelComponent comp = IndirectModelComponentCreator.createComponent(model, "Am2900");
+ ModelComponent comp = new Am2900MachineDefinition().createNew(model).getAm2900();
List<String> inputPinNames = new ArrayList<>();
List<String> outputPinNames = new ArrayList<>();