# Difference between nettype and "wire logic"

**URL:** <https://verificationacademy.com/forums/t/difference-between-nettype-and-wire-logic/30860>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, nettype\
**Created:** [July 12, 2015, 6:36pm UTC](https://verificationacademy.com/forums/t/difference-between-nettype-and-wire-logic/30860 "2015-07-12T18:36:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivaj](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@sivaj](https://verificationacademy.com/forums/u/sivaj)\
**Post date:** [July 12, 2015, 6:36pm UTC](https://verificationacademy.com/forums/t/difference-between-nettype-and-wire-logic/30860/1 "2015-07-12T18:36:37Z")

</div>

What is the difference between nettype and “wire logic”. Can you please explain with example?

I Know the below details.

For “wire logic” there is an inbuilt resolution function and for “nettype”we can have our own resolution function, we can drive whatever the data that we want to drive (4-state data, 2-state data,real value data),i.e., we can define the type of driving data in case of “nettype”.

Can you please explain with some examples on advantages of nettype over “wire logic”?

---

<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:** [July 13, 2015, 1:25am UTC](https://verificationacademy.com/forums/t/difference-between-nettype-and-wire-logic/30860/2 "2015-07-13T01:25:32Z")

</div>

**nettype** was added to SystemVerilog primarily for Analog modeling; either entirely within SystemVerilog, or interfacing with another analog modeling language. And example would be using the sum of a set of real number drivers to cross a threshold value that would be converted to a digital 0 or 1.

Although having the ability to create any arbitrary resolution function might be ideal, in practice, this functionality needs to be limited to a set of standard resolution functions for interoperability and performance. That standard has yet to be defined.

---

<div class="post-metadata">

**Author:** ![sivaj](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@sivaj](https://verificationacademy.com/forums/u/sivaj)\
**Post date:** [July 16, 2015, 5:32pm UTC](https://verificationacademy.com/forums/t/difference-between-nettype-and-wire-logic/30860/3 "2015-07-16T17:32:19Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/difference-between-nettype-and-wire-logic/30860/2):_

Hi Dave,

Thanks for your answer. can you please give one simple example for nettype with resolution function.

Thanks in advance.

---

<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:** [July 16, 2015, 7:13pm UTC](https://verificationacademy.com/forums/t/difference-between-nettype-and-wire-logic/30860/4 "2015-07-16T19:13:49Z")

</div>

_In reply to [sivaj](https://verificationacademy.com/forums/t/difference-between-nettype-and-wire-logic/30860/3):_

There is an example at the end of section _6.6.7 User-defined nettypes_ that sums the value from multiple real drivers

---

<div class="post-metadata">

**Author:** ![sivaj](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@sivaj](https://verificationacademy.com/forums/u/sivaj)\
**Post date:** [July 19, 2015, 7:14pm UTC](https://verificationacademy.com/forums/t/difference-between-nettype-and-wire-logic/30860/5 "2015-07-19T19:14:27Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/difference-between-nettype-and-wire-logic/30860/4):_

Hi Dave,

Thanks for your answers i write one simple program as shown below but i was unable to use the resolution function. Could you please give me the code on how can i use the resolution function in this case.

typedef struct {  
real field1;  
real field2;

} T;

function automatic T Tsum  
(input T driver);  
[//Tsum.filed1](https://Tsum.filed1) = 0.0;  
foreach(driver[i])  
Tsum.field1 += driver[i].field1;  
endfunction

// a nettype whoose data type is T and resolution function is Tsum  
nettype T wTsum with Tsum;  
module foo (foo\_p);  
output wTsum foo\_p;  
wTsum q;

assign q=foo\_p;  
assign foo\_p = T’{14.5,2.5};

endmodule
