|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
module Afifo_sync_w2r(
// Outputs
wr_ptr_sync,
// Inputs
wrClk,
wrReset,
rdClk,
rdReset,
wr_ptr
);
parameter DATASIZE = 32; //Memory data width
parameter DEPTH = 5; //Afifo depth
input wrClk; //Write clock domain
input wrReset; //Write reset "1" is valid
input rdClk; //Read clock domain
input rdReset; //Read reset "1" is valid
input [DEPTH-1:0] wr_ptr; //Read pointer
output [DEPTH-1:0] wr_ptr_sync; //Write pointer sync to read clock domain
wire [DEPTH-1:0] wr_ptr_gray_D;
reg [DEPTH-1:0] wr_ptr_gray;
reg [DEPTH-1:0] wr_ptr_sync;
reg [DEPTH-1:0] wr_ptr_sync1;
//Bin to Gray
assign wr_ptr_gray_D = (wr_ptr >> 1) ^ wr_ptr;
//one level register in write clock domain
always @ (posedge wrClk) begin
if(wrReset)
wr_ptr_gray <= #1 {DEPTH{1'b0}};
else
wr_ptr_gray <= #1 wr_ptr_gray_D;
end
//two level register in write clock domain
always @ (posedge rdClk) begin
if(rdReset)
wr_ptr_sync1 <= #1 {DEPTH{1'b0}};
else
wr_ptr_sync1 <= #1 wr_ptr_gray;
end
always @ (posedge rdClk) begin
if(rdReset)
wr_ptr_sync <= #1 {DEPTH{1'b0}};
else
wr_ptr_sync <= #1 wr_ptr_sync1;
end
endmodule
一个异步FIFO里面的一个同步模块,请各位版主大虾们指点一下,这个模块DC综合的约束脚本该怎么写
谢谢了 |
|