Skip to content

Commit 2547821

Browse files
committed
Add doc about blackbox io clock domain specification
1 parent b85f86a commit 2547821

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

source/SpinalHDL/Structuring/blackbox.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,43 @@ For example:
163163
mapCurrentClockDomain(io.clkB)
164164
}
165165
166+
By default the ports of the blackbox are considered clock-less, meaning no clock crossing checks will be made on their usage. You can specify ports clock domain by using the ClockDomainTag :
167+
168+
.. code-block:: scala
169+
170+
class DemoBlackbox extends BlackBox {
171+
val io = new Bundle{
172+
val clk, rst = in Bool()
173+
val a = in Bool()
174+
val b = out Bool()
175+
}
176+
mapCurrentClockDomain(io.clk, io.rst)
177+
ClockDomainTag(this.clockDomain)(
178+
io.a,
179+
io.b
180+
)
181+
}
182+
183+
You can also apply the tag to the whole bundle with :
184+
185+
.. code-block:: scala
186+
val io = new Bundle{
187+
val clk, rst = in Bool()
188+
val a = in Bool()
189+
val b = out Bool()
190+
}
191+
ClockDomainTag(this.clockDomain)(io)
192+
193+
You can also apply the current clock domain to all the ports using (SpinalHDL 1.10.2):
194+
195+
.. code-block:: scala
196+
val io = new Bundle{
197+
val clk, rst = in Bool()
198+
val a = in Bool()
199+
val b = out Bool()
200+
}
201+
setIoCd()
202+
166203
io prefix
167204
---------
168205

0 commit comments

Comments
 (0)