if(addComments){
int sliceCount = 0;
int bramCount = 0;
int dspCount = 0;
for(Instance instance : instances.values()){
PrimitiveType type = instance.getType();
if(sliceTypes.contains(type)){
sliceCount++;
}
else if(dspTypes.contains(type)){
dspCount++;
}
else if(bramTypes.contains(type)){
bramCount++;
}
}
bw.write("# ======================================================="+nl);
bw.write("# SUMMARY"+nl);
bw.write("# Number of Module Defs: " + modules.size() + nl);
bw.write("# Number of Module Insts: " + moduleInstances.size() + nl);
bw.write("# Number of Primitive Insts: "+ instances.size() +nl);
bw.write("# Number of SLICES: "+ sliceCount +nl);
bw.write("# Number of DSP48s: "+ dspCount +nl);
bw.write("# Number of BRAMs: "+ bramCount +nl);
bw.write("# Number of Nets: " + nets.size() + nl);
bw.write("# ======================================================="+nl+nl+nl);
}
}
else{
if(addComments){
Module mod = getHardMacro();
bw.write("# ======================================================="+nl);
bw.write("# MACRO SUMMARY"+nl);
bw.write("# Number of Module Insts: " + mod.getInstances().size() + nl);
HashMap<PrimitiveType,Integer> instTypeCount = new HashMap<PrimitiveType,Integer>();
for(Instance inst : mod.getInstances()){
Integer count = instTypeCount.get(inst.getType());
if(count == null){
instTypeCount.put(inst.getType(),1);
}
else{
count++;
instTypeCount.put(inst.getType(),count);
}
}
for(PrimitiveType type : instTypeCount.keySet()){
bw.write("# Number of " + type.toString() + "s: " + instTypeCount.get(type) + nl);
}
bw.write("# Number of Module Ports: " + mod.getPorts().size() + nl);
bw.write("# Number of Module Nets: "+ mod.getNets().size() +nl);
bw.write("# ======================================================="+nl+nl+nl);
}