예제 #1
0
        public IEnumerable <IXILMapping> TryMap(ITransactionSite taSite, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes)
        {
            var fu  = taSite.Host;
            BCU bcu = fu as BCU;

            if (bcu != _host)
            {
                yield break;
            }

            switch (instr.Name)
            {
            case InstructionCodes.Goto:
            case InstructionCodes.BranchIfTrue:
            case InstructionCodes.BranchIfFalse:
            {
                var target = (BranchLabel)instr.Operand;
                switch (instr.Name)
                {
                case InstructionCodes.Goto:
                    yield return(new GotoMapping(bcu, target));

                    yield break;

                case InstructionCodes.BranchIfTrue:
                    yield return(new BranchIfMapping(bcu, target));

                    yield break;

                case InstructionCodes.BranchIfFalse:
                    yield return(new BranchIfNotMapping(bcu, target));

                    yield break;

                default:
                    throw new NotImplementedException();
                }
            }

            default:
                yield break;
            }
        }
예제 #2
0
 public BCUMapping(BCU bcu, BranchLabel target)
 {
     _bcu    = bcu;
     _target = target;
 }
예제 #3
0
 public BCUTransactionSite(BCU host) :
     base(host)
 {
     _host = host;
 }
예제 #4
0
 /// <summary>
 /// Constructs an instance
 /// </summary>
 /// <param name="host">the branch control unit</param>
 /// <param name="latency">desired latency</param>
 public BCUMapper(BCU host, int latency = 1)
 {
     _host    = host;
     _latency = latency;
 }
예제 #5
0
 public BranchIfNotMapping(BCU bcu, BranchLabel target) :
     base(bcu, target)
 {
 }
예제 #6
0
 public GotoMapping(BCU bcu, BranchLabel target) :
     base(bcu, target)
 {
 }