0

How to tell in SystemVerilog that one of the module's outputs is directly connected to one of it's inputs?

Does it depend on the modeling level used? If yes, what is the right way for switch level?

module abc (input in1, in2, output out1, out2, out3);

// out3 needs to be directly connected to in1
// ...

endmodule
2
  • I assume your looking for a more system-verilog idiomatic way than the traditional Verilog method of assign out3 = in1; ? Commented Mar 24, 2016 at 8:38
  • Yes, SystemVerilog way is preferable. Commented Mar 24, 2016 at 8:41

1 Answer 1

2

There are a number of ways to do this. But not all downstream tools like synthesis physical tools may support it.

This is the way to do it in SystemVerilog

module abc (input in1, in2, output out1, out2, out3);
// out3 needs to be directly connected to in1
// ...
alias out3 = in1;
endmodule

In Verilog

module abc (input .in1(sig), in2, output out1, out2, .out3(sig));
wire sig;
// out3 needs to be directly connected to in1
// ...
endmodule
Sign up to request clarification or add additional context in comments.

2 Comments

OK, but can you say that either alias, or assign, or connecting both ports to an internal net is better for some reason than the others for SystemVerilog (apart from current support by tools)?
If you want a direct connection for a switch-level netlist, then use alias. You lose strength propagation through an assign statement. If you are writing RTL, then an assign would be fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.