I am porting from code from SystemVerilog to SystemC. SV is easily able to interpret packed structs of bits/logic as a single bit/logic vector. For example:
typedef struct logic {
logic [31:0] blk1; //63:32
logic [4:0] blk2; //31:27
logic [2:0] blk3; //26:24
logic [4:0] blk4; //23:19
logic [2:0] blk5; //18:16
logic [7:0] blk6; //15:8
logic [7:0] blk7; //7:0
} typ_block;
...
typ_block blockA;
logic[63:0] blockB;
blockB = blockA; // no problem here
But with SystemC and using sc_lv<> template, this gives a compiler error due to the mismatching types.
struct typ_block {
sc_lv<32> blk1; //63:32
sc_lv<5> blk2; //31:27
sc_lv<3> blk3; //26:24
sc_lv<5> blk4; //23:19
sc_lv<3> blk5; //18:16
sc_lv<8> blk6; //15:8
sc_lv<8> blk7; //7:0
};
...
typ_block blockA;
sc_lv<64> blockB;
blockB = blockA; // compiler error
Is there a good SystemC-supported way to do this equivalent? I can think of potential solutions but they are not elegant or concise, and I'm not sure if a c-style pointer cast would be safe/correct.