I tried synthesizing the following code and was surprised to see that it doesn't work (at least with Vivado 2017.2).
module top(
input wire clk,
output reg dout
);
always @(posedge clk) begin
dout <= clk;
end
endmodule
It complains with the error: use of clock signal in expression not supported
.
Why is this? Shouldn't the value of clk
be guaranteed to be 1
in its own posedge
procedural block? Or, is this a race condition because skew could lead to the clock arriving before the data input?
Edit On second thought this isn’t all that surprising since this is very likely to violate the register’s setup timing requirement.