Пример #1
0
        private void CreateStagedInterconnect(FlowMatrix flowSpec, FlowMatrix detailedFlow)
        {
            flowSpec.Transitize();
            detailedFlow.AddNeutral(flowSpec.NeutralFlow);
            var tflows  = flowSpec.GetTimedFlows();
            var grouped = tflows.GroupBy(tf => tf.Target);

            foreach (var group in grouped)
            {
                var net = ConstructNetwork(group.Key, group);
                foreach (var tflow in net)
                {
                    var tsf = tflow as TimedSignalFlow;
                    var tvf = tflow as TimedValueFlow;
                    if (tsf != null)
                    {
                        detailedFlow.Add((int)tflow.Time, new SignalFlow(tsf.Source, tsf.Target));
                    }
                    else
                    {
                        detailedFlow.Add((int)tflow.Time, new ValueFlow(tvf.Value, tvf.Target));
                    }
                }
            }
            for (int i = 0; i < _stageInSignals.Count; i++)
            {
                detailedFlow.AddNeutral(new SignalFlow(
                                            _stageOutSignals[i].ToSignalRef(SignalRef.EReferencedProperty.Cur),
                                            _stageInSignals[i].ToSignalRef(SignalRef.EReferencedProperty.Next)));
            }
        }
Пример #2
0
        public void CreateInterconnect(FlowMatrix flowSpec, FlowMatrix detailedFlow)
        {
            flowSpec.Transitize();
            var tflows = flowSpec.GetTimedFlows();
            var sflows = tflows
                         .Select(tf => tf as TimedSignalFlow)
                         .Where(tf => tf != null);

            SlimMux <int, int, TimedSignalFlow> .ConstructInterconnect(_smih, sflows);

            var pipeen = _smih.ComputePipeEnMatrix(flowSpec.NumCSteps);
            var pipes  = _smih.InstantiatePipes();
            int idx    = 0;

            foreach (RegPipe rp in pipes)
            {
                string id = "icpipe" + idx;
                _host.Descriptor.AddChild(rp.Descriptor, id);
                ++idx;
            }
            var pflows = _smih.ToFlow(flowSpec.NumCSteps, flowSpec.NeutralFlow, pipeen);
            var vflows = tflows
                         .Select(tf => tf as TimedValueFlow)
                         .Where(tf => tf != null);


            detailedFlow.AddNeutral(flowSpec.NeutralFlow);
            foreach (var vf in vflows)
            {
                detailedFlow.Add((int)vf.Time, new ValueFlow(vf.Value, vf.Target));
            }
            int cstep = 0;

            foreach (var pf in pflows)
            {
                detailedFlow.Add(cstep, pf);
                cstep++;
            }

            _host.Descriptor.GetDocumentation().Documents.Add(
                new Document("SlimMuxInterconnectGraph.dotty",
                             _smih.GetInterconnectGraphForDotty()));
        }
Пример #3
0
        private void VerifyResult()
        {
            //TODO: Need new verification concept when block memories come into play
#if false
            var orgFlows = _flowSpec.GetTimedFlows().OrderBy(f => f.Target.ToString()).OrderBy(f => f.Time).ToArray();
            var resFlows = _detailedFlow.GetTimedFlows().OrderBy(f => f.Target.ToString()).OrderBy(f => f.Time).ToArray();

            /*
             * var ins = new List<ITimedFlow>();
             * var del = new List<ITimedFlow>();
             * int i = 0; int j = 0;
             * while (i < orgFlows.Length && j < resFlows.Length)
             * {
             *  if (!orgFlows[i].Equals(resFlows[j]))
             *  {
             *      if (i < orgFlows.Length - 1 && orgFlows[i + 1].Equals(resFlows[j]))
             *      {
             *          ins.Add(orgFlows[i]);
             ++i;
             *      }
             *      else if (j < resFlows.Length - 1 && orgFlows[i].Equals(resFlows[j + 1]))
             *      {
             *          del.Add(resFlows[j]);
             ++j;
             *      }
             *  }
             *  else
             *  {
             ++i;
             ++j;
             *  }
             * }
             * Debug.Assert(ins.Count == 0 && del.Count == 0);
             * */
            Debug.Assert(orgFlows.Length == resFlows.Length);
            for (int i = 0; i < orgFlows.Length; i++)
            {
                Debug.Assert(orgFlows[i].Equals(resFlows[i]));
            }
#endif
        }
        public void CreateInterconnect(FlowMatrix flowSpec, FlowMatrix detailedFlow)
        {
            flowSpec.Transitize();
            var tflows = flowSpec.GetTimedFlows();
            var sflows = tflows
                .Select(tf => tf as TimedSignalFlow)
                .Where(tf => tf != null);
            SlimMux<int, int, TimedSignalFlow>.ConstructInterconnect(_smih, sflows);
            var pipeen = _smih.ComputePipeEnMatrix(flowSpec.NumCSteps);
            var pipes = _smih.InstantiatePipes();
            int idx = 0;
            foreach (RegPipe rp in pipes)
            {
                string id = "icpipe" + idx;
                _host.Descriptor.AddChild(rp.Descriptor, id);
                ++idx;
            }
            var pflows = _smih.ToFlow(flowSpec.NumCSteps, flowSpec.NeutralFlow, pipeen);
            var vflows = tflows
                .Select(tf => tf as TimedValueFlow)
                .Where(tf => tf != null);


            detailedFlow.AddNeutral(flowSpec.NeutralFlow);
            foreach (var vf in vflows)
            {
                detailedFlow.Add((int)vf.Time, new ValueFlow(vf.Value, vf.Target));
            }
            int cstep = 0;
            foreach (var pf in pflows)
            {
                detailedFlow.Add(cstep, pf);
                cstep++;
            }

            _host.Descriptor.GetDocumentation().Documents.Add(
                new Document("SlimMuxInterconnectGraph.dotty",
                    _smih.GetInterconnectGraphForDotty()));
        }
Пример #5
0
 private void CreateStagedInterconnect(FlowMatrix flowSpec, FlowMatrix detailedFlow)
 {
     flowSpec.Transitize();
     detailedFlow.AddNeutral(flowSpec.NeutralFlow);
     var tflows = flowSpec.GetTimedFlows();
     var grouped = tflows.GroupBy(tf => tf.Target);
     foreach (var group in grouped)
     {
         var net = ConstructNetwork(group.Key, group);
         foreach (var tflow in net)
         {
             var tsf = tflow as TimedSignalFlow;
             var tvf = tflow as TimedValueFlow;
             if (tsf != null)
                 detailedFlow.Add((int)tflow.Time, new SignalFlow(tsf.Source, tsf.Target));
             else
                 detailedFlow.Add((int)tflow.Time, new ValueFlow(tvf.Value, tvf.Target));
         }
     }
     for (int i = 0; i < _stageInSignals.Count; i++)
     {
         detailedFlow.AddNeutral(new SignalFlow(
             _stageOutSignals[i].ToSignalRef(SignalRef.EReferencedProperty.Cur),
             _stageInSignals[i].ToSignalRef(SignalRef.EReferencedProperty.Next)));
     }
 }