Skip to content

Commit

Permalink
add assert info
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfel1 committed Jan 10, 2018
1 parent e99c1d8 commit 4ec0248
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions docs/site/tutorial/nw.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In this section, you will learn about the following components in Spatial:

- File IO and text management

- Breakpoints and Sleep
- Asserts, Breakpoints, and Sleep



Expand Down Expand Up @@ -222,7 +222,7 @@ we can use if/then/else to arbitrarily execute parts of the hardware.::
Generally, an FSM is a hardware version of a while loop. It allows you to arbitrarily branch between
control structures and selectively execute code until some breaking state condition is reached.

Breakpoints and Sleep
Asserts, Breakpoints, and Sleep
---------------------

There are sometimes cases where the app writer wants to escape the app early or pause the app for a period of time. In this
Expand All @@ -239,25 +239,25 @@ skipped and wants to know which of these conditions caused the exit::

if (score_matrix(b_addr,a_addr).ptr == ALIGN.to[Int16]) {
...
breakpoint() // Or exit()
breakpoint()
} else if (score_matrix(b_addr,a_addr).ptr == SKIPA.to[Int16]) {
...
breakpoint() // Or exit()
assert(score_matrix(b_addr,a_addr).ptr != SKIPA.to[Int16], "This is an assert example")
} else {
...
breakpoint() // Or exit()
exit()
}

Note that "breakpoint()" in this case is not the same as a breakpoint in software. A breakpoint here causes
the entire app to quit, rather than allowing the user to step through code manually. While functionality to
switch from the FPGA's built in clock to a manual clock to let the user manually step through cycles may be implemented
in the future, there are no current plans to support this.

The above code may generate output that looks like this if the third breakpoint was reached first (breakpoints are 0-indexed)::
The above code may generate output that looks like this if the second breakpoint were reached first (breakpoints are 0-indexed)::

===================
Breakpoint 2 triggered!
tutorial.scala:100:23
Breakpoint 1 triggered!
tutorial.scala:100:23 - This is an assert example
===================

In apps that interact with real external systems, such as pixel buffers, audio devices, and sensors, it may be very useful to
Expand Down
2 changes: 1 addition & 1 deletion docs/site/tutorial/starting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,5 @@ you find convenient:

- File IO and text management

- Breakpoints and Sleep
- Asserts, Breakpoints, and Sleep

16 changes: 8 additions & 8 deletions docs/source/tutorial/nw.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In this section, you will learn about the following components in Spatial:

- File IO and text management

- Breakpoints and Sleep
- Asserts, Breakpoints, and Sleep



Expand Down Expand Up @@ -214,7 +214,7 @@ we can use if/then/else to arbitrarily execute parts of the hardware.::
Generally, an FSM is a hardware version of a while loop. It allows you to arbitrarily branch between
control structures and selectively execute code until some breaking state condition is reached.

Breakpoints and Sleep
Asserts, Breakpoints, and Sleep
---------------------

There are sometimes cases where the app writer wants to escape the app early or pause the app for a period of time. In this
Expand All @@ -231,25 +231,25 @@ skipped and wants to know which of these conditions caused the exit::

if (score_matrix(b_addr,a_addr).ptr == ALIGN.to[Int16]) {
...
breakpoint() // Or exit()
breakpoint()
} else if (score_matrix(b_addr,a_addr).ptr == SKIPA.to[Int16]) {
...
breakpoint() // Or exit()
assert(score_matrix(b_addr,a_addr).ptr != SKIPA.to[Int16], "This is an assert example")
} else {
...
breakpoint() // Or exit()
exit()
}

Note that "breakpoint()" in this case is not the same as a breakpoint in software. A breakpoint here causes
the entire app to quit, rather than allowing the user to step through code manually. While functionality to
switch from the FPGA's built in clock to a manual clock to let the user manually step through cycles may be implemented
in the future, there are no current plans to support this.

The above code may generate output that looks like this if the third breakpoint was reached first (breakpoints are 0-indexed)::
The above code may generate output that looks like this if the second breakpoint were reached first (breakpoints are 0-indexed)::

===================
Breakpoint 2 triggered!
tutorial.scala:100:23
Breakpoint 1 triggered!
tutorial.scala:100:23 - This is an assert example
===================

In apps that interact with real external systems, such as pixel buffers, audio devices, and sensors, it may be very useful to
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial/starting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,5 @@ you find convenient:

- File IO and text management

- Breakpoints and Sleep
- Asserts, Breakpoints, and Sleep

0 comments on commit 4ec0248

Please sign in to comment.