slaclab / surf

A huge VHDL library for FPGA development
Other
343 stars 55 forks source link

use surf in a project #916

Closed Ahmad-Zaklouta closed 2 years ago

Ahmad-Zaklouta commented 2 years ago

Hi! I have been looking into the AxiStreamRepeater.vhd and I need to use it in a project. How can I add the surf library to my project? I see in the code:

library surf;
use surf.StdRtlPkg.all;
use surf.AxiStreamPkg.all;

I cloned the repo and run setup.py but did not know how to continue.

ruck314 commented 2 years ago

Hi Ahmad,

I recommend that you review this example project: https://github.com/slaclab/Simple-10GbE-RUDP-KCU105-Example/

Here's the documentation for that project: https://slaclab.github.io/Simple-10GbE-RUDP-KCU105-Example/

There are 3 common methods that you can use to add source code into Vivado of a particular library type. 1) Manually add it using the Vivado TCL commands

add_files -fileset {sources_1} {<PATH_TO_FILE>/AxiStreamRepeater.vhd}
set_property LIBRARY {surf} [get_files AxiStreamRepeater.vhd]

2) Add the file using the Vivado GUI and include surf in the VHDL library property

3) Use the ruckus TCL helper function (recommended method)

# Load Source Code
loadSource -lib surf -dir "$::DIR_PATH/rtl"

https://github.com/slaclab/surf/blob/master/axi/axi-stream/ruckus.tcl#L5

I cloned the repo and run setup.py but did not know how to continue.

surf is designed to be a "submodule for your application firmware project. setup.py is used for setting up the python surf library. The simplest way to add all the surf VHDL code into your Vivado in a single command is to use this ruckus helper function:

# Load common and sub-module ruckus.tcl files
loadRuckusTcl $::env(TOP_DIR)/submodules/surf

https://github.com/slaclab/Simple-10GbE-RUDP-KCU105-Example/blob/main/firmware/targets/Simple10GbeRudpKcu105Example/ruckus.tcl#L5

Note: Here's an intro presentation to ruckus: https://docs.google.com/presentation/d/1kvzXiByE8WISo40Xd573DdR7dQU4BpDQGwEgNyeJjTI/edit?usp=sharing

Ahmad-Zaklouta commented 2 years ago

Thanks for your fast response. I managed now to add them manually. But I checked Ruckus and it looks very interesting. Does Ruckus work with Vivado installed in Windows 10? My work computer is locked and it would be difficult to install WSL.

ruck314 commented 2 years ago

For window 10 users, in the past people have used (ruckus + vivado + surf) using either WSL2, virtual machine or cygwin. Another interesting option is using a cloud-based Linux machine.