Ejemplo n.º 1
0
        private void Recompute(T instr)
        {
            var s = new Stack <T>(
                Adapter.Preds[instr].Select(_ => _.Task)
                .Concat(Adapter.Succs[instr].Select(_ => _.Task)));
            var l = new List <T>();

            l.Add(instr);
            while (s.Any())
            {
                T cur = s.Pop();

                long asap    = ASAP(cur);
                long alap    = ALAP(cur);
                long oldAsap = asap;
                long oldAlap = alap;
                foreach (var pred in Adapter.Preds[cur])
                {
                    asap = Math.Max(asap, ASAP(pred.Task) + pred.MinDelay);
                    alap = Math.Min(alap, ALAP(pred.Task) + pred.MaxDelay);
                }
                //long curlat = Adapter.Latency[cur];
                foreach (var succ in Adapter.Succs[cur])
                {
                    alap = Math.Min(alap, ALAP(succ.Task) - succ.MinDelay);
                    asap = Math.Max(asap, ASAP(succ.Task) - succ.MaxDelay);
                }
                if (asap > alap)
                {
                    throw new NotSchedulableException();
                }
                if (asap != oldAsap || alap != oldAlap)
                {
                    object op = Adapter.IClass[cur];
                    DG     dg = _dg[op];
                    dg.Unconsume(cur);
                    SetASAP(cur, asap);
                    SetALAP(cur, alap);
                    dg.Consume(cur);
                    l.Add(cur);
                    foreach (var pred in Adapter.Preds[cur])
                    {
                        s.Push(pred.Task);
                    }
                    foreach (var succ in Adapter.Succs[cur])
                    {
                        s.Push(succ.Task);
                    }
                }
            }
            ComputeIDs(l);
        }
Ejemplo n.º 2
0
 private void Pin(T instr, long cstep)
 {
     Adapter.FDSIndex[instr] = cstep;
     if (ASAP(instr) != ALAP(instr))
     {
         object op = Adapter.IClass[instr];
         DG     dg = _dg[op];
         dg.Unconsume(instr);
         SetASAP(instr, cstep);
         SetALAP(instr, cstep);
         dg.Consume(instr);
         Recompute(instr);
     }
 }