Formula deriving ROM speed and Clock speed?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Formula deriving ROM speed and Clock speed?
by on (#117689)
I was wondering, is there a formula that correlates the SNES CPU Clock, the SNES Operating speed (2.58 3.xx speeds) to the ROM speeds?

for example, what correlates the 200 ns Slow ROM to the 2.58 Mhz processing speed?

I believed that the calculation was:
(1,000,000,000 ns/ s) / (Clock*2) where clock is in Hz,

although that calculation seems to approximate a result, I remember getting a lower speed value for the slowRom calculation, which would suggest that the ROM had to be faster. Must be an error or inaccuracy in the formula.
Re: Formula deriving ROM speed and Clock speed?
by on (#117692)
Maybe the thing to do is take the master clock, 21.477mhz and look at the master clock dividers of 6, 8, and 12 clocks which relate to 3.58mhz, 2.68mhz, and 1.7mhz.

Were you getting a number of 171ns or something like that for slowrom access?

By the way, I've read some people have tested 200ns MaskROMs from SNES carts and found atleast some can be accessed faster than 200ns.
Re: Formula deriving ROM speed and Clock speed?
by on (#117696)
I remember speculating that the timing is actually 3 low 3 high for fast ROM and 3 low 5 high for slow ROM. This results in 140 ns high for fast ROM and 233 ns high for slow ROM; add a margin of safety and you get the commonly quoted 120 ns and 200 ns figures.
Re: Formula deriving ROM speed and Clock speed?
by on (#117698)
tepples wrote:
I remember speculating that the timing is actually 3 low 3 high for fast ROM and 3 low 5 high for slow ROM. This results in 140 ns high for fast ROM and 233 ns high for slow ROM; add a margin of safety and you get the commonly quoted 120 ns and 200 ns figures.


Tepples, can you elaborate on your convention? I've seen this format of communicating, "3 low 3 high." I vaguely know that it resembles the clock signal? I don't know much about CPU, let alone just learned of the words "phase clock signals" or whatever it is, never even heard of it until last night. Can you explain and elaborate that to me? I'm not sure how it connects
Re: Formula deriving ROM speed and Clock speed?
by on (#117700)
MottZilla wrote:
Were you getting a number of 171ns or something like that for slowrom access?

Yes I recall a number around the 170-180 ns range,
Re: Formula deriving ROM speed and Clock speed?
by on (#117702)
The CPU contains a 65816 core and a memory controller. It receives a master clock at 945/44 = 21.48 MHz from a crystal oscillator. Then it divides the master clock to produce the 65816 clock, and this clock isn't necessarily 50% duty. How long it remains high depends on the address, which is where the memory controller comes in. Some addresses are slow, others fast. In a fast cycle, the CPU clock is low for 3 master clock periods and then high for 3 master clock periods. In a slow cycle, it appears to be low for 3 and high for 5.

(Some of the above is speculation; logic analyzer plots confirming it would be appreciated.)

For an oscillator at 945/44 MHz, the period is 44/945*1000 = 46.6 ns.

3 master clocks = 3*44/945*1000 = 140 ns
5 master clocks = 5*44/945*1000 = 233 ns

All that matters is that ROM is fast enough to return a value between when it's selected at the start of the high period and when the CPU reads the data bus at the end.

Do you want another ASCII art diagram?
Re: Formula deriving ROM speed and Clock speed?
by on (#117704)
What's 50% duty? What concept does that encompass?
Re: Formula deriving ROM speed and Clock speed?
by on (#117706)
In a pulse wave, duty is the fraction of time that it's high. See examples of 12.5%, 25.0%, 50.0%, and 75.0% duty square waves.
Code:
Fast cycles
_       _____       _____
 |_____|     |_____|     |_
5 0 1 2 3 4 5 0 1 2 3 4 5 0

Slow cycles
_       _________       _________
 |_____|         |_____|         |_
7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0

Controller port cycles
_       _________________       _________________
 |_____|                 |_____|                 |_
B 0 1 2 3 4 5 6 7 8 9 A B 0 1 2 3 4 5 6 7 8 9 A B 0
Re: Formula deriving ROM speed and Clock speed?
by on (#117707)
Alright THanks Tepples