File size: 1,380 Bytes
cb65407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright cocotb contributors
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause

import os
import sys

import pytest
from cocotb.runner import get_runner
from test_cocotb import (
    compile_args,
    gpi_interfaces,
    hdl_toplevel,
    hdl_toplevel_lang,
    module_name,
    sim,
    sim_args,
    sim_build,
    tests_dir,
    verilog_sources,
    vhdl_sources,
)

pytestmark = pytest.mark.simulator_required
sys.path.insert(0, os.path.join(tests_dir, "pytest"))

# test_timing_triggers.py requires a 1ps time precision.
timescale = ("1ps", "1ps")


@pytest.mark.compile
def test_cocotb_parallel_compile():
    runner = get_runner(sim)

    runner.build(
        always=True,
        verilog_sources=verilog_sources,
        vhdl_sources=vhdl_sources,
        hdl_toplevel=hdl_toplevel,
        build_dir=sim_build,
        build_args=compile_args,
        timescale=timescale,
    )


@pytest.mark.parametrize("seed", list(range(4)))
def test_cocotb_parallel(seed):
    runner = get_runner(sim)

    runner.build_args = compile_args

    runner.test(
        seed=seed,
        hdl_toplevel_lang=hdl_toplevel_lang,
        hdl_toplevel=hdl_toplevel,
        gpi_interfaces=gpi_interfaces,
        test_module=module_name,
        test_args=sim_args,
        build_dir=sim_build,
        timescale=timescale,
    )