Coverage for tsfpga/vivado/simlib.py: 100%
9 statements
« prev ^ index » next coverage.py v6.4, created at 2022-05-28 04:01 +0000
« prev ^ index » next coverage.py v6.4, created at 2022-05-28 04:01 +0000
1# --------------------------------------------------------------------------------------------------
2# Copyright (c) Lukas Vik. All rights reserved.
3#
4# This file is part of the tsfpga project.
5# https://tsfpga.com
6# https://gitlab.com/tsfpga/tsfpga
7# --------------------------------------------------------------------------------------------------
9from .simlib_commercial import VivadoSimlibCommercial
10from .simlib_ghdl import VivadoSimlibGhdl
13class VivadoSimlib:
15 """
16 Factory class for getting a Vivado simlib API.
17 """
19 @staticmethod
20 def init(output_path, vunit_proj, vivado_path=None):
21 """
22 Get a Vivado simlib API suitable for your current simulator. Uses VUnit mechanism
23 for detecting the simulator currently in use.
25 Arguments:
26 output_path (pathlib.Path): The compiled simlib will be placed here.
27 vunit_proj: The VUnit project that is used to run simulation.
28 vivado_path (pathlib.Path): Path to Vivado executable. If left out, the default
29 from system ``PATH`` will be used.
30 Return:
31 A :class:`.VivadoSimlibCommon` child object.
32 """
33 simulator_interface = vunit_proj._simulator_class # pylint: disable=protected-access
34 if simulator_interface.name == "ghdl":
35 return VivadoSimlibGhdl(output_path, vunit_proj, simulator_interface, vivado_path)
36 return VivadoSimlibCommercial(output_path, vunit_proj, simulator_interface, vivado_path)