In reply to sharvil111:
You might want to take a look at these 2 tutorials about packing and unpacking using streaming operators. They will answer your questions:
https://www.amiq.com/consulting/2017/05/29/how-to-pack-data-using-systemverilog-streaming-operators/