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(); } }
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(); } }
public ShifterTransactor(Shifter host) : base(host) { _host = host; }
public RShiftXILMapping(Shifter host) : base(host.TASite, EMappingKind.ReplicatableResource) { _host = host; }
public ShifterTransactor(Shifter host): base(host) { _host = host; }
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(); } }
public RShiftXILMapping(Shifter host) : base(host.TASite, EMappingKind.ReplicatableResource) { _host = host; }