A hierarchical layout to circuit extractor using a finite state approach