Exemplo n.º 1
0
 public Signal(ModellingType type, VHDL.Object.Signal parsedVariable, List <AbstractSignalDump> dumps)
 {
     this.parsedVariable = parsedVariable;
     this.name           = parsedVariable.Identifier;
     this.type           = type;
     if ((type.Type is VHDL.type.RecordType) || (type.Type is VHDL.type.ArrayType))
     {
         dump = new SignalScopeDump(parsedVariable.Identifier, type, dumps);
     }
     InitChildrens();
     InitValue();
 }
 public NewSortedDictionaryScopeIterator(SignalScopeDump dump)
 {
     this.Dump = dump;
     this.Type = dump.Type;
     iterators = new List <IValueIterator>();
     foreach (AbstractSignalDump d in dump.Dumps)
     {
         IValueIterator i = d.Iterator;
         i.Reset();
         iterators.Add(i);
     }
 }
Exemplo n.º 3
0
        private static Signal CreateUnconstrainedArraySignal(string name, IndexSubtypeIndication si)
        {
            if (si.BaseType is UnconstrainedArray)
            {
                UnconstrainedArray arrayType = si.BaseType as UnconstrainedArray;

                List <ResolvedDiscreteRange> resolvedRanges = new List <ResolvedDiscreteRange>();
                foreach (DiscreteRange r in si.Ranges)
                {
                    if (r is Range)
                    {
                        int from = (ExpressionEvaluator.DefaultEvaluator.Evaluate((r as Range).From) as IntegerValue).Value;
                        int to   = (ExpressionEvaluator.DefaultEvaluator.Evaluate((r as Range).To) as IntegerValue).Value;
                        ResolvedDiscreteRange newRange = ResolvedDiscreteRange.FormIntegerIndexes(from, to);
                        resolvedRanges.Add(newRange);
                    }
                }

                ModellingType resType = ModellingType.CreateModellingType(arrayType, resolvedRanges.ToArray());
                resType.Constraints.Add(new IndexTypeConstraint(si));


                List <AbstractSignalDump> dumps     = new List <AbstractSignalDump>();
                List <Signal>             childrens = new List <Signal>();

                int[,] resIndexes = ResolvedDiscreteRange.CombineRanges(resolvedRanges.ToArray());
                for (int i = 0; i < resIndexes.GetLength(0); i++)
                {
                    for (int j = 0; j < resIndexes.GetLength(1); j++)
                    {
                        Signal newSignal = CreateSignal(resolvedRanges[j][resIndexes[i, j]].ToString(), arrayType.IndexSubtypes[j]);
                        childrens.Add(newSignal);
                        dumps.Add(newSignal.Dump);
                    }
                }

                SignalScopeDump resDump   = new SignalScopeDump(name, resType, dumps);
                Signal          resSignal = new Signal(resDump);
                return(resSignal);
            }
            return(null);
        }
Exemplo n.º 4
0
        public static Signal CreateSignal(string name, ISubtypeIndication si)
        {
            if (si is ResolvedSubtypeIndication)
            {
                Signal res = CreateSignal(name, (si as ResolvedSubtypeIndication).BaseType);
                return(res);
            }

            if (si is RangeSubtypeIndication)
            {
                Signal res = CreateSignal(name, (si as RangeSubtypeIndication).BaseType);
                return(res);
            }

            if (si is IndexSubtypeIndication)
            {
                Signal res = CreateUnconstrainedArraySignal(name, si as IndexSubtypeIndication);
                return(res);
            }

            if (si is Subtype)
            {
                return(CreateSignal(name, (si as Subtype).SubtypeIndication));
            }
            if (si is IntegerType)
            {
                ModellingType resType = ModellingType.CreateModellingType(si as IntegerType);
                IntegerAbstractValueConvertor  conv    = new IntegerAbstractValueConvertor(resType);
                AbstractSimpleSignalDump <int> resDump = new AbstractSimpleSignalDump <int>(name, resType, conv);
                Signal resSignal = new Signal(resDump);
                return(resSignal);
            }
            if (si is RealType)
            {
                ModellingType resType = ModellingType.CreateModellingType(si as RealType);
                RealAbstractValueConvertor        conv    = new RealAbstractValueConvertor(resType);
                AbstractSimpleSignalDump <double> resDump = new AbstractSimpleSignalDump <double>(name, resType, conv);
                Signal resSignal = new Signal(resDump);
                return(resSignal);
            }
            if (si is PhysicalType)
            {
                ModellingType resType = ModellingType.CreateModellingType(si as PhysicalType);
                PhysicalAbstractValueConvertor             conv    = new PhysicalAbstractValueConvertor(resType);
                AbstractSimpleSignalDump <PhysicalLiteral> resDump = new AbstractSimpleSignalDump <PhysicalLiteral>(name, resType, conv);
                Signal resSignal = new Signal(resDump);
                return(resSignal);
            }
            if (si is RecordType)
            {
                RecordType    recType = si as RecordType;
                ModellingType resType = ModellingType.CreateModellingType(recType);

                List <AbstractSignalDump> dumps     = new List <AbstractSignalDump>();
                List <Signal>             childrens = new List <Signal>();

                foreach (var el in recType.Elements)
                {
                    foreach (string s in el.Identifiers)
                    {
                        Signal newSignal = CreateSignal(s, el.Type);
                        childrens.Add(newSignal);
                        dumps.Add(newSignal.Dump);
                    }
                }

                SignalScopeDump resDump   = new SignalScopeDump(name, resType, dumps);
                Signal          resSignal = new Signal(resDump);
                return(resSignal);
            }
            if (si is EnumerationType)
            {
                ModellingType resType = ModellingType.CreateModellingType(si as EnumerationType);
                EnumerationAbstractValueConvertor conv;

                if (si == StdLogic1164.STD_ULOGIC)
                {
                    conv = new STD_ULOGIC_AbstractValueConvertor(resType);
                }
                else
                {
                    if (si == StdLogic1164.STD_LOGIC)
                    {
                        conv = new STD_LOGIC_AbstractValueConvertor(resType);
                    }
                    else
                    {
                        conv = new EnumerationAbstractValueConvertor(resType);
                    }
                }

                AbstractSimpleSignalDump <EnumerationLiteral> resDump = new AbstractSimpleSignalDump <EnumerationLiteral>(name, resType, conv);
                Signal resSignal = new Signal(resDump);
                return(resSignal);
            }

            if (si is ConstrainedArray)
            {
                ConstrainedArray arrayType = si as ConstrainedArray;
                ModellingType    resType   = ModellingType.CreateModellingType(arrayType);

                List <AbstractSignalDump> dumps     = new List <AbstractSignalDump>();
                List <Signal>             childrens = new List <Signal>();

                ResolvedDiscreteRange[] ranges = resType.Dimension;
                int[,] resIndexes = ResolvedDiscreteRange.CombineRanges(ranges);
                for (int i = 0; i < resIndexes.GetLength(0); i++)
                {
                    for (int j = 0; j < resIndexes.GetLength(1); j++)
                    {
                        Signal newSignal = CreateSignal(ranges[j][resIndexes[i, j]].ToString(), arrayType.ElementType);
                        childrens.Add(newSignal);
                        dumps.Add(newSignal.Dump);
                    }
                }

                SignalScopeDump resDump   = new SignalScopeDump(name, resType, dumps);
                Signal          resSignal = new Signal(resDump);
                return(resSignal);
            }

            return(null);
        }
Exemplo n.º 5
0
 public STD_LOGIC_VECTOR_View(SignalScopeDump data, ScaleManager scaleManager)
     : base(data, scaleManager)
 {
 }
Exemplo n.º 6
0
 public BusViewBase(SignalScopeDump data, ScaleManager scaleManager)
     : base(data, scaleManager)
 {
 }
 public CompositeDataTypeView(SignalScopeDump data, ScaleManager scaleManager)
     : base(data, scaleManager)
 {
 }