summaryrefslogtreecommitdiff
path: root/src/scripts/clock.5c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-10-18 11:17:38 -0700
committerEric Anholt <eric@anholt.net>2007-10-18 11:29:24 -0700
commit1f8bf110394cc1df66aae9acf5c818145ae19b52 (patch)
tree39f44dfec7bf05a91023089a939be4e5b73384c8 /src/scripts/clock.5c
parent79636b8c776ae024518103c9fa137c8498c21d48 (diff)
Add some nickle scripts for looking at PLL issues.
While here, move similar nickle scripts under src/scripts/
Diffstat (limited to 'src/scripts/clock.5c')
-rw-r--r--src/scripts/clock.5c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/scripts/clock.5c b/src/scripts/clock.5c
new file mode 100644
index 00000000..8ee9d90e
--- /dev/null
+++ b/src/scripts/clock.5c
@@ -0,0 +1,40 @@
+int p2 = 14;
+int min_p, max_p;
+
+if (p2 == 7 || p2 == 14) {
+ /* LVDS */
+ min_p = 7;
+ max_p = 98;
+} else {
+ /* SDVO/DAC */
+ min_p = 5;
+ max_p = 80;
+}
+
+for (int m1 = 10; m1 <= 20; m1++) {
+ for (int m2 = 5; m2 <= 9; m2++) {
+ for (int n = 3; n <= 8; n++) {
+ for (int p1 = 1; p1 <= 8; p1++) {
+ int ref = 96000000;
+ int m = 5 * (m1 + 2) + (m2 + 2);
+ int p = p1 * p2;
+ int vco = floor(ref * m / (n + 2));
+ int clock = floor(vco / p);
+
+ if (p < min_p || p > max_p)
+ continue;
+ if (m < 70 || m > 120)
+ continue;
+ if (m2 > m1)
+ continue; /* won't happen */
+ if (vco < 1400000000 ||
+ vco > 2800000000)
+ continue;
+
+ printf("clock: %d (%d,%d),%d,(%d,%d)\n",
+ floor(clock / 1000),
+ m1, m2, n, p1, p2);
+ }
+ }
+ }
+}