4700 Edge Counters
From embeddedTS Manuals
The FPGA includes two 16-bit edge counters. Edge counter 0 is on DIO 6, and Edge counter 1 is on DIO 4. The registers for each counter are in the #Syscon and can be accessed using peekpoke:
peekpoke 16 0x80004030 # read edge counter 0
peekpoke 16 0x80004032 # read edge counter 1
# you can also clear the current count by writing to the counter register:
peekpoke 16 0x80004030 0x0