module signal_dly (
clk,
rstb,
sig,
delay_sig
);
input clk;
input rstb;
input sig;
output delay_sig;
reg delay_sig;
reg sig_buf_0;
always @(posedge clk or negedge rstb) begin // 1 clock delay
if(!rstb) begin
delay_sig <= 1'b0;
sig_buf_0 <= 1'b0;
end
else begin
sig_buf_0 <= sig;
delay_sig <= sig_buf_0;
end
end
endmodule
module signal_dly (
clk,
rstb,
sig,
delay_sig
);
input clk;
input rstb;
input sig;
output delay_sig;
reg delay_sig;
reg sig_buf_0;
reg sig_buf_1;
reg sig_buf_2;
always @(posedge clk or negedge rstb) begin // 3 clock delay
if(!rstb) begin
delay_sig <= 1'b0;
sig_buf_0 <= 1'b0;
sig_buf_1 <= 1'b0;
sig_buf_2 <= 1'b0;
end
else begin
sig_buf_0 <= sig;
sig_buf_1 <= sig_buf_0;
sig_buf_2 <= sig_buf_1;
delay_sig <= sig_buf_2;
end
end
endmodule
No comments :
Post a Comment