I am currently working on a model that consists of three components: memory, adder and link element between the two of them. The data transmission between them happens via ports that look like sc_in<BasePort*>, so a pointer to the BasePort class. This class only contains the status bits (e.g. valid), while the actual data is part of a child class of BasePort that is just callled Port. Inside the memory an object of type Port will be instatiated, the data will be written to that object, and finally the oject is static casted to an object of type BasePort that will then be written to the output port. The reason for this split is that the linking element should be able to work independently from the underlying data type that is transmitted.
The problem I am running into is that the data of BasePort, the status bits, seem to get lost during transmission. So for example, in the linking element I can only see the data while the valid flag will always be set to false, even though it was correctly set in the memory. So, i can see the correct data but the valid flag will not be set.
So far I have checked that the pointer that is seen in the linking element is the same as the one that is written in the memory, which is the case. I have also tried chaning the data type of the channels connecting the components from sc_signal<BasePort*> to sc_buffer<BasePort*> but that also didn't fix the issue. I really don't understand why this part of the data transmission is lost. If either all or nothing is lost that would make sense, but I can't think of any reason why only the data of BasePort but not the data of Port is lost.
Any thoughts on what I am doing wrong here?