Dev Posted December 16, 2013 Report Share Posted December 16, 2013 hello, i have jus started working with the systemC implementations for high level synthesis I need to implement the bit slicing paradigm in systemC which i tried with the variable.range() method and it works fine. But when i used with the fixed point types as shown in the code below, it didnt not work. define SC_INCLUDE_FX #include "systemc.h" SC_MODULE(slice){ sc_in<sc_fixed<42,12,SC_TRN,SC_SAT> > input sc_out<sc_fixed<14,14,SC_TRN,SC_SAT> > output void do_slice(){ // output=input.read().range(42,28); //ERROR IN THIS LINE } SC_CTOR(slice){ SC_METHOD(do_slice) sensitive<<input_re; dont_initialize(); } }; then, i tried of casting the fixed to a float / double value and tried to use it with the range method which also didnt work. So the range() method only works with sc_int and sc_uint? Is there any other way to do bit slicing paradigms for fractional values in systemC? please let me know. Thanks in advance Quote Link to comment Share on other sites More sharing options...
apfitch Posted December 17, 2013 Report Share Posted December 17, 2013 You can convert the range object to and from sc_int, e.g. SC_MODULE(Slice){ sc_in<sc_fixed<42,12> > input; sc_out<sc_fixed<14,14> > output; void do_slice(){ // sc_int<14> temp = sc_int<14>(input.read().range(41,28)); output.write( sc_fixed<14,14>(temp) ); } SC_CTOR(Slice){ SC_METHOD(do_slice) sensitive<<input; dont_initialize(); } }; The allowed conversions are shown in IEEE 1666-2011. regards Alan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.