sosarkar Posted January 31, 2014 Report Share Posted January 31, 2014 Hello, I am somewhat new to SystemC and I am interested in converting ASCII string to sc_bv and vice versa. I tried static casting the string without success. I am trying with stringstream; first convert the string to a stream and then stream into sc_bv. Any comments and suggestions are welcome. Thanks for your kind attention. ~S Quote Link to comment Share on other sites More sharing options...
ralph.goergen Posted January 31, 2014 Report Share Posted January 31, 2014 Hi. As far as I know, the following should work: sc_bv<8> my_bv_var("01010101"); and my_bv_var.to_string(); See IEEE 1666 - 2011: 7.9.3 and 7.9.5 for details. Greetings Ralph Quote Link to comment Share on other sites More sharing options...
sosarkar Posted January 31, 2014 Author Report Share Posted January 31, 2014 Thanks Ralph. Quote Link to comment Share on other sites More sharing options...
dakupoto Posted February 1, 2014 Report Share Posted February 1, 2014 Hello, I am somewhat new to SystemC and I am interested in converting ASCII string to sc_bv and vice versa. I tried static casting the string without success. I am trying with stringstream; first convert the string to a stream and then stream into sc_bv. Any comments and suggestions are welcome. Thanks for your kind attention. ~S Hello Sir. Please note that whenever you use casting, you are trying to force the compiler to do something that it normally would not do, and so create irritating side-effects. This especially true in a complicated simulation involving large number of interacting modules. The best option is to use string literals. This is especially true if 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.