fc2ブログ

[SystemC][SCV] SCV2.0公式レビューの doxygenファイル

Forumsにて、あったのでメモ。


scv-2.0-public_preview Documentation


とスレッドではなっているのですが、中身は doxygenのファイルでした。
ファイル:131MB、解凍後:181MBってあんまり圧縮率・・・


SystemCの doxygen生成

上記のスレッドを立てた人は、SystemC 2.3も投稿していたみたいなのですが、
そこで、生成について書いてありました。

  • 引用

cd $SYSTEMC_HOME
make -C objdir doxygen

Makefile内に doxygen生成用も入っていたんですね。

[SystemC][SCV] SCV-2.0の公開レビュー

http://www.accellera.org/activities/committees/systemc-verification/


  • 引用:

On June 20, 2013, the SystemC Verification Working Group began a 90-day public review of the SystemC Verification Library 2.0.

ということで、開始されています。


更新内容:(2088は誤記だと思いたいw)

  • Compatible with IEEE 1666-2011 through Accellera SystemC 2.3.0.
  • 64-bit support
  • Recent compilers support (Visual C++ 2088, GCC up to 4.7, clang)
  • Modern OS support (Windows 7, recent RHEL and Ubtuntu Linux, OS X)
  • Numerous bug fixes


2.0といいつつもバグFix?

ファイルダウンロードして、「RELEASENOTES」見てみたのですが、
特に新しい機能とかなく・・・


なんで 2.0にした?っていうぐらい疑問に思うのだけど。。。
coverage」は?「UCIS」の実行オブジェクトは!!!???

SCV:SystemCデータ型のランダマイズ

今まで試したソースは C/C++のデータ・タイプだったので、
SystemCのデータ・タイプで試してみました。

  • サンプルコード

  •  1|#include <scv.h>
     2|
     3|int sc_mainint argc, char* argv[] ) {
     4|
     5|  printf( "-----------------------\n");
     6|  printf( "--- Type:sc_int<8>  ---\n");
     7|  printf( "-----------------------\n");
     8|  scv_smart_ptr<sc_int<8> > sci_p( "sc_int" );
     9|
    10|  sci_p->keep_out( -3030 );
    11|
    12|  for (int i=0; i<10; i++) {
    13|    sci_p->next();
    14|    printf( "[SCV] data = %d\n", sci_p->read().to_int() );
    15|  }
    16|
    17|  printf( "-----------------------\n");
    18|  printf( "--- Type:sc_lv<8> -----\n");
    19|  printf( "-----------------------\n");
    20|  scv_smart_ptr<sc_lv<4> > sclv_p( "sc_lv" );
    21|
    22|  sclv_p->keep_out07 );
    23|  sclv_p->set_mode(scv_extensions_if::RANDOM_AVOID_DUPLICATE);
    24|
    25|  for (int i=0; i<10; i++) {
    26|    sclv_p->next();
    27|    printf( "[SCV] data = %d\n", sclv_p->read().to_uint() );
    28|  }
    29|
    30|  return 0;
    31|}
  • 実行結果

  • $> ./main 
    
                 SystemC 2.2.0 --- Jan 15 2012 14:19:56
            Copyright (c) 1996-2006 by all Contributors
                        ALL RIGHTS RESERVED
    -----------------------
    --- Type:sc_int<8>  ---
    -----------------------
    [SCV] data = 101
    [SCV] data = -77
    [SCV] data = 112
    [SCV] data = -75
    [SCV] data = -93
    [SCV] data = 74
    [SCV] data = -114
    [SCV] data = -39
    [SCV] data = -66
    [SCV] data = -128
    -----------------------
    --- Type:sc_lv<8> -----
    -----------------------
    [SCV] data = 14
    [SCV] data = 9
    [SCV] data = 12
    [SCV] data = 15
    [SCV] data = 10
    [SCV] data = 11
    [SCV] data = 8
    [SCV] data = 13
    [SCV] data = 11
    [SCV] data = 9
    

当たり前ですが、普通に出来ますね。

SCV:SCV_SOFT_SONSTRAINT

前にブログで紹介したのですが、SystemVerilog 2012より
soft constraintが追加されます。


SystemVerilog 2012 : soft constraint


しかし、試そうにも Modelsim-ASEはランダム生成は無理だったので、
soft constraintがどういったものかイマイチ分かっていませんでしたが、


「それ、SCVなら出来るよ!」


っていうことです。

  • サンプルコード

  •  1|#include <scv.h>
     2|
     3|//Valid values for a are 10 or 30
     4|class slower : public scv_constraint_base {
     5|public:
     6|  scv_smart_ptr <int> a;
     7|  SCV_CONSTRAINT_CTOR(slower) {
     8|    SCV_SOFT_CONSTRAINT(
     9|      (a() == 10 || a() == 30)
    10|    );
    11|  }
    12|};
    13|
    14|//Valid values for a are 20 or 50
    15|class new_slower : public slower {
    16|  SCV_CONSTRAINT_CTOR(new_slower) {
    17|    SCV_BASE_CONSTRAINT(slower);
    18|    SCV_CONSTRAINT(
    19|      (a() == 20 || a() == 50)
    20|    );
    21|  }
    22|};
    23|
    24|int sc_mainint argc, char* argv[] ) {
    25|
    26|  slower     s_hoge("slower");
    27|  new_slower n_hoge("new_slower");
    28|
    29|  for (int i=0; i<5; i++) {
    30|    s_hoge.next();
    31|    printf( "[SCV] slower data = %d\n", s_hoge.a->read() );
    32|  }
    33|  printf("\n");
    34|  for (int i=0; i<5; i++) {
    35|    n_hoge.next();
    36|    printf( "[SCV] new slower data = %d\n", n_hoge.a->read() );
    37|  }
    38|
    39|  return 0;
    40|}
    41|
  • 実行結果

  • $> ./main 
    
                 SystemC 2.2.0 --- Jan 15 2012 14:19:56
            Copyright (c) 1996-2006 by all Contributors
                        ALL RIGHTS RESERVED
    
    *** SCV_WARNING: CONSTRAINT_WARNING_IGNORE_SOFT_CONSTRAINT at time 0 s in process 
        Soft constraints for over-constrained  object 'new_slower' will be ignored. 
    
    [SCV] slower data = 30
    [SCV] slower data = 10
    [SCV] slower data = 30
    [SCV] slower data = 30
    [SCV] slower data = 10
    
    [SCV] new slower data = 20
    [SCV] new slower data = 20
    [SCV] new slower data = 20
    [SCV] new slower data = 50
    [SCV] new slower data = 20
    

確かに、制約が上書きされていることが分かります。
でも、SCVの場合 SCV_BASE_CONSTRAINT書かなければ。。。(ry


ちなみに、相反する制約かけると暴走?します。
ぜひお試しください。

SCV:制約付ランダムデータ生成(その2)

今回は、SCVを使った制約付きランダム生成(その2)です。
前回のデータを元に更に制約を加えてみたいと思います。

  • サンプルコード

  •  1|#include <scv.h>
     2|
     3|// Valid values for a are 10-20, 50-60, 90-100
     4|class slower : public scv_constraint_base {
     5|public:
     6|  scv_smart_ptr <int> a;
     7|  SCV_CONSTRAINT_CTOR(slower) {
     8|    SCV_CONSTRAINT(
     9|       (a() >= 10 && a() <= 100) &&
    10|      !(a() >= 21 && a() <= 49) &&
    11|      !(a() >= 61 && a() <= 89)
    12|    );
    13|  }
    14|};
    15|
    16|// Valid values for a are 55-60, 90-100
    17|class new_slower : public slower {
    18|  SCV_CONSTRAINT_CTOR(new_slower) {
    19|    SCV_BASE_CONSTRAINT(slower);
    20|    SCV_CONSTRAINT(
    21|      ( a() >= 55)
    22|    );
    23|  }
    24|};
    25|
    26|int sc_mainint argc, char* argv[] ) {
    27|
    28|  slower     s_hoge("slower");
    29|  new_slower n_hoge("new_slower");
    30|
    31|  for (int i=0; i<10; i++) {
    32|    s_hoge.next();
    33|    printf( "[SCV] slower data = %d\n", s_hoge.a->read() );
    34|  }
    35|  printf("\n");
    36|  for (int i=0; i<20; i++) {
    37|    n_hoge.next();
    38|    printf( "[SCV] new slower data = %d\n", n_hoge.a->read() );
    39|  }
    40|
    41|  return 0;
    42|}
  • 実行結果

  • $> ./main 
    
                 SystemC 2.2.0 --- Jan 15 2012 14:19:56
            Copyright (c) 1996-2006 by all Contributors
                        ALL RIGHTS RESERVED
    [SCV] slower data = 94
    [SCV] slower data = 99
    [SCV] slower data = 55
    [SCV] slower data = 94
    [SCV] slower data = 99
    [SCV] slower data = 55
    [SCV] slower data = 15
    [SCV] slower data = 99
    [SCV] slower data = 91
    [SCV] slower data = 100
    
    [SCV] new slower data = 56
    [SCV] new slower data = 92
    [SCV] new slower data = 55
    [SCV] new slower data = 93
    [SCV] new slower data = 55
    [SCV] new slower data = 91
    [SCV] new slower data = 93
    [SCV] new slower data = 96
    [SCV] new slower data = 60
    [SCV] new slower data = 93
    [SCV] new slower data = 99
    [SCV] new slower data = 96
    [SCV] new slower data = 96
    [SCV] new slower data = 94
    [SCV] new slower data = 60
    [SCV] new slower data = 55
    [SCV] new slower data = 100
    [SCV] new slower data = 58
    [SCV] new slower data = 93
    [SCV] new slower data = 58
    

新しく制約を追加したものは、制約通りに出力されています。
ちなみに、 SCV_BASE_CONSTRAINT(slower); を記載しないと、
ベースクラス(slower)の制約はなかったものとなります。

プロフィール

Kocha

Author:Kocha
なんでもチャレンジ!(^o^)/

はてなブログがメイン場に
github:Kocha
イベントカレンダー

カレンダー
02 | 2024/03 | 04
- - - - - 1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31 - - - - - -
カテゴリ
OVP (4)
最新記事
最新コメント
アーカイブ
リンク
Twitter
アクセス人数