I have tried to use bidirectional bits (inout) in a Verilog module that many Verilog simulators flag as illegal L-Values. This does not make sense if you really intend to support bidirectional interface parameters. In order for bits to be birectional, you have to be able to input from them and output to them. I use an input selector that defines when it is to be used for input (Write) and when it is to be used for output (Read). Veritak does not flag an error, but Veritak seems to do minimal checking and doesn't complain even when it should. For example, you can use a "wire" that is not declared anywhere but can use it in an expression and Veritak doesn't care. So why have "inout" if you can never output to it? It seems to either be a flaw in Verilog itelf or an incorrect implementation by those who wrote the simulator. Here is an example:
//Data Register Access Module
module TEST
(
inout [7:0] Dat, //Data
input Idl, //Select when Low
input Wri, //Access Type: 0=Read,1=Write
input Clk //Clock
);
//Registers
reg [7:0] Test; //Data Values
//Not Selected
always @(posedge Clk) if (Idl)
Dat = 64'bZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ;
//Selected-Write
else if (Wri)
Test = Dat;
//Selected-Read
else
Dat = Test;
endmodule
I selected Icarus Verilog 0.9.7 and these are the error messages it produced:
[2021-06-01 11:19:32 EDT] iverilog '-Wall' design.sv testbench.sv && unbuffer vvp a.out design.sv:16: error: Dat is not a valid l-value in TEST.design.sv:5: : Dat is declared here as wire.design.sv:24: error: Dat is not a valid l-value in TEST.design.sv:5: : Dat is declared here as wire.2 error(s) during elaboration.Exit code expected: 0, received: 1Done