1
+ # Support for the Pipistrello - http://pipistrello.saanlima.com/
1
2
from fractions import Fraction
2
- import struct
3
3
4
4
from migen .fhdl .std import *
5
5
from migen .genlib .resetsync import AsyncResetSynchronizer
6
6
from migen .bus import wishbone
7
7
8
8
from misoclib .com import gpio
9
+ from misoclib .mem .flash import spiflash
9
10
from misoclib .mem .sdram .module import MT46H32M16
10
11
from misoclib .mem .sdram .phy import s6ddrphy
11
12
from misoclib .mem .sdram .core .lasmicon import LASMIconSettings
12
- from misoclib .mem .flash import spiflash
13
13
from misoclib .soc .sdram import SDRAMSoC
14
14
15
15
from gateware import dna
16
16
from gateware import firmware
17
17
from gateware import git_info
18
18
from gateware import hdmi_out
19
+ from gateware import i2c
19
20
from gateware import i2c_hack
20
21
from gateware import platform_info
21
22
@@ -133,16 +134,18 @@ class BaseSoC(SDRAMSoC):
133
134
134
135
mem_map = {
135
136
"firmware_ram" : 0x20000000 , # (default shadow @0xa0000000)
137
+ "spiflash" : 0x30000000 , # (default shadow @0xb0000000)
136
138
}
137
139
mem_map .update (SDRAMSoC .mem_map )
138
140
139
- def __init__ (self , platform , clk_freq = (83 + Fraction (1 , 3 ))* 1000 * 1000 ,
140
- sdram_controller_settings = LASMIconSettings (l2_size = 32 ,
141
- with_bandwidth = True ),
142
- firmware_ram_size = 0xa000 , firmware_filename = None , ** kwargs ):
141
+ def __init__ (self , platform ,
142
+ firmware_ram_size = 0xa000 ,
143
+ firmware_filename = None ,
144
+ ** kwargs ):
145
+ clk_freq = (83 + Fraction (1 , 3 ))* 1000 * 1000
143
146
SDRAMSoC .__init__ (self , platform , clk_freq ,
144
147
integrated_rom_size = 0x8000 ,
145
- sdram_controller_settings = sdram_controller_settings ,
148
+ sdram_controller_settings = LASMIconSettings ( l2_size = 32 , with_bandwidth = True ) ,
146
149
** kwargs )
147
150
148
151
platform .add_extension (PipistrelloCustom )
@@ -169,19 +172,12 @@ def __init__(self, platform, clk_freq=(83 + Fraction(1, 3))*1000*1000,
169
172
]
170
173
self .register_sdram_phy (self .ddrphy )
171
174
172
- if not self .integrated_rom_size :
173
- self .submodules .spiflash = spiflash .SpiFlash (platform .request ("spiflash4x" ),
174
- dummy = 10 , div = 4 )
175
- self .add_constant ("SPIFLASH_PAGE_SIZE" , 256 )
176
- self .add_constant ("SPIFLASH_SECTOR_SIZE" , 0x10000 )
177
- self .flash_boot_address = 0x180000
178
- self .register_rom (self .spiflash .bus , 0x1000000 )
179
- platform .add_platform_command ("""PIN "hdmi_out_pix_bufg.O" CLOCK_DEDICATED_ROUTE = FALSE;""" )
180
-
181
- _hdmi_infos = {
182
- "HDMI_OUT0_MNEMONIC" : "J4" ,
183
- "HDMI_OUT0_DESCRIPTION" : "XXX" ,
184
- }
175
+ self .submodules .spiflash = spiflash .SpiFlash (
176
+ platform .request ("spiflash4x" ), dummy = platform .spiflash_read_dummy_bits , div = platform .spiflash_clock_div )
177
+ self .add_constant ("SPIFLASH_PAGE_SIZE" , platform .spiflash_page_size )
178
+ self .add_constant ("SPIFLASH_SECTOR_SIZE" , platform .spiflash_sector_size )
179
+ self .flash_boot_address = self .mem_map ["spiflash" ]+ platform .gateware_size
180
+ self .register_mem ("spiflash" , self .mem_map ["spiflash" ], self .spiflash .bus , size = platform .gateware_size )
185
181
186
182
187
183
class VideomixerSoC (BaseSoC ):
@@ -196,7 +192,9 @@ def __init__(self, platform, **kwargs):
196
192
self .submodules .hdmi_out0 = hdmi_out .HDMIOut (
197
193
platform .request ("hdmi" , 0 ), self .sdram .crossbar .get_master ())
198
194
199
- for k , v in _hdmi_infos .items ():
195
+ platform .add_platform_command ("""PIN "hdmi_out_pix_bufg.O" CLOCK_DEDICATED_ROUTE = FALSE;""" )
196
+
197
+ for k , v in platform .hdmi_infos .items ():
200
198
self .add_constant (k , v )
201
199
202
200
default_subtarget = VideomixerSoC
0 commit comments