LoginSignup
1
1

More than 5 years have passed since last update.

Visual StudioでSystemCの環境構築

Last updated at Posted at 2018-06-02

はじめに

Visual Studioの環境でSystemCをはじめる手順を記載します。
以下の内容は基本的にこれを参考にしています。

環境

  • Visual Studio2015
  • systemc-2.3.2

手順

1.acclleraでSystemCをDLします。
http://www.accellera.org/downloads/standards/systemc
ここのSystemC 2.3.2 (Includes TLM)->Core SystemC Language and Examples (.zip)

2.解凍してどこかのディレクトリに配置します。

3.systemc-2.3.2->msvc10->SystemCのSystemC.slnをvisual studio 2015で開きます。
バージョンアップしますか?はYesで進みます。

4.Debugタブ横はx64に設定します。
新規作成用と同じであれば大丈夫です。

5.SystemCとSystemC-coreのSolutionプロパティを設定します。
C/C++->Code Generation->Runtime Libraryを(/MTd)に設定します。

6.Buildして.libを生成します。
systemc-2.3.2/msvc10/SystemC/x64/DebugにSystemC.libが生成出来ていればOKです。

7.新しいプロジェクトをVisual Studioで作成します。
Win32 Console application->Empty projectで作成します。

8.C++ファイルをAddしておきます。

9.はじめに記載した参考サイトの手順9~14を実行します。
手順13はsystemc-2.3.2/msvc10/SystemC/x64/Debugを指定します。

10.C++ファイルに以下を貼り付けます。
参考サイトとほぼ変わりません。

#define _CRT_SECURE_NO_WARNINGS
#include <systemc.h>

struct test_module : sc_module {
    SC_HAS_PROCESS(test_module);

    test_module(::sc_core::sc_module_name) {
        SC_THREAD(test_thread);
    }

    sc_signal<std::string>  message{ "message" };

    void test_thread() {
        message.write("Hello world!");
        wait(1, SC_NS);
        cout << message.read() << endl;
        sc_stop();
    }
};

int sc_main(int argc, char** argv)
{
    test_module tmod{ "tmod" };
    sc_start();
    return 0;
}

11.Buildして成功したら完成です。
お疲れ様でした。

おわりに

深夜に適当に書いたので間違ってたり分からなかったら教えてください。画像追加したりします多分…。
QiitaにSystemCの記事が全くないのでこれを機会に誰かたくさん書いてください、お願いします。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1