Skip to content

Add VUNIT_VIVADO_PATH env variable #1

Description

@LarsAsplund

This issue was moved from VUnit/vunit#811.


The vivado.py python script pulls the path to the vivado binary from either the user's path or from method argument, rather than from a env variable like the simulator paths. Modifying the run_vivado method under vivado.py to pull from an env variable would make it much easier to work with multiple local vivado installs on a machine, and unify this code with how VUnit specifies other binaries.

The run_vivado method might look something like this

def run_vivado(tcl_file_name, tcl_args=None, cwd=None, vivado_path=None):
  """
  Run tcl script in Vivado in batch mode.
  Note: the shell=True is important in windows where Vivado is just a bat file.
  """
  vivado = os.environ.get("VUNIT_VIVADO_PATH", None) if vivado_path is None else str(Path(vivado_path).resolve() / "bin" / "vivado")
  cmd = f"{vivado} -nojournal -nolog -notrace -mode batch -source {str(Path(tcl_file_name).resolve())}"
  if tcl_args is not None:
      cmd += " -tclargs " + " ".join([str(val) for val in tcl_args])

  print(cmd)
  check_call(cmd, cwd=cwd, shell=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions