inputs without type in system verilog
Asked Answered
F

3

3

I've encountered in an example for a system verilog code decleration of inputs and outputs for a module without stating their type, e.g logic, wire...

module mat_to_stream (
  input [2:0] [2:0] [2:0] a,b,
  input newdata,
  input rst, clk,
  output [2:0] [7:0] A_out, B_out);
  ...rest of code...

What is the diffrence between stating logic and not stating any type?

Faubion answered 1/4, 2011 at 14:43 Comment(0)
T
10

There is no difference between stating logic and not stating any type.

input newdata,

is equivalent to

input logic newdata,

The SystemVerilog IEEE Std (1800-2009) describes this in section: "23.2.2.3 Rules for determining port kind, data type and direction".

Tubercular answered 1/4, 2011 at 15:5 Comment(1)
Actually, input newdata, is equivalent to input wire logic newdata,. logic is a data type, and wire is a signal kind with a default data type of logic.Seena
M
2

It is very common to not assign inputs a data type, as they should almost always be wire.

input [7:0] newdata

Is nominally equivalent to:

input wire [7:0] newdata

It is actually picking up `default_nettype wire which could be changed to say uwire to enforce compiler checks for unique drivers, which will fail on wiring mistakes with multiple drives.

Using logic as a type allows the auto selection between wire and reg which is useful for outputs and allows easier refracting. Inputs can never be reg type.

Stuart Sutherlands SNUG2013 paper, section 12 covers how uwire could be used to better imply design intent if it was supported correctly by the tools.

Manolo answered 17/1, 2014 at 16:13 Comment(0)
H
1

enter image description here

From, SystemVerilog IEEE Std (1800-2017) describes this in section: "23.2.2.3 Rules for determining port kind, data type and direction"

Hostage answered 29/12, 2022 at 10:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.