Ejemplo n.º 1
0
        /// <summary>
        /// Input connections to device
        /// </summary>
        /// <param name="cycle">Zero-based program cycle number</param>
        /// <returns></returns>
        private static List <Connection> Connections(int cycle)
        {
            var conns = new List <Connection>();

            DevicePort aluPortOut       = DevicePort.ALU;
            DevicePort shifterAluPortIn = DevicePort.Shifter;

            PortStatus aluPortOut_Stat;
            PortStatus shifterAluPortIn_Stat;

            InputsUsed(cycle,
                       out aluPortOut_Stat,
                       out shifterAluPortIn_Stat);

            var alu_label = ALUModel.OutputCalc(cycle).FormattedValue;

            conns.Add(new Connection(
                          BusType.Data,
                          aluPortOut,
                          aluPortOut_Stat,
                          alu_label,
                          null,
                          shifterAluPortIn,
                          shifterAluPortIn_Stat));

            return(conns);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Inputs used by the device in the active instruction
        /// </summary>
        /// <param name="cycle">Zero-based program cycle number</param>
        /// <param name="aluPortOut_Stat">Status of port</param>
        /// <param name="shifterAluPortIn">Status of port</param>
        private static void InputsUsed(
            int cycle,
            out PortStatus aluPortOut_Stat,
            out PortStatus shifterAluPortIn)
        {
            aluPortOut_Stat  = PortStatus.Inactive;
            shifterAluPortIn = PortStatus.Inactive;

            // alu
            var aluOutput = ALUModel.OutputCalc(cycle);

            if (aluOutput.Value.HasValue)
            {
                aluPortOut_Stat  = PortStatus.Active;
                shifterAluPortIn = PortStatus.Active;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Input to the device for the given cycle
        /// </summary>
        /// <param name="cycle">Zero-based program cycle number</param>
        /// <returns></returns>
        private static LabeledValue <long?> InputCalc(int cycle)
        {
            var label = "In:";

            var val = ALUModel.OutputCalc(cycle);

            if (val != null)
            {
                var r = new LabeledValue <long?>(label);
                r.Value          = val.Value;
                r.FormattedValue = r.Value.HasValue ? FormatValue(VALUE_WIDTH, r.Value) : "";
                return(r);
            }
            else
            {
                return(NullLabeledValue <long?>(label));
            }
        }