generated from esynr3z/template-python-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
72 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,31 @@ | ||
# Example | ||
|
||
Simple example of how to pack and use packed components to build testbench. | ||
Simple example of how to pack and use packed components to build a testbench. | ||
|
||
- `dummy_math_lib` - root directory for `dummy_math_lib` package | ||
- `fizzbuzz_agent` - root directory for `fizzbuzz_agent` package, which depends on `dummy_math_lib` | ||
- `testbench` - directory with testbench using `fizzbuzz_agent` | ||
|
||
Normally, to run testbench you simply need to install all dependencies using | ||
|
||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
|
||
However, mentioned packages are protected from publishing to PyPi with the special [trove classifier](https://pypi.org/classifiers/), but you still can pack and install them locally. | ||
|
||
Make sure that you have [poetry](https://python-poetry.org/) installed: | ||
|
||
```bash | ||
pip install poetry | ||
``` | ||
|
||
Then you can build [.whl](https://peps.python.org/pep-0427/) and install it to your system: | ||
|
||
```bash | ||
cd <package_root> | ||
poetry build | ||
pip install dist/<package>.whl | ||
``` | ||
|
||
After all packages are installed try to run the testbench in [Verilator](https://www.veripool.org/verilator/) using `make`. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...cies/fizzbuzz_agent/fizzbuzz_agent_pkg.sv → ...gent/fizzbuzz_agent/fizzbuzz_agent_pkg.sv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
obj_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.PHONY: all clean build sim | ||
|
||
BIN := Vtop | ||
NPROC := 4 | ||
|
||
# Export all variables needed for filelists | ||
$(foreach var, $(shell pip-hdl inspect requirements.txt all_sources_vars), $(eval export $(var))) | ||
|
||
BUILD_OPTS = \ | ||
--timescale 1ns/1ps \ | ||
--cc \ | ||
--binary \ | ||
--timing \ | ||
-O3 \ | ||
-j $(NPROC) \ | ||
-o $(BIN) | ||
|
||
SOURCES = \ | ||
$(shell pip-hdl inspect requirements.txt all_filelists_as_args) \ | ||
tb.sv | ||
|
||
all: clean build sim | ||
|
||
clean: | ||
rm -rf obj_dir | ||
|
||
build: | ||
# This export is an alternative to a global foreach loop export above | ||
#export $(shell pip-hdl inspect requirements.txt all_sources_vars);\ | ||
verilator $(BUILD_OPTS) $(SOURCES) | ||
|
||
sim: | ||
./obj_dir/$(BIN) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Testbench | ||
|
||
Simple testbench that uses an agent, described in `requirements.txt` | ||
|
||
Python packages `pip-hdl`, `fizzbuzz-agent` and `dummy-math-lib` have to be installed. | ||
|
||
Run `make` to build and simulate the example in Verilator. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.