# SV and vhdl Dut connection

**URL:** <https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659>\
**Category:** UVM\
**Tags:** UVM, vhdl-design, sytemverilog\
**Created:** [February 1, 2021, 11:18am UTC](https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659 "2021-02-01T11:18:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![poonamnlwd](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/p/ecc23a/32.png) [@poonamnlwd](https://verificationacademy.com/forums/u/poonamnlwd)\
**Post date:** [February 1, 2021, 11:18am UTC](https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659/1 "2021-02-01T11:18:18Z")

</div>

Hi,  
In uvm environment I want connect .sv(TB) and design in vhdl. How to represent record under record in systemverilog struct?

```vhdl

 type abc_t is
  record
  valid :std_logic
  data : std_logic_vector(7 downto 0);
  end record;
  type a is array (5 downto 0) of abc_t;
  type b is array (3 downto 0) of a;
  
  type bcd_t is
   record
    efg : b
   end record;

```

How to represent above code in system verilog?

---

<div class="post-metadata">

**Author:** ![cgales](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/ccd318/32.png) [@cgales](https://verificationacademy.com/forums/u/cgales)\
**Post date:** [February 1, 2021, 3:46pm UTC](https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659/2 "2021-02-01T15:46:40Z")

</div>

_In reply to [poonamnlwd](https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659):_

Please use [code tags](https://verificationacademy.com/forums/announcements/please-format-your-code-code-and/code-tags) making your code easier to read. I have added them for you.

There is no standard that defines the interaction between VHDL and SystemVerilog, although most simulation tools provide methods to connect the two. You will need to refer to your tool documentation or contact your tool vendor for additional assistance.

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [February 2, 2021, 7:26am UTC](https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659/3 "2021-02-02T07:26:48Z")

</div>

_In reply to [poonamnlwd](https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659/2):_

> Hi,  
> In uvm environment I want connect .sv(TB) and design in vhdl. How to represent record under record in systemverilog struct?

```vhdl

type abc_t is
record
valid :std_logic
data : std_logic_vector(7 downto 0);
end record;
type a is array (5 downto 0) of abc_t;
type b is array (3 downto 0) of a;
type bcd_t is
record
efg : b
end record;

```

How to represent above code in system verilog?

You could do it like this:

```verilog
package my_sv_types;
typedef struct packed {
     logic val;
     logic [7:0] dat;
     } abc_sv_t;

typedef abc_sv_t [5:0] a;   
typedef a [3:0] b;   

typedef struct packed {
     b efg;
    } bcd_sv_t;

endpackage

```

---

<div class="post-metadata">

**Author:** ![poonamnlwd](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/p/ecc23a/32.png) [@poonamnlwd](https://verificationacademy.com/forums/u/poonamnlwd)\
**Post date:** [February 2, 2021, 8:15am UTC](https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659/4 "2021-02-02T08:15:33Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659/3):_

```verilog

typedef struct {
  bit val;
  bit [7:0] data;
}abc_t;

typedef abc_t a[6];
typedef a b[4];

typedef struct {
  b efg;
}bcd_sv_t
 

```

type a is array (5 downto 0) of abc\_t;  
5 downto 0 is considered as a width or depth?

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [February 2, 2021, 1:23pm UTC](https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659/5 "2021-02-02T13:23:11Z")

</div>

_In reply to [poonamnlwd](https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659/4):_

This does not matter. See the code example below.

```verilog
package my_sv_types;
typedef struct packed {
     logic val;
     logic [7:0] dat;
     } abc_sv_t;

typedef abc_sv_t [6] a;   
typedef a [4] b;   

typedef struct packed {
     b efg;
    } bcd_sv_t;

endpackage

module tb;
  import my_sv_types::*;
  logic clk;
  a sig1 = '{'{1'b0, 8'h55}, '{1'b0, 8'h55}, '{1'b0, 8'h55}, '{1'b0, 8'h55}, '{1'b0, 8'h55}, '{1'b0, 8'h55}};
  b sig2;
  abc_sv_t [5:0] sig3;
  bcd_sv_t [3:0] sig4;

  abc_sv_t [0:5] sig5;
  bcd_sv_t [0:3] sig6;

  initial begin
    sig3 = sig1;
    #10;
    sig5 = sig1;
    #10;
  end
endmodule

```

---

<div class="post-metadata">

**Author:** ![poonamnlwd](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/p/ecc23a/32.png) [@poonamnlwd](https://verificationacademy.com/forums/u/poonamnlwd)\
**Post date:** [February 2, 2021, 3:07pm UTC](https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659/6 "2021-02-02T15:07:03Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/sv-and-vhdl-dut-connection/38659/5):_

Thank you for an example
