Skip to content

Add support for Digilent Basys3 board#130

Open
FrancescoConti wants to merge 5 commits into
pulp-platform:mainfrom
FrancescoConti:main
Open

Add support for Digilent Basys3 board#130
FrancescoConti wants to merge 5 commits into
pulp-platform:mainfrom
FrancescoConti:main

Conversation

@FrancescoConti

Copy link
Copy Markdown
Member

This pull request adds support for building and running the CROC SoC on the Digilent Basys3 FPGA board (https://digilent.com/reference/programmable-logic/basys-3/reference-manual), in addition to the previously supported Genesys2 board. The changes include updates to the build system, hardware description, and scripts to handle board-specific differences such as clocking, reset, and JTAG/debug interfaces. The scripts and hardware now automatically adapt to the selected target board, and a new OpenOCD script is provided for debugging via the Basys3's internal JTAG.

Basys3 FPGA support

  • Added Basys3 as a supported target board in the build system (Bender.yml, run_xilinx.sh, add_sources.basys3.tcl, common.tcl). [1] [2] [3] [4] [5]
  • Updated run_xilinx.sh to accept a --target argument for board selection, generate board-specific file lists, and create separate build directories/logs per target. [1] [2] [3] [4] [5]

Hardware description updates

  • Modified croc_xilinx.sv to support both Genesys2 and Basys3: added board-specific defines, conditional differential/single-ended clock buffer instantiation, and conditional JTAG/BSCANE2 debug logic. [1] [2] [3] [4] [5] [6] [7] [8]

Board-specific scripts and configuration

  • Added xilinx/scripts/add_sources.basys3.tcl for Basys3 Vivado project sources, and updated xilinx/scripts/common.tcl with Basys3 part numbers and configuration. [1] [2]
  • Updated IP generation scripts to select the correct clock frequency for each board (impl_ip.tcl).

Debug and development tools

  • Added xilinx/scripts/openocd.basys3.tcl, an OpenOCD script for debugging the SoC on Basys3 using the FPGA's internal JTAG (BSCANE2), eliminating the need for external JTAG cables.

Other improvements

  • Cleaned up and refactored run_xilinx.sh for better maintainability, including improved help output and removal of hardcoded directory creation. [1] [2]

These changes make it straightforward to build, implement, and debug the CROC SoC on both Genesys2 and Basys3 boards, with board-specific configuration handled automatically.

This exposes JTAG through a PMOD, which is unfortunate.
Replace dmi_jtag_tap with dmi_bscane_tap so RISC-V debug uses the
FPGA's built-in config JTAG instead of four PMOD JA I/Os. External
JTAG ports are removed from croc_xilinx for TARGET_BASYS3; internal
dummy wires satisfy croc_soc's port list (ignored by dmi_bscane_tap).
XDC constraints for PMOD JA and the CLOCK_DEDICATED_ROUTE workaround
are dropped. An OpenOCD script is added that connects via the on-board
FTDI adapter and remaps DTMCS/DMI to USER3/USER4 IR codes (0x22/0x23).
…targets

add_sources.basys3.tcl is autogenerated by bender; without the 'xilinx'
and 'bscane' targets the riscv-dbg Bender.yml condition all(xilinx,bscane)
evaluates false and dmi_jtag_tap.sv is selected, overwriting the BSCANE2
intent on every --flist/--all run.  Pass both extra targets for basys3 so
the generated file consistently picks dmi_bscane_tap.sv.  Also restore the
current add_sources.basys3.tcl to match.
…p Debugger 0.12.0+dev-04404-geb01c632a (2025-10-09-10:08)
Comment thread xilinx/run_xilinx.sh
@FrancescoConti FrancescoConti marked this pull request as ready for review June 26, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant