|
1 |
| -Chisel Project Template |
2 |
| -======================= |
| 1 | +# Introduction |
3 | 2 |
|
4 |
| -You've done the [Chisel Bootcamp](https://github.com/freechipsproject/chisel-bootcamp), and now you |
5 |
| -are ready to start your own Chisel project. The following procedure should get you started |
6 |
| -with a clean running [Chisel3](https://www.chisel-lang.org/) project. |
| 3 | +This is a demo project using [Chisel](https://github.com/chipsalliance/chisel). It begins with the [Chisel template](https://github.com/chipsalliance/chisel-template) and includes additional **pre-commit** configuration. |
7 | 4 |
|
8 |
| -## Make your own Chisel3 project |
| 5 | +I have included several practice solutions in the `src/main/scala/hdlbits` folder. The generated simulation files and Verilog files will be placed in the `gen` and `simWorkspace` folders. |
9 | 6 |
|
10 |
| -### Dependencies |
11 |
| - |
12 |
| -#### JDK 8 or newer |
13 |
| - |
14 |
| -We recommend LTS releases Java 8 and Java 11. You can install the JDK as your operating system recommends, or use the prebuilt binaries from [AdoptOpenJDK](https://adoptopenjdk.net/). |
15 |
| - |
16 |
| -#### SBT or mill |
17 |
| - |
18 |
| -SBT is the most common build tool in the Scala community. You can download it [here](https://www.scala-sbt.org/download.html). |
19 |
| -mill is another Scala/Java build tool without obscure DSL like SBT. You can download it [here](https://github.com/com-lihaoyi/mill/releases) |
20 |
| - |
21 |
| -#### Verilator |
22 |
| - |
23 |
| -The test with `svsim` needs Verilator installed. |
24 |
| -See Verilator installation instructions [here](https://verilator.org/guide/latest/install.html). |
25 |
| - |
26 |
| -### How to get started |
27 |
| - |
28 |
| -#### Create a repository from the template |
29 |
| - |
30 |
| -This repository is a Github template. You can create your own repository from it by clicking the green `Use this template` in the top right. |
31 |
| -Please leave `Include all branches` **unchecked**; checking it will pollute the history of your new repository. |
32 |
| -For more information, see ["Creating a repository from a template"](https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template). |
33 |
| - |
34 |
| -#### Wait for the template cleanup workflow to complete |
35 |
| - |
36 |
| -After using the template to create your own blank project, please wait a minute or two for the `Template cleanup` workflow to run which will removes some template-specific stuff from the repository (like the LICENSE). |
37 |
| -Refresh the repository page in your browser until you see a 2nd commit by `actions-user` titled `Template cleanup`. |
38 |
| - |
39 |
| - |
40 |
| -#### Clone your repository |
41 |
| - |
42 |
| -Once you have created a repository from this template and the `Template cleanup` workflow has completed, you can click the green button to get a link for cloning your repository. |
43 |
| -Note that it is easiest to push to a repository if you set up SSH with Github, please see the [related documentation](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/connecting-to-github-with-ssh). SSH is required for pushing to a Github repository when using two-factor authentication. |
44 |
| - |
45 |
| -```sh |
46 |
| -git clone git@github.com:ttboma/chisel-hdlbits.git |
47 |
| -cd chisel-hdlbits |
48 |
| -``` |
49 |
| - |
50 |
| -#### Set project organization and name in build.sbt |
51 |
| - |
52 |
| -The cleanup workflow will have attempted to provide sensible defaults for `ThisBuild / organization` and `name` in the `build.sbt`. |
53 |
| -Feel free to use your text editor of choice to change them as you see fit. |
54 |
| - |
55 |
| -#### Clean up the README.md file |
56 |
| - |
57 |
| -Again, use you editor of choice to make the README specific to your project. |
58 |
| - |
59 |
| -#### Add a LICENSE file |
60 |
| - |
61 |
| -It is important to have a LICENSE for open source (or closed source) code. |
62 |
| -This template repository has the Unlicense in order to allow users to add any license they want to derivative code. |
63 |
| -The Unlicense is stripped when creating a repository from this template so that users do not accidentally unlicense their own work. |
64 |
| - |
65 |
| -For more information about a license, check out the [Github Docs](https://docs.github.com/en/free-pro-team@latest/github/building-a-strong-community/adding-a-license-to-a-repository). |
66 |
| - |
67 |
| -#### Commit your changes |
68 |
| -```sh |
69 |
| -git commit -m 'Starting chisel-hdlbits' |
70 |
| -git push origin main |
71 |
| -``` |
72 |
| - |
73 |
| -### Did it work? |
74 |
| - |
75 |
| -You should now have a working Chisel3 project. |
76 |
| - |
77 |
| -You can run the included test with: |
78 |
| -```sh |
79 |
| -sbt test |
80 |
| -``` |
81 |
| - |
82 |
| -Alternatively, if you use Mill: |
83 |
| -```sh |
84 |
| -mill chisel-hdlbits.test |
85 |
| -``` |
86 |
| - |
87 |
| -You should see a whole bunch of output that ends with something like the following lines |
88 |
| -``` |
89 |
| -[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0 |
90 |
| -[info] All tests passed. |
91 |
| -[success] Total time: 5 s, completed Dec 16, 2020 12:18:44 PM |
92 |
| -``` |
93 |
| -If you see the above then... |
94 |
| - |
95 |
| -### It worked! |
96 |
| - |
97 |
| -You are ready to go. We have a few recommended practices and things to do. |
98 |
| - |
99 |
| -* Use packages and following conventions for [structure](https://www.scala-sbt.org/1.x/docs/Directories.html) and [naming](http://docs.scala-lang.org/style/naming-conventions.html) |
100 |
| -* Package names should be clearly reflected in the testing hierarchy |
101 |
| -* Build tests for all your work |
102 |
| -* Read more about testing in SBT in the [SBT docs](https://www.scala-sbt.org/1.x/docs/Testing.html) |
103 |
| -* This template includes a [test dependency](https://www.scala-sbt.org/1.x/docs/Library-Dependencies.html#Per-configuration+dependencies) on [ScalaTest](https://www.scalatest.org/). This, coupled with `svsim` (included with Chisel) and `verilator`, are a starting point for testing Chisel generators. |
104 |
| - * You can remove this dependency in the build.sbt file if you want to |
105 |
| -* Change the name of your project in the build.sbt file |
106 |
| -* Change your README.md |
107 |
| - |
108 |
| -## Problems? Questions? |
109 |
| - |
110 |
| -Check out the [Chisel Users Community](https://www.chisel-lang.org/community.html) page for links to get in contact! |
| 7 | +Please note that these solutions are not necessarily optimal, but rather intended to help you gradually work through the SpinalHDL language. |
0 commit comments