# [coreboot] Memory clock cycles -> microseconds (us)

Joseph Smith joe at settoplinux.org
Mon Jun 9 21:15:46 CEST 2008

```

On Mon, 9 Jun 2008 19:47:24 +0200, Peter Stuge <peter at stuge.se> wrote:
> On Mon, Jun 09, 2008 at 01:36:29PM -0400, Joseph Smith wrote:
>> >> >> Does anyone know the mathematical formula for converting memory
>> >> >> clock cycles into microseconds (us)??
>> >> >
>> >> > 1 MHz means 1 million clock cycles per second, so 1 clock cycle
>> >> > per microsecond.
>> >> >
>> >> > 166 MHz -> 166 clock cycles per microsecond.
>> >
>> > The formula is: t=1/f
>> >
>> > If f=1000000, each cycle is 1/1000000 seconds, or 1 microsecond.
>> > If f=166000000, each cycle is 1/166000000 seconds, or 1/166 us = 6 ns
>>
>> Ok, let me get this straight. So in my case the memory is PC133
>> which is 133 MHz. So each clock cycle is 1/133 us? And, to delay for
>> 3 clocks would be 3/133 us = 22 ns?
>
> Yes sir, that's correct!
>
>
Ok then, that brings me to my next question. In alot of our raminit.c's we
use udelay() between the memory initialization steps. We could probably cut
microseconds.

How hard would it be to add a nanoseconds delay to delay.h?

--
Thanks,
Joseph Smith
Set-Top-Linux
www.settoplinux.org

```