I am using the following without any issues
typedef bit[`AMIQ_ETH_ADDRESS_WIDTH - 1:0] amiq_eth_address;
rand amiq_eth_address destination_address;
`uvm_pack_int(amiq_eth_address'({<<8{destination_address}}));
But if I now try and unpack using
`uvm_unpack_int(amiq_eth_address'({>>8{destination_address}}));
I am getting the following error
near "'": syntax error, unexpected '\'', expecting "'{".
I am not sure what I am doing wrong.
This is one of the big problems with the field automation macros. Very difficult to debug mistakes unless you know exactly what the macros is doing. That and their poor performance are some of the many reasons we try to steer people away from them.
The problem is your macro gets expanded in part to
amiq_eth_address'({>>8{destination_address}}) = packer.m_bits[packer.count +: SIZE]; \
A cast on the LHS of an assignment is illegal. There’s no need for it as the streaming operator on the LHS is an implicit cast to the type of the target anyways.
I only used the cast as the simulator issues a warning if I don’t. I may try and rewrite the code without the macros. Thanks
What was the warning message?
(vlog-2960) Streaming concatenation shall not be used as an operand in an expression without first casting it to a bit-stream type.