<commit_before>#
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
# SVN revision information:
#  $Rev::                       $:
#  $Author::                    $:
#  $Date::                      $:
#
#Initial version by <NAME> <<EMAIL>>
#

import os
import socket
import logging

import cocotb
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, Timer
from cocotb.result import TestError

from SimSiLibUsbDriver import FullSpeedBus
from SimSiLibUsbProtocol import WriteExternalRequest, ReadExternalRequest, ReadExternalResponse, PickleInterface

@cocotb.test()
def socket_test(dut, debug=True):
    """Testcase that uses a socket to drive the DUT"""

    host = os.getenv("SIMULATION_HOST")
    port = os.getenv("SIMULATION_PORT")

    if host is None or port is None:
        dut.log.error("SIMULATION_HOST and SIMULATION_PORT environment variables must be set")
        raise TestError("Unable to open a socket")
    port = int(port)

    if debug:
        dut.log.setLevel(logging.DEBUG)

    # Kick off a clock generator
    cocotb.fork(Clock(dut.FCLK_IN, 5000).start())
    bus = FullSpeedBus(dut, dut.FCLK_IN)

    yield RisingEdge(dut.FCLK_IN)
    for _ in range(100):
	#while dut.BUS_RST.value:
        yield RisingEdge(dut.FCLK_IN)

    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    s.bind((host, port))<commit_msg>ENH: Longer reset<commit_after>#
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
# SVN revision information:
#  $Rev::                       $:
#  $Author::                    $:
#  $Date::                      $:
#
#Initial version by <NAME> <<EMAIL>>
#

import os
import socket
import logging

import cocotb
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, Timer
from cocotb.result import TestError

from SimSiLibUsbDriver import FullSpeedBus
from SimSiLibUsbProtocol import WriteExternalRequest, ReadExternalRequest, ReadExternalResponse, PickleInterface

@cocotb.test()
def socket_test(dut, debug=True):
    """Testcase that uses a socket to drive the DUT"""

    host = os.getenv("SIMULATION_HOST")
    port = os.getenv("SIMULATION_PORT")

    if host is None or port is None:
        dut.log.error("SIMULATION_HOST and SIMULATION_PORT environment variables must be set")
        raise TestError("Unable to open a socket")
    port = int(port)

    if debug:
        dut.log.setLevel(logging.DEBUG)

    # Kick off a clock generator
    cocotb.fork(Clock(dut.FCLK_IN, 5000).start())
    bus = FullSpeedBus(dut, dut.FCLK_IN)

    yield RisingEdge(dut.FCLK_IN)
    for _ in range(1000):
	#while dut.BUS_RST.value:
        yield RisingEdge(dut.FCLK_IN)

    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    s.bind((host, port))
{'fraction_non_alphanumeric': 0.16766656141458794, 'fraction_numerical': 0.0053678560151563, 'mean_word_length': 2.439739413680782, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3611110', 'n_tokens_mistral': 1001, 'n_tokens_neox': 941, 'n_words': 255}