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


Python BinaryValue.assign方法代码示例

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


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

示例1: Ram_Read

# 需要导入模块: from cocotb.binary import BinaryValue [as 别名]
# 或者: from cocotb.binary.BinaryValue import assign [as 别名]
    def Ram_Read(self,dut, A):


#############  Reading value from RAM
        Ad = BinaryValue()
        Ad.assign(A)

        #print Ad, Bd
        dut.a_adbus.value = Ad          
        yield RisingEdge(self.dut.clk)
        yield ReadOnly()
        raise ReturnValue(dut.a_data_out.value)
开发者ID:deepakkapoor624,项目名称:Projects,代码行数:14,代码来源:test_ks.py

示例2: Ram_write

# 需要导入模块: from cocotb.binary import BinaryValue [as 别名]
# 或者: from cocotb.binary.BinaryValue import assign [as 别名]
    def Ram_write(self,dut, A, B):

######  Writing value from RAM 
        Ad = BinaryValue()
        Ad.assign(A)
        Bd = BinaryValue()
        Bd.assign(B)
        dut.a_adbus.value = Bd
        dut.a_data_in.value = Ad
        dut.a_w.value=1
        yield RisingEdge(self.dut.clk)
        dut.a_w.value=0
        yield ReadOnly()
开发者ID:deepakkapoor624,项目名称:Projects,代码行数:15,代码来源:test_ks.py

示例3: _driver_send

# 需要导入模块: from cocotb.binary import BinaryValue [as 别名]
# 或者: from cocotb.binary.BinaryValue import assign [as 别名]
    def _driver_send(self, value, sync=True):
        """Send a transmission over the bus.

        Args:
            value: data to drive onto the bus.
        """
        self.log.debug("Sending Avalon transmission: %d" % value)

        # Avoid spurious object creation by recycling
        clkedge = RisingEdge(self.clock)

        word = BinaryValue(n_bits=len(self.bus.data), bigEndian=False)

        # Drive some defaults since we don't know what state we're in
        self.bus.valid <= 0

        if sync:
            yield clkedge

        # Insert a gap where valid is low
        if not self.on:
            self.bus.valid <= 0
            for i in range(self.off):
                yield clkedge

            # Grab the next set of on/off values
            self._next_valids()

        # Consume a valid cycle
        if self.on is not True and self.on:
            self.on -= 1

        self.bus.valid <= 1

        word.assign(value)
        self.bus.data <= word

        # If this is a bus with a ready signal, wait for this word to
        # be acknowledged
        if hasattr(self.bus, "ready"):
            yield self._wait_ready()

        yield clkedge
        self.bus.valid <= 0
        word.binstr   = ("x"*len(self.bus.data))
        self.bus.data <= word

        self.log.debug("Successfully sent Avalon transmission: %d" % value)
开发者ID:TC01,项目名称:cocotb,代码行数:50,代码来源:avalon.py

示例4: PUSH

# 需要导入模块: from cocotb.binary import BinaryValue [as 别名]
# 或者: from cocotb.binary.BinaryValue import assign [as 别名]
    def PUSH(self,dut, A,command):

        Ad = BinaryValue()
        Ad.assign(A)
    
        dut.Data_in_Core1_Inp.value = Ad
        dut.wr_en_Core1_Inp.value=1
    
        dut.wr_en_Core1_Cmd.value  =1
        dut.Data_in_Core1_Cmd.value=command
        yield RisingEdge(self.dut.clk)
       
        dut.wr_en_Core1_Inp.value=0
        dut.wr_en_Core1_Cmd.value  =0
        
        yield ReadOnly()
开发者ID:devil2015,项目名称:ecc,代码行数:18,代码来源:test_ks.py

示例5: _monitor_recv

# 需要导入模块: from cocotb.binary import BinaryValue [as 别名]
# 或者: from cocotb.binary.BinaryValue import assign [as 别名]
    def _monitor_recv(self):
        """Watch the pins and reconstruct transactions."""

        # Avoid spurious object creation by recycling
        clkedge = RisingEdge(self.clock)
        rdonly = ReadOnly()
        pkt = ""
        in_pkt = False
        invalid_cyclecount = 0
        channel = None

        def valid():
            if hasattr(self.bus, 'ready'):
                return self.bus.valid.value and self.bus.ready.value
            return self.bus.valid.value

        while True:
            yield clkedge
            yield rdonly

            if self.in_reset:
                continue

            if valid():
                invalid_cyclecount = 0

                if self.bus.startofpacket.value:
                    if pkt and self.config['fail_immediately']:
                        raise AvalonProtocolError(
                            "Duplicate start-of-packet received on %s" % (
                                str(self.bus.startofpacket)))
                    pkt = ""
                    in_pkt = True

                if not in_pkt and self.config['fail_immediately']:
                    raise AvalonProtocolError("Data transfer outside of "
                                              "packet")

                # Handle empty and X's in empty / data
                vec = BinaryValue()
                if not self.bus.endofpacket.value:
                    vec = self.bus.data.value
                else:
                    value = self.bus.data.value.get_binstr()
                    if self.config["useEmpty"] and self.bus.empty.value.integer:
                        empty = self.bus.empty.value.integer * self.config["dataBitsPerSymbol"]
                        if self.config["firstSymbolInHighOrderBits"]:
                            value = value[:-empty]
                        else:
                            value = value[empty:]
                    vec.assign(value)
                    if not vec.is_resolvable:
                        raise AvalonProtocolError("After empty masking value is still bad?  Had empty {:d}, got value {:s}".format(empty, self.bus.data.value.get_binstr()))

                vec.big_endian = self.config['firstSymbolInHighOrderBits']
                pkt += vec.buff

                if hasattr(self.bus, 'channel'):
                    if channel is None:
                        channel = self.bus.channel.value.integer
                        if channel > self.config["maxChannel"]:
                            raise AvalonProtocolError("Channel value (%d) is greater than maxChannel (%d)" % (channel,self.config["maxChannel"]))
                    elif self.bus.channel.value.integer != channel:
                        raise AvalonProtocolError("Channel value changed during packet")

                if self.bus.endofpacket.value:
                    self.log.info("Received a packet of %d bytes" % len(pkt))
                    self.log.debug(hexdump(str((pkt))))
                    self.channel = channel
                    self._recv(pkt)
                    pkt = ""
                    in_pkt = False
                    channel = None
            else :
                if in_pkt :
                    invalid_cyclecount += 1
                    if self.config["invalidTimeout"] :
                        if invalid_cyclecount >= self.config["invalidTimeout"] :
                            raise AvalonProtocolError(
                                "In-Packet Timeout. Didn't receive any valid data for %d cycles!" %
                                invalid_cyclecount)
开发者ID:zpan007,项目名称:cocotb,代码行数:83,代码来源:avalon.py


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