-
Notifications
You must be signed in to change notification settings - Fork 132
Add support for Digilent Basys3 board #130
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
base: main
Are you sure you want to change the base?
Changes from all commits
af74bac
faaa493
a195b18
753605e
ae814b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,13 +17,15 @@ set -u # Error on undefined vars | |
| # Source environment | ||
| source "../env.sh" | ||
|
|
||
| VIVADO=${VIVADO:-"vitis-2022.1 vivado"} | ||
| # Select IIS-internal tool commands if we run on IIS machines | ||
| if [ -f /etc/iis.version ]; then | ||
| VIVADO=${VIVADO:-"vitis-2022.1 vivado"} | ||
| else | ||
| VIVADO=${VIVADO:-"vivado"} | ||
| fi | ||
|
|
||
| mkdir -p build | ||
| mkdir -p out | ||
| mkdir -p build/genesys2.clkwiz | ||
| mkdir -p build/genesys2.vio | ||
| mkdir -p build/genesys2.croc | ||
|
|
||
|
|
||
| ################ | ||
|
|
@@ -38,17 +40,19 @@ Usage: | |
| ./run_xilinx.sh [OPTIONS] | ||
|
|
||
| Options: | ||
| --help, -h Show this help message | ||
| --dry-run, -n Only print commands instead of executing | ||
| --verbose, -v Print commands while executing | ||
| --flist Regenerate compile script reading sources (add_sources.genesys2.tcl) | ||
| --clkwiz Implement build/genesys2.clkwiz | ||
| --vio Implement build/genesys2.vio | ||
| --croc Implement Croc SoC only | ||
| --all Implement clkwiz, vio, and Croc SoC | ||
| --help, -h Show this help message | ||
| --dry-run, -n Only print commands instead of executing | ||
| --verbose, -v Print commands while executing | ||
| --target <board> Target board: genesys2 (default), basys3 | ||
| --flist Regenerate compile script reading sources | ||
| --clkwiz Implement clock wizard IP | ||
| --vio Implement VirtualIO IP | ||
| --croc Implement Croc SoC only | ||
| --all Implement clkwiz, vio, and Croc SoC | ||
|
|
||
| Example: | ||
| ./run_xilinx.sh --all | ||
| ./run_xilinx.sh --target basys3 --all | ||
|
|
||
| EOF | ||
| exit 0 | ||
|
|
@@ -64,45 +68,64 @@ run_cmd() { | |
| } | ||
|
|
||
|
|
||
| get_bender_target() { | ||
| echo "$TARGET" | ||
| } | ||
|
|
||
|
|
||
| generate_flist() { | ||
| run_cmd "echo [INFO][Bender] Generate add_sources.genesys2.tcl" | ||
| local bender_target | ||
| bender_target=$(get_bender_target) | ||
|
|
||
| # Basys3 uses BSCANE2 for JTAG: pass 'xilinx' and 'bscane' so that | ||
| # riscv-dbg selects dmi_bscane_tap.sv instead of dmi_jtag_tap.sv. | ||
| local extra_targets="" | ||
| if [ "$TARGET" = "basys3" ]; then | ||
| extra_targets="-t xilinx -t bscane" | ||
| fi | ||
|
Comment on lines
+80
to
+85
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of this we could use a rather new bender feature documented here. and directly say 'if this target is passed, pass another target to a dependency'. So this would automatically pass |
||
|
|
||
| run_cmd "echo [INFO][Bender] Generate add_sources.${TARGET}.tcl" | ||
| run_cmd "bender \ | ||
| script vivado \ | ||
| -t genesys2 \ | ||
| -t ${bender_target} \ | ||
| -t synthesis \ | ||
| ${extra_targets} \ | ||
| -D COMMON_CELLS_ASSERTS_OFF=1 \ | ||
| > scripts/add_sources.genesys2.tcl" | ||
| > scripts/add_sources.${TARGET}.tcl" | ||
|
|
||
| run_cmd "echo [INFO][Bender] Remove absolute paths" | ||
| run_cmd "sed -i 's|${CROC_ROOT}|../../..|g' scripts/add_sources.genesys2.tcl" | ||
| run_cmd "sed -i 's|${CROC_ROOT}|../../..|g' scripts/add_sources.${TARGET}.tcl" | ||
|
|
||
| run_cmd "echo [INFO][Bender] File list generated: add_sources.genesys2.tcl" | ||
| run_cmd "echo [INFO][Bender] File list generated: add_sources.${TARGET}.tcl" | ||
| } | ||
|
|
||
|
|
||
| impl_clockwiz() { | ||
| run_cmd "echo [INFO][VIVADO] Implement clock wizard IP" | ||
| run_cmd "cd build/genesys2.clkwiz" | ||
| mkdir -p build/${TARGET}.clkwiz | ||
| run_cmd "echo [INFO][VIVADO] Implement clock wizard IP [${TARGET}]" | ||
| run_cmd "cd build/${TARGET}.clkwiz" | ||
| run_cmd "${VIVADO} -mode batch -source ../../scripts/impl_ip.tcl \ | ||
| -tclargs genesys2 clkwiz > ../../clkwiz.log" | ||
| -tclargs ${TARGET} clkwiz > ../../clkwiz.${TARGET}.log" | ||
| run_cmd "cd ../.." | ||
| } | ||
|
|
||
|
|
||
| impl_vio() { | ||
| run_cmd "echo [INFO][VIVADO] Implement VirtualIO IP" | ||
| run_cmd "cd build/genesys2.vio" | ||
| mkdir -p build/${TARGET}.vio | ||
| run_cmd "echo [INFO][VIVADO] Implement VirtualIO IP [${TARGET}]" | ||
| run_cmd "cd build/${TARGET}.vio" | ||
| run_cmd "${VIVADO} -mode batch -source ../../scripts/impl_ip.tcl \ | ||
| -tclargs genesys2 vio > ../../vio.log" | ||
| -tclargs ${TARGET} vio > ../../vio.${TARGET}.log" | ||
| run_cmd "cd ../.." | ||
| } | ||
|
|
||
|
|
||
| impl_croc(){ | ||
| run_cmd "echo [INFO][VIVADO] Implement Croc" | ||
| run_cmd "cd build/genesys2.croc" | ||
| impl_croc() { | ||
| mkdir -p build/${TARGET}.croc | ||
| run_cmd "echo [INFO][VIVADO] Implement Croc [${TARGET}]" | ||
| run_cmd "cd build/${TARGET}.croc" | ||
| run_cmd "${VIVADO} -mode batch -source ../../scripts/impl_sys.tcl \ | ||
| -tclargs genesys2 croc ../genesys2.clkwiz/out.xci ../genesys2.vio/out.xci > ../../croc.log" | ||
| -tclargs ${TARGET} croc ../${TARGET}.clkwiz/out.xci ../${TARGET}.vio/out.xci > ../../croc.${TARGET}.log" | ||
| run_cmd "cd ../.." | ||
| } | ||
|
|
||
|
|
@@ -112,17 +135,20 @@ impl_croc(){ | |
| #################### | ||
|
|
||
| DRYRUN=0 | ||
| TARGET="genesys2" | ||
|
|
||
| # default action if no argument is given | ||
| if [ $# -eq 0 ]; then | ||
| show_help | ||
| return 0 | ||
| fi | ||
|
|
||
| # check for global arguments | ||
| for arg in "$@"; do | ||
| [[ "$arg" == -v || "$arg" == --verbose ]] && set -x | ||
| [[ "$arg" == -n || "$arg" == --dry-run ]] && DRYRUN=1 | ||
| # check for global arguments (first pass, order-independent) | ||
| args=("$@") | ||
| for ((i=0; i<${#args[@]}; i++)); do | ||
| [[ "${args[i]}" == -v || "${args[i]}" == --verbose ]] && set -x | ||
| [[ "${args[i]}" == -n || "${args[i]}" == --dry-run ]] && DRYRUN=1 | ||
| [[ "${args[i]}" == --target ]] && TARGET="${args[i+1]}" | ||
| done | ||
|
|
||
| # parse arguments | ||
|
|
@@ -137,6 +163,10 @@ while [[ $# -gt 0 ]]; do | |
| --dry-run|-n) | ||
| shift | ||
| ;; | ||
| --target) | ||
| TARGET="$2" | ||
| shift 2 | ||
| ;; | ||
| # script-specific commands | ||
| --flist) | ||
| generate_flist | ||
|
|
@@ -155,6 +185,7 @@ while [[ $# -gt 0 ]]; do | |
| shift | ||
| ;; | ||
| --all) | ||
| generate_flist | ||
| impl_clockwiz | ||
| impl_vio | ||
| impl_croc | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.