<s> from __future__ import absolute_import <EOL> from __future__ import print_function <EOL> import os <EOL> import sys <EOL> from pyverilog . dataflow . dataflow_analyzer import VerilogDataflowAnalyzer <EOL> from pyverilog . dataflow . optimizer import VerilogDataflowOptimizer <EOL> from pyverilog . controlflow . controlflow_analyzer import VerilogControlflowAnalyzer <EOL> codedir = os . path . dirname ( os . path . dirname ( os . path . dirname ( os . path . abspath ( __file__ ) ) ) ) + '<STR_LIT>' <EOL> expected = """<STR_LIT>""" <EOL> def test ( ) : <EOL> filelist = [ codedir + '<STR_LIT>' ] <EOL> topmodule = '<STR_LIT>' <EOL> noreorder = False <EOL> nobind = False <EOL> include = None <EOL> define = None <EOL> analyzer = VerilogDataflowAnalyzer ( filelist , topmodule , <EOL> noreorder = noreorder , <EOL> nobind = nobind , <EOL> preprocess_include = include , <EOL> preprocess_define = define ) <EOL> analyzer . generate ( ) <EOL> directives = analyzer . get_directives ( ) <EOL> instances = analyzer . getInstances ( ) <EOL> terms = analyzer . getTerms ( ) <EOL> binddict = analyzer . getBinddict ( ) <EOL> optimizer = VerilogDataflowOptimizer ( terms , binddict ) <EOL> optimizer . resolveConstant ( ) <EOL> c_analyzer = VerilogControlflowAnalyzer ( topmodule , terms , <EOL> binddict , <EOL> resolved_terms = optimizer . getResolvedTerms ( ) , <EOL> resolved_binddict = optimizer . getResolvedBinddict ( ) , <EOL> constlist = optimizer . getConstlist ( ) <EOL> ) <EOL> output = [ ] <EOL> for tk in sorted ( c_analyzer . resolved_terms . keys ( ) , key = lambda x : str ( x ) ) : <EOL> tree = c_analyzer . makeTree ( tk ) <EOL> output . append ( str ( tk ) + '<STR_LIT>' + tree . tocode ( ) ) <EOL> rslt = '<STR_LIT:\n>' . join ( output ) + '<STR_LIT:\n>' <EOL> print ( rslt ) <EOL> assert ( expected == rslt ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> test ( ) </s>
