Coverage for tsfpga/vivado/simlib.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2022-11-29 20:01 +0000

1# -------------------------------------------------------------------------------------------------- 

2# Copyright (c) Lukas Vik. All rights reserved. 

3# 

4# This file is part of the tsfpga project, a project platform for modern FPGA development. 

5# https://tsfpga.com 

6# https://gitlab.com/tsfpga/tsfpga 

7# -------------------------------------------------------------------------------------------------- 

8 

9# Local folder libraries 

10from .simlib_commercial import VivadoSimlibCommercial 

11from .simlib_ghdl import VivadoSimlibGhdl 

12 

13 

14class VivadoSimlib: 

15 

16 """ 

17 Factory class for getting a Vivado simlib API. 

18 """ 

19 

20 @staticmethod 

21 def init(output_path, vunit_proj, vivado_path=None): 

22 """ 

23 Get a Vivado simlib API suitable for your current simulator. Uses VUnit mechanism 

24 for detecting the simulator currently in use. 

25 

26 Arguments: 

27 output_path (pathlib.Path): The compiled simlib will be placed here. 

28 vunit_proj: The VUnit project that is used to run simulation. 

29 vivado_path (pathlib.Path): Path to Vivado executable. If left out, the default 

30 from system ``PATH`` will be used. 

31 Return: 

32 A :class:`.VivadoSimlibCommon` child object. 

33 """ 

34 simulator_interface = vunit_proj._simulator_class # pylint: disable=protected-access 

35 if simulator_interface.name == "ghdl": 

36 return VivadoSimlibGhdl(output_path, vunit_proj, simulator_interface, vivado_path) 

37 return VivadoSimlibCommercial(output_path, vunit_proj, simulator_interface, vivado_path)