OMark Posted October 10, 2021 Report Share Posted October 10, 2021 Given a variable "data1" of type uint32_t and a output port "data2" of type sc_lv<32>, can I safely do: data2.write(data1)? or shall I convert first the variable "data1" to a sc_lv<32> type of data? Quote Link to comment Share on other sites More sharing options...
maehne Posted October 11, 2021 Report Share Posted October 11, 2021 Check IEEE Std 1666-2011 clause 7.9.8.2. sc_lv<32> has a constructor and assignment operator for uint64, so your approach should be safe. If you want to be more explicit, you can create the temporary sc_lv<32> object yourself before passing it to the write function. Quote Link to comment Share on other sites More sharing options...
David Black Posted October 11, 2021 Report Share Posted October 11, 2021 Please read the IEEE-1666-2011 LRM (specifically section 7.9.6.5 Assignment operators). Works fine - see https://edaplayground.com/x/WHnn (morning exercise) 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.