主要思想是抓取memory的lib文件然后獲取詳細(xì)信息進(jìn)行計(jì)算
=======================================================
set MemAll [get_property [get_cells -hierarchical -filter {is_memory_cell == true} ] ref_lib_cell_name]
set MemType [lsort -u $MemAll]
#puts $MemType
set byte 8
set AllMemcapB 0
set AllMemcapK 0
set AllMemcapM 0
set address_width_format "? ? ? address_width : "
set word_width_format "? ? ? word_width : "
puts "=====================Memory Library Infomation Summary=========================="
puts "MemoryCellName? MemoryCellNumber? LibFilePath:"
foreach MemType_n $MemType {
set Memnum [llength [dbGet top.insts.cell.name $MemType_n]]
set libPath [lindex [get_property [get_lib -of_objects [get_lib_cell $MemType_n]] source_file_name] 0]
puts "$MemType_n? $Memnum? $libPath"
set lib_info [open $libPath r]
while {[gets $lib_info line] >=0} {
if {[string match $address_width_format* $line]} {
set AddressWidth [string trimright [string trimleft $line $address_width_format] ";"]
#puts $AddressWidth
}
if {[string match $word_width_format* $line]} {
set WordWidth [string trimright [string trimleft $line $word_width_format] ";"]
#puts $WordWidth
}
}
close $lib_info
set MemcapB [expr ((pow(2,$AddressWidth))*$WordWidth*$Memnum)/$byte]
set MemcapK [expr $MemcapB/1024]
set MemcapM [expr $MemcapK/1024]
set AllMemcapB [expr $MemcapB + $AllMemcapB]
set AllMemcapK [expr $MemcapK + $AllMemcapK]
set AllMemcapM [expr $MemcapM + $AllMemcapM]
#puts "$AllMemcapB $AllMemcapK $AllMemcapM"
}
puts "===============================Summary End======================================"
puts "All of Memories capacitances are $AllMemcapB Byte ;$AllMemcapK KB ;$AllMemcapM MB .\n"