In Verilog, I have an input port that I would like to make optional. It's the start pin for a microarchitecture. If user does not want to drive the start pin manually, the module will use its own internal clock to drive the start pin.
It would be really nice if the user could hard code this pin to 'Z', and then the module has a snippet like this:
always @(posedge clk) begin
if (rst == 1'b1) begin
...
end else begin
if (start == 1'bz) begin
start_2 <= internally_generated_strobe;
end else begin
start_2 <= start;
end
end
end
The port map to instantiate this module has something like this:
my_module INST_NAME (
.clk(clk),
.rst(rst),
.start(1'bz),
...
);
Is this something that most synthesizers support? Or will you get weird results?
I give this example in Verilog, but I'm also interested if VHDL vs. Verilog makes any difference.