⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 afifo36_internal.v

📁 DDR2源代码 DDR2源代码 DDR2源代码
💻 V
📖 第 1 页 / 共 5 页
字号:
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/verunilibs/data/rainier/AFIFO36_INTERNAL.v,v 1.16 2007/10/26 21:08:54 wloo Exp $///////////////////////////////////////////////////////////////////////////////// Copyright (c) 1995/2005 Xilinx, Inc.// All Right Reserved./////////////////////////////////////////////////////////////////////////////////   ____  ____//  /   /\/   /// /___/  \  /    Vendor : Xilinx// \   \   \/     Version : 10.1//  \   \         Description : This is not an user primitive.//  /   /                  Xilinx Functional Simulation Library Component 36K-Bit FIFO.// /___/   /\     Filename : AFIFO36_INTERNAL.v// \   \  /  \    Timestamp : Tues July 26 16:44:06 PST 2005//  \___\/\___\//// Revision://    07/26/05 - Initial version.//    12/16/05 - Added independent read and write ecc features.//    08/16/06 - Fixed the faulty deassign for invalid rst (CR 234092).//    10/16/06 - Fixed the unused bits of wrcount and rdcount to match the hardware (CR 426347).//    01/24/07 - Removed DRC warning for RST in ECC mode (CR 432367).//    06/01/07 - Added wire declaration for internal signals.//    06/14/07 - Implemented high performace version of the model.//    10/26/07 - Changed wren_in to wren_reg to fix FULL flag (CR 452554).// End Revision`timescale 1 ps/1 psmodule AFIFO36_INTERNAL (ALMOSTEMPTY, ALMOSTFULL, DBITERR, DO, DOP, ECCPARITY, EMPTY, FULL, RDCOUNT, RDERR, SBITERR, WRCOUNT, WRERR,			DI, DIP, RDCLK, RDEN, RDRCLK, RST, WRCLK, WREN);     output ALMOSTEMPTY;    output ALMOSTFULL;    output DBITERR;    output [63:0] DO;    output [7:0] DOP;    output [7:0] ECCPARITY;    output EMPTY;    output FULL;    output [12:0] RDCOUNT;    output RDERR;    output SBITERR;    output [12:0] WRCOUNT;    output WRERR;    input [63:0] DI;    input [7:0] DIP;    input RDCLK;    input RDEN;    input RDRCLK;    input RST;    input WRCLK;    input WREN;    tri0 GSR = glbl.GSR;        parameter integer DATA_WIDTH = 4;    parameter integer DO_REG = 1;    parameter EN_SYN = "FALSE";    parameter FIRST_WORD_FALL_THROUGH = "FALSE";    parameter ALMOST_EMPTY_OFFSET = 13'h0080;    parameter ALMOST_FULL_OFFSET = 13'h0080;    parameter EN_ECC_WRITE = "FALSE";    parameter EN_ECC_READ = "FALSE";    parameter SIM_MODE = "SAFE";        reg [63:0] do_in = 64'b0;    reg [63:0] do_out = 64'b0;    reg [63:0] do_outreg = 64'b0;    reg [63:0] do_out_mux = 64'b0;    wire [63:0] do_out_out;    reg [7:0] dop_in = 8'b0, dop_out = 8'b0;    wire [7:0] dop_out_out;    reg [7:0] dop_outreg = 8'b0, dop_out_mux = 8'b0;    reg almostempty_out = 1'b1, almostfull_out = 1'b0, empty_out = 1'b1;    reg full_out = 1'b0, rderr_out = 0, wrerr_out = 0;    reg dbiterr_out = 0, sbiterr_out = 0;    reg dbiterr_out_out = 0, sbiterr_out_out = 0;    reg [71:0] ecc_bit_position;        reg [7:0] eccparity_out;    reg [7:0] dopr_ecc, dop_buf, dip_ecc, dip_int;    reg [63:0] do_buf, di_in_ecc_corrected;    reg [7:0] syndrome, dip_in_ecc_corrected;    wire [63:0] di_in;    wire [7:0] dip_in;    wire rdclk_in, rden_in, rst_in, wrclk_in, wren_in;    wire rdrclk_in, gsr_in;        reg rden_reg, wren_reg;    reg [12:0] ae_empty, ae_full;    reg fwft;    integer addr_limit, rd_prefetch = 0;    integer wr1_addr = 0;    reg [12:0] rdcount_out = 13'b0, wr_addr = 0, rd_addr = 0;    reg [12:0] rdcount_out_out = 13'h1fff, wr_addr_out = 13'h1fff;    reg rd_flag = 0, rdcount_flag = 0, rdprefetch_flag = 0, wr_flag = 0;    reg wr1_flag = 0, awr_flag = 0;    reg [3:0] almostfull_int = 4'b0000, almostempty_int = 4'b1111;    reg [3:0] full_int = 4'b0000;    reg [3:0] empty_ram = 4'b1111;    reg [8:0] i, j;    reg rst_tmp1 = 0, rst_tmp2 = 0;    reg [2:0] rst_rdckreg = 3'b0, rst_wrckreg = 3'b0;    reg rst_rdclk_flag = 0, rst_wrclk_flag = 0;    // xilinx_internal_parameter on    // WARNING !!!: This model may not work properly if the following parameter is changed.    parameter integer FIFO_SIZE = 36;// xilinx_internal_parameter off        localparam mem_size4 = (FIFO_SIZE == 18) ? 4095 : (FIFO_SIZE == 36) ? 8191 : 0;    localparam mem_size9 = (FIFO_SIZE == 18) ? 2047 : (FIFO_SIZE == 36) ? 4095 : 0;    localparam mem_size18 = (FIFO_SIZE == 18) ? 1023 : (FIFO_SIZE == 36) ? 2047 : 0;    localparam mem_size36 = (FIFO_SIZE == 18) ? 511 : (FIFO_SIZE == 36) ? 1023 : 0;    localparam mem_size72 = (FIFO_SIZE == 18) ? 0 : (FIFO_SIZE == 36) ? 511 : 0;    localparam mem_depth = (DATA_WIDTH == 4) ? mem_size4 : (DATA_WIDTH == 9) ? mem_size9 :			   (DATA_WIDTH == 18) ? mem_size18 : (DATA_WIDTH == 36) ? mem_size36 : 			   (DATA_WIDTH == 72) ? mem_size72 : 0;        localparam mem_width = (DATA_WIDTH == 4) ? 3 : (DATA_WIDTH == 9) ? 7 :			   (DATA_WIDTH == 18) ? 15 : (DATA_WIDTH == 36) ? 31 : (DATA_WIDTH == 72) ? 63 : 0;    localparam memp_depth = (DATA_WIDTH == 4) ? 0 : (DATA_WIDTH == 9) ? mem_size9 :			    (DATA_WIDTH == 18) ? mem_size18 : (DATA_WIDTH == 36) ? mem_size36 : 			    (DATA_WIDTH == 72) ? mem_size72 : 0;        localparam memp_width = (DATA_WIDTH == 4 || DATA_WIDTH == 9) ? 0 :			    (DATA_WIDTH == 18) ? 1 : (DATA_WIDTH == 36) ? 3 : (DATA_WIDTH == 72) ? 7 : 0;    reg [mem_width : 0] mem [mem_depth : 0];    reg [memp_width : 0] memp [memp_depth : 0];    reg sync;    initial	if ((SIM_MODE != "FAST") && (SIM_MODE != "SAFE")) begin	    $display("Attribute Syntax Error : The attribute SIM_MODE on AFIFO36_INTERNAL instance %m is set to %s.  Legal values for this attribute are FAST or SAFE.", SIM_MODE);	    $finish;	    	end    /********************* SAFE mode **************************/    generate if (SIM_MODE == "SAFE") begin	    buf b_di[63:0] (di_in, DI);    buf b_dip[7:0] (dip_in, DIP);    buf b_do[63:0] (DO, do_out_out);    buf b_dop[7:0] (DOP, dop_out_out);    buf b_rdclk (rdclk_in, RDCLK);    buf b_rdrclk (rdrclk_in, RDRCLK);    buf b_rden (rden_in, RDEN);    buf b_rst (rst_in, RST);    buf b_wrclk (wrclk_in, WRCLK);    buf b_wren (wren_in, WREN);    buf b_in5 (gsr_in, GSR);    buf b_out0 (ALMOSTEMPTY, almostempty_out);    buf b_out1 (ALMOSTFULL, almostfull_out);    buf b_empty (EMPTY, empty_out);    buf b_full (FULL, full_out);    buf b_rderr (RDERR, rderr_out);    buf b_wrerr (WRERR, wrerr_out);        buf b_sbiterr (SBITERR, sbiterr_out_out);    buf b_dbiterr (DBITERR, dbiterr_out_out);    buf b_eccparity[7:0] (ECCPARITY, eccparity_out);    buf b_rdcount[12:0] (RDCOUNT, rdcount_out_out);    buf b_wrcount[12:0] (WRCOUNT, wr_addr_out);    always @(gsr_in)	if (gsr_in == 1'b1) begin	    assign do_out = 64'b0;	    assign dop_out = 8'b0;	    assign do_outreg = 64'b0;	    assign dop_outreg = 8'b0;	end	else if (gsr_in == 1'b0) begin	    deassign do_out;	    deassign dop_out;	    deassign do_outreg;	    deassign dop_outreg;	end    always @(gsr_in or rst_in)	if (gsr_in == 1'b1 || rst_in == 1'b1) begin	    assign almostempty_int = 4'b1111;	    assign almostempty_out = 1'b1;	    assign almostfull_int = 4'b0000;	    assign almostfull_out = 1'b0;	    assign do_in = 64'b00000000000000000000000000000000;	    assign dop_in = 8'b0000;	    assign empty_ram = 4'b1111;	    assign empty_out = 1'b1;	    assign full_int = 4'b0000;	    assign full_out = 1'b0;	    assign rdcount_out = 13'b0;	    assign rdcount_out_out = 13'b0;	    assign wr_addr_out = 13'b0;	    assign rderr_out = 0;	    assign wrerr_out = 0;	    assign sbiterr_out_out = 1'b0;	    assign dbiterr_out_out = 1'b0;	    assign rd_addr = 0;	    assign rd_prefetch = 0;	    assign wr_addr = 0;	    assign wr1_addr = 0;	    assign rdcount_flag = 0;	    assign rd_flag = 0;	    assign rdprefetch_flag = 0;	    assign wr_flag = 0;	    assign wr1_flag = 0;	    assign awr_flag = 0;	end	else if (gsr_in == 1'b0 && rst_in == 1'b0) begin	    deassign almostempty_int;	    deassign almostempty_out;	    deassign almostfull_int;	    deassign almostfull_out;	    deassign do_in;	    deassign dop_in;	    deassign empty_ram;	    deassign empty_out;	    deassign full_int;	    deassign full_out;	    deassign rdcount_out;	    deassign rdcount_out_out;            deassign wr_addr_out;	    deassign rderr_out;	    deassign wrerr_out;	    deassign sbiterr_out_out;	    deassign dbiterr_out_out;	    deassign rd_addr;	    deassign rd_prefetch;	    deassign wr_addr;	    deassign wr1_addr;	    deassign rdcount_flag;	    deassign rd_flag;	    deassign rdprefetch_flag;	    deassign wr_flag;	    deassign wr1_flag;	    deassign awr_flag;	    	end    initial begin	case (DATA_WIDTH)	    4 : begin		    if (FIFO_SIZE == 36)			addr_limit = 8192;		    else			addr_limit = 4096;		end	    9 : begin		    if (FIFO_SIZE == 36)			addr_limit = 4096;		    else			addr_limit = 2048;		end	   18 : begin	            if (FIFO_SIZE == 36)			addr_limit = 2048;		    else			addr_limit = 1024;		end	   36 : begin	            if (FIFO_SIZE == 36)			addr_limit = 1024;		    else			addr_limit = 512;		end	   72 : begin		    addr_limit = 512;		end	   default :		begin		    $display("Attribute Syntax Error : The attribute DATA_WIDTH on AFIFO36_INTERNAL instance %m is set to %d.  Legal values for this attribute are 4, 9, 18, 36 or 72.", DATA_WIDTH);		    $finish;		end	endcase		case (EN_SYN)	    "FALSE" : sync = 0;	    "TRUE" : sync = 1;	    default : begin		          $display("Attribute Syntax Error : The attribute EN_SYN on AFIFO36_INTERNAL instance %m is set to %s.  Legal values for this attribute are TRUE or FALSE.", EN_SYN);		          $finish;	              end	endcase // case(EN_SYN)	case (FIRST_WORD_FALL_THROUGH)	    "FALSE" : begin		          fwft = 0;		          if (EN_SYN == "FALSE") begin			      ae_empty = ALMOST_EMPTY_OFFSET - 1;	                      ae_full = ALMOST_FULL_OFFSET;			  end			  else begin			      ae_empty = ALMOST_EMPTY_OFFSET;	                      ae_full = ALMOST_FULL_OFFSET;			  end		      end	    "TRUE"  : begin		          fwft = 1;		          ae_empty = ALMOST_EMPTY_OFFSET - 2;	                  ae_full = ALMOST_FULL_OFFSET;	              end	    default : begin		$display("Attribute Syntax Error : The attribute FIRST_WORD_FALL_THROUGH on AFIFO36_INTERNAL instance %m is set to %s.  Legal values for this attribute are TRUE or FALSE.", FIRST_WORD_FALL_THROUGH);		$finish;	      end	endcase		if (EN_SYN == "FALSE") begin	    if (fwft == 1'b0) begin	    		if ((ALMOST_EMPTY_OFFSET < 5) || (ALMOST_EMPTY_OFFSET > addr_limit - 5)) begin		    $display("Attribute Syntax Error : The attribute ALMOST_EMPTY_OFFSET on AFIFO36_INTERNAL instance %m is set to %d.  Legal values for this attribute are %d to %d", ALMOST_EMPTY_OFFSET, 5, addr_limit - 5);		    $finish;		end				if ((ALMOST_FULL_OFFSET < 4) || (ALMOST_FULL_OFFSET > addr_limit - 5)) begin		    $display("Attribute Syntax Error : The attribute ALMOST_FULL_OFFSET on AFIFO36_INTERNAL instance %m is set to %d.  Legal values for this attribute are %d to %d", ALMOST_FULL_OFFSET, 4, addr_limit - 5);		    $finish;		end			    end // if (fwft == 1'b0)	    else begin				if ((ALMOST_EMPTY_OFFSET < 6) || (ALMOST_EMPTY_OFFSET > addr_limit - 4)) begin		    $display("Attribute Syntax Error : The attribute ALMOST_EMPTY_OFFSET on AFIFO36_INTERNAL instance %m is set to %d.  Legal values for this attribute are %d to %d", ALMOST_EMPTY_OFFSET, 6, addr_limit - 4);		    $finish;		end				if ((ALMOST_FULL_OFFSET < 4) || (ALMOST_FULL_OFFSET > addr_limit - 5)) begin		    $display("Attribute Syntax Error : The attribute ALMOST_FULL_OFFSET on AFIFO36_INTERNAL instance %m is set to %d.  Legal values for this attribute are %d to %d", ALMOST_FULL_OFFSET, 4, addr_limit - 5);		    $finish;		end	    end // else: !if(fwft == 1'b0)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -