#NEWLINE# def Instance( self , module , instname , params = None , ports = None ) : #NEWLINE# #INDENT# if isinstance ( ports , str ) : #NEWLINE# #INDENT# module = StubModule ( module ) #NEWLINE# #UNINDENT# if ( not isinstance ( module , ( Module , StubModule , str ) ) ) : #NEWLINE# #INDENT# raise TypeError ( ( '"module" of Instance must be Module, StubModule, or str, not %s' % type ( module ) ) ) #NEWLINE# #UNINDENT# if ( not isinstance ( self . find_identifier ( instname ) , vtypes . AnyType ) ) : #NEWLINE# #INDENT# raise ValueError ( ( "Object '%s' is already defined." % instname ) ) #NEWLINE# #UNINDENT# t = Instance ( module , instname , params , ports ) #NEWLINE# self . instance [ instname ] = t #NEWLINE# self . items . append ( t ) #NEWLINE# if ( self . find_module ( module . name ) is not None ) : #NEWLINE# #INDENT# if ( self . submodule [ module . name ] != module ) : #NEWLINE# #INDENT# raise ValueError ( ( "Module '%s' is already defined." % module . name ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . submodule [ module . name ] = module #NEWLINE# #UNINDENT# return t