Commit 5b6011d3 authored by Mingjun Li's avatar Mingjun Li
Browse files

small bug fixed

refs 662
parent 2ef7a30b
...@@ -25,21 +25,25 @@ import org.fortiss.af3.generator.common.model.source.DefinitionBase; ...@@ -25,21 +25,25 @@ import org.fortiss.af3.generator.common.model.source.DefinitionBase;
/** /**
* Generates the VHDL package declaration and definition statement. Packages are * Generates the VHDL package declaration and definition statement. Packages are
* made up of two parts, the Declarative part and the body part. In the * made up of two parts, the Declarative part and the body part. In the
* declarative part are functions and component declarations(NOTICE: A package * declarative part are VHDL enumeration types, functions and component declarations(NOTICE: A
* can contain other things like: type, subtype, constants and procedure, but * package
* can contain other things like: sub-types, constants and procedure, but
* they are not implemented yet). The body of package is the place where * they are not implemented yet). The body of package is the place where
* function implementations are located. * function implementations are located.
* *
* @author li * @author li
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating GREEN Hash: CA5C1D93F33E90C66B39EEE508F00CA6 * @ConQAT.Rating YELLOW Hash: 39F4C416A5B5FDAABE4373035E1D83F3
*/ */
public class VHDLPackage { public class VHDLPackage {
/** Package name. */ /** Package name. */
private final String name; private final String name;
/** List of user defined VHDL enumeration types. */
private final List<VHDLEnumType> enumTypes;
/** List of functions. */ /** List of functions. */
private final List<VHDLFunction> functions; private final List<VHDLFunction> functions;
...@@ -47,8 +51,10 @@ public class VHDLPackage { ...@@ -47,8 +51,10 @@ public class VHDLPackage {
private final List<VHDLComponent> comps; private final List<VHDLComponent> comps;
/** Constructor. */ /** Constructor. */
public VHDLPackage(String name, List<VHDLFunction> functions, List<VHDLComponent> comps) { public VHDLPackage(String name, List<VHDLEnumType> enumTypes, List<VHDLFunction> functions,
List<VHDLComponent> comps) {
this.name = name; this.name = name;
this.enumTypes = enumTypes;
this.comps = comps; this.comps = comps;
this.functions = functions; this.functions = functions;
} }
...@@ -60,7 +66,13 @@ public class VHDLPackage { ...@@ -60,7 +66,13 @@ public class VHDLPackage {
public String toString() { public String toString() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("\npackage " + name + " is\n"); buffer.append("\npackage " + name + " is\n");
buffer.append("\t-- Components declarations.\n"); buffer.append("\t-- User defined enumeration types declarations.\n");
if(enumTypes != null) {
for(VHDLEnumType enumType : enumTypes) {
buffer.append("\t" + enumType.getDefinition().toString() + "\n");
}
}
buffer.append("\n\t-- Components declarations.\n");
if(comps != null) { if(comps != null) {
for(VHDLComponent comp : comps) { for(VHDLComponent comp : comps) {
buffer.append(comp.getDeclaration().toString()); buffer.append(comp.getDeclaration().toString());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment