[sv-ec] Packed union member pass by reference

From: Radosław Nawrot <Radoslaw.Nawrot@aldec.com.pl>
Date: Wed Dec 04 2013 - 23:43:29 PST
Hi,
I have question about packed union elements pass by reference.
Simple example:
 
module top (  );
 union packed {reg r; bit b;}u;
 function  automatic void foo(ref reg x);
  x=1'bz;
 endfunction
 task automatic tsk (ref bit b);
 #1;
 case ( b )
  0: $display("0");
  1: $display("1");
  default : $display("Error");
 endcase
 endtask
 
 initial
  fork
   foo(u.r);
   tsk(u.b);
  join
endmodule
 
 
LRM say's:"
Only the following shall be legal to pass by reference:

- A variable,

- A class property,

- A member of an unpacked structure, or

- An element of an unpacked array.

"

That means union member cannot be passed by reference. Am I right?  Why?

What are the contraindications to allow such construction?

 

 
Regards,
Radek
 

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Dec 4 23:44:00 2013

This archive was generated by hypermail 2.1.8 : Wed Dec 04 2013 - 23:44:14 PST