4

I need a clarification on SystemVerilog IEEE Std 1800-2012, ports section 23.2.2.3.

The LRM says when the port kind (net type or variable) is omitted on input port, it defaults to net type, but when the input port is of bit data type without specifying the port kind, does it infer to net type according to LRM?

A reply would be highly appreciated!

2 Answers 2

3

The port kind defaults to a net and you referenced, but 6.7.1 Net declarations with built-in net types says that net types are restricted to 4-state integral types. So you should get an error if you try to declare input bit instead of input var bit.

Note that earlier versions of the SystemVerilog LRM had the default port kind a variable when specifying a data type without a port kind. Some tools might not generate an error if they are not up to date.

Sign up to request clarification or add additional context in comments.

Comments

1

"bit" only specifies the data type, not the net type, of a signal.

When you declare a port as "input bit foo", the tools are supposed to infer net type based on whatever `default_nettype is set to.

A number of verilog style guides have recommended "`default_nettype none" as a poor-mans linting tool to detect typos in net names. This breaks under systemverilog, in so far as it then starts requiring that everything be declared with both a net and a data type, like this:

input wire bit foo

Everybody hates that, so instead:

  • don't use "`default_nettype none"
  • use a real linting tool to do linting instead.

Comments

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.