-
Please make sure you have already installed mill https://com-lihaoyi.github.io/mill/mill/Intro_to_Mill.html
-
Clone some repos
$ git clone https://github.com/RC4ML/chisel_template.git $ cd chisel_template $ git submodule add [email protected]:carlzhang4/common.git common $ git submodule add [email protected]:RC4ML/qdma.git qdma -
Generate your first module:
$ mill project_foo FooCorresponding sv file Foo.sv can be found under Verilog folder
When you write a new module and want to generate its verilog, edit Elaborate.scala For example a new Bar module, put following code near other cases in Elaborate.scala.
"case "Foo" => stage.execute(arr,Seq(ChiselGeneratorAnnotation(() => new Foo()),dir)) "
-
First, create a vivado project, vivado version must either of 2020.01/2020.02/2021.01(recommended)
-
Modify one line in ./qdma/src/examples/basic/QDMATop.scala, replace with your vivado version and PCIe width, e.g.
val qdma = Module(new QDMA(VIVADO_VERSION="202101", PCIE_WIDTH=16)Note that
VIVADO_VERSIONshould match your Vivado version, andPCIE_WIDTHis 16 for a PCIe Gen 3 machine (or 8 for a PCIe Gen 4 machine). -
Generate Top module
$ mill project_foo QDMATopThis will generate a QDMATop.sv under Verilog folder, copy and add it to your vivado project.
And it will also print several tcl commands, starts with create_ip xxxx, ends with update_compile_order -fileset sources_1.
Copy these tcls and execute them in your vivado project's tcl console, this will help you to generate a QDMA IP.
-
Copy xdc file (./qdma/sv) to your vivado project and add it as constraint.
Then you can generate your bitstream in vivado.
-
Corresponding benchmark software and corresponding driver could be found in https://github.com/RC4ML/rc4ml_qdma
You can also write your own top file by refering QDMATop.scala.
-
Create a config.json file in the project root dir, fill it with following contents
{ "project_foo":{ "destIPRepoPath" : "/path to your vivado project/example.srcs/sources_1/ip", "destSrcPath" : "/path to your vivado project/example.srcs/sources_1/new", "moniterDelay" : 6, "projectGeneration" : "Versal" } }destSrcPath is where you want to put your sv file destIPRepoPath is where you want to put your vivado ip if you have used chisel based ila in your project. projectGeneration should be "ultrascale" if your target board is UltraScale+ boards (e.g., VCU128, U50, U280) or "versal" if your target borad is Versal boards (e.g., VHK158, V80)
-
$ python3 postElaborating.py project_foo QDMATop -t -pAbove command will help you move sv file to your vivado project and generate some tcl if you have used it.
This script aims to generate some basic testbench content automatically.
-
Move ./common/sv/TESTER.sv to your vivado project, and add it as simulation source
-
If your sv module file has been generated, run following command to generate a testbench, replace Foo with your module name. Copy the output to your testbench file.
$ python3 instant.py Foo -
Control the signals by yourself.