public ProgramCounter(IClock clock, IBus bus, IControlUnit controlUnit) { this.Bus = bus; busOutputLine = controlUnit.GetControlLine(ControlLineId.PC_OUT); countEnableLine = controlUnit.GetControlLine(ControlLineId.PC_ENABLE); busInputLine = controlUnit.GetControlLine(ControlLineId.PC_IN); clock.AddConnectedComponent(this); // Setup the callback for when the bus output line goes high or low. Depending on which, we either start or stop driving the bus busOutputLine.onTransition = () => { if (busOutputLine.State == true) { Bus.Driver = this; } else { if (Bus.Driver == this) { Bus.Driver = null; } } return(true); }; }
public FlagsRegister4Bit(SystemRegister id, IClock clock, IControlUnit controlUnit, IAlu alu) { this.id = id; Value = 0; this.controlUnit = controlUnit; this.alu = alu; clock.AddConnectedComponent(this); updateFlagsLine = controlUnit.GetControlLine(ControlLineId.UPDATE_FLAGS); }
public Register(SystemRegister id, IClock clock, IBus bus, IControlUnit controlUnit) { this.id = id; Bus = bus; Value = 0; this.controlUnit = controlUnit; clock.AddConnectedComponent(this); switch (id) { case SystemRegister.A: busOutputLine = controlUnit.GetControlLine(ControlLineId.A_REG_OUT); busInputLine = controlUnit.GetControlLine(ControlLineId.A_REG_IN); break; case SystemRegister.B: busOutputLine = controlUnit.GetControlLine(ControlLineId.B_REG_OUT); busInputLine = controlUnit.GetControlLine(ControlLineId.B_REG_IN); break; case SystemRegister.MAR: busOutputLine = null; busInputLine = controlUnit.GetControlLine(ControlLineId.MAR_IN); break; case SystemRegister.IR: busOutputLine = null; busInputLine = controlUnit.GetControlLine(ControlLineId.IR_IN); break; case SystemRegister.IR_PARAM: busOutputLine = controlUnit.GetControlLine(ControlLineId.IR_PARAM_OUT); busInputLine = controlUnit.GetControlLine(ControlLineId.IR_PARAM_IN); break; case SystemRegister.OUT: busOutputLine = null; busInputLine = controlUnit.GetControlLine(ControlLineId.OUT_REG_IN); break; default: throw new ArgumentException("missing reg type"); } // Setup the callback for when the bus output line goes high or low. Depending on which, we either start or stop driving the bus if (busOutputLine != null) { busOutputLine.onTransition = () => { if (busOutputLine.State == true) { Bus.Driver = this; } else { if (Bus.Driver == this) { Bus.Driver = null; } } return(true); }; } }
public MicrostepCounter(IClock clock, IControlUnit controlUnit) { clock.AddConnectedComponent(this); this.controlUnit = controlUnit; }