#NEWLINE# def main( ) : #NEWLINE# #INDENT# INFO = 'Active condition analyzer (Obsoluted)' #NEWLINE# VERSION = pyverilog . utils . version . VERSION #NEWLINE# USAGE = 'Usage: python example_active_range.py -t TOPMODULE file ...' #NEWLINE# def showVersion( ) : #NEWLINE# #INDENT# print ( INFO ) #NEWLINE# print ( VERSION ) #NEWLINE# print ( USAGE ) #NEWLINE# sys . exit ( ) #NEWLINE# #UNINDENT# optparser = OptionParser ( ) #NEWLINE# optparser . add_option ( '-v' , '--version' , action = 'store_true' , dest = 'showversion' , default = False , help = 'Show the version' ) #NEWLINE# optparser . add_option ( '-t' , '--top' , dest = 'topmodule' , default = 'TOP' , help = 'Top module, Default=TOP' ) #NEWLINE# optparser . add_option ( '-s' , '--search' , dest = 'searchtarget' , action = 'append' , default = [ ] , help = 'Search Target Signal' ) #NEWLINE# ( options , args ) = optparser . parse_args ( ) #NEWLINE# filelist = args #NEWLINE# if options . showversion : #NEWLINE# #INDENT# showVersion ( ) #NEWLINE# #UNINDENT# for f in filelist : #NEWLINE# #INDENT# if ( not os . path . exists ( f ) ) : #NEWLINE# #INDENT# raise IOError ( ( 'file not found: ' + f ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( filelist ) == 0 ) : #NEWLINE# #INDENT# showVersion ( ) #NEWLINE# #UNINDENT# analyzer = VerilogDataflowAnalyzer ( filelist , options . topmodule ) #NEWLINE# analyzer . generate ( ) #NEWLINE# directives = analyzer . get_directives ( ) #NEWLINE# terms = analyzer . getTerms ( ) #NEWLINE# binddict = analyzer . getBinddict ( ) #NEWLINE# optimizer = VerilogDataflowOptimizer ( terms , binddict ) #NEWLINE# optimizer . resolveConstant ( ) #NEWLINE# resolved_terms = optimizer . getResolvedTerms ( ) #NEWLINE# resolved_binddict = optimizer . getResolvedBinddict ( ) #NEWLINE# constlist = optimizer . getConstlist ( ) #NEWLINE# aanalyzer = VerilogActiveAnalyzer ( options . topmodule , terms , binddict , resolved_terms , resolved_binddict , constlist ) #NEWLINE# for target in options . searchtarget : #NEWLINE# #INDENT# signal = util . toTermname ( target ) #NEWLINE# print ( ( 'Active Conditions: %s' % signal ) ) #NEWLINE# active_conditions = aanalyzer . getActiveConditions ( signal ) #NEWLINE# print ( sorted ( active_conditions , key = ( lambda x : str ( x ) ) ) ) #NEWLINE# print ( 'Changed Conditions' ) #NEWLINE# changed_conditions = aanalyzer . getChangedConditions ( signal ) #NEWLINE# print ( sorted ( changed_conditions , key = ( lambda x : str ( x ) ) ) ) #NEWLINE# print ( 'Changed Condition Dict' ) #NEWLINE# changed_conditiondict = aanalyzer . getChangedConditionsWithAssignments ( signal ) #NEWLINE# print ( sorted ( changed_conditiondict . items ( ) , key = ( lambda x : str ( x [ 0 ] ) ) ) ) #NEWLINE# print ( 'Unchanged Conditions' ) #NEWLINE# unchanged_conditions = aanalyzer . getUnchangedConditions ( signal ) #NEWLINE# print ( sorted ( unchanged_conditions , key = ( lambda x : str ( x ) ) ) )