1
0
Fork 0
mirror of https://git.sr.ht/~kivikakk/niar synced 2024-12-23 01:03:13 +00:00

template: clean up template project.

This commit is contained in:
Asherah Connor 2024-07-02 12:59:02 +03:00
parent db7ca3b5d2
commit 4db4fc2509
4 changed files with 19 additions and 21 deletions

View file

@ -19,4 +19,4 @@ jobs:
- uses: kivikakk/niar/setup-action@main - uses: kivikakk/niar/setup-action@main
- name: Run tests - name: Run tests
run: pytest -n auto tests run: pytest

View file

@ -45,7 +45,7 @@ int main(int argc, char **argv) {
// ledr should be low or high according to 'expected', where each element // ledr should be low or high according to 'expected', where each element
// represents 1/4th of a second. ledg should always be high. // represents 1/4th of a second. ledg should always be high.
// //
// This mirrors TestTop in Python. // This mirrors test_blinks in Python.
int rc = 0; int rc = 0;
bool done = false; bool done = false;

View file

@ -8,7 +8,7 @@ authors = [
dependencies = [ dependencies = [
"amaranth >= 0.5, < 0.7", "amaranth >= 0.5, < 0.7",
"amaranth-boards", "amaranth-boards",
"niar >= 0.1", "niar >= 0.1.1",
] ]
requires-python = ">=3.8" requires-python = ">=3.8"
license = {text = "BSD-2-Clause"} license = {text = "BSD-2-Clause"}
@ -16,3 +16,7 @@ license = {text = "BSD-2-Clause"}
[build-system] [build-system]
requires = ["pdm-backend"] requires = ["pdm-backend"]
build-backend = "pdm.backend" build-backend = "pdm.backend"
[tool.pytest.ini_options]
addopts = ["-n", "auto"]
testpaths = ["tests"]

View file

@ -1,8 +1,5 @@
import unittest
from amaranth.hdl import Fragment from amaranth.hdl import Fragment
from amaranth.sim import Simulator from amaranth.sim import Simulator
from newproject.rtl import Blinker from newproject.rtl import Blinker
@ -11,10 +8,7 @@ class test:
default_clk_frequency = 8.0 default_clk_frequency = 8.0
class TestBlinker(unittest.TestCase): def test_blinks():
platform = test()
def test_blinks(self):
dut = Blinker() dut = Blinker()
async def testbench(ctx): async def testbench(ctx):
@ -24,7 +18,7 @@ class TestBlinker(unittest.TestCase):
assert ctx.get(dut.ledg) assert ctx.get(dut.ledg)
await ctx.tick() await ctx.tick()
sim = Simulator(Fragment.get(dut, self.platform)) sim = Simulator(Fragment.get(dut, test()))
sim.add_clock(1 / 8) sim.add_clock(1 / 8)
sim.add_testbench(testbench) sim.add_testbench(testbench)
sim.run() sim.run()