KMLM List
View email archives for the history of this mailing list.
|
|
|
|
systemc-forum - Re: [Systemc-forum] Using sc_fixed
|
Message Thread:
Previous |
Next
|
- To: systemc-forum@xxxxxxxxxxx
- From: Thorsten Schubert <Thorsten.Schubert@xxxxxxxx>
- Date: Fri, 6 May 2005 13:33:31 +0200
- Send Email to systemc-forum@osci.kavi.com:
- Send new message
- Reply to this message
|
Hi,
> So, it might be ugly, but the only way I have found to do this is to
copy
> the bits over, one by one:
> Given:
> sc_out<sc_bv<24> > data;
> sc_fixed<24, 16> sn;
> sc_bv<24> bv_tmp;
>
> ...then
> for (int i = 23; i >=0; i--) {
> bv_tmp[i] = sn[i];
> }
> data = bv_tmp;
A sightly less ugly way for the conversion is:
sc_bv<24> bv_tmp = sc_uint<24>(sn.range(23,0));
Regards,
Thorsten
--
OFFIS - R&D Division Embedded Hardware-/Software-Systems
Escherweg 2 - 26121 Oldenburg - Germany - http://www.offis.de/
Phone: +49-441-9722-229 - Fax: +49-441-9722-282
|
|