# Cannot mix packed and unpacked types in this operation

**URL:** <https://verificationacademy.com/forums/t/cannot-mix-packed-and-unpacked-types-in-this-operation/32995>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, unpacked-array, packed-array\
**Created:** [March 24, 2017, 9:18am UTC](https://verificationacademy.com/forums/t/cannot-mix-packed-and-unpacked-types-in-this-operation/32995 "2017-03-24T09:18:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alessandro](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@alessandro](https://verificationacademy.com/forums/u/alessandro)\
**Post date:** [March 24, 2017, 9:18am UTC](https://verificationacademy.com/forums/t/cannot-mix-packed-and-unpacked-types-in-this-operation/32995/1 "2017-03-24T09:18:17Z")

</div>

I have the below code and the assignment is giving me “Cannot mix packed and unpacked types in this operation” as an error.  
What options do I have to get this to work?

```verilog

interface my_interface
  #(
     parameter int unsigned N
  )
  ( 
    outuput sig_o [N - 1 : 0]
  );

  bit drv;
  logic sig_i [N - 1 : 0];

  assign sig_o = drv ? sig_i : 1'hz;
endinterface

```

---

<div class="post-metadata">

**Author:** ![sunils](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/df705f/32.png) [@sunils](https://verificationacademy.com/forums/u/sunils)\
**Post date:** [March 24, 2017, 9:32am UTC](https://verificationacademy.com/forums/t/cannot-mix-packed-and-unpacked-types-in-this-operation/32995/2 "2017-03-24T09:32:00Z")

</div>

_In reply to [alessandro](https://verificationacademy.com/forums/t/cannot-mix-packed-and-unpacked-types-in-this-operation/32995):_

Use wire type in assign statement instead of reg.

Or the other way around is:

```verilog
interface my_interface(outs);
 
  bit drv;
  logic [3:0]sig_i;
  output [3:0]outs;
 
  assign outs = drv ? sig_i : 1'hz;
endinterface

```

Thanks.

---

<div class="post-metadata">

**Author:** ![alessandro](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@alessandro](https://verificationacademy.com/forums/u/alessandro)\
**Post date:** [March 24, 2017, 9:39am UTC](https://verificationacademy.com/forums/t/cannot-mix-packed-and-unpacked-types-in-this-operation/32995/3 "2017-03-24T09:39:30Z")

</div>

_In reply to [sunils](https://verificationacademy.com/forums/t/cannot-mix-packed-and-unpacked-types-in-this-operation/32995/2):_

Having sig\_i as a wire does not solve the issue unfortunately.

Thanks.

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [March 24, 2017, 4:32pm UTC](https://verificationacademy.com/forums/t/cannot-mix-packed-and-unpacked-types-in-this-operation/32995/4 "2017-03-24T16:32:01Z")

</div>

_In reply to [alessandro](https://verificationacademy.com/forums/t/cannot-mix-packed-and-unpacked-types-in-this-operation/32995/3):_

Use an array assignment pattern with a default. (section 10.9.1 in the 1800-2012 LRM)

assign sig\_o = drv ? sig\_i : '{default:'z};
