Skip to content

Commit 754078b

Browse files
committed
address code review comments
1 parent ff117b9 commit 754078b

File tree

4 files changed

+842
-16
lines changed

4 files changed

+842
-16
lines changed

DirectProgramming/C++SYCL_FPGA/Tutorials/DesignPatterns/restartable_kernel/README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ flowchart LR
3838
3939
tier1 --> tier2 --> tier3 --> tier4
4040
41-
style tier1 fill:#f96,stroke:#0071c1,stroke-width:1px,color:#fff
41+
style tier1 fill:#0071c1,stroke:#0071c1,stroke-width:1px,color:#fff
4242
style tier2 fill:#0071c1,stroke:#0071c1,stroke-width:1px,color:#fff
43-
style tier3 fill:#0071c1,stroke:#333,stroke-width:1px,color:#fff
43+
style tier3 fill:#f96,stroke:#333,stroke-width:1px,color:#fff
4444
style tier4 fill:#0071c1,stroke:#0071c1,stroke-width:1px,color:#fff
4545
```
4646

@@ -82,7 +82,7 @@ while (keep_going) {
8282
}
8383
```
8484

85-
In this sample, `StopPipe` has been assigned the `protocol::avalon_mm_uses_ready` property so it terminates in the kernel's control/status register (CSR) instead of in a streaming interface. Terminating in the CSR allows this kernel to be managed by a memory-mapped host (such as a Nios® V softcore processor), while terminating in a streaming interface is convenient if this kernel were to be managed by another SYCL kernel. For details about the `protocol::avalon_mm_uses_ready` property, see the [CSR Pipes](/DirectProgramming/C++SYCL_FPGA/Tutorials/Features/hls_flow_interfaces/component_interfaces_comparison/csr-pipes) sub-sample within the [Component Interfaces Comparison](/DirectProgramming/C++SYCL_FPGA/Tutorials/Features/hls_flow_interfaces/component_interfaces_comparison) code sample.
85+
In this sample, `StopPipe` has been assigned the `protocol::avalon_mm_uses_ready` property so it is mapped to the kernel's control/status register (CSR) instead of a streaming interface. Mapping to the CSR allows this kernel to be managed by a memory-mapped host (such as a Nios® V softcore processor), but mapping to a streaming interface is convenient if this kernel were to be managed by another SYCL kernel. For details about the `protocol::avalon_mm_uses_ready` property, see the [CSR Pipes](/DirectProgramming/C++SYCL_FPGA/Tutorials/Features/hls_flow_interfaces/component_interfaces_comparison/csr-pipes) sub-sample within the [Component Interfaces Comparison](/DirectProgramming/C++SYCL_FPGA/Tutorials/Features/hls_flow_interfaces/component_interfaces_comparison) code sample.
8686

8787
![](assets/stopcsr.png)
8888

@@ -93,7 +93,19 @@ The testbench in `main.cpp` exercises the kernel in the following steps:
9393
3. Read 256 more outputs from the kernel, which should be a monotonically growing sequence starting at 263.
9494
4. Stop the kernel.
9595
5. Initialize the kernel with a new initialization value of 77.
96-
6. ead 256 more outputs from the kernel, which should be a monotonically growing sequence starting at 77.
96+
6. Read 256 more outputs from the kernel, which should be a monotonically growing sequence starting at 77.
97+
98+
### Packets
99+
100+
This design uses the Avalon `start_of_packet` signal to indicate when the a new set of values is being written to `OutputPipe`. The `start_of_packet` sideband signal is not *generally* necessary for implementing a restartable kernel, but it is used in this design to compensate for the decoupled way that the `RestartableCounter` kernel executes with respect to the host code. Since the host code does not tell `RestartableCounter` how many values to write to `OutputPipe`, the `RestartableCounter` will continue to write to `OutputPipe` until either
101+
102+
1. `OutputPipe` fills up, in which case the `RestartableCounter` kernel will stop incrementing its internal counter until the pipe can be written to again
103+
104+
2. A `true` is written to the `StopPipe`
105+
106+
Any data written to the `OutputPipe` between the host code writing a `true` to `StopPipe`, and the `RestartableCounter` kernel *consuming* the `true` from `StopPipe` will still be in `OutputPipe` the next time the host code tries to read from it, so it is necessary to flush these extra beats of data. The `start_of_packet` sideband signals the beginning of a new stream of counter data in `OutputPipe`.
107+
108+
![](assets/restartable_kernel_sequence_diagram.svg)
97109

98110
## Building the `restartable_kernel` Tutorial
99111

0 commit comments

Comments
 (0)