<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns="http://purl.org/rss/1.0/"
 xmlns:content="http://purl.org/rss/1.0/modules/content/"
 xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
 xmlns:admin="http://webns.net/mvcb/"
>
<channel rdf:about="http://blog.livedoor.jp/hardyboy/">
<title>まごころせいじつ堂 - GR-SAKURA</title>
<link>http://blog.livedoor.jp/hardyboy/</link>
<description>浜町庄金　研究開発
　マイコンで遊んでばっかりで

</description>
<dc:language>ja</dc:language>
<admin:generatorAgent rdf:resource="http://blog.livedoor.com/?v=2.0" />
<items>
 <rdf:Seq>
  <rdf:li rdf:resource="http://blog.livedoor.jp/hardyboy/archives/5824127.html" />
  <rdf:li rdf:resource="http://blog.livedoor.jp/hardyboy/archives/5799631.html" />
 </rdf:Seq>
</items>
</channel>

<item rdf:about="http://blog.livedoor.jp/hardyboy/archives/5824127.html">
<title>GR-SAKURAのイーサポートがシールドと干渉する</title>
<link>http://blog.livedoor.jp/hardyboy/archives/5824127.html</link>
<description>　見たまんま。シールドによってはショートする危険性もある。　まあこうするしかないよね。　Netduino plusという、同じようにイーサの口を持ったボードはこうなってる。　プラスチック製で絶縁されており、基板の下に逃がしてあるので背が低い。 </description>
<dc:creator>hardyboy</dc:creator>
<dc:date>2012-08-12T01:50:42+09:00</dc:date>
<dc:subject>GR-SAKURA</dc:subject>
<content:encoded><![CDATA[<img src="http://livedoor.blogimg.jp/hardyboy/imgs/d/f/dfed2a04.jpg" width="400" height="300" border="0" alt="2012grsakura1" hspace="5" class="pict"><br /><br />　見たまんま。シールドによってはショートする危険性もある。<br /><br /><img src="http://livedoor.blogimg.jp/hardyboy/imgs/1/5/1572e5d2.jpg" width="400" height="300" border="0" alt="2012grsakura2" hspace="5" class="pict"><br /><br />　まあこうするしかないよね。<br /><br />　Netduino plusという、同じようにイーサの口を持ったボードはこうなってる。<br /><br /><img src="http://livedoor.blogimg.jp/hardyboy/imgs/0/f/0f4da827.jpg" width="400" height="300" border="0" alt="2012netduino1" hspace="5" class="pict"><br /><br />　プラスチック製で絶縁されており、基板の下に逃がしてあるので背が低い。<br />&nbsp;<img src="http://livedoor.blogimg.jp/hardyboy/imgs/9/7/97b34cb2.jpg" width="400" height="300" border="0" alt="2012netduino2" hspace="5" class="pict"><br /><br /><br />]]>
</content:encoded>
</item>
<item rdf:about="http://blog.livedoor.jp/hardyboy/archives/5799631.html">
<title>GR-SAKURA がじぇるねボード</title>
<link>http://blog.livedoor.jp/hardyboy/archives/5799631.html</link>
<description>RSコンポーネンツで注文したGR-SAKURA がじぇるねボードが届いた。ルネサスのRX63Nマイコンを搭載し、Arduinoのシールドが使える。単体でもEther、USB、SDカードなど機能豊富。 　USBコネクタが部品で付属している。必要なら半田付け。　USBケーブルを接続して赤いリセット...</description>
<dc:creator>hardyboy</dc:creator>
<dc:date>2012-08-01T02:44:33+09:00</dc:date>
<dc:subject>GR-SAKURA</dc:subject>
<content:encoded><![CDATA[RSコンポーネンツで注文したGR-SAKURA がじぇるねボードが届いた。ルネサスのRX63Nマイコンを搭載し、Arduinoのシールドが使える。単体でもEther、USB、SDカードなど機能豊富。<br /><br />&nbsp;<img class="pict" hspace="5" alt="2012sakura1" border="0" height="300" width="400" src="http://livedoor.blogimg.jp/hardyboy/imgs/b/7/b769c7fe.jpg"><br /><br />　USBコネクタが部品で付属している。必要なら半田付け。<br /><br /><img class="pict" hspace="5" alt="2012sakura" border="0" height="300" width="400" src="http://livedoor.blogimg.jp/hardyboy/imgs/d/d/dd00205c.jpg"><br /><br />　USBケーブルを接続して赤いリセットボタンを押すと、GR-SAKURAがドライブとして認識される。これにwebコンパイラでコンパイルしたバイナリをコピーするとそれを実行する。えらい簡単。<br /><br />　MacOSXで動作確認した。/Volumes/GR-SAKURAとして見える。<br /><br /><a target="_blank" href="http://japan.renesas.com/products/promotion/gr/index.jsp">がじぇっとるねさす<br /></a><a target="_blank" href="http://sakuraboard.net/">SAKURA BOARD</a>&nbsp;<br /><br />　浮動小数点演算のハードを内蔵しているということで、whetstoneでも試してみようかと思い動かしてみた。<br /><br />元ネタ：<a target="_blank" href="http://www.netlib.org/benchmark/">Benchmark Programs and Reports</a><br /><br />

<pre>/*GR-SAKURA Sketch Template Version: V1.00*/
#include &lt;rxduino.h&gt;

#define INTERVAL 100


#define ITERATIONS    10000 /* 1 Million Whetstone instructions */

#include "math.h"

#define PREC float

PREC        x1, x2, x3, x4, x, y, z, t, t1, t2;
PREC         e1[4];
int        i, j, k, l, n1, n2, n3, n4, n6, n7, n8, n9, n10, n11;


void setup()
{
    Serial.begin(9600); 
    pinMode(PIN_LED0,OUTPUT);
    pinMode(PIN_LED1,OUTPUT);
    pinMode(PIN_LED2,OUTPUT);
    pinMode(PIN_LED3,OUTPUT);
}

void pa(PREC *e)
{
    register int j;

    j = 0;
     lab:
    e[0] = (  e[0] + e[1] + e[2] - e[3] ) * t;
    e[1] = (  e[0] + e[1] - e[2] + e[3] ) * t;
    e[2] = (  e[0] - e[1] + e[2] + e[3] ) * t;
    e[3] = ( -e[0] + e[1] + e[2] + e[3] ) / t2;
    j += 1;
    if (j &lt; 6)
        goto lab;
    return;
}


void p3(PREC x, PREC y, PREC *z)
{
    x  = t * (x + y);
    y  = t * (x + y);
    *z = (x + y) /t2;
    return;
}


void p0()
{
    e1[j] = e1[k];
    e1[k] = e1[l];
    e1[l] = e1[j];
    return;
}

#ifdef POUT
pout(int n, int j, int k, PREC x1, PREC x2, PREC x3, PREC x4)
{
    printf("%6d%6d%6d  %5e  %5e  %5e  %5e\n",
        n, j, k, x1, x2, x3, x4);
}
#endif

void testfloat() {

    /* initialize constants */

    t   =   0.499975;
    t1  =   0.50025;
    t2  =   2.0;

    /* set values of module weights */

    n1  =   0 * ITERATIONS;
    n2  =  12 * ITERATIONS;
    n3  =  14 * ITERATIONS;
    n4  = 345 * ITERATIONS;
    n6  = 210 * ITERATIONS;
    n7  =  32 * ITERATIONS;
    n8  = 899 * ITERATIONS;
    n9  = 616 * ITERATIONS;
    n10 =   0 * ITERATIONS;
    n11 =  93 * ITERATIONS;

/* MODULE 1:  simple identifiers */
    digitalWrite(PIN_LED0, 1);

    x1 =  1.0;
    x2 = x3 = x4 = -1.0;

    for(i = 1; i &lt;= n1; i += 1) {
        x1 = ( x1 + x2 + x3 - x4 ) * t;
        x2 = ( x1 + x2 - x3 - x4 ) * t;
        x3 = ( x1 - x2 + x3 + x4 ) * t;
        x4 = (-x1 + x2 + x3 + x4 ) * t;
    }
#ifdef POUT
    pout(n1, n1, n1, x1, x2, x3, x4);
#endif


/* MODULE 2:  array elements */
    digitalWrite(PIN_LED1, 1);

    e1[0] =  1.0;
    e1[1] = e1[2] = e1[3] = -1.0;

    for (i = 1; i &lt;= n2; i +=1) {
        e1[0] = ( e1[0] + e1[1] + e1[2] - e1[3] ) * t;
        e1[1] = ( e1[0] + e1[1] - e1[2] + e1[3] ) * t;
        e1[2] = ( e1[0] - e1[1] + e1[2] + e1[3] ) * t;
        e1[3] = (-e1[0] + e1[1] + e1[2] + e1[3] ) * t;
    }
#ifdef POUT
    pout(n2, n3, n2, e1[0], e1[1], e1[2], e1[3]);
#endif

/* MODULE 3:  array as parameter */
    digitalWrite(PIN_LED2, 1);

    for (i = 1; i &lt;= n3; i += 1)
        pa(e1);
#ifdef POUT
    pout(n3, n2, n2, e1[0], e1[1], e1[2], e1[3]);
#endif

/* MODULE 4:  conditional jumps */
    digitalWrite(PIN_LED3, 1);

    j = 1;
    for (i = 1; i &lt;= n4; i += 1) {
        if (j == 1)
            j = 2;
        else
            j = 3;

        if (j &gt; 2)
            j = 0;
        else
            j = 1;

        if (j &lt; 1 )
            j = 1;
        else
            j = 0;
    }
#ifdef POUT
    pout(n4, j, j, x1, x2, x3, x4);
#endif

/* MODULE 5:  omitted */

/* MODULE 6:  integer arithmetic */
    digitalWrite(PIN_LED0, 0);

    j = 1;
    k = 2;
    l = 3;

    for (i = 1; i &lt;= n6; i += 1) {
        j = j * (k - j) * (l -k);
        k = l * k - (l - j) * k;
        l = (l - k) * (k + j);

        e1[l - 2] = j + k + l;        /* C arrays are zero based */
        e1[k - 2] = j * k * l;
    }
#ifdef POUT
    pout(n6, j, k, e1[0], e1[1], e1[2], e1[3]);
#endif

/* MODULE 7:  trig. functions */
    digitalWrite(PIN_LED1, 0);

    x = y = 0.5;

    for(i = 1; i &lt;= n7; i +=1) {
        x = t * atan(t2*sin(x)*cos(x)/(cos(x+y)+cos(x-y)-1.0));
        y = t * atan(t2*sin(y)*cos(y)/(cos(x+y)+cos(x-y)-1.0));
        // x = x * 2;
        // y = y * 2;
}
#ifdef POUT
    pout(n7, j, k, x, x, y, y);
#endif

/* MODULE 8:  procedure calls */
    digitalWrite(PIN_LED2, 0);

    x = y = z = 1.0;

    for (i = 1; i &lt;= n8; i +=1)
        p3(x, y, &amp;z);
#ifdef POUT
    pout(n8, j, k, x, y, z, z);
#endif

/* MODULE9:  array references */
    digitalWrite(PIN_LED3, 0);

    j = 1;
    k = 2;
    l = 3;

    e1[0] = 1.0;
    e1[1] = 2.0;
    e1[2] = 3.0;

    for(i = 1; i &lt;= n9; i += 1)
        p0();
#ifdef POUT
    pout(n9, j, k, e1[0], e1[1], e1[2], e1[3]);
#endif

/* MODULE10:  integer arithmetic */
    digitalWrite(PIN_LED0, 1);
    digitalWrite(PIN_LED1, 1);

    j = 2;
    k = 3;

    for(i = 1; i &lt;= n10; i +=1) {
        j = j + k;
        k = j + k;
        j = k - j;
        k = k - j - j;
    }
#ifdef POUT
    pout(n10, j, k, x1, x2, x3, x4);
#endif

/* MODULE11:  standard functions */
    digitalWrite(PIN_LED2, 1);
    digitalWrite(PIN_LED3, 1);

    x = 0.75;
    for(i = 1; i &lt;= n11; i +=1)
        x = sqrt( exp( log(x) / t1));
        // x = x / 2;
#ifdef POUT
    pout(n11, j, k, x, x, x, x);
#endif

// -----------------------------

}

void loop() {
    digitalWrite(PIN_LED0, 0);
    digitalWrite(PIN_LED1, 0);
    digitalWrite(PIN_LED2, 0);
    digitalWrite(PIN_LED3, 0);
    Serial.println(millis());
    testfloat();
}

</pre>
<br />　ITERATIONSを1000倍にして15秒だったので、1000÷15=約66.7MWIPSかな？目安程度に。<br /><br />　当初、doubleとfloatの実行速度が変わらなくて「?」だったのだが、Arduino互換ということでfloatもdoubleも単精度となる。実際にdouble版とfloat版でコンパイルしてバイナリを比較したら一致した。<br /><br />　LEDが4個載っているのでprintfデバッグも楽、web上でコンパイルできるため開発環境をインストールしなくて済む。フラッシュ1MB/RAM 128KBで入出力も豊富。これはたのしい。<br />]]>
</content:encoded>
</item>

</rdf:RDF>
