I have recently completed a design that had run into timing issues (negative slack). The modules that were found to be troublesome, from the timing reports generated in Vivado 2017.4, are these modules that are used to calculate some synchronous outputs. A clock, reset, and enable (en) signal are provided as inputs. The modules that had these issues were previously implemented as shown below:
always @ (clk, rst) begin
if (rst) begin
...
...
end
else if (clk & en) begin
...
...
end
end
A coworker suggested that the "code is creating latches for the pipeline segments, instead of clocked flip flops". Following his suggestions I changed the modules to what is shown below.
always @ (posedge clk, posedge rst) begin
if (rst) begin
...
...
end
else if (en) begin
...
...
end
end
This seems to have resolved the negative slack coming from these modules, but I am curious to know why this is the case.