Send the global register to the chip.

        Loads the values of self['GLOBAL_REG'] onto the chip.
        Includes enabling the clock, and loading the Control (CTR)
        and DAC shadow registers.
554560
def program_global_reg(self):
        

        self._clear_strobes()

        gr_size = len(self['GLOBAL_REG'][:])  # get the size
        self['SEQ']['SHIFT_IN'][0:gr_size] = self['GLOBAL_REG'][:]  # this will be shifted out
        self['SEQ']['GLOBAL_SHIFT_EN'][0:gr_size] = bitarray(gr_size * '1')  # this is to enable clock
        self['SEQ']['GLOBAL_CTR_LD'][gr_size + 1:gr_size + 2] = bitarray("1")  # load signals
        self['SEQ']['GLOBAL_DAC_LD'][gr_size + 1:gr_size + 2] = bitarray("1")

        # Execute the program (write bits to output pins)
        # + 1 extra 0 bit so that everything ends on LOW instead of HIGH
        self._run_seq(gr_size + 3)
775245
def set_register(self, reg, data):
        
        if reg < 0:
            return
        elif reg < len(self._register_list):
            regName = self._register_list[reg].name
            regBits = self._register_list[reg].bitsize
            if regBits == 64:
                value = conversion.hex16_to_u64be(data)
            else:
                value = conversion.hex8_to_u32be(data)
            logging.debug("GDB: write reg %s: 0x%X", regName, value)
            self._context.write_core_register_raw(regName, value)
787843
def execute(self):
        
        from vsgen.util.logger import VSGLogger

        VSGLogger.info(self._logname, self._message)
        start = time.clock()
        for i in self._registerables:
            i.register()
        end = time.clock()
        VSGLogger.info(self._logname, "Register %s items in %s seconds:", len(self._registerables), end - start)
        self._start = time.clock()
572668
def register(origin, target, &block)
      raise(ArgumentError, 'block is required') unless block_given?

      @mutex.synchronize do
        @coercions[origin][target] = Coercion.new(origin, target, &block)
      end
    end
58660
def send(self, message):
        
        message.update(self._globalFields)
        errors = []
        for dest in self._destinations:
            try:
                dest(message)
            except:
                errors.append(sys.exc_info())
        if errors:
            raise _DestinationsSendError(errors)
1011570
def add_global(self, globalvalue):
        
        assert globalvalue.name not in self.globals
        self.globals[globalvalue.name] = globalvalue
1171004
def register_trading_control(self, control):
        
        if self.initialized:
            raise RegisterTradingControlPostInit()
        self.trading_controls.append(control)
46464
def enqueue_global(self, message: Message):
        
        self.enqueue(
            queue_identifier=QueueIdentifier(
                recipient=self.receiver,
                channel_identifier=CHANNEL_IDENTIFIER_GLOBAL_QUEUE,
            ),
            message=message,
        )
51336
def _send(self, value, mode):
        """"""
        # Wait, if compatibility mode is enabled
        if self.compat_mode:
            self._wait()

        # Choose instruction or data mode
        GPIO.output(self.pins.rs, mode)

        # If the RW pin is used, set it to low in order to write.
        if self.pins.rw is not None:
            GPIO.output(self.pins.rw, 0)

        # Write data out in chunks of 4 or 8 bit
        if self.data_bus_mode == c.LCD_8BITMODE:
            self._write8bits(value)
        else:
            self._write4bits(value >> 4)
            self._write4bits(value)

        # Record the time for the tail-end of the last send event
        if self.compat_mode:
            self.last_send_event = now()
396618
function () {
                //Push all the globalDefQueue items into the context's defQueue
                if (globalDefQueue.length) {
                    //Array splice in the values since the context code has a
                    //local var ref to defQueue, so cannot just reassign the one
                    //on context.
                    apsp.apply(context.defQueue,
                               [context.defQueue.length - 1, 0].concat(globalDefQueue));
                    globalDefQueue = [];
                }
            }
1237373
def to_risc(compiler)
      transfer = SlotLoad.new([:message , :next_message , :receiver] , @receiver, self).to_risc(compiler)
      compiler.reset_regs
      @arguments.each do |arg|
        arg.to_risc(compiler)
        compiler.reset_regs
      end
      transfer
    end
84422
def _ensure_global(self, values=None):
        
        if self._gpayload is None:
            self._gpayload = values or {}
        self.enable()
590032
def send(self):
        

        for name, array in iteritems(self):

            shader_id = c_int(0)
            gl.glGetIntegerv(gl.GL_CURRENT_PROGRAM, byref(shader_id))
            if shader_id.value == 0:
                raise UnboundLocalError("""Shader not bound to OpenGL context--uniform cannot be sent.
                ------------ Tip -------------
                with ratcave.default_shader:
                    mesh.draw()
                ------------------------------
                """)

            # Attach a shader location value to the array, for quick memory lookup. (gl calls are expensive, for some reason)
            try:
                loc, shader_id_for_array = array.loc
                if shader_id.value != shader_id_for_array:
                    raise Exception('Uniform location bound to a different shader')
            except (AttributeError, Exception) as e:
                array.loc = (gl.glGetUniformLocation(shader_id.value, name.encode('ascii')), shader_id.value)

            if array.ndim == 2:  # Assuming a 4x4 float32 matrix (common for graphics operations)
                try:
                    pointer = array.pointer
                except AttributeError:
                    array.pointer = array.ctypes.data_as(POINTER(c_float * 16)).contents
                    pointer = array.pointer
                gl.glUniformMatrix4fv(array.loc[0], 1, True, pointer)

            else:
                sendfun = self._sendfuns[array.dtype.kind][len(array) - 1]  # Find correct glUniform function
                sendfun(array.loc[0], *array)
813299
def register(self, arguments=list()):
        
        target_name = self.target_name
        if target_name in ['memory.usage_in_bytes', 'memory.memsw.usage_in_bytes']:
            threshold = arguments[0]
            line = "%d %d %d\0" % (self.event_fd, self.target_fd, long(threshold))
        elif target_name in ['memory.pressure_level']:
            threshold = arguments[0]
            line = "%d %d %s\0" % (self.event_fd, self.target_fd, threshold)
        else:
            line = "%d %d\0" % (self.event_fd, self.target_fd)
        os.write(self.ec_fd, line)
912475
def _setup_global_state_for_execution(laser_evm, transaction) -> None:
    
    # TODO: Resolve circular import between .transaction and ..svm to import LaserEVM here
    global_state = transaction.initial_global_state()
    global_state.transaction_stack.append((transaction, None))

    new_node = Node(
        global_state.environment.active_account.contract_name,
        function_name=global_state.environment.active_function_name,
    )
    if laser_evm.requires_statespace:
        laser_evm.nodes[new_node.uid] = new_node

    if transaction.world_state.node:
        if laser_evm.requires_statespace:
            laser_evm.edges.append(
                Edge(
                    transaction.world_state.node.uid,
                    new_node.uid,
                    edge_type=JumpType.Transaction,
                    condition=None,
                )
            )

        global_state.mstate.constraints += transaction.world_state.node.constraints
        new_node.constraints = global_state.mstate.constraints.as_list

    global_state.world_state.transaction_sequence.append(transaction)
    global_state.node = new_node
    new_node.states.append(global_state)
    laser_evm.work_list.append(global_state)
310200
def _send_register_payload(self, websocket):
        """"""
        file = os.path.join(os.path.dirname(__file__), HANDSHAKE_FILE_NAME)

        data = codecs.open(file, 'r', 'utf-8')
        raw_handshake = data.read()

        handshake = json.loads(raw_handshake)
        handshake['payload']['client-key'] = self.client_key

        yield from websocket.send(json.dumps(handshake))
        raw_response = yield from websocket.recv()
        response = json.loads(raw_response)

        if response['type'] == 'response' and \
                        response['payload']['pairingType'] == 'PROMPT':
            raw_response = yield from websocket.recv()
            response = json.loads(raw_response)
            if response['type'] == 'registered':
                self.client_key = response['payload']['client-key']
                self.save_key_file()
1329725
def _get_constrs_move_register(self, gadget):
        
        # *src* register has to have the same value of *dst* for all
        # possibles assignments of *dst*.

        dst = self.analyzer.get_register_expr(gadget.destination[0].name, mode="post")
        src = self.analyzer.get_register_expr(gadget.sources[0].name, mode="pre")

        # Check all non-modified registers don't change.
        constrs_mod = []

        for name in self._arch_info.registers_gp_base:
            if name not in [r.name for r in gadget.modified_registers]:
                var_initial = self.analyzer.get_register_expr(name, mode="pre")
                var_final = self.analyzer.get_register_expr(name, mode="post")

                constrs_mod += [var_initial != var_final]

        if constrs_mod:
            constrs_mod = [reduce(lambda c, acc: acc | c, constrs_mod[1:], constrs_mod[0])]

        return [dst != src] + constrs_mod