FE310-G002 clock and I-Cache performance


(Dana Myers) #1

Tinkering a bit, I did a very simple benchmark sort of thing (excerpted code):

new_cpu_clock = metal_clock_set_rate_hz(&__metal_dt_clock_4.clock,
  clock_rate);

if (new_cpu_clock == last_cpu_clock) {
	printf("skipping %ld\n", new_cpu_clock);
	return;
}

last_cpu_clock = new_cpu_clock;

rtcd = metal_rtc_get_device(0);
t1 = metal_rtc_get_count(rtcd);

for (int32_t i = 0; i < 10000000L; i++) {
	// (void) metal_gpio_toggle_pin(gpd, 5);
	(void)mrand48();
}
t2 = metal_rtc_get_count(rtcd);

RTC is driven by an external 32.768kHz oscillator. My guess is that all of the code fits in the I-Cache (though I haven’t confirmed it). I found that mrand48() required consistently 96.2 clocks at every clock up to and including 288MHz. At 320MHz - the documented FMAX of the part - it required 103.7 clocks. If I’m doing this right, this suggests that the I-Cache runs out of steam between 288MHz and 320MHz.

My take-away is that 288MHz is the maximum practical clock then. Any comments?