Reputation: 181
Now I'm trying to understand the merit what we using the negedge clock in verilog. I came across as the below verilog code in the google.
module negedgecapture
(
input clk,
input rst_n,
input din,
output wire dout
);
reg neg_dout ;
assign dout = neg_dout;
always @(negedge clk or negedge rst_n)
if (~rst_n) neg_dout <= 0;
else neg_dout <= din;
endmodule
and in case, as I know, the setup time is at least required time the data to become stable before the clock edge. and hold time is at least required time the data to become stable after the clock edge.
But I don't know what benefits are in there? why we use those kinds of Technic?
Upvotes: 2
Views: 8721
Reputation: 668
If you are writing on a posedge, reading would be useful on a negedge. That would save one full clock cycle on a read operation.
Negedge clock operation is also used in testbenches, to avoid race condition between DUT and Testbench, since both are driven at different clock edges.
Upvotes: 5
Reputation: 529
There is no particular advantage to using the falling edge of a clock as opposed to the rising edge to clock a register. In fact, most designs I've worked on using a rising edge for everything. There are a few cases where I've seen the negative edge used though:
Upvotes: 1