(vsim-3971) $cast to type

In reply to lalithjithan:

You want to cast using the ’ operator:


xtn.trans_type = transaction_t'(vif.mmon_cb.HTRANS); 
xtn.burst_mode = burst_t'(vif.mmon_cb.HBURST);
xtn.trans_size = size_t'(vif.mmon_cb.HSIZE);
xtn.read_write = rw_t'(vif.mmon_cb.HWRITE);
xtn.response = resp_t'(vif.mmon_cb.HRESP);

Section 6.19.4 of the LRM does refer to Section 6.24.2 (Dynamic casting with $cast), but I believe that will only work with compatible data types. Since reg is 4-state and bit is 2-state, the assignment types are not compatible.