Skip to content

Commit

Permalink
[Ci/Cd] Add shell.
Browse files Browse the repository at this point in the history
  • Loading branch information
egorman44 committed Aug 24, 2024
1 parent 3bbc335 commit 978b141
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 118 deletions.
5 changes: 4 additions & 1 deletion .github/actions/cocotb-sim/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ runs:
using: "composite"
steps:
- name: Install Dependencies
shell: bash
run: |
ls
sudo apt-get update
sudo apt-get install -y libunwind-dev
sudo apt-get install -y git help2man perl make autoconf g++ flex libfl-dev bison ccache numactl perl-doc
- name: Install Verilator
if: steps.verilator-cache.outputs.cache-hit != 'true'
shell: bash
run: |
git clone https://github.com/verilator/verilator.git
cd verilator
Expand All @@ -28,11 +29,13 @@ runs:
python-version: '3.10'

- name: Install Python packages
shell: bash
run: |
pip install cocotb==1.8.1
pip install reedsolo
- name: run sim
shell: bash
working-directory: ./coco_sim
run: |
python3 rs_decoder.py -l RsBlockRecovery
110 changes: 2 additions & 108 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,110 +1,4 @@
Chisel Project Template
=======================

You've done the [Chisel Bootcamp](https://github.com/freechipsproject/chisel-bootcamp), and now you
are ready to start your own Chisel project. The following procedure should get you started
with a clean running [Chisel3](https://www.chisel-lang.org/) project.
runMain Rs.GenRsBlockRecovery --axis-clock 156.25 --core-clock 125.00 --symb-width 8 --bus-width 8 --poly 285 --fcr 0 --n-len 255 --k-len 239

## Make your own Chisel3 project

### Dependencies

#### JDK 8 or newer

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/).

#### SBT or mill

SBT is the most common build tool in the Scala community. You can download it [here](https://www.scala-sbt.org/download.html).
mill is another Scala/Java build tool without obscure DSL like SBT. You can download it [here](https://github.com/com-lihaoyi/mill/releases)

#### Verilator

The test with `svsim` needs Verilator installed.
See Verilator installation instructions [here](https://verilator.org/guide/latest/install.html).

### How to get started

#### Create a repository from the template

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.
Please leave `Include all branches` **unchecked**; checking it will pollute the history of your new repository.
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).

#### Wait for the template cleanup workflow to complete

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).
Refresh the repository page in your browser until you see a 2nd commit by `actions-user` titled `Template cleanup`.


#### Clone your repository

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.
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.

```sh
git clone [email protected]:egorman44/chisel-lib.git
cd chisel-lib
```

#### Set project organization and name in build.sbt

The cleanup workflow will have attempted to provide sensible defaults for `ThisBuild / organization` and `name` in the `build.sbt`.
Feel free to use your text editor of choice to change them as you see fit.

#### Clean up the README.md file

Again, use you editor of choice to make the README specific to your project.

#### Add a LICENSE file

It is important to have a LICENSE for open source (or closed source) code.
This template repository has the Unlicense in order to allow users to add any license they want to derivative code.
The Unlicense is stripped when creating a repository from this template so that users do not accidentally unlicense their own work.

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).

#### Commit your changes
```sh
git commit -m 'Starting chisel-lib'
git push origin main
```

### Did it work?

You should now have a working Chisel3 project.

You can run the included test with:
```sh
sbt test
```

Alternatively, if you use Mill:
```sh
mill chisel-lib.test
```

You should see a whole bunch of output that ends with something like the following lines
```
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[success] Total time: 5 s, completed Dec 16, 2020 12:18:44 PM
```
If you see the above then...

### It worked!

You are ready to go. We have a few recommended practices and things to do.

* 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)
* Package names should be clearly reflected in the testing hierarchy
* Build tests for all your work
* Read more about testing in SBT in the [SBT docs](https://www.scala-sbt.org/1.x/docs/Testing.html)
* 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.
* You can remove this dependency in the build.sbt file if you want to
* Change the name of your project in the build.sbt file
* Change your README.md

## Problems? Questions?

Check out the [Chisel Users Community](https://www.chisel-lang.org/community.html) page for links to get in contact!
docker build -t verilator-coco .
1 change: 1 addition & 0 deletions coco_sim/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def read_json(file_path):
print("================")
print(f"\t AXIS_CLOCK = {AXIS_CLOCK}")
print(f"\t CORE_CLOCK = {CORE_CLOCK}")
print(f"\t BUS_WIDTH = {BUS_WIDTH}")
print(f"\t SINGLE_CLOCK = {SINGLE_CLOCK}")
print(f"\t POLY = {POLY}")
print(f"\t N_LEN = {N_LEN}")
Expand Down
18 changes: 9 additions & 9 deletions rs.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"AXIS_CLOCK" : 156.25,
"CORE_CLOCK" : 156.25,
"SYMB_WIDTH" : 8,
"BUS_WIDTH" : 8,
"POLY" : 285,
"FCR" : 0,
"N_LEN" : 255,
"K_LEN" : 239
}
"AXIS_CLOCK" : 156.25,
"CORE_CLOCK" : 125,
"SYMB_WIDTH" : 8,
"BUS_WIDTH" : 4,
"POLY" : 285,
"FCR" : 0,
"N_LEN" : 255,
"K_LEN" : 239
}

0 comments on commit 978b141

Please sign in to comment.