コグノスケ


link 未来から過去へ表示(*)  link 過去から未来へ表示

link もっと前
2021年8月18日 >>> 2021年8月18日
link もっと後

2021年8月18日

HiFive Unmatchedの動作周波数

目次: RISC-V

以前HiFive Unleashedの動作周波数を調べました(2019年7月4日の日記参照)。今回はHiFive Unmatchedの動作周波数を調べます。Unmatchedに元々書き込んであるLinuxを起動したあと、PRCIレジスタ領域を見てみました。ダンプすると下記のようになっています。

PRCIレジスタ領域のダンプ
0x10000000:     0xc0000000      0x820544c2      0x00000000      0x820d1180
0x10000010:     0x80000000      0x00000000      0x00000000      0x8206b982
0x10000020:     0x80000000      0x00000000      0x0000006f      0x00000004
0x10000030:     0x00000000      0x00000000      0x030187c1      0x00000000
0x10000040:     0x00000000      0x00000000      0x00000000      0x00000000
0x10000050:     0x82063bc2      0x80000000      0x00000000      0x00000000
0x10000060:     0x00000000      0x00000000      0x00000000      0x00000000

ビット31がPLL enableですので、オフセット0x4:core_pll, 0xc: ddr_pll, 0x1c: gemgxl_pll, 0x50: hfpclk_pllの設定が有効になっているようです。

いずれのPLL設定もビットフィールドの意味は同じで、[5:0] divr, [14:6] divf, [17:15] divqです。ビットフィールドが4bit境界にないので、PythonなどでPLLの設定値を表示させると楽だと思います。

SiFive U740の仕様書(7. Clocking and Reset)を見ると、PLLの出力周波数foutは
fout = fin / (div_r + 1) * 2 * (div_f + 1) / 2 ^ (div_q)
とのこと。PLLの入力finはいずれのPLLも同じでhfclkという26MHzの外部クロックです。

各PLL設定の意味
>> def dump(val):
...     r = val & 0x3f
...     f = (val >> 6) & 0x1ff
...     q = (val >> 15) & 0x7
...     o = 26 / (r + 1) * 2 * (f + 1) / pow(2, q)
...     print("r", r, "f", f, "q", q, "freq", o)

>>> dump(0x820544c2)
r 2 f 275 q 2 freq 1196.0

>>> dump(0x820d1180)
r 0 f 70 q 2 freq 923.0

>>> dump(0x8206b982)
r 2 f 230 q 5 freq 125.12499999999999

>>> dump(0x82063bc2)
r 2 f 239 q 4 freq 260.0

出力結果を見るとcore_pll:1196MHz, ddr_pll:923MHz, gemgxl_pll:125.125MHz, hfpclk_pll: 260MHzという設定です。どうしてこの値なのかはわからないですけど、参考になります。

rangeフィールドの意味

PLL設定に [20:18] rangeというフィールドがあるのですが、SiFiveの仕様書には説明が書かれていません。クロック周りはAnalog Bitsという会社のCLN28HPC Wide Range PLLを使っているようですが、PLLの詳細仕様はNDAを結ばないと知ることができません。うーむ、不親切……。

しかしSiFiveの人たちはLinuxのクロックドライバを作ってくれており、実装からPLLの仕様を窺い知ることができます。ドライバはlinux/drivers/clk/analogbits/wrpll-cln28hpc.cにあります。

PLLのrange設定の実装

/**
 * __wrpll_calc_filter_range() - determine PLL loop filter bandwidth
 * @post_divr_freq: input clock rate after the R divider
 *
 * Select the value to be presented to the PLL RANGE input signals, based
 * on the input clock frequency after the post-R-divider @post_divr_freq.
 * This code follows the recommendations in the PLL datasheet for filter
 * range selection.
 *
 * Return: The RANGE value to be presented to the PLL configuration inputs,
 *         or a negative return code upon error.
 */
static int __wrpll_calc_filter_range(unsigned long post_divr_freq)
{
	if (post_divr_freq < MIN_POST_DIVR_FREQ ||
	    post_divr_freq > MAX_POST_DIVR_FREQ) {
		WARN(1, "%s: post-divider reference freq out of range: %lu",
		     __func__, post_divr_freq);
		return -ERANGE;
	}

	switch (post_divr_freq) {
	case 0 ... 10999999:
		return 1;
	case 11000000 ... 17999999:
		return 2;
	case 18000000 ... 29999999:
		return 3;
	case 30000000 ... 49999999:
		return 4;
	case 50000000 ... 79999999:
		return 5;
	case 80000000 ... 129999999:
		return 6;
	}

	return 7;
}

単純に入力をswitch文で見ているだけです。説明を見るとpost-R-dividerとあるのでfin / (divr + 1) の周波数を見て決めれば良さそうですね。この情報を公開していただけるのは非常にありがたいのですが、NDAは大丈夫なんですかね……?大した情報ではないとはいえ、ちょっと心配になってしまいます。

編集者:すずき(2021/08/21 02:42)

コメント一覧

  • コメントはありません。
open/close この記事にコメントする



link もっと前
2021年8月18日 >>> 2021年8月18日
link もっと後

管理用メニュー

link 記事を新規作成

<2021>
<<<08>>>
1234567
891011121314
15161718192021
22232425262728
293031----

最近のコメント5件

  • link 24年5月16日
    すずきさん (05/21 11:41)
    「あー、確かにdpkg-reconfigu...」
  • link 24年5月16日
    hdkさん (05/21 08:55)
    「システム全体のlocale設定はDebi...」
  • link 24年5月17日
    すずきさん (05/20 13:16)
    「そうですねえ、普通はStandardなの...」
  • link 24年5月17日
    hdkさん (05/19 07:45)
    「なるほど、そういうことなんですね。Exc...」
  • link 24年5月17日
    すずきさん (05/19 03:41)
    「Standardだと下記の設定になってい...」

最近の記事3件

  • link 24年5月19日
    すずき (06/04 00:44)
    「[Yocto - まとめリンク] 目次: YoctoHello YoctoYoctoのセットアップスクリプトとビルドディレクト...」
  • link 24年5月31日
    すずき (06/04 00:43)
    「[Bitbakeのクラス] 目次: YoctoYocto Scarthgap(5.0.1)のメモです。前回同様、コードを読んで...」
  • link 24年5月30日
    すずき (06/04 00:35)
    「[Bitbakeのレイヤー] 目次: YoctoYocto Scarthgap(5.0.1)のメモです。Yoctoの使い方は以...」
link もっとみる

こんてんつ

open/close wiki
open/close Linux JM
open/close Java API

過去の日記

open/close 2002年
open/close 2003年
open/close 2004年
open/close 2005年
open/close 2006年
open/close 2007年
open/close 2008年
open/close 2009年
open/close 2010年
open/close 2011年
open/close 2012年
open/close 2013年
open/close 2014年
open/close 2015年
open/close 2016年
open/close 2017年
open/close 2018年
open/close 2019年
open/close 2020年
open/close 2021年
open/close 2022年
open/close 2023年
open/close 2024年
open/close 過去日記について

その他の情報

open/close アクセス統計
open/close サーバ一覧
open/close サイトの情報

合計:  counter total
本日:  counter today

link About www.katsuster.net
RDFファイル RSS 1.0

最終更新: 06/04 00:44