代码拉取完成,页面将自动刷新
//------------------------------------------------------------------------------
// delay.v
// Konstantin Pavlov, pavlovconst@gmail.com
//------------------------------------------------------------------------------
// INFO -------------------------------------------------------------------------
// Static Delay for arbitrary signal
// Another equivalent names for this module:
// conveyor.sv
// synchronizer.sv
//
// Tip for Xilinx-based implementations: Leave nrst=1'b1 and ena=1'b1 on
// purpose of inferring Xilinx`s SRL16E/SRL32E primitives
//
//
// CAUTION: delay module is widely used for synchronizing signals across clock
// domains. To automatically exclude input data paths from timing analisys
// set_false_path SDC constraint is integrated into this module. Applicable
// only to Intel/Altera Quartus IDE. Xilinx users still should write the
// constraints manually
//
/* --- INSTANTIATION TEMPLATE BEGIN ---
delay #(
.LENGTH( 2 )
) S1 (
.clk( clk ),
.nrst( 1'b1 ),
.ena( 1'b1 ),
.in( ),
.out( )
);
--- INSTANTIATION TEMPLATE END ---*/
module delay #( parameter
LENGTH = 2 // delay/synchronizer chain length
// default length for synchronizer chain is 2
)(
input clk,
input nrst,
input ena,
input in,
output out
);
generate
if ( LENGTH == 0 ) begin
assign out = in;
end else if( LENGTH == 1 ) begin
logic data = 0;
always_ff @(posedge clk) begin
if (~nrst) begin
data <= 0;
end else if (ena) begin
data <= in;
end
end
assign out = data;
end else begin
logic [LENGTH:1] data = 0;
always_ff @(posedge clk) begin
if (~nrst) begin
data[LENGTH:1] <= 0;
end else if (ena) begin
data[LENGTH:1] <= {data[LENGTH-1:1],in};
end
end
assign out = data[LENGTH];
end // if
endgenerate
endmodule
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。