#NEWLINE# def __getitem__( s , key ) : #NEWLINE# #INDENT# if isinstance ( key , slice ) : #NEWLINE# #INDENT# addr = int ( key . start ) #NEWLINE# nbytes = ( int ( key . stop ) - int ( key . start ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# addr = int ( key ) #NEWLINE# nbytes = 1 #NEWLINE# #UNINDENT# len_ = ( nbytes if ( nbytes < ( s . memreq . msg . data . nbits / 8 ) ) else 0 ) #NEWLINE# s . trace = 'r' #NEWLINE# memreq_msg = s . MemReqMsgType ( ) #NEWLINE# memreq_msg . type_ = s . MemReqMsgType . TYPE_READ #NEWLINE# memreq_msg . addr = addr #NEWLINE# memreq_msg . opaque = 0 #NEWLINE# memreq_msg . len = len_ #NEWLINE# memreq_msg . data = 0 #NEWLINE# s . memreq . msg . next = memreq_msg #NEWLINE# s . memreq . val . next = 1 #NEWLINE# s . memresp . rdy . next = 1 #NEWLINE# greenlet . getcurrent ( ) . parent . switch ( 0 ) #NEWLINE# s . memreq . val . next = 1 #NEWLINE# s . memresp . rdy . next = 1 #NEWLINE# while ( not s . memreq . rdy ) : #NEWLINE# #INDENT# s . trace = ';' #NEWLINE# greenlet . getcurrent ( ) . parent . switch ( 0 ) #NEWLINE# #UNINDENT# s . memreq . val . next = 0 #NEWLINE# s . memresp . rdy . next = 1 #NEWLINE# while ( not s . memresp . val ) : #NEWLINE# #INDENT# s . trace = ':' #NEWLINE# greenlet . getcurrent ( ) . parent . switch ( 0 ) #NEWLINE# #UNINDENT# s . trace = ' ' #NEWLINE# s . memreq . val . next = 0 #NEWLINE# s . memresp . rdy . next = 0 #NEWLINE# return len_ . memresp . msg . data [ 0 : ( nbytes * 8 ) ]