I am building an OOP testbench for some ethernet packet verification. I need to compute a checksum, and I would really like to be able to use the streaming operators to take my ethernet class and populate a queue. Something like this:
bit[15:0] checksum[$];
checksum = { >> {this} };
// compute the checksum with a loop here
The code above compiles just fine, but when I try to run it in ModelSim 10.3, I get the following error:
** Fatal: Casting is only allowed on bit stream types.
Time: 0 ns Iteration: 0 Process: /model_test/#INITIAL#5 File: …
It sounds like what I am trying to do is not supported. So my question is: Is there a way to cast a class into a queue or byte stream without manually placing all the class members into the queue?
Thanks.