scsc 0 Report post Posted November 5, 2018 I had a struct defined as struct pixel { sc_uint<8> r; sc_uint<8> g; sc_uint<8> b; }; Then I try to pass actual pixel values to the ports, defined as pixel data type in main.cpp sc_signal<pixel> p1; sc_signal<pixel> p2; p1.write(pixel(1, 2, 3)); p2.write(pixel(4, 5, 6)); But it seems p1.write() and p2.write() didn't initialize p1 and p2 correctly as I still see they don't have the expected pixel values (1,2,3) and (4,5,6). Do I need to use sc_interface to pass this customized data type around? Thanks Quote Share this post Link to post Share on other sites
Eyck 57 Report post Posted November 5, 2018 Where did you check the values of p1 and p2? write() only schedules the values to be written, you will see the actual value in the next delta cycle. Best regards 1 kartikkg reacted to this Quote Share this post Link to post Share on other sites
scsc 0 Report post Posted November 5, 2018 That's a quick response. Thanks. p1 and p2 are in an SC_METHOD process so I didn't put in clocks. I checked their contents by printing out their struct values. Could "the next delta cycle" mean a wait()? Quote Share this post Link to post Share on other sites
Eyck 57 Report post Posted November 13, 2018 Well, if this is in the same method then you won't see the update as there is not delta cylce in between. You would see it if you put it in a SC_THREAD and put a wait(SC_ZERO_TIME); between the write() and the read() of p1 and p2 Quote Share this post Link to post Share on other sites
scsc 0 Report post Posted November 13, 2018 Yes, I figured this one out by inserting a process ... Quote Share this post Link to post Share on other sites