新千葉 ガーベージ・コレクション

FPGA マガジンやインターフェースで書けなかったこと等をちょぼちょぼ書いてます。@ryos36

2016-01-01から1ヶ月間の記事一覧

fact も cps 変換

とりあえず末尾再帰の fact も cps 変換できるようになった。 (:FIXH ((|:FACT0| (FACT0 |sym11| K N RV) (:= (N 0) NIL ((:RECORD-REF (|sym11| 0) (|sym23|) ((:APP |sym23| (|sym11| RV)))) (:- (N 1) (|sym17|) ((:* (N RV) (|sym16|) ((:RECORD-REF (FA…

xorshift

Google Chromeが採用した、擬似乱数生成アルゴリズム「xorshift」の数理 – びりあるの研究ノート開発中のプログラムで動くように書いてみた。長ったらしいのは xor を持っていないから。そもそも、ビット幅が特定できない、、、print もないしなぁ、、、 ((:…

eta(η) reduction

((:fix ((even? (x) (:if (:= x 0) :#t (odd? (:- x 1)))) (odd? (x) (:if (:= x 0) :#t (even? (:- x 1))))) (even? 997))) 典型的な交互に呼び合う非効率であるけど偶数奇数判定機。cps 変換すると (:FIXH ((EVEN? (|sym2| X) (:FIXS ((|sym3| (|sym4|) (:…

cps 変換したものを reorder

Unfortunately, the problem of reordering directed acyclic graphs for optimal register allocation is NP-complete. だそうなので、10 命令でも 10! 回計算しないといけなさそう。ということで、ヒューリスティックな方法で解きます。 (:FIXH ((|:G0| (G…

openocd と sama5d4

ちょっと前進。MEM-AP を探せないとおっしゃっている。MEM-AP がなにかは不明。 Open On-Chip Debugger 0.10.0-dev-00189-g554313b (2016-01-07-23:46) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html debug_le…

libusb とか

libusb0.1 と libusb1.0 というのが cygwin のぱけーじにあって、どうやら API が違うらしい。作者が同じかどうかもわからない、、、最新の openocd では libusb0.1 はねむいさんのぶろぐによると使わないらしい。libusb1.0 を使いましょう。あと、hidapi と…

OpenOCD を自前でコンパイル

openocd> ./bootstrap + aclocal + libtoolize --automake --copy + autoconf configure.ac:12: error: possibly undefined macro: AC_MSG_WARN If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. co…