KMLM List
View email archives for the history of this mailing list.
|
|
|
|
systemc-forum - Re: [systemc-forum] sc_in<sc_bit> port can't be used with binary operat
|
Message Thread:
Previous |
Next
|
- To: Ibrahim Kazi <ibrahimkazi@xxxxxxxxx>
- From: Rohit Kurup <rohitbkurup@xxxxxxxxx>
- Date: Thu, 27 Aug 2009 11:27:47 +0530
- Cc: systemc-forum@xxxxxxxxxxxxxxxxx
- Send Email to systemc-forum@lists.systemc.org:
- Send new message
- Reply to this message
|
Ibrahim,
sc_in is a template class. The | operation is to perform on the template
parameter. Template parameters can be standard types(int, sc_bit, char,
etc....) or used defined types. Since implementation of the operator varies
across the types sc_in does not define this.
You need to modify your code to:
c->write(a->read()|b->read());
It is safe to use read and write defined for sc_in and sc_out respectively
to perform this operation.
BR,
Rohit
On Thu, Aug 27, 2009 at 11:00 AM, Ibrahim Kazi <ibrahimkazi@xxxxxxxxx>wrote:
> Hello ppl i am a newbie to systemC so forgive me for the simplicity of
> my questions: the following is my code for a simple OR-Gate and the
> error generated when i compile/build this code in VC++. can anyone
> help me in this regard?
>
> #include "systemc.h"
>
> SC_MODULE(or_gate)
> {
> sc_in<sc_bit> a;
> sc_in<sc_bit> b;
> sc_out<sc_bit> c;
>
> void prc_or_gate() {c=a | b;} //this line gives error
>
> SC_CTOR(or_gate)
> {
> SC_METHOD(prc_or_gate);
> sensitive << a << b;
> }
> };
>
> THE ERROR GENERATED IS : error C2678: binary '|' : no operator defined
> which takes a left-hand operand of type 'class sc_in<class
> sc_dt::sc_bit>' (or there is no acceptable conversion)
>
> --
> Ibrahim.B.Kazi
>
--
Warm regards,
Rohit
|
|