Replaced Blinky with LedChaser.

This commit is contained in:
Derek Mulcahy 2021-12-24 22:14:18 -05:00
parent 154cb672da
commit a118a0e499
1 changed files with 10 additions and 20 deletions

View File

@ -21,8 +21,7 @@ from litex.soc.interconnect import wishbone
from litex.soc.cores.clock import * from litex.soc.cores.clock import *
from litex.soc.integration.soc_core import * from litex.soc.integration.soc_core import *
from litex.soc.integration.builder import * from litex.soc.integration.builder import *
from litex.soc.cores.led import LedChaser
from litex.build.generic_platform import Pins, IOStandard, Subsignal
# UTILS --------------------------------------------------------------------------------------------- # UTILS ---------------------------------------------------------------------------------------------
@ -38,12 +37,6 @@ def load_ps7(soc, xci_file):
os.system("cp -p " + xci_file + " " + dst) os.system("cp -p " + xci_file + " " + dst)
soc.cpu.set_ps7_xci(dst) soc.cpu.set_ps7_xci(dst)
class Blinky(Module):
def __init__(self, led, sys_clk_freq, period=1e0):
counter = Signal(max=int(period * sys_clk_freq))
self.comb += led.eq(counter[counter.nbits-1])
self.sync += counter.eq(counter + 1)
# CRG ---------------------------------------------------------------------------------------------- # CRG ----------------------------------------------------------------------------------------------
class _CRG(Module): class _CRG(Module):
@ -71,10 +64,10 @@ class _CRG(Module):
class BaseSoC(SoCCore): class BaseSoC(SoCCore):
def __init__(self, def __init__(self,
sys_clk_freq = int(100e6), sys_clk_freq = int(100e6),
ext_clk_freq = None, ext_clk_freq = None,
with_blinky = True, with_led_chaser = True,
xci_file = None, xci_file = None,
**kwargs): **kwargs):
platform = snickerdoodle.Platform() platform = snickerdoodle.Platform()
@ -117,12 +110,11 @@ class BaseSoC(SoCCore):
platform.add_platform_command("set_property BITSTREAM.GENERAL.COMPRESS True [current_design]") platform.add_platform_command("set_property BITSTREAM.GENERAL.COMPRESS True [current_design]")
if with_blinky: # Leds -------------------------------------------------------------------------------------
self.submodules.blinky = Blinky( if with_led_chaser:
led = platform.request("user_led"), self.submodules.leds = LedChaser(
sys_clk_freq = sys_clk_freq, pads = platform.request_all("user_led"),
period = 1 sys_clk_freq = sys_clk_freq)
)
# Build -------------------------------------------------------------------------------------------- # Build --------------------------------------------------------------------------------------------
@ -130,7 +122,6 @@ def main():
parser = argparse.ArgumentParser(description="LiteX SoC on Snickerdoodle") parser = argparse.ArgumentParser(description="LiteX SoC on Snickerdoodle")
parser.add_argument("--build", action="store_true", help="Build bitstream") parser.add_argument("--build", action="store_true", help="Build bitstream")
parser.add_argument("--load", action="store_true", help="Load bitstream") parser.add_argument("--load", action="store_true", help="Load bitstream")
parser.add_argument("--with-blinky", default=True, action="store_true", help="Enable Blinky")
parser.add_argument("--ext-clk-freq", default=10e6, type=float, help="External Clock Frequency") parser.add_argument("--ext-clk-freq", default=10e6, type=float, help="External Clock Frequency")
parser.add_argument("--sys-clk-freq", default=100e6, type=float, help="System clock frequency") parser.add_argument("--sys-clk-freq", default=100e6, type=float, help="System clock frequency")
parser.add_argument("--xci-file", help="XCI file for PS7 configuration") parser.add_argument("--xci-file", help="XCI file for PS7 configuration")
@ -143,7 +134,6 @@ def main():
soc = BaseSoC( soc = BaseSoC(
sys_clk_freq = args.sys_clk_freq, sys_clk_freq = args.sys_clk_freq,
ext_clk_freq = args.ext_clk_freq, ext_clk_freq = args.ext_clk_freq,
with_blinky = args.with_blinky,
xci_file = args.xci_file, xci_file = args.xci_file,
**soc_core_argdict(args) **soc_core_argdict(args)
) )