当前位置: 首页>>代码示例>>C#>>正文


C# TypeDescriptor.All方法代码示例

本文整理汇总了C#中TypeDescriptor.All方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDescriptor.All方法的具体用法?C# TypeDescriptor.All怎么用?C# TypeDescriptor.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TypeDescriptor的用法示例。


在下文中一共展示了TypeDescriptor.All方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryAllocate

        public IXILMapping TryAllocate(Component host, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes, IProject proj)
        {
            if (instr.Name != InstructionCodes.Concat)
                return null;

            if (!operandTypes[0].CILType.Equals(typeof(StdLogicVector)) ||
                !resultTypes[0].CILType.Equals(typeof(StdLogicVector)))
                return null;

            if (!operandTypes.All(t => t.Equals(operandTypes[0])))
                return null;

            int wordWidth = (int)operandTypes[0].TypeParams[0];
            Concatenizer cc = new Concatenizer(operandTypes.Length, wordWidth);

            return new ConcatXILMapping(cc);
        }
开发者ID:venusdharan,项目名称:systemsharp,代码行数:17,代码来源:Concatenizer.cs

示例2: TryAllocate

        public IXILMapping TryAllocate(Component host, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes, IProject proj)
        {
            if (!CheckFixCompliance(instr, operandTypes, resultTypes))
                return null;

            bool isArith = false;
            int osize0, osize1 = 0;
            int rsize;
            ALU.EArithMode amode;
            ALU.EFunction op;
            switch (instr.Name)
            {
                case InstructionCodes.Add:
                case InstructionCodes.Sub:
                case InstructionCodes.Mul:
                    isArith = true;
                    goto case InstructionCodes.IsLt;

                case InstructionCodes.IsLt:
                case InstructionCodes.IsLte:
                case InstructionCodes.IsEq:
                case InstructionCodes.IsNEq:
                case InstructionCodes.IsGte:
                case InstructionCodes.IsGt:
                    {
                        if (operandTypes.All(t => t.CILType.Equals(typeof(Signed))) &&
                            (!isArith || resultTypes[0].CILType.Equals(typeof(Signed))) &&
                            (isArith || resultTypes[0].CILType.Equals(typeof(bool)) ||
                            resultTypes[0].CILType.Equals(typeof(StdLogicVector))))
                            amode = ALU.EArithMode.Signed;
                        else if (operandTypes.All(t => t.CILType.Equals(typeof(SFix))) &&
                            (!isArith || resultTypes[0].CILType.Equals(typeof(SFix))) &&
                            (isArith || resultTypes[0].CILType.Equals(typeof(bool)) ||
                            resultTypes[0].CILType.Equals(typeof(StdLogicVector))))
                            amode = ALU.EArithMode.Signed;
                        else if (operandTypes.All(t => t.CILType.Equals(typeof(Unsigned))) &&
                            (!isArith || resultTypes[0].CILType.Equals(typeof(Unsigned))) &&
                            (isArith || resultTypes[0].CILType.Equals(typeof(bool)) ||
                            resultTypes[0].CILType.Equals(typeof(StdLogicVector))))
                            amode = ALU.EArithMode.Unsigned;
                        else if (operandTypes.All(t => t.CILType.Equals(typeof(UFix))) &&
                            (!isArith || resultTypes[0].CILType.Equals(typeof(UFix))) &&
                            (isArith || resultTypes[0].CILType.Equals(typeof(bool)) ||
                            resultTypes[0].CILType.Equals(typeof(StdLogicVector))))
                            amode = ALU.EArithMode.Unsigned;
                        else if (operandTypes.All(t => t.CILType.Equals(typeof(StdLogicVector))) &&
                            resultTypes[0].CILType.Equals(typeof(StdLogicVector)))
                            amode = ALU.EArithMode.Unsigned;
                        else if (operandTypes.All(t => t.CILType.Equals(typeof(StdLogic))) &&
                            resultTypes[0].CILType.Equals(typeof(StdLogicVector)) &&
                            (instr.Name == InstructionCodes.IsEq ||
                            instr.Name == InstructionCodes.IsNEq))
                            amode = ALU.EArithMode.Unsigned;
                        else
                            return null;
                        osize0 = TypeLowering.Instance.GetWireWidth(operandTypes[0]);
                        osize1 = TypeLowering.Instance.GetWireWidth(operandTypes[1]);
                        rsize = TypeLowering.Instance.GetWireWidth(resultTypes[0]); ;

                        switch (instr.Name)
                        {
                            case InstructionCodes.Add:
                                op = ALU.EFunction.Add;
                                break;

                            case InstructionCodes.Sub:
                                op = ALU.EFunction.Sub;
                                break;

                            case InstructionCodes.Mul:
                                op = ALU.EFunction.Mul;
                                break;

                            case InstructionCodes.IsLt:
                            case InstructionCodes.IsLte:
                            case InstructionCodes.IsEq:
                            case InstructionCodes.IsNEq:
                            case InstructionCodes.IsGte:
                            case InstructionCodes.IsGt:
                                op = ALU.EFunction.Compare;
                                break;

                            default:
                                throw new InvalidOperationException();
                        }
                    }
                    break;

                case InstructionCodes.Neg:
                    {
                        if (operandTypes[0].CILType.Equals(typeof(Signed)) &&
                            resultTypes[0].CILType.Equals(typeof(Signed)))
                            amode = ALU.EArithMode.Signed;
                        else if (operandTypes[0].CILType.Equals(typeof(SFix)) &&
                            resultTypes[0].CILType.Equals(typeof(SFix)))
                            amode = ALU.EArithMode.Signed;
                        else if (operandTypes[0].CILType.Equals(typeof(Unsigned)) &&
                            resultTypes[0].CILType.Equals(typeof(Unsigned)))
                            amode = ALU.EArithMode.Unsigned;
                        else if (operandTypes[0].CILType.Equals(typeof(UFix)) &&
//.........这里部分代码省略.........
开发者ID:venusdharan,项目名称:systemsharp,代码行数:101,代码来源:ALU.cs

示例3: TryMap

        public IEnumerable<IXILMapping> TryMap(ITransactionSite taSite, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes)
        {
            var fu = taSite.Host;
            Concatenizer cc = fu as Concatenizer;
            if (cc == null)
                yield break;

            if (instr.Name != InstructionCodes.Concat)
                yield break;

            if (!operandTypes[0].CILType.Equals(typeof(StdLogicVector)) ||
                !resultTypes[0].CILType.Equals(typeof(StdLogicVector)))
                yield break;

            if (!operandTypes.All(t => t.Equals(operandTypes[0])))
                yield break;

            int wordWidth = (int)operandTypes[0].TypeParams[0];
            if (cc.WordWidth != wordWidth ||
                cc.NumWords != operandTypes.Length)
                yield break;

            yield return new ConcatXILMapping(cc);
        }
开发者ID:venusdharan,项目名称:systemsharp,代码行数:24,代码来源:Concatenizer.cs


注:本文中的TypeDescriptor.All方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。