@@ -52,7 +52,7 @@ def __init__(self, platform, sys_clk_freq):
5252
5353class BaseSoC (SoCCore ):
5454 def __init__ (self , sys_clk_freq = int (125e6 ), with_ethernet = False , with_led_chaser = True ,
55- with_pcie = False , with_sata = False , ** kwargs ):
55+ with_spi_flash = False , with_pcie = False , with_sata = False , ** kwargs ):
5656 platform = kc705 .Platform ()
5757
5858 # CRG --------------------------------------------------------------------------------------
@@ -81,6 +81,12 @@ def __init__(self, sys_clk_freq=int(125e6), with_ethernet=False, with_led_chaser
8181 clk_freq = self .clk_freq )
8282 self .add_ethernet (phy = self .ethphy )
8383
84+ # SPI Flash --------------------------------------------------------------------------------
85+ if with_spi_flash :
86+ from litespi .modules import N25Q128A13
87+ from litespi .opcodes import SpiNorFlashOpCodes as Codes
88+ self .add_spi_flash (mode = "4x" , module = N25Q128A13 (Codes .READ_1_1_4 ), rate = "1:1" , with_master = True )
89+
8490 # PCIe -------------------------------------------------------------------------------------
8591 if with_pcie :
8692 self .submodules .pcie_phy = S7PCIEPHY (platform , platform .request ("pcie_x4" ),
@@ -134,22 +140,24 @@ def main():
134140 from litex .soc .integration .soc import LiteXSoCArgumentParser
135141 parser = LiteXSoCArgumentParser (description = "LiteX SoC on KC705" )
136142 target_group = parser .add_argument_group (title = "Target options" )
137- target_group .add_argument ("--build" , action = "store_true" , help = "Build bitstream." )
138- target_group .add_argument ("--load" , action = "store_true" , help = "Load bitstream." )
139- target_group .add_argument ("--sys-clk-freq" , default = 125e6 , help = "System clock frequency." )
140- target_group .add_argument ("--with-ethernet" , action = "store_true" , help = "Enable Ethernet support." )
141- target_group .add_argument ("--with-pcie" , action = "store_true" , help = "Enable PCIe support." )
142- target_group .add_argument ("--driver" , action = "store_true" , help = "Generate PCIe driver." )
143- target_group .add_argument ("--with-sata" , action = "store_true" , help = "Enable SATA support (over SFP2SATA)." )
143+ target_group .add_argument ("--build" , action = "store_true" , help = "Build bitstream." )
144+ target_group .add_argument ("--load" , action = "store_true" , help = "Load bitstream." )
145+ target_group .add_argument ("--sys-clk-freq" , default = 125e6 , help = "System clock frequency." )
146+ target_group .add_argument ("--with-ethernet" , action = "store_true" , help = "Enable Ethernet support." )
147+ target_group .add_argument ("--with-spi-flash" , action = "store_true" , help = "Enable SPI Flash (MMAPed)." )
148+ target_group .add_argument ("--with-pcie" , action = "store_true" , help = "Enable PCIe support." )
149+ target_group .add_argument ("--driver" , action = "store_true" , help = "Generate PCIe driver." )
150+ target_group .add_argument ("--with-sata" , action = "store_true" , help = "Enable SATA support (over SFP2SATA)." )
144151 builder_args (parser )
145152 soc_core_args (parser )
146153 args = parser .parse_args ()
147154
148155 soc = BaseSoC (
149- sys_clk_freq = int (float (args .sys_clk_freq )),
150- with_ethernet = args .with_ethernet ,
151- with_pcie = args .with_pcie ,
152- with_sata = args .with_sata ,
156+ sys_clk_freq = int (float (args .sys_clk_freq )),
157+ with_ethernet = args .with_ethernet ,
158+ with_spi_flash = args .with_spi_flash ,
159+ with_pcie = args .with_pcie ,
160+ with_sata = args .with_sata ,
153161 ** soc_core_argdict (args )
154162 )
155163 builder = Builder (soc , ** builder_argdict (args ))
0 commit comments