acc_sysC Posted September 9, 2022 Report Share Posted September 9, 2022 I tried the following ways: auto write_val = sc_dt::sc_biguint<64>(0xffffffffffffffff)<<192 + sc_dt::sc_biguint<64>(0xffffffffffffffff)<<128 + sc_dt::sc_biguint<64>(0xffffffffffffffff)<<64 + sc_dt::sc_biguint<64>(0xffffffffffffffff); Also tried this: sc_dt::sc_biguint<N> write_val = sc_dt::sc_biguint<64>(0xffffffffffffffff)<<192 + sc_dt::sc_biguint<64>(0xffffffffffffffff)<<128 + sc_dt::sc_biguint<64>(0xffffffffffffffff)<<64 + sc_dt::sc_biguint<64>(0xffffffffffffffff); It compiles but does not take any values I give it. write_val always has 0s. Please guide me. EDA link:https://www.edaplayground.com/x/Dr6L Quote Link to comment Share on other sites More sharing options...
Eyck Posted September 9, 2022 Report Share Posted September 9, 2022 The problem is operator precedence. The expression should look like: auto write_val = (sc_dt::sc_biguint<64>(0xffffffffffffffff)<<192) + (sc_dt::sc_biguint<64>(0xffffffffffffffff)<<128) + (sc_dt::sc_biguint<64>(0xffffffffffffffff)<<64) + sc_dt::sc_biguint<64>(0xffffffffffffffff); Quote Link to comment Share on other sites More sharing options...
acc_sysC Posted September 9, 2022 Author Report Share Posted September 9, 2022 @Eyck it still gives me only 0s. Is it giving you some value when Data_in is printed out? I'm not sure if I am doing something wrong. The output as seen here:https://www.edaplayground.com/x/Dr6L Quote Link to comment Share on other sites More sharing options...
Eyck Posted September 17, 2022 Report Share Posted September 17, 2022 I modified your example: sc_bv<N> write_val = (sc_dt::sc_bv<64>(0xffffffffffffffff)<<192) | (sc_dt::sc_bv<64>(0xffffffffffffffff)<<128) | (sc_dt::sc_bv<64>(0xffffffffffffffff)<<64) | sc_dt::sc_bv<64>(0xffffffffffffffff); Data_in.write(write_val); wait(SC_ZERO_TIME); cout<< "at time: " << sc_time_stamp()<< endl << "Data_in in stimulus = "<< Data_in.read() << endl; If you write to a signal you need to wait at least for a delta-cycle to read the same value. Other than in my original post you need to or them rather than add. Quote Link to comment Share on other sites More sharing options...
acc_sysC Posted September 19, 2022 Author Report Share Posted September 19, 2022 @Eyckit works now! Thanks 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.