2017-04-24 13:13:17 -04:00
|
|
|
import unittest
|
2017-04-24 13:25:58 -04:00
|
|
|
import os
|
2017-04-24 13:13:17 -04:00
|
|
|
|
2018-02-23 07:38:19 -05:00
|
|
|
from migen import *
|
2017-04-24 13:13:17 -04:00
|
|
|
|
|
|
|
from litex.soc.integration.builder import *
|
|
|
|
|
|
|
|
|
|
|
|
def build_test(socs):
|
2017-04-24 13:25:58 -04:00
|
|
|
errors = 0
|
2017-04-24 13:13:17 -04:00
|
|
|
for soc in socs:
|
2017-04-24 13:25:58 -04:00
|
|
|
os.system("rm -rf build")
|
|
|
|
builder = Builder(soc, output_dir="./build", compile_software=False, compile_gateware=False)
|
2017-04-24 13:13:17 -04:00
|
|
|
builder.build()
|
2017-04-24 13:25:58 -04:00
|
|
|
errors += not os.path.isfile("./build/gateware/top.v")
|
|
|
|
os.system("rm -rf build")
|
|
|
|
return errors
|
2017-04-24 13:13:17 -04:00
|
|
|
|
|
|
|
|
|
|
|
class TestTargets(unittest.TestCase):
|
2019-04-22 02:32:00 -04:00
|
|
|
kwargs = {"cpu_type": "vexriscv"}
|
2018-09-23 19:15:33 -04:00
|
|
|
# altera boards
|
2017-04-24 13:13:17 -04:00
|
|
|
def test_de0nano(self):
|
|
|
|
from litex.boards.targets.de0nano import BaseSoC
|
2019-04-22 02:32:00 -04:00
|
|
|
errors = build_test([BaseSoC(**self.kwargs)])
|
2017-04-24 13:25:58 -04:00
|
|
|
self.assertEqual(errors, 0)
|
2017-04-24 13:13:17 -04:00
|
|
|
|
2018-09-23 19:15:33 -04:00
|
|
|
# xilinx boards
|
2017-04-24 13:13:17 -04:00
|
|
|
def test_minispartan6(self):
|
|
|
|
from litex.boards.targets.minispartan6 import BaseSoC
|
2019-04-22 02:32:00 -04:00
|
|
|
errors = build_test([BaseSoC(**self.kwargs)])
|
2017-04-24 13:25:58 -04:00
|
|
|
self.assertEqual(errors, 0)
|
2017-04-24 13:13:17 -04:00
|
|
|
|
2018-09-23 19:15:33 -04:00
|
|
|
def test_arty(self):
|
|
|
|
from litex.boards.targets.arty import BaseSoC, EthernetSoC
|
2019-04-22 02:32:00 -04:00
|
|
|
errors = build_test([BaseSoC(**self.kwargs), EthernetSoC(**self.kwargs)])
|
2018-09-23 19:15:33 -04:00
|
|
|
self.assertEqual(errors, 0)
|
|
|
|
|
|
|
|
def test_nexys4ddr(self):
|
|
|
|
from litex.boards.targets.nexys4ddr import BaseSoC
|
2019-04-22 02:32:00 -04:00
|
|
|
errors = build_test([BaseSoC(**self.kwargs)])
|
2018-09-23 19:15:33 -04:00
|
|
|
self.assertEqual(errors, 0)
|
|
|
|
|
2017-04-24 13:13:17 -04:00
|
|
|
def test_nexys_video(self):
|
2018-09-23 19:15:33 -04:00
|
|
|
from litex.boards.targets.nexys_video import BaseSoC, EthernetSoC
|
2019-04-22 02:32:00 -04:00
|
|
|
errors = build_test([BaseSoC(**self.kwargs), EthernetSoC(**self.kwargs)])
|
2018-09-23 19:15:33 -04:00
|
|
|
self.assertEqual(errors, 0)
|
|
|
|
|
|
|
|
def test_genesys2(self):
|
|
|
|
from litex.boards.targets.genesys2 import BaseSoC, EthernetSoC
|
2019-04-22 02:32:00 -04:00
|
|
|
errors = build_test([BaseSoC(**self.kwargs), EthernetSoC(**self.kwargs)])
|
2018-09-23 19:15:33 -04:00
|
|
|
self.assertEqual(errors, 0)
|
|
|
|
|
|
|
|
def test_kc705(self):
|
|
|
|
from litex.boards.targets.kc705 import BaseSoC, EthernetSoC
|
2019-04-22 02:32:00 -04:00
|
|
|
errors = build_test([BaseSoC(**self.kwargs), EthernetSoC(**self.kwargs)])
|
2018-09-23 19:15:33 -04:00
|
|
|
self.assertEqual(errors, 0)
|
|
|
|
|
|
|
|
# lattice boards
|
2018-11-17 11:36:57 -05:00
|
|
|
def test_versa_ecp5(self):
|
|
|
|
from litex.boards.targets.versa_ecp5 import BaseSoC
|
2019-04-22 02:32:00 -04:00
|
|
|
errors = build_test([BaseSoC(**self.kwargs)])
|
2018-11-17 11:36:57 -05:00
|
|
|
self.assertEqual(errors, 0)
|
|
|
|
|
|
|
|
def test_versa_ulx3s(self):
|
|
|
|
from litex.boards.targets.ulx3s import BaseSoC
|
2019-04-22 02:32:00 -04:00
|
|
|
errors = build_test([BaseSoC(**self.kwargs)])
|
2018-11-17 11:36:57 -05:00
|
|
|
self.assertEqual(errors, 0)
|
|
|
|
|
2018-09-23 20:01:47 -04:00
|
|
|
# build simple design for all platforms
|
|
|
|
def test_simple(self):
|
|
|
|
platforms = [
|
|
|
|
"arty",
|
|
|
|
"de0nano",
|
|
|
|
"genesys2",
|
|
|
|
"kc705",
|
|
|
|
"kcu105",
|
|
|
|
"machxo3",
|
|
|
|
"minispartan6",
|
|
|
|
"nexys4ddr",
|
|
|
|
"nexys_video",
|
|
|
|
"tinyfpga_bx",
|
2018-11-17 11:36:57 -05:00
|
|
|
"versa_ecp3",
|
|
|
|
"versa_ecp5"
|
2018-09-23 20:01:47 -04:00
|
|
|
]
|
|
|
|
for p in platforms:
|
2019-04-22 02:53:43 -04:00
|
|
|
os.system("litex/boards/targets/simple.py litex.boards.platforms." + p +
|
2019-04-22 02:32:00 -04:00
|
|
|
" --cpu-type=vexriscv " +
|
2018-09-23 20:01:47 -04:00
|
|
|
" --no-compile-software " +
|
|
|
|
" --no-compile-gateware " +
|
|
|
|
" --uart-stub=True")
|