public Motherboard() { clk1 = new Frequency(21477272, new Ratio(8, 11)); // 21,477,272.72~ clk2 = new Frequency(24576000, new Ratio(0, 0)); // 24,576,000.00 Frequency.Synchronize(clk1, clk2); cpu = new SCPU (); dsp = new SDSP (); ppu1 = new SPPU1(); ppu2 = new SPPU2(); smp = new SSMP (); }
public static void Synchronize(Frequency a, Frequency b) { if (a.r.d <= 0) throw new ArgumentException("Denominator of 'a' must be positive, and non-zero."); if (b.r.d <= 0) throw new ArgumentException("Denominator of 'b' must be positive, and non-zero."); // make both frequencies integers, and align them to each other // todo: make 64-bit? a.single = ((a.f * a.r.d) + a.r.n) * b.r.d; b.single = ((b.f * b.r.d) + b.r.n) * a.r.d; MathHelper.Reduce(ref a.single, ref b.single); // create synchronization point a.period = Math.Max(a.single, b.single); b.period = Math.Max(a.single, b.single); }