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?
There is no difference between stating
logic
and not stating any type.is equivalent to
The SystemVerilog IEEE Std (1800-2009) describes this in section: "23.2.2.3 Rules for determining port kind, data type and direction".
It is very common to not assign inputs a data type, as they should almost always be
wire
.Is nominally equivalent to:
It is actually picking up
`default_nettype wire
which could be changed to sayuwire
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 betweenwire
andreg
which is useful for outputs and allows easier refracting. Inputs can never bereg
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.