You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
4.0 KiB

8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. # vivado-git
  2. Trying to make Vivado more git-friendly.
  3. ### Requirements
  4. - Tested on Vivado 2019.2
  5. #### Windows
  6. - [Git for Windows](https://git-scm.com/download/win)
  7. - Add `C:\Program Files\Git\bin` (or wherever you have your `git.exe`) to your `PATH`
  8. #### Linux
  9. - Git
  10. ### Installation
  11. Add `Vivado_init.tcl` (or append the relevant lines if you already have
  12. something in it) along with the `scripts` directory to:
  13. - `%APPDATA%\Roaming\Xilinx\Vivado` on Windows
  14. - `~/.Xilinx/Vivado` on Linux
  15. ### How it works
  16. Vivado is a pain in the ass to source control decently, so these scripts provide:
  17. - A modified `write_project_tcl_git.tcl` script to generate the project script
  18. without absolute paths.
  19. - A git wrapper that will recreate the project script and add it before committing.
  20. - A Tcl script (`wproj`) to just create the Tcl project generator script without
  21. using git. This script can be called from the Tcl Console on Vivado.
  22. ### Workflow
  23. 1. When first starting a project, create it in a folder called `vivado_project`
  24. (e.g. `PROJECT_NAME/vivado_project`). All the untracked files will be under this directory.
  25. 2. Place your source files anywhere you want in your project folder
  26. (e.g. `PROJECT_NAME/src`).
  27. Here is an example of a possible project structure:
  28. ```
  29. PROJECT_NAME
  30. ├── .git
  31. ├── .gitignore
  32. ├── project_name.tcl # Project generator script
  33. ├── src/ # Tracked source files
  34. │ ├── design
  35. │ │ ├── *.v
  36. │ │ └── *.vhd
  37. │ ├── testbench
  38. │ │ ├── *.v
  39. │ │ └── *.vhd
  40. │ └── ...
  41. └── vivado_project/ # Untracked generated files
  42. ├── project_name.xpr
  43. ├── project_name.cache/
  44. ├── project_name.hw/
  45. ├── project_name.sim/
  46. ├── project_name.srcs/
  47. │ ├── sources_1/
  48. │ │ ├── bd/ # BDs are regenerated from script
  49. │ │ │ ├── my_bd/hdl/my_bd_wrapper.{v,vhd} # BD wrappers are also regenerated
  50. │ │ │ └── ...
  51. │ │ └── ...
  52. │ └── ...
  53. └── ...
  54. ```
  55. 3. Initialize the git repository with `git init` on the Tcl Console. This will
  56. create the repository, automatically change to your project directory
  57. (`PROJECT_NAME`), generate the `.gitignore` file and stage it.
  58. 4. Stage your source files with `git add`.
  59. 5. When you are done, `git commit` your project. A `PROJECT_NAME.tcl`
  60. script will be created in your `PROJECT_NAME` folder and added to your commit.
  61. 6. Afterwards, when opening the project after cloning it, do it by using
  62. `Tools -> Run Tcl Script...` and selecting the `PROJECT_NAME.tcl` file
  63. created earlier. This will regenerate the project so that you can continue to work.
  64. ### Notes
  65. ### Block design support
  66. If a block design is present, Tcl processes will be integrated in the project
  67. generator file to regenerate it.
  68. The script will also automatically create and add the BD wrapper to the project.
  69. The wrapper of the `.bd` file **must** be called `${bd_name}_wrapper`
  70. (e.g. `my_awesome_bd_wrapper` if your BD is called `my_awesome_bd`),
  71. which is the default when creating in the GUI with `Create HDL Wrapper...`.
  72. The BD wrapper that is automatically generated by Vivado **must not** be
  73. tracked by Git. If you need to manually modify the BD wrapper generated by Vivado,
  74. you can write a handwritten wrapper to the generated wrapper and put only the
  75. handwritten one under source control.
  76. #### Board part and IP repositories paths
  77. Only board part and IP repositories inside the project are stored in the project
  78. generator script.
  79. If you have a system wide board part or IP repository, you will need to add it manually
  80. after recreating the project from the Tcl script (e.g. via `Settings --> Board Repository`).