README.md 3.11 KB
Newer Older
Jens Korinth's avatar
Jens Korinth committed
1
2
3
Chisel IP-XACT packaging for Xilinx Vivado Design Suite
=======================================================

Jens Korinth's avatar
Jens Korinth committed
4
Helper scripts and Scala classes to simplify the generation of IP-XACT IP cores from Chisel.
5
6
7
8
9
10
Uses [*Xilinx Vivado Design Suite*] [2] to infer most of the interfaces automatically.
The resulting `component.xml` files can be edited manually or with Vivado, if the automagic
did not fit your needs.

Requirements
----------------------
Jens Korinth's avatar
Jens Korinth committed
11
12
13
14

*   Vivado 2016.x+
*   Chisel 3.x *(currently using `3.0-SNAPSHOT`)*
*   *optional*: sbt
Jens Korinth's avatar
Jens Korinth committed
15

Jens Korinth's avatar
Jens Korinth committed
16
17
Basic Usage
-----------
Jens Korinth's avatar
Jens Korinth committed
18

Jens Korinth's avatar
Jens Korinth committed
19
20
Class `ModuleBuilder` provides an abstract base class for an executable object with a `main`
method. You'll only need to provide a list of Chisel cores you'd like to wrap into IP-XACT.
21
A full example can be found in `example`; test it as follows:
Jens Korinth's avatar
Jens Korinth committed
22

Jens Korinth's avatar
Jens Korinth committed
23
24
25
1.   Source the Vivado settings scripts, make sure `vivado` is in the `PATH`.
2.   In the `chisel-packaging` base dir, do:  
      
26
        cp example/* .
27
        
Jens Korinth's avatar
Jens Korinth committed
28
3.   Execute via:
29
30
31
        
        sbt run
        
Jens Korinth's avatar
Jens Korinth committed
32
4.   This should create a new directory `ip`, which contains subdirectories for each core.
Jens Korinth's avatar
Jens Korinth committed
33
34
35
36
37
     The subdirectories contain the Verilog sources and the IP-XACT `component.xml`.

You can use the `ip` directory as a base directory for user IP in Vivado, the cores should
automatically appear in Vivado and IP-Integrator.

Jens Korinth's avatar
Jens Korinth committed
38
39
40

Usage in Chisel Projects (*sbt*)
--------------------------------
Jens Korinth's avatar
Jens Korinth committed
41

42
43
The easiest way to setup `chisel-packaging` for your Chisel project with `sbt` is using
**git subtree** ([this article] [1] has an excellent intro to subtrees) as follows:
Jens Korinth's avatar
Jens Korinth committed
44

Jens Korinth's avatar
Jens Korinth committed
45
1.   In your the base directory of your project, add a new remote *chisel-packaging*:
46
47
48
        
        git remote add chisel-packaging https://bitbucket.org/jkorinth/chisel-packaging.git
        
Jens Korinth's avatar
Jens Korinth committed
49
50
2.   Setup a subtree in `packaging`:
       
51
        git subtree add --prefix packaging chisel-packaging master --squash
Jens Korinth's avatar
Jens Korinth committed
52
      
53
    This will clone the `chisel-packaging` into the `packaging` folder.
Jens Korinth's avatar
Jens Korinth committed
54
55
    
3.   Add a project dependency in your `build.sbt`, add lines:
56
57
58
59
60
        
        lazy val packaging = project.in(file("packaging"))
        
        lazy val root = (project in file(".")).dependsOn(packaging)
        
Jens Korinth's avatar
Jens Korinth committed
61
    
62
    *Note that the empty lines are **not optional** - a quirk of sbt.*
Jens Korinth's avatar
Jens Korinth committed
63
64
    
4.   Implement `chisel.packaging.ModuleBuilder` in your own code; if you've chosen
Jens Korinth's avatar
Jens Korinth committed
65
     a different directory than `packaging` for the subtree, you can pass it to the
66
     baseclass constructor -- see [example/ModuleBuilderTest.scala][3]
Jens Korinth's avatar
Jens Korinth committed
67
68
     
5.   Build the IP-XACT cores via `sbt run`.
Jens Korinth's avatar
Jens Korinth committed
69
70
71

Gotchas
-------
Jens Korinth's avatar
Jens Korinth committed
72
73

*   The python script requires `vivado` to be in `PATH`, so you need to source the Vivado
Jens Korinth's avatar
Jens Korinth committed
74
    settings scripts first.
Jens Korinth's avatar
Jens Korinth committed
75
*   The repo is setup for Chisel 3.x; it can be used for Chisel 2.x, but that requires
Jens Korinth's avatar
Jens Korinth committed
76
    manual changes - open an issue in the issue tracker if you need it.
Jens Korinth's avatar
Jens Korinth committed
77
*   If you're using the `sbt` approach outlined above, make sure your `build.sbt` contains
Jens Korinth's avatar
Jens Korinth committed
78
79
    the empty lines; they are required by `sbt`.

Jens Korinth's avatar
Jens Korinth committed
80
[1]: https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree
81
82
[2]: https://www.xilinx.com/products/design-tools/vivado.html
[3]: example/ModuleBuilderTest.scala