コード例 #1
0
            protected override void DeclareAlgorithm()
            {
                SignalRef        curStateRef = SignalRef.Create(_cpb._stateSignal, SignalRef.EReferencedProperty.Cur);
                LiteralReference lrCurState  = new LiteralReference(curStateRef);
                Array            stateValues = _cpb._stateSignal.Descriptor.ElementType.CILType.GetEnumValues();

                // Insert neutral pre-sets
                _flowSpec.NeutralFlow.ToProcess().Implement(this);

                // State-dependent MUX
                Switch(lrCurState);
                {
                    for (int cstep = 0; cstep < stateValues.Length; cstep++)
                    {
                        Case(LiteralReference.CreateConstant(stateValues.GetValue(cstep)));
                        {
                            Comment(_flowSpec.GetComment(cstep));
                            _flowSpec.GetFlow(cstep).ToProcess().Implement(this);
                        }
                        EndCase();
                    }
                    DefaultCase();
                    {
                        _flowSpec.NeutralFlow.ToProcess().Implement(this);
                    }
                    EndCase();
                }
                EndSwitch();
            }
コード例 #2
0
            protected override void DeclareAlgorithm()
            {
                SignalRef        curStateRef = SignalRef.Create(_cpb._stateSignal, SignalRef.EReferencedProperty.Cur);
                LiteralReference lrCurState  = new LiteralReference(curStateRef);
                Array            stateValues = _cpb._stateSignal.Descriptor.ElementType.CILType.GetEnumValues();

                // Insert neutral pre-sets
                var npflow = new ParFlow();

                foreach (var flow in _flowSpec.NeutralFlow.Flows)
                {
                    if (_nonTristateTargets.Contains(flow.Target))
                    {
                        npflow.Add(flow);
                    }
                }
                npflow.ToProcess().Implement(this);

                // State-dependent MUX
                Switch(lrCurState);
                {
                    for (int cstep = 0; cstep < stateValues.Length; cstep++)
                    {
                        Case(LiteralReference.CreateConstant(stateValues.GetValue(cstep)));
                        {
                            Comment(_flowSpec.GetComment(cstep));
                            var pflow = new ParFlow();
                            foreach (var flow in _flowSpec.GetFlow(cstep).Flows)
                            {
                                if (_nonTristateTargets.Contains(flow.Target))
                                {
                                    pflow.Add(flow);
                                }
                            }
                            pflow.ToProcess().Implement(this);
                        }
                        EndCase();
                    }
                    DefaultCase();
                    {
                        npflow.ToProcess().Implement(this);
                    }
                    EndCase();
                }
                EndSwitch();
            }