title: Casting struct to logic
body: <p>This is related to my previous <a href="https://stackoverflow.com/questions/23896809/casting-enum-to-logic">question</a>. Consider the following module declaration:</p>
  
  <pre><code>module DFF(d, q, CLK, RESET);
   parameter W = 2;
   input  [W-1:0] d;                      
   input  CLK;                                
   input  RESET;      
   output logic [W-1:0]   q; 
  
  //....
  endmodule
  </code></pre>
  
  <p>What is the proper way of instantiating it where d and q are of struct type? Here is my struct type:</p>
  
  <pre><code>typedef struct { logic s1; logic s2} T_STATE;
  </code></pre>
  
  <p>I would like to instantiate the DFF for a T_STATE variable type:</p>
  
  <pre><code>T_STATE d, q;
  DFF dff_inst (.d(d), .q(q), .CLK(CLK), .RESET(RESET));
  </code></pre>
  
  <p>I have unsuccessfully  tried the followings:</p>
  
  <pre><code>typedef logic [$bits(T_STATE) - 1 : 0] T_STATE_LOGIC; 
  DFF dff_inst (.d(T_STATE_LOGIC'(d)), .q(T_STATE_LOGIC'(q)), .CLK(CLK), .RESET(RESET));
  </code></pre>
  
  <p>and</p>
  
  <pre><code>DFF dff_inst (.d({d}), .q({q}), .CLK(CLK), .RESET(RESET));
  </code></pre>
  
  <p>I need the code to be synthesizable.</p>