migen/test: start unittests

This commit is contained in:
Robert Jördens 2013-11-29 01:47:32 -07:00 committed by Sebastien Bourdeauducq
parent 55afab2276
commit cb5e0953aa
3 changed files with 25 additions and 0 deletions

0
migen/test/__init__.py Normal file
View File

24
migen/test/support.py Normal file
View File

@ -0,0 +1,24 @@
import unittest
from migen.fhdl.std import *
from migen.sim.generic import Simulator
from migen.fhdl import verilog
class SimBench(Module):
callback = None
def do_simulation(self, s):
if self.callback is not None:
return self.callback(self, s)
class SimCase(unittest.TestCase):
TestBench = SimBench
def setUp(self):
self.tb = self.TestBench()
def test_to_verilog(self):
verilog.convert(self.tb)
def run_with(self, cb, cycles=-1):
self.tb.callback = cb
with Simulator(self.tb) as s:
s.run(cycles)

View File

@ -22,6 +22,7 @@ setup(
url="http://www.milkymist.org",
download_url="https://github.com/milkymist/migen",
packages=find_packages(here),
test_suite="migen.test",
license="BSD",
platforms=["Any"],
keywords="HDL ASIC FPGA hardware design",