Software APIs
sim_verilator.c
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #include <stdint.h>
6 
7 #include "dt/dt_api.h" // Generated
8 
9 // FIXME Are those really fixed in DV? Does it matter?
10 static const uint32_t clock_freqs[kDtClockCount] = {
11  [kDtClockMain] = 500 * 1000, [kDtClockIo] = 500 * 1000,
12  [kDtClockUsb] = 48 * 1000 * 1000, [kDtClockAon] = 125 * 1000,
13  [kDtClockIoDiv2] = 250 * 1000, [kDtClockIoDiv4] = 125 * 1000,
14 };
15 
16 uint32_t dt_clock_frequency(dt_clock_t clk) {
17  if (clk < kDtClockCount) {
18  return clock_freqs[clk];
19  }
20  return 0;
21 }