Compare commits
No commits in common. "ff4d52ba5b0a55fe5c20ec7f4d1e531b6ae7be8c" and "a75b77d8e5232323339876e61e389903d3748f1f" have entirely different histories.
ff4d52ba5b
...
a75b77d8e5
|
@ -19,8 +19,6 @@ jobs:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- if: ${{ env.ACT }}
|
|
||||||
run: sudo apt-get update
|
|
||||||
- run: sudo apt-get install -y asciidoctor
|
- run: sudo apt-get install -y asciidoctor
|
||||||
- id: config
|
- id: config
|
||||||
uses: actions/configure-pages@v2
|
uses: actions/configure-pages@v2
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
name: Run test suite
|
|
||||||
|
|
||||||
on:
|
|
||||||
push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
- name: Install dependencies missing in act
|
|
||||||
if: ${{ env.ACT }}
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y python3-dev
|
|
||||||
- name: Get pip cache dir
|
|
||||||
id: pip-cache
|
|
||||||
run: |
|
|
||||||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
|
|
||||||
- name: Cache pip dependencies
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ${{ steps.pip-cache.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-pip-
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
||||||
sudo apt-get install -y fpga-icestorm iverilog nextpnr-ice40 yosys-dev
|
|
||||||
python3 -m venv venv
|
|
||||||
venv/bin/pip install -r requirements.txt
|
|
||||||
- name: Run tests
|
|
||||||
run: |
|
|
||||||
source venv/bin/activate
|
|
||||||
make -k test
|
|
|
@ -1,3 +0,0 @@
|
||||||
asyncstdlib==3.12.2
|
|
||||||
cocotb @ git+https://git@github.com/Forty-Bot/cocotb.git@8810af1a66c461217dc00d0aa47043b8ea130f65
|
|
||||||
find_libpython==0.3.0
|
|
26
tb/util.py
26
tb/util.py
|
@ -2,7 +2,6 @@
|
||||||
# Copyright (C) 2022 Sean Anderson <seanga2@gmail.com>
|
# Copyright (C) 2022 Sean Anderson <seanga2@gmail.com>
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import itertools
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import cocotb
|
import cocotb
|
||||||
|
@ -80,20 +79,28 @@ class ReverseList(list):
|
||||||
return super().__reversed__()
|
return super().__reversed__()
|
||||||
|
|
||||||
def one_valid():
|
def one_valid():
|
||||||
return itertools.repeat(1)
|
return 1
|
||||||
|
|
||||||
def two_valid():
|
def two_valid():
|
||||||
return itertools.repeat(2)
|
return 2
|
||||||
|
|
||||||
def rand_valid():
|
def rand_valid():
|
||||||
while True:
|
return random.randrange(3)
|
||||||
yield random.randrange(3)
|
|
||||||
|
|
||||||
def saw_valid():
|
class saw_valid:
|
||||||
return itertools.cycle(range(3))
|
def __init__(self):
|
||||||
|
self.last = 0
|
||||||
|
# Lie for TestFactory
|
||||||
|
self.__qualname__ = self.__class__.__qualname__
|
||||||
|
|
||||||
|
def __call__(self):
|
||||||
|
self.last += 1
|
||||||
|
if self.last > 2:
|
||||||
|
self.last = 0
|
||||||
|
return self.last
|
||||||
|
|
||||||
def with_valids(g, f):
|
def with_valids(g, f):
|
||||||
for valids in (one_valid, two_valid, rand_valid, saw_valid):
|
for valids in (one_valid, two_valid, rand_valid, saw_valid()):
|
||||||
async def test(*args, valids=valids, **kwargs):
|
async def test(*args, valids=valids, **kwargs):
|
||||||
await f(*args, valids=valids, **kwargs)
|
await f(*args, valids=valids, **kwargs)
|
||||||
test.__name__ = f"{f.__name__}_{valids.__qualname__}"
|
test.__name__ = f"{f.__name__}_{valids.__qualname__}"
|
||||||
|
@ -105,7 +112,8 @@ async def send_recovered_bits(clk, data, valid, bits, valids):
|
||||||
bits = iter(bits)
|
bits = iter(bits)
|
||||||
await FallingEdge(clk)
|
await FallingEdge(clk)
|
||||||
try:
|
try:
|
||||||
for v in valids():
|
while True:
|
||||||
|
v = valids()
|
||||||
if v == 0:
|
if v == 0:
|
||||||
d = 'XX'
|
d = 'XX'
|
||||||
elif v == 1:
|
elif v == 1:
|
||||||
|
|
Loading…
Reference in New Issue