mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
test: add initial (minimal) test for clock abstraction modules.
Also fix divclk_divide_range on S6DCM.
This commit is contained in:
parent
c304c4db27
commit
eb9f54b2bc
2 changed files with 70 additions and 1 deletions
|
@ -229,7 +229,7 @@ class S6DCM(XilinxClocking):
|
||||||
self.logger = logging.getLogger("S6DCM")
|
self.logger = logging.getLogger("S6DCM")
|
||||||
self.logger.info("Creating S6DCM, {}.".format(colorer("speedgrade {}".format(speedgrade))))
|
self.logger.info("Creating S6DCM, {}.".format(colorer("speedgrade {}".format(speedgrade))))
|
||||||
XilinxClocking.__init__(self)
|
XilinxClocking.__init__(self)
|
||||||
self.divclk_divide_range = (1, 1) # FIXME
|
self.divclk_divide_range = (1, 2) # FIXME
|
||||||
self.clkin_freq_range = {
|
self.clkin_freq_range = {
|
||||||
-1: (0.5e6, 200e6),
|
-1: (0.5e6, 200e6),
|
||||||
-2: (0.5e6, 333e6),
|
-2: (0.5e6, 333e6),
|
||||||
|
|
69
test/test_clock.py
Normal file
69
test/test_clock.py
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
# This file is Copyright (c) 2020 Florent Kermarrec <florent@enjoy-digital.fr>
|
||||||
|
# License: BSD
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from litex.soc.cores.clock import *
|
||||||
|
|
||||||
|
|
||||||
|
class TestClock(unittest.TestCase):
|
||||||
|
# Xilinx / Spartan 6
|
||||||
|
def test_s6pll(self):
|
||||||
|
pll = S6PLL()
|
||||||
|
pll.register_clkin(Signal(), 100e6)
|
||||||
|
for i in range(pll.nclkouts_max):
|
||||||
|
pll.create_clkout(ClockDomain("clkout{}".format(i)), 200e6)
|
||||||
|
pll.compute_config()
|
||||||
|
|
||||||
|
def test_s6dcm(self):
|
||||||
|
dcm = S6DCM()
|
||||||
|
dcm.register_clkin(Signal(), 100e6)
|
||||||
|
for i in range(dcm.nclkouts_max):
|
||||||
|
dcm.create_clkout(ClockDomain("clkout{}".format(i)), 200e6)
|
||||||
|
dcm.compute_config()
|
||||||
|
|
||||||
|
# Xilinx / 7-Series
|
||||||
|
def test_s7pll(self):
|
||||||
|
pll = S7PLL()
|
||||||
|
pll.register_clkin(Signal(), 100e6)
|
||||||
|
for i in range(pll.nclkouts_max):
|
||||||
|
pll.create_clkout(ClockDomain("clkout{}".format(i)), 200e6)
|
||||||
|
pll.compute_config()
|
||||||
|
|
||||||
|
def test_s7mmcm(self):
|
||||||
|
mmcm = S7MMCM()
|
||||||
|
mmcm.register_clkin(Signal(), 100e6)
|
||||||
|
for i in range(mmcm.nclkouts_max):
|
||||||
|
mmcm.create_clkout(ClockDomain("clkout{}".format(i)), 200e6)
|
||||||
|
mmcm.compute_config()
|
||||||
|
|
||||||
|
# Xilinx / Ultrascale
|
||||||
|
def test_uspll(self):
|
||||||
|
pll = USPLL()
|
||||||
|
pll.register_clkin(Signal(), 100e6)
|
||||||
|
for i in range(pll.nclkouts_max):
|
||||||
|
pll.create_clkout(ClockDomain("clkout{}".format(i)), 200e6)
|
||||||
|
pll.compute_config()
|
||||||
|
|
||||||
|
def test_usmmcm(self):
|
||||||
|
mmcm = USMMCM()
|
||||||
|
mmcm.register_clkin(Signal(), 100e6)
|
||||||
|
for i in range(mmcm.nclkouts_max):
|
||||||
|
mmcm.create_clkout(ClockDomain("clkout{}".format(i)), 200e6)
|
||||||
|
mmcm.compute_config()
|
||||||
|
|
||||||
|
# Lattice / iCE40
|
||||||
|
def test_ice40pll(self):
|
||||||
|
pll = USMMCM()
|
||||||
|
pll.register_clkin(Signal(), 100e6)
|
||||||
|
for i in range(pll.nclkouts_max):
|
||||||
|
pll.create_clkout(ClockDomain("clkout{}".format(i)), 200e6)
|
||||||
|
pll.compute_config()
|
||||||
|
|
||||||
|
# Lattice / ECP5
|
||||||
|
def test_ecp5pll(self):
|
||||||
|
pll = ECP5PLL()
|
||||||
|
pll.register_clkin(Signal(), 100e6)
|
||||||
|
for i in range(pll.nclkouts_max):
|
||||||
|
pll.create_clkout(ClockDomain("clkout{}".format(i)), 200e6)
|
||||||
|
pll.compute_config()
|
Loading…
Reference in a new issue