Math2mat
|
00001 package m2m.backend.buildingblocks; 00002 00003 import java.util.ArrayList; 00004 00005 00014 abstract public class BuildingBlock { 00015 00019 public BuildingBlock() { 00020 } 00021 00025 public enum NumType { 00026 00028 FLOAT, 00030 FLOAT32, 00032 FLOAT64, 00034 FIXED, 00036 INTUINT, 00038 INT, 00040 UINT, 00042 OTHER; 00043 00044 00049 public static NumType getNum(String text) { 00050 00051 for(NumType num : NumType.values()) 00052 if(text.equalsIgnoreCase(num.name())) 00053 return num; 00054 00055 return NumType.OTHER; 00056 } 00057 00063 public static String getVHDLType(NumType numType) { 00064 switch(numType) { 00065 case FLOAT32: return "std_logic_vector(31 downto 0)"; 00066 case FLOAT64: return "std_logic_vector(63 downto 0)"; 00067 default: return "std_logic_vector(31 downto 0)"; 00068 } 00069 } 00070 00076 public static int getDataSize(NumType numType) { 00077 switch(numType) { 00078 case FLOAT32: return 32; 00079 case FLOAT64: return 64; 00080 default: return 32; 00081 } 00082 } 00083 }; 00084 00088 public enum ImplType { 00089 00091 SEQUENTIAL, 00093 PIPELINE, 00095 COMBINATORIAL 00096 }; 00097 00105 public boolean useGenericSize() { 00106 return false; 00107 } 00108 00114 public abstract NumType numType(); 00115 00122 public abstract ImplType implType(); 00123 00128 public abstract int version(); 00129 00134 public abstract String author(); 00135 00144 public int latencyTime() { 00145 return 1; 00146 } 00147 00153 public abstract int resources(); 00154 00160 public abstract int period(); 00161 00171 public int cycleTime() { 00172 return 1; 00173 } 00174 00194 public abstract String functionName(); 00195 00200 public abstract String vhdlFileName(); 00201 00206 public abstract ArrayList<String> dependentFiles(); 00207 00212 public abstract String entityName(); 00213 00220 public int nbInputs(){ 00221 return 2; 00222 } 00223 00230 public int nbOutputs() { 00231 return 1; 00232 } 00233 00240 public String device() { 00241 return null; 00242 } 00243 00249 public abstract String description(); 00250 } 00251