Beispiel #1
0
    def __init__(self, signal, clock, interleaved=True, callback=None,
                 event=None):
        """
        Args:
            signal (SimHandle):         The xgmii data bus

            clock (SimHandle):          The associated clock (assumed to be
                                        driven by another coroutine)

        Kwargs:
            interleaved (bool:          Whether control bits are interleaved
                                        with the data bytes or not.

        If interleaved the bus is
            byte0, byte0_control, byte1, byte1_control ....

            Otherwise expect:

            byte0, byte1, ..., byte0_control, byte1_control...
        """
        self.log = signal.log
        self.clock = clock
        self.signal = signal
        self.bytes = len(self.signal) / 9
        self.interleaved = interleaved
        Monitor.__init__(self, callback=callback, event=event)
Beispiel #2
0
    def __init__(self,
                 signal,
                 clock,
                 interleaved=True,
                 callback=None,
                 event=None):
        """Args:
            signal (SimHandle): The XGMII data bus.
            clock (SimHandle): The associated clock (assumed to be
                driven by another coroutine).
            interleaved (bool, optional): Whether control bits are interleaved
                with the data bytes or not.

        If interleaved the bus is
            byte0, byte0_control, byte1, byte1_control, ...

        Otherwise expect
            byte0, byte1, ..., byte0_control, byte1_control, ...
        """
        self.log = signal._log
        self.clock = clock
        self.signal = signal
        self.bytes = len(self.signal) // 9
        self.interleaved = interleaved
        Monitor.__init__(self, callback=callback, event=event)
Beispiel #3
0
    def __init__(self, config, signals, clk, *, clk_freq=None):
        self.log = SimLog("cocomod.uart.{}".format(self.__class__.__name__))

        self.config = config
        self.clk = clk.signal
        if clk_freq is None:
            clk_freq = 1 / get_time_from_sim_steps(clk.period, "sec")
        self.divisor = round(clk_freq / config.baud)
        self.duration = clk.period * self.divisor
        self.tx = signals.tx
        self.rx = signals.rx
        self.ctsn = signals.ctsn
        self.rtsn = signals.rtsn

        if config.flow_control == UARTFlowControl.HARDWARE and self.ctsn is None:
            raise RuntimeError(
                "HARDWARE flow control selected and no CTS signal")
        if config.flow_control == UARTFlowControl.HARDWARE and self.rtsn is None:
            raise RuntimeError(
                "HARDWARE flow control selected and no RTS signal")

        self.tx <= 1
        if self.ctsn is not None:
            self.ctsn <= 1

        Driver.__init__(self)
        Monitor.__init__(self)
 def __init__(self, signals, clk, callback=None, event=None):
     self.name = "cocomod.fifointerface.%s" % (self.__class__.__name__)
     self.log = SimLog(self.name)
     self.valid = signals.valid
     self.ready = signals.ready
     self.data = signals.data
     self.clk = clk.signal
     Monitor.__init__(self, callback, event)
Beispiel #5
0
 def __init__(self, dut, cfg={}, io={}, callback=None, event=None):
     self.dut = dut
     self.io = io
     if cfg:
         self.name = cfg['name'] if cfg['name'] else 'SPI Monitor'
         self.size = cfg['size'] if cfg['size'] else 8  # bits
         self.lsb_first = cfg['lsb_first'] if cfg['lsb_first'] else False
         self.mode = cfg['mode'] if cfg['mode'] else 0
     self.enable = False  # .start() sets enable, .stop() clears enable
     Monitor.__init__(self, callback, event)
Beispiel #6
0
 def __init__(self,
              name,
              signala,
              signalb,
              clock,
              callback=None,
              event=None):
     self.name = name
     self.signala = signala
     self.signalb = signalb
     self.clock = clock
     Monitor.__init__(self, callback, event)
 def __init__(self,
              rx,
              clock,
              baud,
              reset_n=None,
              callback=None,
              event=None):
     self.clock = clock
     self.rx = rx
     self.baud = baud
     self.receiving = False
     self.buff = 0
     self.count = 0
     self.reset_n = reset_n
     Monitor.__init__(self, callback, event)
Beispiel #8
0
    def __init__(self, config, signals, clk, *, clk_freq=None):
        self.log = logging.getLogger("cocotbext.spi.{}".format(self.__class__.__name__))
        self.log.setLevel(config.loglevel)
        self.config = config
        self.clk = clk
        if clk_freq is None:
            clk_freq = 1 / get_time_from_sim_steps(clk.period, "sec")
        self.miso = signals.miso
        self.mosi = signals.mosi
        self.cs = signals.cs
        self.sclk = signals.sclk

        # chip select Edging
        if self.config.csphase:
            self.csBeginEdge = RisingEdge(self.cs)
            self.csEndEdge = FallingEdge(self.cs)
        else:
            self.csBeginEdge = FallingEdge(self.cs)
            self.csEndEdge = RisingEdge(self.cs)

        # sclk edging
        # CPOL  | leading edge | trailing edge
        # ------|--------------|--------------
        # false | rising       | falling
        # true  | falling      | rising
        if self.config.cpol:
            self.sclkLeadEdge = FallingEdge(self.sclk)
            self.sclkTrailEdge = RisingEdge(self.sclk)
        else:
            self.sclkLeadEdge = RisingEdge(self.sclk)
            self.sclkTrailEdge = FallingEdge(self.sclk)

        # CPHA  | data change    | data read
        # ------|----------------|--------------
        # false | trailling edge | leading edge
        # true  | leading edge   | trailing edge
        if self.config.cpha:
            self.dataChangEdge = self.sclkLeadEdge
            self.dataReadEdge = self.sclkTrailEdge
        else:
            self.dataChangEdge = self.sclkTrailEdge
            self.dataReadEdge = self.sclkLeadEdge

        Driver.__init__(self)
        Monitor.__init__(self)
Beispiel #9
0
    def __init__(
        self,
        fifo_block,
        clock,
        block_name,
        io_enum,
        callbacks=[],
        write_out=True,
        out_dir="",
    ):
        FifoWrapper.__init__(self, fifo_block, clock, block_name, io_enum,
                             write_out, out_dir)
        Monitor.__init__(self)

        self.add_callback(self.store_word)
        if write_out:
            self.add_callback(self.write_word)
        if callbacks:
            for cb in callbacks:
                self.add_callback(cb)
Beispiel #10
0
 def __init__(self, name, signal, clock, callback=None, event=None):
     self.name = name
     self.signal = signal
     self.clock = clock
     Monitor.__init__(self, callback, event)
Beispiel #11
0
 def __init__(self, dut, **kwargs):
     self.dut = dut
     Monitor.__init__(self, **kwargs)
 def __init__(self, name, bcd_out, busy):
     self.name = name
     self._bcd_out = bcd_out
     self._busy = busy
     Monitor.__init__(self)
Beispiel #13
0
 def __init__(self, dut):
     self.dut = dut
     self.bytes = defaultdict()
     Monitor.__init__(self)
Beispiel #14
0
 def __init__(self, dut, name, callback=None, **kwargs):
     self.dut = dut
     self.name = name
     Monitor.__init__(self, callback=callback)
Beispiel #15
0
 def __init__(self, dut, name, **kwargs):
     self.dut = dut
     self.name = name
     Monitor.__init__(self)
Beispiel #16
0
 def __init__(self, name, signal, clk, callback=None, event=None):
     self.name = name
     self.signal = signal
     self.clk = clk
     Monitor.__init__(self, callback, event)
 def __init__(self, dut, **kwargs):
     self.dut = dut
     Monitor.__init__(self, **kwargs)
Beispiel #18
0
 def __init__(self, entity, regfile, callback=None, event=None):
     self.dut = entity
     self.regfile = regfile
     self.irqs = regfile.get_rtl_irq_inputs()
     Monitor.__init__(self, callback=callback, event=event)
Beispiel #19
0
 def __init__(self, entity, callback=None, event=None, debug=False):
     self.dut = entity
     Monitor.__init__(self, callback=callback, event=event)
Beispiel #20
0
 def __init__(self, name, dut, callback=None, event=None):
     self.name = name
     self.dut = dut
     Monitor.__init__(self, callback, event)