@@ -146,6 +146,31 @@ def add_clock_constraint(self, clock, frequency):
146
146
super ().add_clock_constraint (clock , frequency )
147
147
clock .attrs ["keep" ] = "true"
148
148
149
+ @property
150
+ def default_clk_constraint (self ):
151
+ # Internal high-speed oscillator on Cyclone V devices.
152
+ # It is specified to not be faster than 100MHz, but the actual
153
+ # frequency seems to vary a lot between devices. Measurements
154
+ # of 78 to 84 MHz have been observed.
155
+ if self .default_clk == "cyclonev_oscillator" :
156
+ assert self .device .startswith ("5C" )
157
+ return Clock (100e6 )
158
+ # Otherwise, use the defined Clock resource.
159
+ return super ().default_clk_constraint
160
+
161
+ def create_missing_domain (self , name ):
162
+ if name == "sync" and self .default_clk == "cyclonev_oscillator" :
163
+ # Use the internal high-speed oscillator for Cyclone V devices
164
+ assert self .device .startswith ("5C" )
165
+ m = Module ()
166
+ m .domains += ClockDomain ("sync" )
167
+ m .submodules += Instance ("cyclonev_oscillator" ,
168
+ i_oscena = Const (1 ),
169
+ o_clkout = ClockSignal ("sync" ))
170
+ return m
171
+ else :
172
+ return super ().create_missing_domain (name )
173
+
149
174
# The altiobuf_* and altddio_* primitives are explained in the following Intel documents:
150
175
# * https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/ug/ug_altiobuf.pdf
151
176
# * https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/ug/ug_altddio.pdf
0 commit comments