EPFL-LAP / dynamatic

DHLS (Dynamic High-Level Synthesis) compiler based on MLIR
Other
49 stars 14 forks source link

[experimental][hdl] Support for handshake::sharing_wrapper in the experimental VHDL backend #85

Open Jiahui17 opened 2 months ago

Jiahui17 commented 2 months ago

This PR introduces new features to the RTL generation flow (handshake -> hw -> RTL) by supporting resource sharing circuit. This PR adds handling to the handshake.sharing_wrapper operation (a handshake module that manages access to the shared operation) introduced in #77.

This PR depends on the changes in #96 (floating-point arithmetic units in the experimental backend).

Changes:

  1. HandshakeToHW.cpp: adding hw attributes of sharing wrapper to the corresponding hw op.
  2. sharing-wrapper-generator: RTL generator binary for sharing-wrapper.
  3. rtl-config.json: rules for calling the sharing-wrapper-generator.
  4. vhdl/support/sharing_support.vhd: dependency modules of the sharing-wrapper (implementation for priority encoder, arbiter, branch, mux, etc).

The following bash script can be used to test the circuit generation flow with resource sharing:

#!/bin/bash

SIMPLE_BUFFERS="--simple-buffers"
SIMPLE_BUFFERS=""
SHARING=""
SHARING="--sharing"

f_benchmark_src="polyn_mult/polyn_mult.c"
f_benchmark_src="float_basic/float_basic.c"
f_benchmark_src="gsum/gsum.c"

echo "set-dynamatic-path ./dynamatic; \
  set-src ./dynamatic/integration-test/$f_benchmark_src; \
  set-clock-period 4; \
  compile $SIMPLE_BUFFERS $SHARING; \
  write-hdl --experimental; \
  simulate --experimental; \
  exit" \
  | dynamatic/bin/dynamatic --exit-on-failure --debug

exit

This PR does not add support for handshake::sharing_wrapper in the legacy .dot backend, therefore, compile.sh has to be changed for the script above to work, i.e., remove the line below: https://github.com/EPFL-LAP/dynamatic/blob/b053ab8ccfda97ec5db06cd7352e10e556004253/tools/dynamatic/scripts/compile.sh#L180

---  export_dot "legacy" "$KERNEL_NAME"