本文整理汇总了C#中TypeDescriptor.Select方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDescriptor.Select方法的具体用法?C# TypeDescriptor.Select怎么用?C# TypeDescriptor.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeDescriptor
的用法示例。
在下文中一共展示了TypeDescriptor.Select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryMapOne
private IXILMapping TryMapOne(ITransactionSite taSite, XILInstr instr, TypeDescriptor[] operandTypes, TypeDescriptor[] resultTypes, bool swap)
{
var fu = taSite.Host;
ALU alu = fu as ALU;
if (alu == null)
return null;
if (resultTypes.Length != 1)
return null;
TypeDescriptor rtype = resultTypes[0];
if (!rtype.IsComplete)
return null;
if (!CheckFixCompliance(instr, operandTypes, resultTypes))
return null;
int rsize = TypeLowering.Instance.GetWireWidth(rtype);
int[] osizes = operandTypes.Select(t => TypeLowering.Instance.GetWireWidth(t)).ToArray();
Func<ISignalSource<StdLogicVector>[], ISignalSink<StdLogicVector>[], IEnumerable<TAVerb>> realize;
if (operandTypes.Length == 1)
{
realize = (os, rs) => alu.Transactor.Do(os[0], rs[0]);
TypeDescriptor otype = operandTypes[0];
long osize = osizes[0];
switch (instr.Name)
{
case InstructionCodes.Neg:
if (alu.FuncSel != ALU.EFunction.Neg)
return null;
if ((!otype.CILType.Equals(typeof(Signed)) ||
!rtype.CILType.Equals(typeof(Signed))) &&
(!otype.CILType.Equals(typeof(SFix)) ||
!rtype.CILType.Equals(typeof(SFix))))
return null;
if (alu.AWidth != osize ||
alu.RWidth != rsize)
return null;
break;
case InstructionCodes.Not:
if (alu.FuncSel != ALU.EFunction.Not)
return null;
if (!otype.CILType.Equals(typeof(StdLogicVector)) ||
!rtype.CILType.Equals(typeof(StdLogicVector)))
return null;
if (alu.AWidth != osize ||
alu.RWidth != osize)
return null;
break;
default:
return null;
}
}
else
{
realize = (os, rs) => alu.Transactor.Do(os[0], os[1], rs[0]);
TypeDescriptor otype0 = operandTypes[0];
TypeDescriptor otype1 = operandTypes[1];
long osize0 = osizes[0];
long osize1 = osizes[1];
if (alu.AWidth != osize0 ||
alu.BWidth != osize1 ||
(alu.FuncSel != ALU.EFunction.Compare && alu.RWidth != rsize))
return null;
bool isArith = false;
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:
switch (alu.ArithMode)
{
case ALU.EArithMode.Signed:
if ((!otype0.CILType.Equals(typeof(Signed)) ||
!otype1.CILType.Equals(typeof(Signed)) ||
(isArith && !rtype.CILType.Equals(typeof(Signed))) ||
(!isArith && !rtype.CILType.Equals(typeof(bool)) &&
!rtype.CILType.Equals(typeof(StdLogicVector)))) &&
(!otype0.CILType.Equals(typeof(SFix)) ||
!otype1.CILType.Equals(typeof(SFix)) ||
(isArith && !rtype.CILType.Equals(typeof(SFix))) ||
(!isArith && !rtype.CILType.Equals(typeof(bool)) &&
!rtype.CILType.Equals(typeof(StdLogicVector)))))
return null;
break;
case ALU.EArithMode.Unsigned:
if ((!(otype0.CILType.Equals(typeof(Unsigned)) || otype0.CILType.Equals(typeof(StdLogicVector))) ||
//.........这里部分代码省略.........