Hardware:
. Mega65 R6
. XMOD_FTDI_JTAG
  (/dev/ttyUSB0, /dev/ttyUSB1)

Vivado examples are based on a release R6 board and created with Vivado 2025.1 ML Edition
Note that, if possible, the original Mega65 core code is (re)used here, albeit in a
reduced manner.
Using xc7a200tfbg484-2 as the FPGA part

Vivado note: If the archive does not contain checkpoints, but the Vivado is set to use
             them then you get a fatal error. Change checkpoint settings accordingly.


Project 'steps':
. Blinky
    The very beginning, so we are able to tell we are at the correct route
. UART out
    If we have this, then we can use it for debugging output if needed
. UART in
    In case we need some interactive/selective execution
. Keyboard
. I2C
  . HDMI (EDID)
  . RTC


. Mega65_Step_01_ClockOnly_Blinky
  . Blinky example, using the clock as used by the Mega65
    . Red   LED D9  (PNP)
    . Red   LED D12 (NPN)
    . Green LED D10 (NPN)
  . The reset button is used to initialize the registers

. Mega65_Step_02_UartOut
  . Continuously outputs preset message (Hello world ...)
  . Blinking LED D9
  . Uses from mega65-core project:
    . clocking.vhdl
  . Debug data on P2 PMOD port and green/red LED D10/D12

. Mega65_Step_03_UartInOut
  . Data received through the serial input is echoed back
  . Blinking LED D9
  . Uses from mega65-core project:
    . clocking.vhdl
  . Debug data on P2 PMOD port and green/red LED D10/D12

. Mega65_Step_04_Keyboard
  . Keyboard data ('translated' into text) is output as serial data
  . Blinking LED D9
  . Uses from mega65-core project:
    . clocking.vhdl
  . Debug data on P2 PMOD port and green/red LED D10/D12

. Mega65_Step_05_I2c
  . HDMI EDID data is output as serial data (first 128 bytes)
  . Onboard Real-Time Clock 'seconds' data is output as serial data
  . Blinking LED D9
  . Uses from mega65-core project:
    . clocking.vhdl
  . Debug data on P2 PMOD port and green/red LED D10/D12


Bitstreams can be put on the Mega65 using the following mega65 tool command:
. m65 --bitonly XXXX.bit


> ./m65 --bitonly ./Mega65_Step_01_ClockOnly_Blinky/Mega65_Step_01_ClockOnly_Blinky.runs/impl_1/clockonly_blinky.bit
> ./m65 --bitonly ./Mega65_Step_02_UartOut/Mega65_Step_02_UartOut.runs/impl_1/main_serialout.bit
> ./m65 --bitonly ./Mega65_Step_03_UartInOut/Mega65_Step_03_UartInOut.runs/impl_1/main_serialinout.bit
> ./m65 --bitonly ./Mega65_Step_04_Keyboard/Mega65_Step_04_Keyboard.runs/impl_1/main_keyboard.bit
> ./m65 --bitonly ./Mega65_Step_05_I2c/Mega65_Step_05_I2c.runs/impl_1/main_i2c.bit

Use 'putty' or any other serial terminal for UART I/O, typically on /dev/ttyUSB1
(set to 115200, Add CR to LF

Example output from the I2C example:
  00 FF FF FF FF FF FF 00 26 CD 27 76 01 00 00 00
  1E 21 01 03 80 50 21 78 2A A8 25 AF 4D 40 A7 26
  10 50 54 BF EB 80 D1 C0 B3 00 95 00 81 80 71 4F
  81 C0 81 40 A9 40 F5 7C 70 A0 D0 A0 29 50 30 20
  35 00 1B 4E 31 00 00 1A 00 00 00 FD 00 30 78 17
  B4 3C 00 0A 20 20 20 20 20 20 00 00 00 FC 00 50
  4C 33 34 36 36 57 51 0A 20 20 20 20 00 00 00 FF
  00 31 31 37 34 30 33 33 30 30 30 31 31 38 01 23 

'00 FF FF FF FF FF FF 00' is the fixed EDID header which basically 'validates' the type of data
