Ubuntu12.04に SCV をインストール
SCV(SystemC Verification library)のことです。
2006年以降全く更新がない困ったライブラリちゃんなので、
ちょっと火がついたのでインストールしてみました。
環境
- Ubuntu12.04 LTS(32bit)
- gcc/g++ 4.4.7
- SystemC 2.2
ダウンロード
こちらからファイルをダウンロードします。
ファイル名「scv-1.0p2-sysc2.2.12jun06.tgz」
http://www.accellera.org/downloads/standards/systemc
インストール
一連の手順はこちらになります。
詳細なことは「INSTALL」ファイルを参照ください。
1.|$> tar xvf scv-1.0p2-sysc2.2.12jun06.tgz 2.|$> cd scv-1.0p2-sysc2.2/ 3.|$> cat scv_gcc44_32bit.patch | patch -p0 4.|$> mkdir objdir 5.|$> cd objdir/ 6.|$> ../configure [--prefix=インストール先] --with-systemc=/usr/local/lib/systemc-2.2.0 --disable-compiler-check 7.|$> gvim config.h 8.|$> make 9.|$> make install
パッチ適用
上記「3行目」にあたる部分になります。
やっていることは「INSTALL」や「参考サイト」に書いてあることです。
いちいち修正するのは面倒なので、パッチ化してます。
以下の内容を「scv_gcc44_32bit.patch」として保存してください。
--- a/configure +++ configure @@ -5637,37 +5637,38 @@ EOF /* So define it here empty. Namespaces are extensible, so this is harmless. */ namespace std {} using namespace std; -#include <string> -#include <stdio.h> -#include <strstream.h> +#include <cstring> +#include <cstdio> +#include <cstdlib> +#include <sstream> int main() { #define STRING_SIZE 100 char buf[STRING_SIZE]; int i = 1; - sprintf(buf, "hello world %i", i); - if (strcmp(buf,"hello world 1") != 0) + std::sprintf(buf, "hello world %i", i); + if (std::strcmp(buf,"hello world 1") != 0) { - exit(1); + std::exit(1); } - ostrstream outString(buf, STRING_SIZE); + std::ostringstream outString; outString << "hello world " << i; - if (strcmp(buf,"hello world 1") != 0) + if (std::strcmp(buf,"hello world 1") != 0) { - exit(1); + std::exit(1); } - string str = "hello world"; + std::string str = "hello world"; str = str + " 1"; if (str != "hello world 1") { - exit(1); + std::exit(1); } // // OK! // - exit(0); + std::exit(0); } EOF if eval ./test.sh; then @@ -5715,13 +5716,13 @@ EOF /* So define it here empty. Namespaces are extensible, so this is harmless. */ namespace std {} using namespace std; -#include <stdlib.h> -#include <iostream.h> +#include <cstdlib> +#include <iostream> int main() { unsigned long long hold = 10; - cout << hold << endl; - exit(0); + std::cout << hold << std::endl; + std::exit(0); } EOF if eval ./test.sh; then @@ -5768,10 +5769,10 @@ struct testT { const char* name; int i; int j; }; testT test = {{"test0",5,2},{"test1",3,3},{0}}; EOF cat > t2conftest.cc <<EOF -#include <iostream.h> -#include <string.h> -#include <stdlib.h> -#include <stdio.h> +#include <iostream> +#include <cstring> +#include <cstdlib> +#include <cstdio> struct testT { const char* name; int i; int j;}; static testT (*testP); extern testT test[]; @@ -5780,12 +5781,12 @@ int main() { static char str[10]; int i=0, failed=0; while((*testP)[i].name){ - sprintf(str, "test%d",i); - if(strcmp(str, (*testP)[i].name) != 0) ++failed; + std::sprintf(str, "test%d",i); + if(std::strcmp(str, (*testP)[i].name) != 0) ++failed; i++; } if(failed) { exit (1); } - exit (0); + std::exit (0); } EOF if eval ./test.sh; then
config.hの修正
上記「7行目」にあたる部分になります。
こちらは「INSTALL」にも書いてある内容になります。
生成された「config.h」を修正します。
44| // #define _USE_HASH_MAP
実行確認
$> cd インストール先 $> cd examples/scv/general/hello/ $> make : SystemC 2.2.0 --- Jan 15 2012 14:19:56 Copyright (c) 1996-2006 by all Contributors ALL RIGHTS RESERVED Hello, world!
ナイス! Hello, world!
その他(64bit版)
64bit版については、SystemC Japan公式サイトにて解決策が載っています。
[00113]Re:Re:Re:SCVインストール
(私に64bit版PCがあれば、マージするのになー 誰か買ってください!)