Basys 3 ASCII Terminal

Turns a Digilent Basys 3 (Artix-7 XC7A35T) into a stand-alone serial terminal:

  • Screen: VGA port, 640x480 @ 60 Hz, 80 columns x 30 rows, 8x16 CP437 font (box-drawing characters included), green/amber/white/cyan.
  • Keyboard: a USB keyboard in the USB HID host port (J2). The board's PIC24 presents it to the FPGA as a PS/2 keyboard.
  • Serial line: the micro-USB PROG/UART port (the FTDI chip), 8N1. Bytes received there are drawn on the screen. Keystrokes are sent out there.

Plug the micro-USB into a PC and open the serial port (/dev/ttyUSB1 is usually the UART; ttyUSB0 is JTAG). For example:

picocom -b 115200 /dev/ttyUSB1

To get a Linux login on the terminal, run a getty on that port:

sudo systemctl start serial-getty@ttyUSB1.service

Controls

Control Function
SW1:0 Baud: 00 115200, 01 9600, 10 19200, 11 57600
SW2 Local echo
SW3 Received LF also does CR (for hosts that send bare \n)
SW5:4 Colour: 00 green, 01 amber, 10 white, 11 cyan
SW6 Backspace sends DEL (7F) instead of BS (08)
SW7 Enter sends CR LF instead of CR
BTNC Reset (clears screen, shows banner)
BTNU Clear screen
LED7:0 Last byte received
LED12 / 13 / 14 / 15 Bell / Caps Lock / UART RX activity / keyboard activity
7-segment Left: last keyboard scan code. Right: last byte sent.

For a Linux getty, set SW6 on (Backspace = DEL).

Terminal features

  • Control characters: CR, LF, VT, FF (clear screen), BS, TAB (every 8 columns), BEL (LED12).
  • Auto-wrap at column 80 (deferred, like a VT100), and hardware scrolling.
  • VT100/ANSI subset:
    • Cursor movement ESC[nA/B/C/D, ESC[r;cH, ESC[r;cf, ESC[nd, ESC[nG
    • Erasing with ESC[nJ and ESC[nK
    • Reverse video with ESC[7m, ESC[27m and ESC[0m
    • Show/hide cursor with ESC[?25h and ESC[?25l
    • ESC c, ESC D, ESC E, ESC M, ESC 7, ESC 8
  • Keyboard: Shift, Caps Lock, Ctrl (^A..^Z, ^[ etc.).
    • The arrow keys, Home, End, Insert, Delete, PgUp and PgDn send xterm sequences.
    • F1 to F4 send ESC O P to ESC O S.
    • The keypad always types digits.

TERM=vt100 is a good setting on the host. Colour SGR codes and scroll regions are not implemented, so full-screen programs that need them may draw incorrectly.

Build and program

Requires Vivado. The scripts use the newest install in ~/vivado/<version>/Vivado; set VIVADO=/path/to/Vivado to pick another. On this machine 2026.1 has no license, so use 2025.2 (export VIVADO=~/vivado/2025.2/Vivado).

./scripts/build.sh            # bitstream -> build/basys3_terminal.bit (+ .mcs)
./scripts/build.sh program    # build and load into the FPGA (until power-off)
./scripts/build.sh flash      # build and write QSPI flash; set JP1 to QSPI to boot from it

Simulation

sim/tb_terminal.v covers the whole design. It types keys over PS/2 and checks the bytes sent on the UART. It sends text and escape sequences into the UART and prints the character buffer. It also checks VGA sync timing and saves one frame as sim/work/frame.png.

VIVADO=~/vivado/2025.2/Vivado ./scripts/sim.sh

scripts/vivado_env.sh adds an ncurses 5 compatibility link under build/, which Vivado needs on newer distros.

Layout

Path Contents
rtl/basys3_terminal.v Top level: reset, switches, FIFOs, banner, LEDs
rtl/term_ctrl.v Terminal engine (control codes, ANSI parser, scrolling)
rtl/text_display.v VGA timing, character RAM, font lookup
rtl/ps2_keyboard.v PS/2 receiver and scan code set 2 to ASCII
rtl/uart.v UART receiver and transmitter
rtl/fifo.v, rtl/sevenseg.v Helpers
font/font.mem 256x16 font ROM, made by tools/psf2mem.py from the Linux console fonts
constraints/basys3.xdc Pin assignments
S
Description
Basys 3 FPGA: VT220 terminal, 90 MHz Z-80 with BASIC, monitor and assembler
Readme MIT
1.8 MiB
0 Stars 1 Watchers 0 Forks
Languages
C 38.1%
Verilog 36%
Python 19.4%
Tcl 2.3%
Shell 1.6%
Other 2.6%