1717from litex .soc .integration .builder import *
1818from litex .soc .cores .video import VideoVGAPHY
1919from litex .soc .cores .led import LedChaser
20+ from litex .soc .cores .seven_seg import SevenSegmentDisplay
2021
2122from litedram .modules import MT47H64M16
2223from litedram .phy import s7ddrphy
@@ -54,6 +55,7 @@ def __init__(self, platform, sys_clk_freq):
5455class BaseSoC (SoCCore ):
5556 def __init__ (self , sys_clk_freq = 75e6 ,
5657 with_spi_flash = False ,
58+ with_seven_seg = False ,
5759 with_ethernet = False ,
5860 with_etherbone = False ,
5961 eth_ip = "192.168.1.50" ,
@@ -82,7 +84,16 @@ def __init__(self, sys_clk_freq=75e6,
8284 module = MT47H64M16 (sys_clk_freq , "1:2" ),
8385 l2_cache_size = kwargs .get ("l2_size" , 8192 )
8486 )
85-
87+
88+ # 7-Segment Display ------------------------------------------------------------------------
89+ if with_seven_seg :
90+ self .seven_seg = SevenSegmentDisplay (
91+ sys_clk_freq = sys_clk_freq ,
92+ segments_pads = platform .request ("seven_seg" ),
93+ anodes_pads = platform .request ("seven_seg_ctrl_n" ),
94+ )
95+ self .csr .add ("seven_seg" )
96+
8697 # SPI Flash --------------------------------------------------------------------------------
8798 if with_spi_flash :
8899 from litespi .modules import S25FL128S
@@ -122,7 +133,8 @@ def main():
122133 ethopts = parser .target_group .add_mutually_exclusive_group ()
123134 ethopts .add_argument ("--with-ethernet" , action = "store_true" , help = "Enable Ethernet support." )
124135 ethopts .add_argument ("--with-etherbone" , action = "store_true" , help = "Enable Etherbone support." )
125- parser .add_target_argument ("--with-spi-flash" , action = "store_true" , help = "Enable memory-mapped SPI flash." )
136+ parser .add_target_argument ("--with-spi-flash" , action = "store_true" , help = "Enable memory-mapped SPI flash." )
137+ parser .add_target_argument ("--with-seven-seg" , action = "store_true" , help = "Enable 7-segment display support." )
126138 parser .add_target_argument ("--eth-ip" , default = "192.168.1.50" , help = "Ethernet/Etherbone IP address." )
127139 parser .add_target_argument ("--eth-dynamic-ip" , action = "store_true" , help = "Enable dynamic Ethernet IP assignment." )
128140 parser .add_target_argument ("--remote-ip" , default = "192.168.1.100" , help = "Remote IP address of TFTP server." )
@@ -139,6 +151,7 @@ def main():
139151 with_ethernet = args .with_ethernet ,
140152 with_etherbone = args .with_etherbone ,
141153 with_spi_flash = args .with_spi_flash ,
154+ with_seven_seg = args .with_seven_seg ,
142155 eth_ip = args .eth_ip ,
143156 eth_dynamic_ip = args .eth_dynamic_ip ,
144157 remote_ip = args .remote_ip ,
0 commit comments