示例#1
0
        public IEnumerable <IXILMapping> TryMap(ITransactionSite taSite, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes)
        {
            var     fu      = taSite.Host;
            Shifter shifter = fu as Shifter;

            if (shifter == null)
            {
                yield break;
            }

            if (instr.Name != InstructionCodes.LShift &&
                instr.Name != InstructionCodes.RShift)
            {
                yield break;
            }

            int fmtData   = GetFixSize(operandTypes[0]);
            int fmtShift  = GetFixSize(operandTypes[1]);
            int fmtResult = GetFixSize(resultTypes[0]);

            if (fmtData < 0 || fmtShift < 0 || fmtResult < 0)
            {
                yield break;
            }

            if (fmtData != fmtResult)
            {
                yield break;
            }

            if (shifter.DataWidth != fmtData ||
                shifter.ShiftWidth != fmtShift)
            {
                yield break;
            }

            switch (instr.Name)
            {
            case InstructionCodes.LShift:
                yield return(new LShiftXILMapping(shifter));

                break;

            case InstructionCodes.RShift:
                yield return(new RShiftXILMapping(shifter));

                break;

            default:
                throw new NotImplementedException();
            }
        }
示例#2
0
        public IXILMapping TryAllocate(Component host, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes, IProject proj)
        {
            if (instr.Name != InstructionCodes.LShift &&
                instr.Name != InstructionCodes.RShift)
            {
                return(null);
            }

            int fmtData   = GetFixSize(operandTypes[0]);
            int fmtShift  = GetFixSize(operandTypes[1]);
            int fmtResult = GetFixSize(resultTypes[0]);

            if (fmtData < 0 || fmtShift < 0 || fmtResult < 0)
            {
                return(null);
            }

            if (!fmtData.Equals(fmtResult))
            {
                return(null);
            }

            if (fmtShift != MathExt.CeilLog2(fmtData))
            {
                return(null);
            }

            Shifter shifter = new Shifter(fmtData, 1);

            switch (instr.Name)
            {
            case InstructionCodes.LShift:
                return(new LShiftXILMapping(shifter));

            case InstructionCodes.RShift:
                return(new RShiftXILMapping(shifter));

            default:
                throw new NotImplementedException();
            }
        }
示例#3
0
 public ShifterTransactor(Shifter host) :
     base(host)
 {
     _host = host;
 }
示例#4
0
 public RShiftXILMapping(Shifter host) :
     base(host.TASite, EMappingKind.ReplicatableResource)
 {
     _host = host;
 }
示例#5
0
 public ShifterTransactor(Shifter host):
     base(host)
 {
     _host = host;
 }
示例#6
0
        public IXILMapping TryAllocate(Component host, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes, IProject proj)
        {
            if (instr.Name != InstructionCodes.LShift &&
                instr.Name != InstructionCodes.RShift)
                return null;

            int fmtData = GetFixSize(operandTypes[0]);
            int fmtShift = GetFixSize(operandTypes[1]);
            int fmtResult = GetFixSize(resultTypes[0]);
            if (fmtData < 0 || fmtShift < 0 || fmtResult < 0)
                return null;

            if (!fmtData.Equals(fmtResult))
                return null;

            if (fmtShift != MathExt.CeilLog2(fmtData))
                return null;

            Shifter shifter = new Shifter(fmtData, 1);

            switch (instr.Name)
            {
                case InstructionCodes.LShift:
                    return new LShiftXILMapping(shifter);

                case InstructionCodes.RShift:
                    return new RShiftXILMapping(shifter);

                default:
                    throw new NotImplementedException();
            }
        }
示例#7
0
 public RShiftXILMapping(Shifter host) :
     base(host.TASite, EMappingKind.ReplicatableResource)
 {
     _host = host;
 }