1
0
Fork 0
mirror of https://git.sr.ht/~kivikakk/niar synced 2024-12-22 19:22:24 +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
- 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
// 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;
bool done = false;

View file

@ -8,7 +8,7 @@ authors = [
dependencies = [
"amaranth >= 0.5, < 0.7",
"amaranth-boards",
"niar >= 0.1",
"niar >= 0.1.1",
]
requires-python = ">=3.8"
license = {text = "BSD-2-Clause"}
@ -16,3 +16,7 @@ license = {text = "BSD-2-Clause"}
[build-system]
requires = ["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.sim import Simulator
from newproject.rtl import Blinker
@ -11,10 +8,7 @@ class test:
default_clk_frequency = 8.0
class TestBlinker(unittest.TestCase):
platform = test()
def test_blinks(self):
def test_blinks():
dut = Blinker()
async def testbench(ctx):
@ -24,7 +18,7 @@ class TestBlinker(unittest.TestCase):
assert ctx.get(dut.ledg)
await ctx.tick()
sim = Simulator(Fragment.get(dut, self.platform))
sim = Simulator(Fragment.get(dut, test()))
sim.add_clock(1 / 8)
sim.add_testbench(testbench)
sim.run()