Based on what you have described, I would suggest that you design in a register that indicated the address of the last valid value in your memory, that you can set when the memory is loaded with the values.
As mentioned in the comments, once synthesized, you have no way of knowing the values passed those you have set explicitly (1'bx
is simply a simulation placeholder for "dont care", meaning the value could be 1'b1
or 1'b0
during the actual run). Thus, you can either have a special value for uninitialized memory addresses that the entire memory is filled with at boot and DOESNT appear in your valid data, or, better, use the register concept suggested above to keep track of the size/address of your last valid entry.