@@ -149,8 +149,8 @@ def elaborate(self, platform):
149
149
150
150
151
151
class QSPIController (wiring .Component ):
152
- def __init__ ( self , ports , * , chip_count = 1 , use_ddr_buffers = False ):
153
- self . ioshape = IOShape ({
152
+ def pins ( chip_count = 1 ):
153
+ return IOShape ({
154
154
"sck" : ("o" , 1 ),
155
155
"io0" : ("io" , 1 ),
156
156
"io1" : ("io" , 1 ),
@@ -159,10 +159,10 @@ def __init__(self, ports, *, chip_count=1, use_ddr_buffers=False):
159
159
"cs" : ("o" , chip_count ),
160
160
})
161
161
162
- self ._ports = self .ioshape .check_ports (ports )
163
-
162
+ def __init__ (self , * , chip_count = 1 , use_ddr_buffers = False ):
164
163
self ._ddr = use_ddr_buffers
165
164
self ._chip_count = chip_count
165
+ self ._ioshape = self .pins (chip_count )
166
166
167
167
super ().__init__ (PortSignature ({
168
168
"o_octets" : In (stream .Signature (data .StructLayout ({
@@ -182,15 +182,16 @@ def elaborate(self, platform):
182
182
183
183
m = Module ()
184
184
185
+ self .ports = platform .get_ports ()
185
186
m .submodules .enframer = enframer = QSPIEnframer (chip_count = self ._chip_count )
186
187
connect (m , controller = flipped (self .o_octets ), enframer = enframer .octets )
187
188
188
- m .submodules .io_clocker = io_clocker = IOClocker (self .ioshape ,
189
+ m .submodules .io_clocker = io_clocker = IOClocker (self ._ioshape ,
189
190
clock = "sck" , o_ratio = ratio , meta_layout = QSPIMode )
190
191
connect (m , enframer = enframer .frames , io_clocker = io_clocker .i_stream )
191
192
m .d .comb += io_clocker .divisor .eq (self .divisor )
192
193
193
- m .submodules .io_streamer = io_streamer = IOStreamer (self .ioshape , self ._ports , init = {
194
+ m .submodules .io_streamer = io_streamer = IOStreamer (self ._ioshape , self ._ports , init = {
194
195
"sck" : {"o" : 1 , "oe" : 1 }, # Motorola "Mode 3" with clock idling high
195
196
"cs" : {"o" : 0 , "oe" : 1 }, # deselected
196
197
}, ratio = ratio , meta_layout = QSPIMode )
0 commit comments