Script to Get Macro List

set all_memory [ all_macro_cells ]
 
array set mem_count {}
array set mem_area {}
foreach_in_collection m $all_memory {
  set ref_name [ get_attr $m ref_name ]
  set mem_count($ref_name) 0
  set mem_area($ref_name) [ get_attr $m area ]
}
 
foreach_in_collection m $all_memory {
  set ref_name [ get_attr $m ref_name ]
  set mem_count($ref_name) [expr $mem_count($ref_name) + 1]
}
 
 
foreach {ref_name count} [array get mem_count] {
  set area $mem_area($ref_name)
  echo $ref_name, $count, $area, [expr $count * $area / 1000000]
}