public Controller(ProgramCounter pcin, Ram ramin, register ain, register bin, Alu aluin, OutputRegister orin) { pc = pcin; ram = ramin; A = ain; B = bin; alu = aluin; or = orin; }
public void OutputRegisterInputs() { DataBus bus = new DataBus(); SignalBus signals = new SignalBus(); Register output = new OutputRegister(bus, signals); bus.Value = 255; signals.OI = true; output.ReadFromBus(); Assert.AreEqual(255, output.Value); }
public string GetExpression(OutputRegister output, Dictionary <string, long> values = null) { return($"{(values == null || !values.ContainsKey(output.Name) ? output.Name : values[output.Name].ToString())} = " + $"f({string.Join(", ", Registers.Values.OfType<InputRegister>().Select(input => values == null || !values.ContainsKey(input.Name) ? input.Name : values[input.Name].ToString()))}) = " + getExpressionFor(output, values: values)); }