private void BuildFlowMap()
            {
                _elseFlows         = new Dictionary <SignalRef, Flow>();
                _enablingStatesMap = new Dictionary <Flow, List <object> >();

                foreach (Flow flow in _flowSpec.NeutralFlow.Flows)
                {
                    if (FlowMatrix.IsDontCareFlow(flow))
                    {
                        var zflow = FlowMatrix.AsDontCareFlow((ValueFlow)flow, StdLogic.Z);
                        _elseFlows[flow.Target] = zflow;
                    }
                    else
                    {
                        NonTristateTargets.Add(flow.Target);
                    }
                }

                Array stateValues = _cpb._stateSignal.Descriptor.ElementType.CILType.GetEnumValues();

                for (int cstep = 0; cstep < stateValues.Length; cstep++)
                {
                    var state = stateValues.GetValue(cstep);
                    var pflow = _flowSpec.GetFlow(cstep);
                    foreach (var flow in pflow.Flows)
                    {
                        if (!_enablingStatesMap.ContainsKey(flow))
                        {
                            _enablingStatesMap[flow] = new List <object>();
                        }
                        _enablingStatesMap[flow].Add(state);
                    }
                }
            }
Beispiel #2
0
        public EncodedFlow(List <Flow> flows, int order)
        {
            Contract.Requires(flows != null && flows.Any());
            Contract.Requires(flows.All(f => f.Target.Equals(flows.First().Target)));

            Targets        = new SignalRef[] { flows.First().Target };
            EncodedSymbols = new int[flows.Count];
            Order          = order;
            _bwdEnc        = new List <ParFlow>();
            int i = 0;

            foreach (var flow in flows)
            {
                int sym = 0;
                if (!FlowMatrix.IsDontCareFlow(flow))
                {
                    var  vflow = flow as ValueFlow;
                    Flow cflow;
                    if (vflow != null)
                    {
                        cflow = FlowMatrix.AsDontCareFlow(vflow);
                    }
                    else
                    {
                        cflow = flow;
                    }
                    var cpflow = new ParFlow(new Flow[] { cflow });
                    if (!_fwdEnc.TryGetValue(cpflow, out sym))
                    {
                        sym             = ++NumSymbols;
                        _fwdEnc[cpflow] = sym;
                        _bwdEnc.Add(new ParFlow(new Flow[] { cflow }));
                    }
                }
                EncodedSymbols[i] = sym;
                i++;
            }
            if (_bwdEnc.Count == 0)
            {
                var dummy = new ParFlow();
                _bwdEnc.Add(dummy);
                _fwdEnc[dummy] = 1;
                NumSymbols     = 1;
            }
        }