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
15 changed files
with
100 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Example | ||
|
||
Simple example of how to pack and use packed components to build testbench. |
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,3 @@ | ||
# dummy_math_lib | ||
|
||
Simple SystemVerilog package without extra dependencies. |
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,4 @@ | ||
"""Dummy math library.""" | ||
from pip_hdl import PackageMetaInfo | ||
|
||
metainfo = PackageMetaInfo("dummy_math_lib") |
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,9 @@ | ||
package dummy_math_lib_pkg; | ||
function automatic bit is_divisible_by_3(int unsigned number); | ||
return (number % 3) == 0; | ||
endfunction | ||
|
||
function automatic bit is_divisible_by_5(int unsigned number); | ||
return (number % 5) == 0; | ||
endfunction | ||
endpackage |
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 @@ | ||
${DUMMY_MATH_LIB_SOURCES_ROOT}/dummy_math_lib_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[tool.poetry] | ||
name = "dummy-math-lib" | ||
version = "0.1.0" | ||
description = "Example for pip-hdl: dummy math library" | ||
authors = ["esynr3z <esynr3z@gmail.com>"] | ||
classifiers = [ | ||
"Private :: Do not Upload", # Prevent uploading to PyPI | ||
] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.8" | ||
pip_hdl = "^0.1" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
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,3 @@ | ||
# fizzbuzz_agent_pkg | ||
|
||
SystemVerilog package with some agent and single dependency. |
4 changes: 4 additions & 0 deletions
4
example/pack_sv_code_with_dependencies/fizzbuzz_agent/__init__.py
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,4 @@ | ||
"""Fizz-buzz agent.""" | ||
from pip_hdl import PackageMetaInfo | ||
|
||
metainfo = PackageMetaInfo("fizzbuzz_agent") |
1 change: 1 addition & 0 deletions
1
example/pack_sv_code_with_dependencies/fizzbuzz_agent/filelist.f
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 @@ | ||
${FIZZBUZZ_AGENT_SOURCES_ROOT}/fizzbuzz_agent_pkg.sv |
24 changes: 24 additions & 0 deletions
24
example/pack_sv_code_with_dependencies/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package hdlp_fizzbuzz_agent_pkg; | ||
import dummy_math_lib_pkg::is_divisible_by_3; | ||
import dummy_math_lib_pkg::is_divisible_by_5; | ||
|
||
class fizzbuzz_agent; | ||
function run_sequence(int unsigned limit); | ||
for (int i = 0; i < limit; i++) begin | ||
string msg; | ||
|
||
if (dummy_math_lib_pkg::is_divisible_by_5(i) && dummy_math_lib_pkg::is_divisible_by_3(i)) begin | ||
msg = "FizzBuzz"; | ||
end else if (dummy_math_lib_pkg::is_divisible_by_3(i)) begin | ||
msg = "Fizz"; | ||
end else if (dummy_math_lib_pkg::is_divisible_by_5(i)) begin | ||
msg = "Buzz"; | ||
end else begin | ||
msg = $sformatf("%0d", i); | ||
end | ||
|
||
$display(msg); | ||
end | ||
endfunction : run_sequence | ||
endclass : fizzbuzz_agent | ||
endpackage |
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,17 @@ | ||
[tool.poetry] | ||
name = "fizzbuzz-agent" | ||
version = "0.1.0" | ||
description = "Example for pip-hdl: agent to create fizz-buzz sequence" | ||
authors = ["esynr3z <esynr3z@gmail.com>"] | ||
classifiers = [ | ||
"Private :: Do not Upload", # Prevent uploading to PyPI | ||
] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.8" | ||
pip_hdl = "^0.1" | ||
dummy_math_lib = "^0.1" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
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 @@ | ||
# FIXME |
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,3 @@ | ||
# Testbench | ||
|
||
Simple testbench that uses an agent, described in `requirements.txt` |
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 @@ | ||
fizzbuzz_agent==0.1.0 |
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,10 @@ | ||
module tb; | ||
import fizzbuzz_agent_pkg::fizzbuzz_agent; | ||
|
||
initial begin | ||
fizzbuzz_agent agent = new(); | ||
|
||
agent.run_sequence(100); | ||
$finish(); | ||
end | ||
endmodule |