# Difference between input and wire clock to an interface

**URL:** <https://verificationacademy.com/forums/t/difference-between-input-and-wire-clock-to-an-interface/40399>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, interface\
**Created:** [May 15, 2022, 12:46pm UTC](https://verificationacademy.com/forums/t/difference-between-input-and-wire-clock-to-an-interface/40399 "2022-05-15T12:46:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rraa](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/53a042/32.png) [@rraa](https://verificationacademy.com/forums/u/rraa)\
**Post date:** [May 15, 2022, 12:46pm UTC](https://verificationacademy.com/forums/t/difference-between-input-and-wire-clock-to-an-interface/40399/1 "2022-05-15T12:46:12Z")

</div>

Hi,

Is there a difference if the main clock of the interface, the clock that used as a clock for the clocking clock define as input or if it is define as a wire and get his value with assign statement.  
Or in other words Does it optional an interface that his clock define as a wire and this interface has clocking block?

Regards.

---

<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:** [May 16, 2022, 2:02am UTC](https://verificationacademy.com/forums/t/difference-between-input-and-wire-clock-to-an-interface/40399/2 "2022-05-16T02:02:46Z")

</div>

_In reply to [rraa](https://verificationacademy.com/forums/t/difference-between-input-and-wire-clock-to-an-interface/40399):_

I cannot make any sense of your question. Can you add some code examples that back up what you are trying to ask?

---

<div class="post-metadata">

**Author:** ![rraa](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/53a042/32.png) [@rraa](https://verificationacademy.com/forums/u/rraa)\
**Post date:** [May 16, 2022, 5:27am UTC](https://verificationacademy.com/forums/t/difference-between-input-and-wire-clock-to-an-interface/40399/3 "2022-05-16T05:27:06Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/difference-between-input-and-wire-clock-to-an-interface/40399/2):_

First thanks to for your answer.

I am trying to add a light bus that will replace an existing VIP, the interface of the VIP doesn’t give the clock of the interface as input but assign as a wire, in order to avoid ifdef I want to connect the clock of the light bus same.

\*\*So want I need to know if there is any difference between both below examples.  
\*\*  
_Example 1, clk is wire:_  
Declare the interface:  
light\_bus\_if bus\_if();

assign the clk:  
bus\_if.clk = `TOP.clk;

in the interface:  
wire clk;  
…  
clocking cb @(posedge clk);

_Example 2, clk is input:_  
Declare the interface and give the clock :  
light\_bus\_if bus\_if(.clk(`TOP.clk));

in the interface:  
interface light\_bus\_if (input bit clk)  
…  
clocking cb @(posedge clk);

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:** [May 16, 2022, 5:38pm UTC](https://verificationacademy.com/forums/t/difference-between-input-and-wire-clock-to-an-interface/40399/4 "2022-05-16T17:38:52Z")

</div>

_In reply to [rraa](https://verificationacademy.com/forums/t/difference-between-input-and-wire-clock-to-an-interface/40399/3):_

OK, that is much clearer now. You have two separate questions.

The first is what is the difference between declaring a signal internal to an interface (which I assume you declared clk that way in example 1), versus declaring a signal as a port of an interface?

You would typically declare signals internal to an interface if you want each instance of that interface to have a different values for each instance. And you would declare signals as ports of an interface if you wanted to share that signals value across other instances (same interface or different interfaces or modules). A shared clock would be a good candidate for this.

The use of clocking blocks is independent to ports versus internal signals. My opinion on that is not to introduce them until you have a specific problem that you know you can solve.

---

<div class="post-metadata">

**Author:** ![rraa](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/53a042/32.png) [@rraa](https://verificationacademy.com/forums/u/rraa)\
**Post date:** [May 19, 2022, 9:10am UTC](https://verificationacademy.com/forums/t/difference-between-input-and-wire-clock-to-an-interface/40399/5 "2022-05-19T09:10:06Z")

</div>

Hi,

So according to what you said.

It is **recommended** to declare a signal as an input if it is a signal that is same for other interfaces/modules.  
But in anyway it can be declared as a wire.

In my case I create some instances of the same interface in generate loop and one of them get other clk than the others, so I have to declare the clk as a wire.

Thanks.
