What is FPGA? (source: Wikipedia)
A field-programmable gate array (FPGA) is an integrated circuit designed to be configured by a customer or a designer after manufacturing – hence the term "field-programmable". The FPGA configuration is generally specified using a hardware description language (HDL), similar to that used for an Application-Specific Integrated Circuit (ASIC). Circuit diagrams were previously used to specify the configuration, but this is increasingly rare due to the advent of electronic design automation tools.
A Spartan FPGA from Xilinx
FPGAs contain an array of programmable logic blocks, and a hierarchy of "reconfigurable interconnects" that allow the blocks to be "wired together", like many logic gates that can be inter-wired in different configurations. Logic blocks can be configured to perform complex combinational functions or merely simple logic gates like AND and XOR. In most FPGAs, logic blocks also include memory elements, which may be simple flip-flops or more complete blocks of memory. Many FPGAs can be reprogrammed to implement different logic functions, allowing flexible reconfigurable computing as performed in computer software.
I wanted to do something useful with FPGA as I had Adruino MKR Vidor laying around which I had received for a past contest. The Vidor is still not so beginner friendly but its Graphics Library is still awesome. Also, I had almost forgotten it has WiFi and a microcontroller also. So, I wanted to make something which uses all of the microchips and which can be used on a day-to-day basis. So, the direct thought came was to do something with display because the Vidor has an HDMI (micro) port and also a great library.
Arduino MKR Vidor 4000
For the project, I thought of making a digital clock- which shows time in analog format and it will also show the date and other information. This will test out my trigonometry skills as well as it can use the internet. Here's how it works...
The Vidor connects to the internet with the help of its WiFi chip (Esp32) and gets the time in the world via NTP Server. Then the time is stored in the RTC of SAMD21 microcontroller. That time is then displayed in analog format with the date on an HDMI monitor. After the day is over it will automatically sync the time with the NTP Server again and hence it will also remain very accurate.The output on Monitor is done by Intel Cyclone FPGA onboard.
Arduino Code for the Vidor Clock
Actually, I have also kept my old code as comments if you are interested. Regarding the trigonometric functions sin and cos have always remained favourable and they perfectly help in assigning coordinate. In my code, some colours are changed that is because in my Vidor (or due to adapter) some colours are represented differently. Though I have mentioned which colour is changed to which.