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


Python BinaryValue.set_value方法代码示例

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


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

示例1: _ad9361_tx_to_rx_loopback

# 需要导入模块: from cocotb.binary import BinaryValue [as 别名]
# 或者: from cocotb.binary.BinaryValue import set_value [as 别名]
 def _ad9361_tx_to_rx_loopback(self):
     cocotb.fork(self._tx_data_from_ad9361())
     i_bin_val = BinaryValue(bits=12, bigEndian=False)
     q_bin_val = BinaryValue(bits=12, bigEndian=False)
     while True:
         yield RisingEdge(self.dut.rx_clk_in_p)
         if self.rx_frame_asserted:
             self.dut.rx_data_in_p <= i_bin_val[5:0]
             self.dut.rx_data_in_n <= ~i_bin_val[5:0]
             self.rx_frame_asserted = False
             self.dut.rx_frame_in_p <= 0
             self.dut.rx_frame_in_n <= 1
         else:
             if len(self.lbqi) > 0:
                 i_bin_val = self.lbqi.popleft()
             else:
                 i_bin_val.set_value(0)
             if len(self.lbqq) > 0:
                 q_bin_val = self.lbqq.popleft()
             else:
                 q_bin_val.set_value(0)
             self.dut.rx_data_in_p <= i_bin_val[11:6]
             self.dut.rx_data_in_n <= ~i_bin_val[11:6]
             self.rx_frame_asserted = True
             self.dut.rx_frame_in_p <= 1
             self.dut.rx_frame_in_n <= 0
         yield RisingEdge(self.dut.rx_clk_in_n)
         if self.rx_frame_asserted:
             self.dut.rx_data_in_p <= q_bin_val[11:6]
             self.dut.rx_data_in_n <= ~q_bin_val[11:6]
         else:
             self.dut.rx_data_in_p <= q_bin_val[5:0]
             self.dut.rx_data_in_n <= ~q_bin_val[5:0]
开发者ID:Paebbels,项目名称:cocotb,代码行数:35,代码来源:ad9361.py

示例2: rx_data_to_ad9361

# 需要导入模块: from cocotb.binary import BinaryValue [as 别名]
# 或者: from cocotb.binary.BinaryValue import set_value [as 别名]
 def rx_data_to_ad9361(self, i_data, q_data, i_data2=None, q_data2=None,
                       binaryRepresentation=BinaryRepresentation.TWOS_COMPLEMENT):
     i_bin_val = BinaryValue(bits=12, bigEndian=False,
                             binaryRepresentation=binaryRepresentation)
     q_bin_val = BinaryValue(bits=12, bigEndian=False,
                             binaryRepresentation=binaryRepresentation)
     index = 0
     if i_data2 is None and q_data2 is None:
         while True:
             yield RisingEdge(self.dut.rx_clk_in_p)
             if self.rx_frame_asserted:
                 self.dut.rx_data_in_p <= i_bin_val[5:0]
                 self.dut.rx_data_in_n <= ~i_bin_val[5:0]
                 self.rx_frame_asserted = False
                 self.dut.rx_frame_in_p <= 0
                 self.dut.rx_frame_in_n <= 1
             else:
                 if index < len(i_data):
                     i_bin_val.set_value(i_data[index])
                     q_bin_val.set_value(q_data[index])
                     index += 1
                 else:
                     return
                 self.dut.rx_data_in_p <= i_bin_val[11:6]
                 self.dut.rx_data_in_n <= ~i_bin_val[11:6]
                 self.rx_frame_asserted = True
                 self.dut.rx_frame_in_p <= 1
                 self.dut.rx_frame_in_n <= 0
             yield RisingEdge(self.dut.rx_clk_in_n)
             if self.rx_frame_asserted:
                 self.dut.rx_data_in_p <= q_bin_val[11:6]
                 self.dut.rx_data_in_n <= ~q_bin_val[11:6]
             else:
                 self.dut.rx_data_in_p <= q_bin_val[5:0]
                 self.dut.rx_data_in_n <= ~q_bin_val[5:0]
     else:
         I_SEND_HIGH = True
         Q_SEND_HIGH = True
         channel = 1
         while True:
             yield RisingEdge(self.dut.rx_clk_in_p)
             if I_SEND_HIGH:
                 self.dut.rx_data_in_p <= i_bin_val[11:6]
                 self.dut.rx_data_in_n <= ~i_bin_val[11:6]
                 I_SEND_HIGH = False
                 if channel == 1:
                     self.dut.rx_frame_in_p <= 1
                     self.dut.rx_frame_in_n <= 0
                 elif channel == 2:
                     self.dut.rx_frame_in_p <= 0
                     self.dut.rx_frame_in_n <= 1
             else:
                 self.dut.rx_data_in_p <= i_bin_val[5:0]
                 self.dut.rx_data_in_n <= ~i_bin_val[5:0]
                 I_SEND_HIGH = True
             yield RisingEdge(self.dut.rx_clk_in_n)
             if Q_SEND_HIGH:
                 self.dut.rx_data_in_p <= q_bin_val[5:0]
                 self.dut.rx_data_in_n <= ~q_bin_val[5:0]
                 Q_SEND_HIGH = False
             else:
                 self.dut.rx_data_in_p <= q_bin_val[11:6]
                 self.dut.rx_data_in_n <= ~q_bin_val[11:6]
                 Q_SEND_HIGH = True
                 if index < len(i_data):
                     if channel == 1:
                         i_bin_val.set_value(i_data[index])
                         q_bin_val.set_value(q_data[index])
                         channel = 2
                     elif channel == 2:
                         i_bin_val.set_value(i_data2[index])
                         q_bin_val.set_value(q_data2[index])
                         channel = 1
                         index += 1
                 else:
                     return
开发者ID:Paebbels,项目名称:cocotb,代码行数:78,代码来源:ad9361.py

示例3: rx_data_to_ad9361

# 需要导入模块: from cocotb.binary import BinaryValue [as 别名]
# 或者: from cocotb.binary.BinaryValue import set_value [as 别名]
    def rx_data_to_ad9361(self, i_data, q_data, i_data2=None, q_data2=None,
                          binaryRepresentation=BinaryRepresentation.TWOS_COMPLEMENT):
        """Receive data to AD9361.

        This is a coroutine.

        Args:
            i_data (int): Data of the I0 channel.
            q_data (int): Data of the Q0 channel.
            i_data2 (int, optional): Data of the I1 channel.
            q_data2 (int, optional): Data of the Q1 channel.
            binaryRepresentation (BinaryRepresentation): The representation of the binary value.
                Default is :any:`TWOS_COMPLEMENT`. 
       """
        i_bin_val = BinaryValue(n_bits=12, bigEndian=False,
                                binaryRepresentation=binaryRepresentation)
        q_bin_val = BinaryValue(n_bits=12, bigEndian=False,
                                binaryRepresentation=binaryRepresentation)
        index = 0
        if i_data2 is None and q_data2 is None:
            while True:
                yield RisingEdge(self.dut.rx_clk_in_p)
                if self.rx_frame_asserted:
                    self.dut.rx_data_in_p <= i_bin_val[5:0]
                    self.dut.rx_data_in_n <= ~i_bin_val[5:0]
                    self.rx_frame_asserted = False
                    self.dut.rx_frame_in_p <= 0
                    self.dut.rx_frame_in_n <= 1
                else:
                    if index < len(i_data):
                        i_bin_val.set_value(i_data[index])
                        q_bin_val.set_value(q_data[index])
                        index += 1
                    else:
                        return
                    self.dut.rx_data_in_p <= i_bin_val[11:6]
                    self.dut.rx_data_in_n <= ~i_bin_val[11:6]
                    self.rx_frame_asserted = True
                    self.dut.rx_frame_in_p <= 1
                    self.dut.rx_frame_in_n <= 0
                yield RisingEdge(self.dut.rx_clk_in_n)
                if self.rx_frame_asserted:
                    self.dut.rx_data_in_p <= q_bin_val[11:6]
                    self.dut.rx_data_in_n <= ~q_bin_val[11:6]
                else:
                    self.dut.rx_data_in_p <= q_bin_val[5:0]
                    self.dut.rx_data_in_n <= ~q_bin_val[5:0]
        else:
            I_SEND_HIGH = True
            Q_SEND_HIGH = True
            channel = 1
            while True:
                yield RisingEdge(self.dut.rx_clk_in_p)
                if I_SEND_HIGH:
                    self.dut.rx_data_in_p <= i_bin_val[11:6]
                    self.dut.rx_data_in_n <= ~i_bin_val[11:6]
                    I_SEND_HIGH = False
                    if channel == 1:
                        self.dut.rx_frame_in_p <= 1
                        self.dut.rx_frame_in_n <= 0
                    elif channel == 2:
                        self.dut.rx_frame_in_p <= 0
                        self.dut.rx_frame_in_n <= 1
                else:
                    self.dut.rx_data_in_p <= i_bin_val[5:0]
                    self.dut.rx_data_in_n <= ~i_bin_val[5:0]
                    I_SEND_HIGH = True
                yield RisingEdge(self.dut.rx_clk_in_n)
                if Q_SEND_HIGH:
                    self.dut.rx_data_in_p <= q_bin_val[5:0]
                    self.dut.rx_data_in_n <= ~q_bin_val[5:0]
                    Q_SEND_HIGH = False
                else:
                    self.dut.rx_data_in_p <= q_bin_val[11:6]
                    self.dut.rx_data_in_n <= ~q_bin_val[11:6]
                    Q_SEND_HIGH = True
                    if index < len(i_data):
                        if channel == 1:
                            i_bin_val.set_value(i_data[index])
                            q_bin_val.set_value(q_data[index])
                            channel = 2
                        elif channel == 2:
                            i_bin_val.set_value(i_data2[index])
                            q_bin_val.set_value(q_data2[index])
                            channel = 1
                            index += 1
                    else:
                        return
开发者ID:TC01,项目名称:cocotb,代码行数:90,代码来源:ad9361.py


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