############################ ### ALF writer interface ### ############################ sub ALF_WriteObject { local($object,$tab) = @_; ### prints all data related to $object in hierarchical format defined by $tab. Returns true local ($parent,$type,$name,$value,$children) = &ALF_ObjectInfo($object); local ($index1,$index2) = &ALF_BusInfo($object); local @start = ($type); $start[$#start+1] = $index1 if defined($index1); $start[$#start+1] = $name if defined($name); $start[$#start+1] = $index2 if defined($index2); print(FILEOUT &AutoTab($tab),"/* object(parent) = $object($parent) */\n") if defined($type) && ($ALF_Debug > 1); if (! defined($type)) { ### irrelevant object } elsif ($children) { ### compound object @start = (@start,'=',$value) if defined($value); print(FILEOUT &AutoTab($tab),join(' ',@start,'{'),"\n"); foreach $child (&Array($children)) { # &ALF_WriteObject($child,$tab+1) unless ($ALF_Hidden{$child} || ($ALF_Parent{$child} ne $object)); &ALF_WriteObject($child,$tab+1) unless ($ALF_Hidden{$child} || ($ALF_Parent{$child} ne $object) && $ALF_Unlink{$child}); } local @end = ('}'); @end = (@end,'//','end',$type,$name) if &StringMatch($type,'LIBRARY','SUBLIBRARY','CELL','WIRE'); print(FILEOUT &AutoTab($tab),join(' ',@end),"\n"); } elsif (defined($value) && &ArraySize($value)) { ### semi-compound object local @value = &Array($value); local $format = $ALF_ArrayFormat{$value}; if ($format) { ### data in multiple rows print(FILEOUT &AutoTab($tab),join(' ',@start,'{')); for $count (0..$#value) { print(FILEOUT ($count % $format)? "\t" : "\n".&AutoTab($tab+1)); print(FILEOUT $value[$count]); } print(FILEOUT "\n") if ($#value % $format); print(FILEOUT &AutoTab($tab),"}\n"); } else { ### data in one row print(FILEOUT &AutoTab($tab),join(' ',@start,'{',@value,'}'),"\n"); } } else { ### atomic object @start = (@start,'=',$value) if defined($value); print(FILEOUT &AutoTab($tab),join(' ',@start,';'),"\n"); } 1; } 1;