YosysHQ / icestorm

Project IceStorm - Lattice iCE40 FPGAs Bitstream Documentation (Reverse Engineered)
ISC License
965 stars 224 forks source link

icepll: Add iteration over list of frequencies for best solution #245

Closed mengstr closed 4 years ago

mengstr commented 4 years ago

This patch adds support for icepll to try multiple input frequencies to find the best crystal for the desired output frequency.

The values tested comes either from a specified file using-B, or from a default set of frequencies from Mousers "normally stocked" crystal oscillators.

The rationale for this is that I wanted to get as close as possible to the 25.175 MHz for the VGA pixel clock using some easily available crystal oscillator frequency. It looks like a lot of changes to the original source, but most of it is just refactoring of the calculation code to its own function.