I am new to cocotb and want to run a sanity test for SPI master. I had coded a simple test without importing driver and monitor but calling all signals from DUT. I tried running a simple test , report showed no syntax or indentation error but test is not getting pick up and finding this message "Did not detect Python virtual environment. Using system-wide Python interpreter" How to solve this?
import logging
import cocotb
from cocotb.triggers import RisingEdge, FallingEdge, Timer, ReadOnly
from cocotb.clock import Clock
from cocotb.result import TestFailure
import random
class MasterSpi(object):
INTERFRAME = (100, "ns")
def __init__(self, dut, clock, w_CPOL=0, w_CPHA=1):
self._dut = dut
self._w_CPOL = w_CPOL
self._w_CPHA = w_CPHA
if w_CPOL == 1:
raise Exception("cpol = 1 not implemented yet")
if w_CPHA == 0:
raise Exception("cpha = 0 not implemented yet")
self._clock_thread = cocotb.fork(clock.start())
spi_sigs = SPISignals(
miso=dut.i_SPI_MISO,
mosi=dut.o_SPI_MOSI,
sclk=dut.o_SPI - Clk,
)
self.spi_config = SPIConfig(
w_CPOL=False,
w_CPHA=True,
baudrate=(1, "us"),
csphase=False,
)
self.spimod = SPIModule(self.spi_config, spi_sigs, clock)
@cocotb.coroutine
def reset(self):
print("inside coroutine")
self._dut.i_Rst_L <= 0
short_per = Timer(100, units="ns")
self._dut.i_Rst_L <= 0
self.spimod.set_ss(False)
self._dut.o_SPI_MOSI <= 0
self._dut.o_SPI_Clk <= 0
yield short_per
self._dut.i_Rst_L <= 1
yield short_per