Search the Community
Showing results for tags 'sc_fixed'.
Found 2 results
Hi all, I'm quite new to all the SystemC world. As far as I got the sc_fixed type should be synthesizable. My problem at the moment is that I have a number, and I need the negative version of that number. The easiest way to do it is to multiply for -1. The problem is the HLS. I actually don't know how this it will be handled by the tool. I would like to avoid to instantiate a multiplier just to do a simple 2 complement operation ( flip the bits and adding 1 to the LSB ). If I can't trust the HLS tools I guess the safest way would be to do the 2 complement by myself, but even there I have some concern : sc_fixed <8,3,SC_RND,SC_SAT> foo, foo_neg; foo_neg = ~foo + 2^(8-3) ( PSEUDOCODE : I still need to figure out ) I don't really like to add 2^-5, it isn't clean. Even here probably it's easier to convert in int and add 1, but still it's quite messy in my opinion. Does anyone know if the tools are smart enough to handle correctly a multiplication between sc_fixed type and -1 and to implement correctly the 2 complement operation? If not how should I need to proceed ?
How to output "float (double)" from sc_fixed type class using sc_trace? I have an existing model (all in floating point design, using "sc_signal<double>"), and am trying to convert it to its fixed point one (i.e. using sc_signal<sc_fixed< ,,,, > >"). sc_signal<double> ch_a; sc_signal<sc_fixed<16,8, SC_RND, SC_SAT> > ch_a_fix; sc_trace(tf, ch_a, "ch_a" ); // floating point channel tracing, it traces signal in "double". sc_trace(tf, ch_a_fix, "ch_a_fix ); // fixed point channel tracing: it traces signal in "integer numbers". The question is, how can I trace the sc_fixed type class (sc_signal<sc_fixed<...:> >) in floating point numbers? For waveform viewer-wise, I'm using gtkwave for now. I have found one posting that has the same question that I have now. But it doesn't have any replies there. http://www.accellera.org/Discussion_Forums/helpforum/archive/msg/msg?list_name=help_forum&monthdir=200802&msg=msg00035.html Many thanks in advance.