Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add RTL blackbox #145

Open
logosAllen opened this issue Dec 25, 2023 · 1 comment
Open

How to add RTL blackbox #145

logosAllen opened this issue Dec 25, 2023 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@logosAllen
Copy link

Hi all,

Is there any way to add my RTL blackbox into TAPA project?
Since some blocks are more suitable in RTL.
Thanks.

@Blaok
Copy link
Collaborator

Blaok commented Dec 28, 2023

Hi @logosAllen,

It is indeed possible, although the process is somewhat manual. Let me explain with the vadd example, which is usually compiled into .xo as follows:

tapa --work-dir /home/ubuntu/tapa/build/Debug/apps/vadd/VecAdd.xilinx_u250_gen3x16_xdma_4_1_202210_1.hw.xo.tapa \
  analyze -f /home/ubuntu/tapa/apps/vadd/vadd.cpp --top VecAdd \
  synth --platform xilinx_u250_gen3x16_xdma_4_1_202210_1 \
  link \
  pack --output /home/ubuntu/tapa/build/Debug/apps/vadd/VecAdd.xilinx_u250_gen3x16_xdma_4_1_202210_1.hw.xo

To add an RTL blackbox, you'll still want to provide an HLS implementation so that csim can work. The body of the fake implementation can be #ifdef __SYNTHESIS__ protected so that you don't have to make it synthesizable. HLS will still generate proper interfaces so that your RTL blackbox can match those interfaces. To inject the RTL blackbox, you'll need to break the above single CLI command into two parts.

First, run steps up to HLS so that the RTL files are generated:

tapa --work-dir /home/ubuntu/tapa/build/Debug/apps/vadd/VecAdd.xilinx_u250_gen3x16_xdma_4_1_202210_1.hw.xo.tapa \
  analyze -f /home/ubuntu/tapa/apps/vadd/vadd.cpp --top VecAdd \
  synth --platform xilinx_u250_gen3x16_xdma_4_1_202210_1 \
  link

You can then replace the RTL files under hdl of the work directory (/home/ubuntu/tapa/build/Debug/apps/vadd/VecAdd.xilinx_u250_gen3x16_xdma_4_1_202210_1.hw.xo.tapa/hdl in the example).

Finally, pack the RTL files:

tapa --work-dir /home/ubuntu/tapa/build/Debug/apps/vadd/VecAdd.xilinx_u250_gen3x16_xdma_4_1_202210_1.hw.xo.tapa \
  pack --output /home/ubuntu/tapa/build/Debug/apps/vadd/VecAdd.xilinx_u250_gen3x16_xdma_4_1_202210_1.hw.xo

Note that Vivado does not seem to do any checking when packing .xo; no error will be reported until you run RTL simulation, if there are syntax errors in your RTL file.

You might want to leverage to TAPA's fast RTL simulation feature to iterate quickly.

@dotkrnl dotkrnl added the enhancement New feature or request label Sep 19, 2024
@dotkrnl dotkrnl added this to the 2024 Q4 milestone Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants