当前位置: 首页>>代码示例>>Python>>正文


Python BinaryValue.get_buff方法代码示例

本文整理汇总了Python中cocotb.binary.BinaryValue.get_buff方法的典型用法代码示例。如果您正苦于以下问题:Python BinaryValue.get_buff方法的具体用法?Python BinaryValue.get_buff怎么用?Python BinaryValue.get_buff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cocotb.binary.BinaryValue的用法示例。


在下文中一共展示了BinaryValue.get_buff方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _write_data

# 需要导入模块: from cocotb.binary import BinaryValue [as 别名]
# 或者: from cocotb.binary.BinaryValue import get_buff [as 别名]
    def _write_data(self):
        clock_re = RisingEdge(self.clock)

        while True:
            while True:
                self.bus.WREADY <= 0
                yield ReadOnly()
                yield NextTimeStep()
                if self.bus.AWVALID.value:
                    self.bus.WREADY <= 1
                    break
                yield clock_re

            yield ReadOnly()
            _awaddr = int(self.bus.AWADDR)
            _awlen = int(self.bus.AWLEN)
            _awsize = int(self.bus.AWSIZE)
            _awburst = int(self.bus.AWBURST)
            _awprot = int(self.bus.AWPROT)

            burst_length = _awlen + 1
            bytes_in_beat = self._size_to_bytes_in_beat(_awsize)

            word = BinaryValue(bits=bytes_in_beat*8, bigEndian=self.big_endain)

            if __debug__:
                self.log.debug(
                    "AWADDR  0x{:x}\n".format(_awaddr) +
                    "AWLEN   %d\n" % _awlen +
                    "AWSIZE  %d\n" % _awsize +
                    "AWBURST %d\n" % _awburst +
                    "BURST_LENGTH %d\n" % burst_length +
                    "Bytes in beat %d\n" % bytes_in_beat)

            burst_count = burst_length

            yield clock_re

            while True:
                if self.bus.WVALID.value:
                    word = self.bus.WDATA.value
                    word.big_endian = self.big_endain
                    _burst_diff = burst_length - burst_count
                    _st = _awaddr + (_burst_diff * bytes_in_beat)  # start
                    _end = _awaddr + ((_burst_diff + 1) * bytes_in_beat)  # end
                    self._memory[_st:_end] = array.array('B', word.get_buff())
                    burst_count -= 1
                    if burst_count == 0:
                        self.bus.BVALID.value = 1
                        while self.bus.BREADY == 0:
                            yield clock_re
                        self.bus.BVALID.value = 0
                        break
                yield clock_re
开发者ID:Martoni,项目名称:cocotb,代码行数:56,代码来源:amba.py

示例2: _write_data

# 需要导入模块: from cocotb.binary import BinaryValue [as 别名]
# 或者: from cocotb.binary.BinaryValue import get_buff [as 别名]
    def _write_data(self):
        clock_re = RisingEdge(self.clock)

        while True:
            while True:
                self.bus.WREADY <= 0
                yield ReadOnly()
                if self.bus.AWVALID.value:
                    self.bus.WREADY <= 1
                    break
                yield clock_re

            yield ReadOnly()
            _awaddr  = int(self.bus.AWADDR)
            _awlen   = int(self.bus.AWLEN)
            _awsize  = int(self.bus.AWSIZE)
            _awburst = int(self.bus.AWBURST)
            _awprot  = int(self.bus.AWPROT)

            burst_length = _awlen + 1
            bytes_in_beat = self._size_to_bytes_in_beat(_awsize)

            word = BinaryValue(bits=bytes_in_beat*8, bigEndian=self.big_endain)

            if __debug__:
                self.log.debug(
                    "AWADDR  %d\n" % _awaddr +
                    "AWLEN   %d\n" % _awlen  +
                    "AWSIZE  %d\n" % _awsize +
                    "AWBURST %d\n" % _awburst +
                    "BURST_LENGTH %d\n" % burst_length +
                    "Bytes in beat %d\n" % bytes_in_beat)

            burst_count = burst_length

            yield clock_re

            while True:
                if self.bus.WVALID.value:
                    word = self.bus.WDATA.value
                    word.big_endian = self.big_endain
                    self._memory[_awaddr+((burst_length-burst_count)*bytes_in_beat):_awaddr+(((burst_length-burst_count)+1)*bytes_in_beat)] = array.array('B',word.get_buff())
                    burst_count -= 1
                    if burst_count == 0:
                        break
                yield clock_re
开发者ID:enchanter,项目名称:cocotb,代码行数:48,代码来源:amba.py


注:本文中的cocotb.binary.BinaryValue.get_buff方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。