ポートでエラーが発生
ハッカーのたのしみに乗っていたNLZ関数をsystemcで書いてみる。
実行するとこんなエラーが。
terminate called after throwing an instance of 'sc_core::sc_report'
what(): Error: (E112) get interface failed: port is not bound: port 'utop.unlz_test.port_1' (sc_in)
In file: ../../.././../src/sysc/communication/sc_port.cpp:196
Abort (core dumped)
nlz.hでこんな感じでport宣言して、
#ifndef _NLZ_H_
#define _NLZ_H_
#include <systemc.h>SC_MODULE(nlz){
sc_in < sc_uint < 32> > nlz_in;
sc_out < sc_uint <8> > nlz_out;
void calc(void);
SC_CTOR(nlz) {
SC_THREAD(calc);
sensitive < < nlz_in.default_event();
}
};
top.hでつないでいるんだが、駄目みたいだ。
SC_MODULE(top){
sc_signal <sc_uint <32> > din;
sc_signal <sc_uint <8> > dout;nlz unlz;
nlz_test unlz_test;SC_CTOR(top): unlz("unlz"), unlz_test("unlz_test")
{
unlz.nlz_in(din);
unlz.nlz_out(dout);unlz_test.nlz_in(din);
unlz_test.nlz_out(dout);
}};
コンストラクタで呼ばれている、これが駄目みたい。
sensitive << nlz_in.default_event();
sensitive << nlz_in; にすればOK。
どこかの記事で、「systemcはcore dumpするから使いにくい」というのを
読んだことがある。それを読んだときは、配列の外アクセスするとか、
破壊したオブジェクトを使おうとしてるんないの?とか思っていたけど、
そんなレベルじゃないな。もっと基本的なところでも簡単にcore dumpする。
聞くとやるとは大違い。
The comments to this entry are closed.


Comments