Why won't Quartus give me an error or warning for this obvious Verilog error during compilation?
Hi,
In my Verilog HDL projects, it seems Quartus provides no notification (errors, warnings, or messages in the compilation log) if I accidentally declare a port as an input but then assign it within the body of the code. A simple example:
module bitwise_negation #(parameter P_DATA_WIDTH=32)
(
input [P_DATA_WIDTH-1:0] a,
output [P_DATA_WIDTH-1:0] y
);
assign y = ~a;
endmodule
module bitwise_negation_wrapper #(parameter P_DATA_WIDTH=32)
(
input [P_DATA_WIDTH-1:0]a,
input [P_DATA_WIDTH-1:0]y // port direct is wrong, should be output
);
bitwise_negation #(.P_DATA_WIDTH(32)) BN_0(.a(a),.y(y));
endmoduleOnce I load the bitstream onto the board, the module simply doesn't function correctly. (Perhaps the port with the incorrect direction is initialized to 0, I'm not sure.) On two separate occasions, this has caused me a few hours of lost time, so I'd like to know: is there a way to make the compiler flag this sort of obvious problem with an error or warning?
Thanks!
This is why such tools as 'VeriLint' were developed that try to check the semantics of what your code is doing vs pure syntax.
Your example has correct language syntax, but the semantics of what you are doing is not (necessarily) meaningful. It could be, or not.
You can't expect the QuartusII verilog parser to figure these things out. VHDL language is much more strict, Verilog is looser.