(vlog-7041) String assignment: Assigning a string to a packed type requires a cast

HI I am facing the following issue:
This is not my code and is running fine with vcs.

string scenario_name = “traffic”;
reg [(512*8)-1:0] scenario_name_reg = scenario_name; this line is generating the error(vlog-7041) String assignment: Assigning a string to a packed type requires a cast.

How do i cast this string variable? Please help. Thanks.

In reply to divya0476:
You can only make assignments to packed(integral) types from other packed type, or reals. You can do a cast, but that would right justify the string in the register, leaving you with null bytes at the beginning. You can use the streaming operator, which is is like a cast, but left justifies.

reg [(512*8)-1:0] scenario_name_reg = {>>{scenario_name}};