Esempio n. 1
0
    def data_sink(self, value):
        """
        This is a private function, you shouldn't need to call this directly.
        """

        if self.type_ == "int":

            self.l.append(value)
            self.times.append(self.chip.time)

        elif self.type_ == "long":

            if self.high_word:
                self.high_word = not self.high_word
                self.l.append(join_words(value, self.low))
                self.times.append(self.chip.time)
            else:
                self.high_word = not self.high_word
                self.low = value

        elif self.type_ == "float":

            self.l.append(bits_to_float(value))
            self.times.append(self.chip.time)

        elif self.type_ == "double":

            if self.high_word:
                self.high_word = not self.high_word
                self.l.append(bits_to_double(join_words(value, self.low)))
                self.times.append(self.chip.time)
            else:
                self.high_word = not self.high_word
                self.low = value
Esempio n. 2
0
    def data_sink(self, value):
        """
        This is a private function, you shouldn't need to call this directly.
        """

        if self.type_ == "int":

            self.l.append(value)
            self.times.append(self.chip.time)

        elif self.type_ == "long":

            if self.high_word:
                self.high_word = not self.high_word
                self.l.append(join_words(value, self.low))
                self.times.append(self.chip.time)
            else:
                self.high_word = not self.high_word
                self.low = value

        elif self.type_ == "float":

            self.l.append(bits_to_float(value))
            self.times.append(self.chip.time)

        elif self.type_ == "double":

            if self.high_word:
                self.high_word = not self.high_word
                self.l.append(bits_to_double(join_words(value, self.low)))
                self.times.append(self.chip.time)
            else:
                self.high_word = not self.high_word
                self.low = value
Esempio n. 3
0
    def mem_location_as_value(self, memory, type_, size, location):

        if size == 4:
            value = memory.get(location, 0)
            if type_ == "int":
                return value
            elif type_ == "float":
                return bits_to_float(value)
        elif size == 8:
            value = memory.get(location, 0) | memory.get(location + 1, 0) << 32
            if type_ == "long":
                return value
            elif type_ == "double":
                return bits_to_double(value)

        return 0
Esempio n. 4
0
    def mem_location_as_value(self, memory, type_, size, location):

        if size == 4:
            value = memory.get(location, 0)
            if type_ == "int":
                return value
            elif type_ == "float":
                return bits_to_float(value)
        elif size == 8:
            value = memory.get(location, 0) | memory.get(location + 1, 0) << 32
            if type_ == "long":
                return value
            elif type_ == "double":
                return bits_to_double(value)

        return 0