Exemplo n.º 1
0
        /// <summary>
        ///   Instantiates a new <see cref="ModuleInfo"/> object.
        /// </summary>
        /// <param name="type"><see cref="ArchitecturalType"/> of the module.</param>
        /// <param name="entity"><see cref="EntityInfo"/> object representing the associated entity for this module.</param>
        /// <exception cref="ArgumentNullException"><paramref name="entity"/> is a null reference.</exception>
        public ModuleInfo(ArchitecturalType type, EntityInfo entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            Type   = type;
            Entity = entity;

            DeclaredTypes        = new NamedTypeList <DeclarationInfo>();
            Functions            = new NamedTypeList <FunctionInfo>();
            Procedures           = new NamedTypeList <ProcedureInfo>();
            Signals              = new NamedTypeList <SignalInfo>();
            Aliases              = new NamedTypeList <AliasInfo>();
            Attributes           = new List <AttributeSpecificationInfo>();
            Processes            = new NamedTypeList <ProcessInfo>();
            Generates            = new NamedTypeList <GenerateInfo>();
            SubModules           = new NamedTypeList <SubModule>();
            ConcurrentStatements = new List <string>();

            // Add the default usings.
            AddUsing("IEEE.STD_LOGIC_1164.all");
            AddUsing("IEEE.NUMERIC_STD.all");
        }
Exemplo n.º 2
0
        /// <summary>
        ///   Instantiates a new <see cref="DeclarationInfo"/> object.
        /// </summary>
        /// <param name="declaration"><see cref="DeclarationType"/> of the declaration.</param>
        /// <param name="name">Name of the declaration.</param>
        /// <param name="type">Type of the declaration.</param>
        /// <param name="summary">Summary description of the declaration.</param>
        /// <param name="defaultValue">Default value of the declaration. Can be null or empty.</param>
        /// <param name="remarks">Additional remarks to add to the documentation.</param>
        /// <exception cref="ArgumentNullException"><paramref name="type"/>, <paramref name="name"/>, or <paramref name="summary"/> is a null reference.</exception>
        /// <exception cref="ArgumentException"><paramref name="type"/>, <paramref name="name"/>, or <paramref name="summary"/> is an empty string.</exception>
        /// <exception cref="InvalidOperationException"><paramref name="defaultValue"/> is specified when the <paramref name="declaration"/> is not a <see cref="DeclarationType.Constant"/>.</exception>
        public DeclarationInfo(DeclarationType declaration, string name, string type, string summary, string defaultValue = null, string remarks = null)
            : base(name, summary, remarks)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (type.Length == 0)
            {
                throw new ArgumentException("type is an empty string");
            }

            if (defaultValue != null && defaultValue.Length > 0 && declaration != DeclarationType.Constant)
            {
                throw new InvalidOperationException(string.Format
                                                    (
                                                        "An attempt was made to instantiate a DeclarationInfo object with a default value ({0}), for a non-constant ({1}). Only constants can have default values.",
                                                        defaultValue,
                                                        Enum.GetName(typeof(DeclarationType), declaration)
                                                    ));
            }

            Declaration  = declaration;
            Type         = type;
            DefaultValue = defaultValue;
            Dependency   = new NamedTypeList <DeclarationInfo>();
        }
Exemplo n.º 3
0
 /// <summary>
 ///   Instantiates a new <see cref="ProcessInfo"/> object.
 /// </summary>
 /// <param name="name">Name of the process.</param>
 /// <param name="summary">Summary description of the process.</param>
 /// <param name="remarks">Additional remarks to add to the documentation.</param>
 /// <exception cref="ArgumentNullException"><paramref name="name"/>, or <paramref name="summary"/> is a null reference.</exception>
 /// <exception cref="ArgumentException"><paramref name="name"/>, or <paramref name="summary"/> is an empty string.</exception>
 public ProcessInfo(string name, string summary, string remarks = null)
     : base(name, summary, remarks)
 {
     SensitivityList = new List <string>();
     Variables       = new NamedTypeList <VariableInfo>();
     CodeLines       = new List <string>();
 }
Exemplo n.º 4
0
 /// <summary>
 ///   Instantiates a new <see cref="ProcedureInfo"/> object.
 /// </summary>
 /// <param name="name">Name of the procedure.</param>
 /// <param name="summary">Summary description of the procedure.</param>
 /// <param name="remarks">Additional remarks to add to the documentation.</param>
 /// <exception cref="ArgumentNullException"><paramref name="name"/>, or <paramref name="summary"/> is a null reference.</exception>
 /// <exception cref="ArgumentException"><paramref name="name"/>, or <paramref name="summary"/> is an empty string.</exception>
 public ProcedureInfo(string name, string summary, string remarks = null)
     : base(name, summary, remarks)
 {
     Parameters = new NamedTypeList <ProcedureParameterInfo>();
     Variables  = new NamedTypeList <VariableInfo>();
     CodeLines  = new List <string>();
 }
Exemplo n.º 5
0
 /// <summary>
 ///   Instantiates a new <see cref="ComponentInfo"/> object.
 /// </summary>
 /// <param name="name">Name of the component.</param>
 /// <param name="summary">Summary description of the component.</param>
 /// <param name="remarks">Additional remarks to add to the documentation.</param>
 /// <param name="skipDeclaration">
 ///   True if the component should not be declared in the module, false if it should. True would be specified for components that
 ///   represent internal macros, primitives, or sub-modules that will be declared directly.
 /// </param>
 /// <exception cref="ArgumentNullException"><paramref name="name"/>, or <paramref name="summary"/> is a null reference.</exception>
 /// <exception cref="ArgumentException"><paramref name="name"/>, or <paramref name="summary"/> is an empty string.</exception>
 public ComponentInfo(string name, string summary, string remarks = null, bool skipDeclaration = false)
     : base(name, summary, remarks)
 {
     Generics        = new NamedTypeList <SimplifiedGenericInfo>();
     Ports           = new NamedTypeList <SimplifiedPortInfo>();
     SkipDeclaration = skipDeclaration;
 }
Exemplo n.º 6
0
        /// <summary>
        ///   Instantiates a <see cref="FunctionInfo"/> object.
        /// </summary>
        /// <param name="name">Name of the function.</param>
        /// <param name="returnType">Type of the return value.</param>
        /// <param name="summary">Summary description of the function.</param>
        /// <param name="returnTypeSummary">Summary description of the return type.</param>
        /// <param name="remarks">Additional remarks to add to the documentation.</param>
        /// <exception cref="ArgumentNullException"><paramref name="returnTypeSummary"/>, <paramref name="returnType"/>, <paramref name="name"/>, or <paramref name="summary"/> is a null reference.</exception>
        /// <exception cref="ArgumentException"><paramref name="returnTypeSummary"/>, <paramref name="returnType"/>, <paramref name="name"/>, or <paramref name="summary"/> is an empty string.</exception>
        public FunctionInfo(string name, string returnType, string summary, string returnTypeSummary, string remarks = null)
            : base(name, summary, remarks)
        {
            if (returnType == null)
            {
                throw new ArgumentNullException("returnType");
            }
            if (returnType.Length == 0)
            {
                throw new ArgumentException("returnType is an empty string");
            }
            if (returnTypeSummary == null)
            {
                throw new ArgumentNullException("returnTypeSummary");
            }
            if (returnTypeSummary.Length == 0)
            {
                throw new ArgumentException("returnTypeSummary is an empty string");
            }

            ReturnType        = returnType;
            ReturnTypeSummary = returnTypeSummary;
            Parameters        = new NamedTypeList <ParameterInfo>();
            Variables         = new NamedTypeList <VariableInfo>();
            CodeLines         = new List <string>();
        }
Exemplo n.º 7
0
        private static SubModule[] GetSubModules(GenerateInfo info)
        {
            NamedTypeList <SubModule> subModules = new NamedTypeList <SubModule>(info.SubModules);

            foreach (GenerateInfo subGen in info.Generates)
            {
                subModules.AddRange(GetSubModules(subGen));
            }
            return(subModules.ToArray());
        }
Exemplo n.º 8
0
        public static SubModule[] GetAllSubModules(ModuleInfo module)
        {
            NamedTypeList <SubModule> subModules = new NamedTypeList <SubModule>(module.SubModules);

            foreach (GenerateInfo subGen in module.Generates)
            {
                subModules.AddRange(GetSubModules(subGen));
            }
            return(subModules.ToArray());
        }
Exemplo n.º 9
0
        /// <summary>
        ///   Instantiates a new <see cref="ComponentInfo"/> object using a <see cref="EntityInfo"/> object.
        /// </summary>
        /// <param name="info"><see cref="EntityInfo"/> object to pull the component information from.</param>
        /// <param name="skipDeclaration">
        ///   True if the component should not be declared in the module, false if it should. True would be specified for components that
        ///   represent internal macros, primitives, or sub-modules that will be declared directly.
        /// </param>
        /// <remarks>This constructor generates a component from an entity so that an entity can be used in another module.</remarks>
        public ComponentInfo(EntityInfo info, bool skipDeclaration = false)
            : base(info.Name, info.Summary, info.Remarks)
        {
            Generics = new NamedTypeList <SimplifiedGenericInfo>(info.Generics.Count);
            foreach (GenericInfo gen in info.Generics)
            {
                Generics.Add(new SimplifiedGenericInfo(gen.Name, gen.Type, gen.DefaultValue));
            }

            Ports = new NamedTypeList <SimplifiedPortInfo>(info.Ports.Count);
            foreach (PortInfo port in info.Ports)
            {
                Ports.Add(new SimplifiedPortInfo(port.Name, port.Direction, port.Type, port.DefaultValue));
            }
            SkipDeclaration = skipDeclaration;
        }
Exemplo n.º 10
0
        /// <summary>
        ///   Instantiates a <see cref="GenerateInfo"/> object.
        /// </summary>
        /// <param name="name">Name of the generate block.</param>
        /// <param name="summary">Summary description of the generate block.</param>
        /// <param name="generateStatement">Initial statement of the generate block (minus the generate key word).</param>
        /// <param name="remarks">Additional remarks to add to the documentation.</param>
        /// <exception cref="ArgumentNullException"><paramref name="name"/>, <paramref name="generateStatement"/>, or <paramref name="summary"/> is a null reference.</exception>
        /// <exception cref="ArgumentException"><paramref name="name"/>, <paramref name="generateStatement"/>, or <paramref name="summary"/> is an empty string.</exception>
        public GenerateInfo(string name, string summary, string generateStatement, string remarks = null)
            : base(name, summary, remarks)
        {
            if (generateStatement == null)
            {
                throw new ArgumentNullException("generateStatement");
            }
            if (generateStatement.Length == 0)
            {
                throw new ArgumentException("generateStatement is an empty string");
            }

            GenerateStatement    = generateStatement;
            ConcurrentStatements = new List <string>();
            Processes            = new NamedTypeList <ProcessInfo>();
            SubModules           = new NamedTypeList <SubModule>();
            Generates            = new NamedTypeList <GenerateInfo>();
        }
Exemplo n.º 11
0
        /// <summary>
        ///   Initializes a new instance of <see cref="NamedTypeDictionary{TKey, TValue}"/>.
        /// </summary>
        /// <param name="list"><see cref="NamedTypeList{T}"/> containing the keys for the lookup table.</param>
        /// <remarks>Default values for the value type will populate the lookup table initially.</remarks>
        public NamedTypeLookup(NamedTypeList <TKey> list)
        {
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }

            if (default(TValue) != null)
            {
                throw new InvalidOperationException("An attempt was made to create the lookup table with a non-nullable type as the value.");
            }

            mLookup = new Dictionary <string, TKey>(list.Count);
            mValues = new Dictionary <TKey, TValue>(list.Count);

            foreach (TKey item in list)
            {
                mValues.Add(item, default(TValue));
                mLookup.Add(item.Name, item);
            }
        }
Exemplo n.º 12
0
 /// <summary>
 ///   Instantiates a new <see cref="EntityInfo"/> object.
 /// </summary>
 /// <param name="name">Name of the entity.</param>
 /// <param name="summary">Summary description of the entity.</param>
 /// <param name="remarks">Additional remarks to add to the documentation.</param>
 /// <exception cref="ArgumentNullException"><paramref name="name"/>, or <paramref name="summary"/> is a null reference.</exception>
 /// <exception cref="ArgumentException"><paramref name="name"/>, or <paramref name="summary"/> is an empty string.</exception>
 public EntityInfo(string name, string summary, string remarks = null)
     : base(name, summary, remarks)
 {
     Generics = new NamedTypeList <GenericInfo>();
     Ports    = new NamedTypeList <PortInfo>();
 }