public XILScheduleMonitor(XIL3Function func)
 {
     Func               = func;
     _maxCStep          = -1;
     _csteps            = new int[func.Instructions.Length];
     _ii                = new int[func.Instructions.Length];
     _lat               = new int[func.Instructions.Length];
     Instructions       = PropMaps.CreateForArray(Func.Instructions, EAccess.ReadOnly);
     CStep              = PropMaps.CreateForArray(_csteps, EAccess.ReadOnly);
     InitiationInterval = PropMaps.CreateForArray(_ii, EAccess.ReadOnly);
     Latency            = PropMaps.CreateForArray(_lat, EAccess.ReadOnly);
 }
 /// <summary>
 /// Constructs a new instance
 /// </summary>
 /// <param name="func">XIL-3 function</param>
 /// <param name="xmm">mapper manager</param>
 /// <param name="host">component instance to host allocated functional units</param>
 /// <param name="targetProject">code generation target project</param>
 public XILSchedulingAdapter(XIL3Function func, XILMapperManager xmm, Component host, IProject targetProject)
 {
     _func             = func;
     _cfg              = Compilation.CreateCFG(func.Instructions);
     _xmm              = xmm;
     _alloc            = xmm.CreateAllocator(host, targetProject);
     _operands         = new DelegatePropMap <XIL3Instr, int[]>(i => i.OperandSlots);
     _results          = new DelegatePropMap <XIL3Instr, int[]>(i => i.ResultSlots);
     _mappingCache     = new IXILMapping[_func.Instructions.Length];
     _classifyCache    = new object[_func.Instructions.Length];
     _mappingKindCache = new EMappingKind[_func.Instructions.Length];
     _latency          = new DelegatePropMap <XIL3Instr, long>(i => GetMapping(i).Latency);
     _index            = new DelegatePropMap <XIL3Instr, int>(i => i.Index);
     _iclass           = new DelegatePropMap <XIL3Instr, object>(i => Classify(i));
     _cstepBack        = new long[_func.Instructions.Length];
     _cstep            = new ArrayBackedPropMap <XIL3Instr, long>(_cstepBack, i => i.Index);
     Init();
 }
Esempio n. 3
0
        internal void ExtractFrom(XIL3Function func, XILSchedulingAdapter xsa)
        {
            if (FirstILIndex == null || LastILIndex == null)
            {
                IsValid = false;
                return;
            }
            var firstInstr = func.Instructions.Where(i => i.CILRef >= FirstILIndex).FirstOrDefault();
            var lastInstr  = func.Instructions.Where(i => i.CILRef <= LastILIndex).LastOrDefault();

            if (firstInstr == null || lastInstr == null)
            {
                FirstCStep = 1;
                LastCStep  = 0;
                IsValid    = false;
                return;
            }
            FirstCStep = xsa.CStep[firstInstr];
            LastCStep  = xsa.CStep[lastInstr];
            IsValid    = true;
        }
Esempio n. 4
0
 public _3ACtoStkImpl(XIL3Function func)
 {
     _inFunc = func;
 }
Esempio n. 5
0
        /// <summary>
        /// Transforms the XIL-3 representation to XIL-S representation.
        /// New local variables will be introduced - one for each output slot.
        /// </summary>
        /// <param name="func">function in XIL-3 representation</param>
        /// <returns>function in XIL-S representation</returns>
        public static XILSFunction ToXILS(this XIL3Function func)
        {
            var xform = new _3ACtoStkImpl(func);

            return(xform.Run());
        }