示例#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 stagePortAOut   = DevicePort.Stage_A;
            DevicePort stagePortBOut   = DevicePort.Stage_B;
            DevicePort muxStagePortAIn = DevicePort.Mux_0;
            DevicePort muxStagePortBIn = DevicePort.Mux_0;

            PortStatus stagePortAOut_Stat;
            PortStatus stagePortBOut_Stat;
            PortStatus muxStagePortAIn_Stat;
            PortStatus muxStagePortBIn_Stat;

            InputsUsed(cycle,
                       out stagePortAOut_Stat,
                       out stagePortBOut_Stat,
                       out muxStagePortAIn_Stat,
                       out muxStagePortBIn_Stat);

            bool busRead_A;
            bool busRead_B;

            BusInModel.BusRead(cycle,
                               out busRead_A,
                               out busRead_B);

            var bankID = busRead_A
                                ? Bank.Bank_A
                                : Bank.Bank_B;

            var outputCalc  = BusInModel.OutputCalc(bankID, cycle);
            var activeLabel = outputCalc.FormattedValue;

            conns.Add(new Connection(
                          BusType.Data,
                          stagePortAOut,
                          stagePortAOut_Stat,
                          activeLabel,
                          null,
                          muxStagePortAIn,
                          muxStagePortAIn_Stat));

            conns.Add(new Connection(
                          BusType.Data,
                          stagePortBOut,
                          stagePortBOut_Stat,
                          activeLabel,
                          null,
                          muxStagePortBIn,
                          muxStagePortBIn_Stat));

            return(conns);
        }
示例#2
0
        /// <summary>
        /// Output value of the device for the given cycle
        /// </summary>
        /// <param name="cycle">Zero-based program cycle number</param>
        /// <returns></returns>
        public static LabeledValue <long?> OutputCalc(int cycle)
        {
            var label        = "Out:";
            var muxInstrWord = ActiveInstrWord(cycle - PIPELINE_DELAY);

            if (muxInstrWord == null)
            {
                return(NullLabeledValue <long?>(label));
            }

            var busChannel = muxInstrWord.AddrOp.Equals(1) ? "A" : "B";

            if (busChannel.Equals("A"))
            {
                return(BusInModel.OutputCalc(Bank.Bank_A, cycle));
            }
            else
            {
                return(BusInModel.OutputCalc(Bank.Bank_B, cycle));
            }
        }