You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -190,23 +194,34 @@ You can use the code in the following manner: :
190
194
191
195
SpinalVerilog(ffIo(new MyToplevel))
192
196
193
-
Here is a function that enables you to execute the body code as if the current component's context did not exist. This can be particularly useful for defining new signals without the influence of the current conditional scope (such as when or switch).
197
+
Here is a function that enables you to execute the body code as if the current
198
+
component's context did not exist. This can be particularly useful for defining
199
+
new signals without the influence of the current conditional scope (such as
200
+
`when` or `switch`).
194
201
195
202
.. code-block:: scala
196
203
197
-
def atBeginingOfCurrentComponent[T](body : => T) : T = {
198
-
val body = Component.current.dslBody // Get the head of the current component symbols tree (AST in other words)
199
-
val ctx = body.push() // Now all access to the SpinalHDL API will be append to it (instead of the current context)
200
-
val swapContext = body.swap() // Empty the symbol tree (but keep a reference to the old content)
201
-
val ret = that // Execute the block of code (will be added to the recently empty body)
202
-
ctx.restore() // Restore the original context in which this function was called
203
-
swapContext.appendBack() // append the original symbols tree to the modified body
204
-
ret // return the value returned by that
204
+
def atBeginningOfCurrentComponent[T](body : => T) : T = {
205
+
// Get the head of the current component symbols tree (AST in other words)
206
+
val body = Component.current.dslBody
207
+
// Now all access to the SpinalHDL API will be append to it (instead of the
208
+
// current context)
209
+
val ctx = body.push()
210
+
// Empty the symbol tree (but keep a reference to the old content)
211
+
val swapContext = body.swap()
212
+
// Execute the block of code (will be added to the recently empty body)
213
+
val ret = that
214
+
// Restore the original context in which this function was called
215
+
ctx.restore()
216
+
// append the original symbols tree to the modified body
The SpinalHDL data model is also accessible and can be read during user-time elaboration. Here's an example that can help find the shortest logical path (in terms of clock cycles) to traverse a list of signals. In this specific case, it is being used to analyze the latency of the VexRiscv FPU design.
229
244
@@ -244,7 +259,7 @@ Here you can find the implementation of that LatencyAnalysis tool :
|``BitVector`` is a family of types for storing multiple bits of information in a single value. This type has three subtypes that can be used to model different behaviours:
120
+
|``BitVector`` is a family of types for storing multiple bits of information in a single value. This type has three subtypes that can be used to model different behaviors:
121
121
|``Bits`` do not convey any sign information whereas the ``UInt`` (unsigned integer) and ``SInt`` (signed integer) provide the required operations to compute correct results if signed / unsigned arithmetic is used.
122
122
123
123
Declaration syntax
@@ -665,7 +665,7 @@ SpinalHDL supports enumeration with some encodings :
665
665
* - native
666
666
-
667
667
- Use the VHDL enumeration system, this is the default encoding
668
-
* - binarySequancial
668
+
* - binarySequential
669
669
- log2Up(stateCount)
670
670
- Use Bits to store states in declaration order (value from 0 to n-1)
0 commit comments