This is my code.
class packet;
rand bit cmd;
rand bit [7:0] data;
rand bit [1:0] td;
rand bit [1:0] addr_inc;
rand bit [3:0] num_rd;
constraint solve_td_b4_cmd {
solve td before cmd;
}
constraint solve_addr_inc_b4_cmd {
solve addr_inc before cmd;
}
constraint solve_num_rd_b4_cmd {
solve num_rd before cmd;
}
constraint solve_cmd_b4_data {
solve cmd before data;
}
constraint set_data {
if (cmd == 1'b0) {
data == {td, addr_inc, num_rd};
}
}
endclass
Now the result is, data is generated randomly without concatenating td, addr_inc, and num_rd.