Add Repo: Frogwells_fpga_design (part 2)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/afifo.v +266 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/cmd_gen.v +941 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/cmd_prbs_gen.v +251 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/data_prbs_gen.v +127 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/init_mem_pattern_ctr.v +692 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/mcb_flow_control.v +634 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/mcb_traffic_gen.v +756 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/rd_data_gen.v +343 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/read_data_path.v +513 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/read_posted_fifo.v +264 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/sp6_data_gen.v +781 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/tg_status.v +128 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/v6_data_gen.v +0 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/wr_data_gen.v +410 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/write_data_path.v +157 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/sim/functional/ddr3_model_c3.v +0 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/sim/functional/ddr3_model_parameters_c3.vh +0 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/sim/functional/isim.tcl +72 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/sim/functional/readme.txt +122 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/sim/functional/sim_tb_top.v +300 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/synth/mem_interface_top_synp.sdc +37 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/synth/script_synp.tcl +57 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_icon_pro/icon_pro.vhd +29 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_icon_pro/icon_pro_flist.txt +11 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_icon_pro/icon_pro_readme.txt +46 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_icon_pro/icon_pro_xmdf.tcl +67 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_ila_pro_0/ila_pro_0.vhd +37 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_ila_pro_0/ila_pro_0_flist.txt +12 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_ila_pro_0/ila_pro_0_readme.txt +47 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_ila_pro_0/ila_pro_0_xmdf.tcl +71 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/camera_capture.v +198 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/chipscope_icon.v +27 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/chipscope_ila.v +31 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/create_ddr.tcl +37 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/create_ff.tcl +37 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/create_ffgg.tcl +37 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/create_fgg.tcl +37 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/create_jj.tcl +37 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/create_pixel_fifo.tcl +37 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo.v +489 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/doc/fifo_generator_v9_3_readme.txt +236 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/example_design/pixel_fifo_exdes.vhd +142 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/fifo_generator_v9_3_readme.txt +236 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/implement/planAhead_ise.tcl +67 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/simulation/functional/vcs_session.tcl +77 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/simulation/functional/wave_isim.tcl +68 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/simulation/functional/wave_ncsim.sv +70 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/simulation/pixel_fifo_dgen.vhd +123 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/simulation/pixel_fifo_dverif.vhd +159 -0
- Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/simulation/pixel_fifo_pctrl.vhd +541 -0
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/af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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//*****************************************************************************
|
| 2 |
+
// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MIG
|
| 54 |
+
// / / Filename: afifo.v
|
| 55 |
+
// /___/ /\ Date Last Modified: $Date: 2011/06/02 07:16:32 $
|
| 56 |
+
// \ \ / \ Date Created: Oct 21 2008
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6
|
| 60 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
//Purpose: A generic synchronous fifo.
|
| 62 |
+
//Reference:
|
| 63 |
+
//Revision History:
|
| 64 |
+
|
| 65 |
+
//*****************************************************************************
|
| 66 |
+
|
| 67 |
+
`timescale 1ps/1ps
|
| 68 |
+
|
| 69 |
+
module afifo #
|
| 70 |
+
(
|
| 71 |
+
parameter TCQ = 100,
|
| 72 |
+
parameter DSIZE = 32,
|
| 73 |
+
parameter FIFO_DEPTH = 16,
|
| 74 |
+
parameter ASIZE = 4,
|
| 75 |
+
parameter SYNC = 1 // only has always '1' logic.
|
| 76 |
+
)
|
| 77 |
+
(
|
| 78 |
+
input wr_clk,
|
| 79 |
+
input rst,
|
| 80 |
+
input wr_en,
|
| 81 |
+
input [DSIZE-1:0] wr_data,
|
| 82 |
+
input rd_en,
|
| 83 |
+
input rd_clk,
|
| 84 |
+
output [DSIZE-1:0] rd_data,
|
| 85 |
+
output reg full,
|
| 86 |
+
output reg empty,
|
| 87 |
+
output reg almost_full
|
| 88 |
+
);
|
| 89 |
+
|
| 90 |
+
// memory array
|
| 91 |
+
reg [DSIZE-1:0] mem [0:FIFO_DEPTH-1];
|
| 92 |
+
|
| 93 |
+
//Read Capture Logic
|
| 94 |
+
// if Sync = 1, then no need to remove metastability logic because wrclk = rdclk
|
| 95 |
+
reg [ASIZE:0] rd_gray_nxt;
|
| 96 |
+
reg [ASIZE:0] rd_gray;
|
| 97 |
+
reg [ASIZE:0] rd_capture_ptr;
|
| 98 |
+
reg [ASIZE:0] pre_rd_capture_gray_ptr;
|
| 99 |
+
reg [ASIZE:0] rd_capture_gray_ptr;
|
| 100 |
+
reg [ASIZE:0] wr_gray;
|
| 101 |
+
reg [ASIZE:0] wr_gray_nxt;
|
| 102 |
+
|
| 103 |
+
reg [ASIZE:0] wr_capture_ptr;
|
| 104 |
+
reg [ASIZE:0] pre_wr_capture_gray_ptr;
|
| 105 |
+
reg [ASIZE:0] wr_capture_gray_ptr;
|
| 106 |
+
wire [ASIZE:0] buf_avail;
|
| 107 |
+
wire [ASIZE:0] buf_filled;
|
| 108 |
+
wire [ASIZE-1:0] wr_addr, rd_addr;
|
| 109 |
+
|
| 110 |
+
reg [ASIZE:0] wr_ptr, rd_ptr;
|
| 111 |
+
integer i,j,k;
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
// for design that use the same clock for both read and write
|
| 115 |
+
generate
|
| 116 |
+
if (SYNC == 1) begin: RDSYNC
|
| 117 |
+
always @ (rd_ptr)
|
| 118 |
+
rd_capture_ptr = rd_ptr;
|
| 119 |
+
end
|
| 120 |
+
endgenerate
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
//capture the wr_gray_pointers to rd_clk domains and convert the gray pointers to binary pointers
|
| 125 |
+
// before do comparison.
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
// if Sync = 1, then no need to remove metastability logic because wrclk = rdclk
|
| 130 |
+
generate
|
| 131 |
+
if (SYNC == 1) begin: WRSYNC
|
| 132 |
+
always @ (wr_ptr)
|
| 133 |
+
wr_capture_ptr = wr_ptr;
|
| 134 |
+
end
|
| 135 |
+
endgenerate
|
| 136 |
+
|
| 137 |
+
// dualport ram
|
| 138 |
+
// Memory (RAM) that holds the contents of the FIFO
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
assign wr_addr = wr_ptr;
|
| 142 |
+
assign rd_data = mem[rd_addr];
|
| 143 |
+
always @(posedge wr_clk)
|
| 144 |
+
begin
|
| 145 |
+
if (wr_en && !full)
|
| 146 |
+
mem[wr_addr] <= #TCQ wr_data;
|
| 147 |
+
|
| 148 |
+
end
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
// Read Side Logic
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
assign rd_addr = rd_ptr[ASIZE-1:0];
|
| 155 |
+
assign rd_strobe = rd_en && !empty;
|
| 156 |
+
|
| 157 |
+
integer n;
|
| 158 |
+
reg [ASIZE:0] rd_ptr_tmp;
|
| 159 |
+
// change the binary pointer to gray pointer
|
| 160 |
+
always @ (rd_ptr)
|
| 161 |
+
begin
|
| 162 |
+
// rd_gray_nxt[ASIZE] = rd_ptr_tmp[ASIZE];
|
| 163 |
+
// for (n=0; n < ASIZE; n=n+1)
|
| 164 |
+
// rd_gray_nxt[n] = rd_ptr_tmp[n] ^ rd_ptr_tmp[n+1];
|
| 165 |
+
|
| 166 |
+
rd_gray_nxt[ASIZE] = rd_ptr[ASIZE];
|
| 167 |
+
for (n=0; n < ASIZE; n=n+1)
|
| 168 |
+
rd_gray_nxt[n] = rd_ptr[n] ^ rd_ptr[n+1];
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
end
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
always @(posedge rd_clk)
|
| 176 |
+
begin
|
| 177 |
+
if (rst)
|
| 178 |
+
begin
|
| 179 |
+
rd_ptr <= #TCQ 'b0;
|
| 180 |
+
rd_gray <= #TCQ 'b0;
|
| 181 |
+
end
|
| 182 |
+
else begin
|
| 183 |
+
if (rd_strobe)
|
| 184 |
+
rd_ptr <= #TCQ rd_ptr + 1;
|
| 185 |
+
|
| 186 |
+
rd_ptr_tmp <= #TCQ rd_ptr;
|
| 187 |
+
|
| 188 |
+
// change the binary pointer to gray pointer
|
| 189 |
+
rd_gray <= #TCQ rd_gray_nxt;
|
| 190 |
+
end
|
| 191 |
+
|
| 192 |
+
end
|
| 193 |
+
|
| 194 |
+
//generate empty signal
|
| 195 |
+
assign buf_filled = wr_capture_ptr - rd_ptr;
|
| 196 |
+
|
| 197 |
+
always @ (posedge rd_clk )
|
| 198 |
+
begin
|
| 199 |
+
if (rst)
|
| 200 |
+
empty <= #TCQ 1'b1;
|
| 201 |
+
else if ((buf_filled == 0) || (buf_filled == 1 && rd_strobe))
|
| 202 |
+
empty <= #TCQ 1'b1;
|
| 203 |
+
else
|
| 204 |
+
empty <= #TCQ 1'b0;
|
| 205 |
+
end
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
// write side logic;
|
| 209 |
+
|
| 210 |
+
reg [ASIZE:0] wbin;
|
| 211 |
+
wire [ASIZE:0] wgraynext, wbinnext;
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
always @(posedge rd_clk)
|
| 216 |
+
begin
|
| 217 |
+
if (rst)
|
| 218 |
+
begin
|
| 219 |
+
wr_ptr <= #TCQ 'b0;
|
| 220 |
+
wr_gray <= #TCQ 'b0;
|
| 221 |
+
end
|
| 222 |
+
else begin
|
| 223 |
+
if (wr_en)
|
| 224 |
+
wr_ptr <= #TCQ wr_ptr + 1;
|
| 225 |
+
|
| 226 |
+
// change the binary pointer to gray pointer
|
| 227 |
+
wr_gray <= #TCQ wr_gray_nxt;
|
| 228 |
+
end
|
| 229 |
+
|
| 230 |
+
end
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
// change the write pointer to gray pointer
|
| 234 |
+
always @ (wr_ptr)
|
| 235 |
+
begin
|
| 236 |
+
wr_gray_nxt[ASIZE] = wr_ptr[ASIZE];
|
| 237 |
+
for (n=0; n < ASIZE; n=n+1)
|
| 238 |
+
wr_gray_nxt[n] = wr_ptr[n] ^ wr_ptr[n+1];
|
| 239 |
+
end
|
| 240 |
+
// calculate how many buf still available
|
| 241 |
+
assign buf_avail = (rd_capture_ptr + FIFO_DEPTH) - wr_ptr;
|
| 242 |
+
|
| 243 |
+
always @ (posedge wr_clk )
|
| 244 |
+
begin
|
| 245 |
+
if (rst)
|
| 246 |
+
full <= #TCQ 1'b0;
|
| 247 |
+
else if ((buf_avail == 0) || (buf_avail == 1 && wr_en))
|
| 248 |
+
full <= #TCQ 1'b1;
|
| 249 |
+
else
|
| 250 |
+
full <= #TCQ 1'b0;
|
| 251 |
+
end
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
always @ (posedge wr_clk )
|
| 255 |
+
begin
|
| 256 |
+
if (rst)
|
| 257 |
+
almost_full <= #TCQ 1'b0;
|
| 258 |
+
else if ((buf_avail == FIFO_DEPTH - 2 ) || ((buf_avail == FIFO_DEPTH -3) && wr_en))
|
| 259 |
+
almost_full <= #TCQ 1'b1;
|
| 260 |
+
else
|
| 261 |
+
almost_full <= #TCQ 1'b0;
|
| 262 |
+
end
|
| 263 |
+
|
| 264 |
+
endmodule
|
| 265 |
+
|
| 266 |
+
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/cmd_gen.v
ADDED
|
@@ -0,0 +1,941 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MIG
|
| 54 |
+
// / / Filename: cmd_gen.v
|
| 55 |
+
// /___/ /\ Date Last Modified: $Date: 2011/05/27 15:50:26 $
|
| 56 |
+
// \ \ / \ Date Created: Oct 21 2008
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6
|
| 60 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
//Purpose: This module genreates different type of commands, address,
|
| 62 |
+
// burst_length to mcb_flow_control module.
|
| 63 |
+
//Reference:
|
| 64 |
+
//Revision History:
|
| 65 |
+
// Nov14 2008. Added constraints for generating PRBS_BL when
|
| 66 |
+
// generated address is too close to end of address space.
|
| 67 |
+
// The BL will be force to 1 to avoid across other port's space.
|
| 68 |
+
// April 2 2009 Fixed Sequential Address Circuit to avoide generate any address
|
| 69 |
+
// beyond the allowed address range.
|
| 70 |
+
// Oct 22 2009 Fixed BRAM interface.
|
| 71 |
+
// Fixed run_traffic stop and go problem.
|
| 72 |
+
// Merged V6 and SP6 specific requirements.
|
| 73 |
+
// Modified syntax for VHDL Formality comparison.
|
| 74 |
+
//*****************************************************************************
|
| 75 |
+
|
| 76 |
+
`timescale 1ps/1ps
|
| 77 |
+
|
| 78 |
+
`define RD 3'b001;
|
| 79 |
+
`define RDP 3'b011;
|
| 80 |
+
`define WR 3'b000;
|
| 81 |
+
`define WRP 3'b010;
|
| 82 |
+
`define REFRESH 3'b100;
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
module cmd_gen #
|
| 86 |
+
(
|
| 87 |
+
parameter TCQ = 100,
|
| 88 |
+
|
| 89 |
+
parameter FAMILY = "SPARTAN6",
|
| 90 |
+
parameter MEM_BURST_LEN = 8,
|
| 91 |
+
parameter PORT_MODE = "BI_MODE",
|
| 92 |
+
parameter NUM_DQ_PINS = 8,
|
| 93 |
+
parameter DATA_PATTERN = "DGEN_ALL", // "DGEN__HAMMER", "DGEN_WALING1","DGEN_WALING0","DGEN_ADDR","DGEN_NEIGHBOR","DGEN_PRBS","DGEN_ALL"
|
| 94 |
+
parameter CMD_PATTERN = "CGEN_ALL", // "CGEN_RPBS","CGEN_FIXED", "CGEN_BRAM", "CGEN_SEQUENTIAL", "CGEN_ALL",
|
| 95 |
+
parameter ADDR_WIDTH = 30,
|
| 96 |
+
parameter DWIDTH = 32,
|
| 97 |
+
parameter PIPE_STAGES = 0,
|
| 98 |
+
parameter MEM_COL_WIDTH = 10, // memory column width
|
| 99 |
+
parameter PRBS_EADDR_MASK_POS = 32'hFFFFD000,
|
| 100 |
+
parameter PRBS_SADDR_MASK_POS = 32'h00002000,
|
| 101 |
+
parameter PRBS_EADDR = 32'h00002000,
|
| 102 |
+
parameter PRBS_SADDR = 32'h00002000
|
| 103 |
+
)
|
| 104 |
+
(
|
| 105 |
+
input clk_i,
|
| 106 |
+
input [9:0] rst_i,
|
| 107 |
+
input run_traffic_i,
|
| 108 |
+
// runtime parameter
|
| 109 |
+
input [6:0] rd_buff_avail_i,
|
| 110 |
+
input force_wrcmd_gen_i,
|
| 111 |
+
input [31:0] start_addr_i, // define the start of address
|
| 112 |
+
input [31:0] end_addr_i,
|
| 113 |
+
input [31:0] cmd_seed_i, // same seed apply to all addr_prbs_gen, bl_prbs_gen, instr_prbs_gen
|
| 114 |
+
input [31:0] data_seed_i,
|
| 115 |
+
input load_seed_i, //
|
| 116 |
+
// upper layer inputs to determine the command bus and data pattern
|
| 117 |
+
// internal traffic generator initialize the memory with
|
| 118 |
+
input [2:0] addr_mode_i, // "00" = bram; takes the address from bram output
|
| 119 |
+
// "01" = fixed address from the fixed_addr input
|
| 120 |
+
// "10" = psuedo ramdom pattern; generated from internal 64 bit LFSR
|
| 121 |
+
// "11" = sequential
|
| 122 |
+
|
| 123 |
+
input [3:0] data_mode_i, // 4'b0010:address as data
|
| 124 |
+
// 4'b0011:DGEN_HAMMER
|
| 125 |
+
// 4'b0100:DGEN_NEIGHBOUR
|
| 126 |
+
// 4'b0101:DGEN_WALKING1
|
| 127 |
+
// 4'b0110:DGEN_WALKING0
|
| 128 |
+
// 4'b0111:PRBS_DATA
|
| 129 |
+
|
| 130 |
+
// for each instr_mode, traffic gen fill up with a predetermined pattern before starting the instr_pattern that defined
|
| 131 |
+
// in the instr_mode input. The runtime mode will be automatically loaded inside when it is in
|
| 132 |
+
input [3:0] instr_mode_i, // "0000" = bram; takes instruction from bram output
|
| 133 |
+
// "0001" = fixed instr from fixed instr input
|
| 134 |
+
// "0010" = R/W
|
| 135 |
+
// "0011" = RP/WP
|
| 136 |
+
// "0100" = R/RP/W/WP
|
| 137 |
+
// "0101" = R/RP/W/WP/REF
|
| 138 |
+
// "0110" = PRBS
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
input [1:0] bl_mode_i, // "00" = bram; takes the burst length from bram output
|
| 142 |
+
// "01" = fixed , takes the burst length from the fixed_bl input
|
| 143 |
+
// "10" = psuedo ramdom pattern; generated from internal 16 bit LFSR
|
| 144 |
+
|
| 145 |
+
input mode_load_i,
|
| 146 |
+
|
| 147 |
+
// fixed pattern inputs interface
|
| 148 |
+
input [5:0] fixed_bl_i, // range from 1 to 64
|
| 149 |
+
input [2:0] fixed_instr_i, //RD 3'b001
|
| 150 |
+
//RDP 3'b011
|
| 151 |
+
//WR 3'b000
|
| 152 |
+
//WRP 3'b010
|
| 153 |
+
//REFRESH 3'b100
|
| 154 |
+
input [31:0] fixed_addr_i, // only upper 30 bits will be used
|
| 155 |
+
// BRAM FIFO input
|
| 156 |
+
input [31:0] bram_addr_i, //
|
| 157 |
+
input [2:0] bram_instr_i,
|
| 158 |
+
input [5:0] bram_bl_i,
|
| 159 |
+
input bram_valid_i,
|
| 160 |
+
output bram_rdy_o,
|
| 161 |
+
|
| 162 |
+
input reading_rd_data_i,
|
| 163 |
+
// mcb_flow_control interface
|
| 164 |
+
input rdy_i,
|
| 165 |
+
|
| 166 |
+
output [31:0] addr_o, // generated address
|
| 167 |
+
output [2:0] instr_o, // generated instruction
|
| 168 |
+
output [5:0] bl_o, // generated instruction
|
| 169 |
+
// output reg [31:0] m_addr_o,
|
| 170 |
+
output cmd_o_vld // valid commands when asserted
|
| 171 |
+
);
|
| 172 |
+
|
| 173 |
+
localparam PRBS_ADDR_WIDTH = 32;
|
| 174 |
+
localparam INSTR_PRBS_WIDTH = 16;
|
| 175 |
+
localparam BL_PRBS_WIDTH = 16;
|
| 176 |
+
|
| 177 |
+
localparam BRAM_DATAL_MODE = 4'b0000;
|
| 178 |
+
localparam FIXED_DATA_MODE = 4'b0001;
|
| 179 |
+
localparam ADDR_DATA_MODE = 4'b0010;
|
| 180 |
+
localparam HAMMER_DATA_MODE = 4'b0011;
|
| 181 |
+
localparam NEIGHBOR_DATA_MODE = 4'b0100;
|
| 182 |
+
localparam WALKING1_DATA_MODE = 4'b0101;
|
| 183 |
+
localparam WALKING0_DATA_MODE = 4'b0110;
|
| 184 |
+
localparam PRBS_DATA_MODE = 4'b0111;
|
| 185 |
+
|
| 186 |
+
reg [10:0] INC_COUNTS;
|
| 187 |
+
reg [2:0] addr_mode_reg;
|
| 188 |
+
reg [1:0] bl_mode_reg;
|
| 189 |
+
|
| 190 |
+
reg [31:0] addr_counts;
|
| 191 |
+
reg [31:0] addr_counts_next_r;
|
| 192 |
+
|
| 193 |
+
wire [14:0] prbs_bl;
|
| 194 |
+
reg [2:0] instr_out;
|
| 195 |
+
wire [14:0] prbs_instr_a;
|
| 196 |
+
wire [14:0] prbs_instr_b;
|
| 197 |
+
|
| 198 |
+
reg [5:0] prbs_brlen;
|
| 199 |
+
|
| 200 |
+
wire [31:0] prbs_addr;
|
| 201 |
+
wire [31:0] seq_addr;
|
| 202 |
+
wire [31:0] fixed_addr;
|
| 203 |
+
reg [31:0] addr_out ;
|
| 204 |
+
reg [5:0] bl_out;
|
| 205 |
+
reg [5:0] bl_out_reg;
|
| 206 |
+
reg mode_load_d1;
|
| 207 |
+
reg mode_load_d2;
|
| 208 |
+
reg mode_load_pulse;
|
| 209 |
+
wire [41:0] pipe_data_o;
|
| 210 |
+
wire cmd_clk_en;
|
| 211 |
+
|
| 212 |
+
wire pipe_out_vld;
|
| 213 |
+
reg [15:0] end_addr_range;
|
| 214 |
+
|
| 215 |
+
reg force_bl1;
|
| 216 |
+
reg A0_G_E0;
|
| 217 |
+
reg A1_G_E1;
|
| 218 |
+
reg A2_G_E2;
|
| 219 |
+
reg A3_G_E3;
|
| 220 |
+
reg AC3_G_E3;
|
| 221 |
+
reg AC2_G_E2;
|
| 222 |
+
reg AC1_G_E1;
|
| 223 |
+
reg bl_out_clk_en;
|
| 224 |
+
reg [41:0] pipe_data_in;
|
| 225 |
+
reg instr_vld;
|
| 226 |
+
reg bl_out_vld;
|
| 227 |
+
reg pipe_data_in_vld;
|
| 228 |
+
reg gen_addr_larger ;
|
| 229 |
+
reg [6:0] buf_avail_r;
|
| 230 |
+
reg [6:0] rd_data_received_counts;
|
| 231 |
+
reg [6:0] rd_data_counts_asked;
|
| 232 |
+
|
| 233 |
+
reg [15:0] rd_data_received_counts_total;
|
| 234 |
+
reg instr_vld_dly1;
|
| 235 |
+
reg first_load_pulse;
|
| 236 |
+
reg mem_init_done;
|
| 237 |
+
reg refresh_cmd_en ;
|
| 238 |
+
reg [9:0] refresh_timer;
|
| 239 |
+
reg refresh_prbs;
|
| 240 |
+
reg cmd_vld;
|
| 241 |
+
reg run_traffic_r;
|
| 242 |
+
reg run_traffic_pulse;
|
| 243 |
+
always @ (posedge clk_i)
|
| 244 |
+
begin
|
| 245 |
+
run_traffic_r <= #TCQ run_traffic_i;
|
| 246 |
+
if ( run_traffic_i && ~run_traffic_r )
|
| 247 |
+
run_traffic_pulse <= #TCQ 1'b1;
|
| 248 |
+
else
|
| 249 |
+
run_traffic_pulse <= #TCQ 1'b0;
|
| 250 |
+
end
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
// commands go through pipeline inserters
|
| 254 |
+
assign addr_o = pipe_data_o[31:0];
|
| 255 |
+
assign instr_o = pipe_data_o[34:32];
|
| 256 |
+
assign bl_o = pipe_data_o[40:35];
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
assign cmd_o_vld = pipe_data_o[41] & run_traffic_r;
|
| 260 |
+
assign pipe_out_vld = pipe_data_o[41] & run_traffic_r;
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
assign pipe_data_o = pipe_data_in;
|
| 264 |
+
|
| 265 |
+
always @(posedge clk_i) begin
|
| 266 |
+
|
| 267 |
+
instr_vld <= #TCQ (cmd_clk_en | (mode_load_pulse & first_load_pulse));
|
| 268 |
+
bl_out_clk_en <= #TCQ (cmd_clk_en | (mode_load_pulse & first_load_pulse));
|
| 269 |
+
bl_out_vld <= #TCQ bl_out_clk_en;
|
| 270 |
+
pipe_data_in_vld <= #TCQ instr_vld;
|
| 271 |
+
end
|
| 272 |
+
|
| 273 |
+
always @ (posedge clk_i) begin
|
| 274 |
+
if (rst_i[0])
|
| 275 |
+
first_load_pulse <= #TCQ 1'b1;
|
| 276 |
+
else if (mode_load_pulse)
|
| 277 |
+
first_load_pulse <= #TCQ 1'b0;
|
| 278 |
+
else
|
| 279 |
+
first_load_pulse <= #TCQ first_load_pulse;
|
| 280 |
+
end
|
| 281 |
+
|
| 282 |
+
generate
|
| 283 |
+
if (CMD_PATTERN == "CGEN_BRAM") begin: cv1
|
| 284 |
+
|
| 285 |
+
always @(posedge clk_i) begin
|
| 286 |
+
cmd_vld <= #TCQ (cmd_clk_en );
|
| 287 |
+
|
| 288 |
+
end
|
| 289 |
+
end endgenerate
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
generate
|
| 293 |
+
if (CMD_PATTERN != "CGEN_BRAM") begin: cv2
|
| 294 |
+
|
| 295 |
+
always @(posedge clk_i) begin
|
| 296 |
+
cmd_vld <= #TCQ (cmd_clk_en | (mode_load_pulse & first_load_pulse ));
|
| 297 |
+
|
| 298 |
+
end
|
| 299 |
+
end endgenerate
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
assign cmd_clk_en = ( rdy_i & pipe_out_vld & run_traffic_i || mode_load_pulse && (CMD_PATTERN == "CGEN_BRAM"));
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
integer i;
|
| 307 |
+
generate
|
| 308 |
+
if (FAMILY == "SPARTAN6") begin: pipe_in_s6
|
| 309 |
+
always @ (posedge clk_i) begin
|
| 310 |
+
if (rst_i[0])
|
| 311 |
+
pipe_data_in[31:0] <= #TCQ start_addr_i;
|
| 312 |
+
else if (instr_vld)
|
| 313 |
+
if (gen_addr_larger && (addr_mode_reg == 3'b100 || addr_mode_reg == 3'b010))
|
| 314 |
+
if (DWIDTH == 32)
|
| 315 |
+
pipe_data_in[31:0] <= #TCQ {end_addr_i[31:8],8'h0};
|
| 316 |
+
else if (DWIDTH == 64)
|
| 317 |
+
pipe_data_in[31:0] <= #TCQ {end_addr_i[31:9],9'h0};
|
| 318 |
+
else
|
| 319 |
+
pipe_data_in[31:0] <= #TCQ {end_addr_i[31:10],10'h0};
|
| 320 |
+
|
| 321 |
+
else begin
|
| 322 |
+
if (DWIDTH == 32)
|
| 323 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:2],2'b00} ;
|
| 324 |
+
else if (DWIDTH == 64)
|
| 325 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:3],3'b000} ;
|
| 326 |
+
else if (DWIDTH == 128)
|
| 327 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:4],4'b0000} ;
|
| 328 |
+
end
|
| 329 |
+
end
|
| 330 |
+
|
| 331 |
+
end endgenerate
|
| 332 |
+
|
| 333 |
+
generate
|
| 334 |
+
if (FAMILY == "VIRTEX6") begin: pipe_in_v6
|
| 335 |
+
always @ (posedge clk_i) begin
|
| 336 |
+
if (rst_i[1])
|
| 337 |
+
pipe_data_in[31:0] <= #TCQ start_addr_i;
|
| 338 |
+
else if (instr_vld)
|
| 339 |
+
// address
|
| 340 |
+
if (gen_addr_larger && (addr_mode_reg == 3'b100 || addr_mode_reg == 3'b010)) //(AC3_G_E3 && AC2_G_E2 && AC1_G_E1 )
|
| 341 |
+
pipe_data_in[31:0] <= #TCQ {end_addr_i[31:8],8'h0};
|
| 342 |
+
else if ((NUM_DQ_PINS >= 128) && (NUM_DQ_PINS <= 144))
|
| 343 |
+
begin
|
| 344 |
+
if (MEM_BURST_LEN == 8)
|
| 345 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:7], 7'b0000000};
|
| 346 |
+
else
|
| 347 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:6], 6'b000000};
|
| 348 |
+
end
|
| 349 |
+
|
| 350 |
+
else if ((NUM_DQ_PINS >= 64) && (NUM_DQ_PINS < 128))
|
| 351 |
+
begin
|
| 352 |
+
|
| 353 |
+
if (MEM_BURST_LEN == 8)
|
| 354 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:6], 6'b000000};
|
| 355 |
+
else
|
| 356 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:5], 5'b00000};
|
| 357 |
+
end
|
| 358 |
+
|
| 359 |
+
else if ((NUM_DQ_PINS == 32) || (NUM_DQ_PINS == 40) || (NUM_DQ_PINS == 48) || (NUM_DQ_PINS == 56))
|
| 360 |
+
begin
|
| 361 |
+
|
| 362 |
+
if (MEM_BURST_LEN == 8)
|
| 363 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:5], 5'b00000};
|
| 364 |
+
else
|
| 365 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:4], 4'b0000};
|
| 366 |
+
end
|
| 367 |
+
|
| 368 |
+
else if ((NUM_DQ_PINS == 16) || (NUM_DQ_PINS == 24))
|
| 369 |
+
if (MEM_BURST_LEN == 8)
|
| 370 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:4], 4'b0000};
|
| 371 |
+
else
|
| 372 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:3], 3'b000};
|
| 373 |
+
|
| 374 |
+
else if ((NUM_DQ_PINS == 8) )
|
| 375 |
+
if (MEM_BURST_LEN == 8)
|
| 376 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:3], 3'b000};
|
| 377 |
+
else
|
| 378 |
+
pipe_data_in[31:0] <= #TCQ {addr_out[31:2], 2'b00};
|
| 379 |
+
|
| 380 |
+
end
|
| 381 |
+
|
| 382 |
+
end endgenerate
|
| 383 |
+
|
| 384 |
+
|
| 385 |
+
//generate
|
| 386 |
+
//if (FAMILY == "VIRTEX6") begin: pipe_m_addr_o
|
| 387 |
+
// always @ (posedge clk_i) begin
|
| 388 |
+
// if (rst_i[1])
|
| 389 |
+
// m_addr_o[31:0] <= #TCQ start_addr_i;
|
| 390 |
+
// else if (instr_vld)
|
| 391 |
+
// if (gen_addr_larger && (addr_mode_reg == 3'b100 || addr_mode_reg == 3'b010)) //(AC3_G_E3 && AC2_G_E2 && AC1_G_E1 )
|
| 392 |
+
// m_addr_o[31:0] <= #TCQ {end_addr_i[31:8],8'h0};
|
| 393 |
+
// else if ((NUM_DQ_PINS >= 128 && NUM_DQ_PINS < 256))
|
| 394 |
+
// m_addr_o <= #TCQ {addr_out[31:6], 6'b00000} ;
|
| 395 |
+
//
|
| 396 |
+
// else if ((NUM_DQ_PINS >= 64 && NUM_DQ_PINS < 128))
|
| 397 |
+
// m_addr_o <= #TCQ {addr_out[31:5], 5'b00000} ;
|
| 398 |
+
//
|
| 399 |
+
// else if ((NUM_DQ_PINS == 32) || (NUM_DQ_PINS == 40) || (NUM_DQ_PINS == 48) || (NUM_DQ_PINS == 56))
|
| 400 |
+
// m_addr_o[31:0] <= #TCQ {addr_out[31:4], 4'b0000};
|
| 401 |
+
// else if ((NUM_DQ_PINS == 16) || (NUM_DQ_PINS == 24))
|
| 402 |
+
// m_addr_o[31:0] <= #TCQ {addr_out[31:3], 3'b000};
|
| 403 |
+
// else if ((NUM_DQ_PINS == 8) )
|
| 404 |
+
// m_addr_o[31:0] <= #TCQ {addr_out[31:2], 2'b00};
|
| 405 |
+
//end
|
| 406 |
+
//
|
| 407 |
+
//end endgenerate
|
| 408 |
+
reg force_wrcmd_gen;
|
| 409 |
+
always @ (posedge clk_i) begin
|
| 410 |
+
if (rst_i[0])
|
| 411 |
+
force_wrcmd_gen <= #TCQ 1'b0;
|
| 412 |
+
else if (buf_avail_r == 63)
|
| 413 |
+
force_wrcmd_gen <= #TCQ 1'b0;
|
| 414 |
+
else if (instr_vld_dly1 && pipe_data_in[32]== 1 && pipe_data_in[41:35] > 16)
|
| 415 |
+
force_wrcmd_gen <= #TCQ 1'b1;
|
| 416 |
+
end
|
| 417 |
+
|
| 418 |
+
reg [3:0]instr_mode_reg;
|
| 419 |
+
always @ (posedge clk_i)
|
| 420 |
+
begin
|
| 421 |
+
instr_mode_reg <= #TCQ instr_mode_i;
|
| 422 |
+
end
|
| 423 |
+
reg force_smallvalue;
|
| 424 |
+
always @ (posedge clk_i)
|
| 425 |
+
begin
|
| 426 |
+
if (rst_i[2]) begin
|
| 427 |
+
pipe_data_in[40:32] <= #TCQ 'b0;
|
| 428 |
+
force_smallvalue <= #TCQ 1'b0;
|
| 429 |
+
end
|
| 430 |
+
else if (instr_vld) begin
|
| 431 |
+
if (instr_mode_reg == 0) begin
|
| 432 |
+
pipe_data_in[34:32] <= #TCQ instr_out;
|
| 433 |
+
end
|
| 434 |
+
else if (instr_out[2]) begin
|
| 435 |
+
pipe_data_in[34:32] <= #TCQ 3'b100;
|
| 436 |
+
end
|
| 437 |
+
//
|
| 438 |
+
else if ( FAMILY == "SPARTAN6" && PORT_MODE == "RD_MODE")
|
| 439 |
+
begin
|
| 440 |
+
pipe_data_in[34:32] <= #TCQ {instr_out[2:1],1'b1};
|
| 441 |
+
end
|
| 442 |
+
|
| 443 |
+
else if ((force_wrcmd_gen || buf_avail_r <= 15) && FAMILY == "SPARTAN6" && PORT_MODE != "RD_MODE")
|
| 444 |
+
begin
|
| 445 |
+
pipe_data_in[34:32] <= #TCQ {instr_out[2],2'b00};
|
| 446 |
+
end
|
| 447 |
+
else begin
|
| 448 |
+
pipe_data_in[34:32] <= #TCQ instr_out;
|
| 449 |
+
end
|
| 450 |
+
|
| 451 |
+
//********* condition the generated bl value except if TG is programmed for BRAM interface'
|
| 452 |
+
// if the generated address is close to end address range, the bl_out will be altered to 1.
|
| 453 |
+
if (bl_mode_i[1:0] == 2'b00) // if programmed BRAM interface
|
| 454 |
+
pipe_data_in[40:35] <= #TCQ bl_out;
|
| 455 |
+
else if (FAMILY == "VIRTEX6")
|
| 456 |
+
pipe_data_in[40:35] <= #TCQ bl_out;
|
| 457 |
+
else if (force_bl1 && (bl_mode_reg == 2'b10 ) && FAMILY == "SPARTAN6") //PRBS_BL
|
| 458 |
+
|
| 459 |
+
pipe_data_in[40:35] <= #TCQ 6'b000001;
|
| 460 |
+
else if ((buf_avail_r[5:0] >= 6'b111100 && buf_avail_r[6] == 1'b0) && pipe_data_in[32] == 1'b1 && FAMILY == "SPARTAN6") //read instructon
|
| 461 |
+
|
| 462 |
+
|
| 463 |
+
begin
|
| 464 |
+
if (bl_mode_reg == 2'b10)
|
| 465 |
+
force_smallvalue <= #TCQ ~force_smallvalue;
|
| 466 |
+
|
| 467 |
+
if ((buf_avail_r[6] && bl_mode_reg == 2'b10))
|
| 468 |
+
|
| 469 |
+
|
| 470 |
+
pipe_data_in[40:35] <= #TCQ {2'b0,bl_out[3:1],1'b1};
|
| 471 |
+
else
|
| 472 |
+
pipe_data_in[40:35] <= #TCQ bl_out;
|
| 473 |
+
end
|
| 474 |
+
else if (buf_avail_r < 64 && rd_buff_avail_i >= 0 && instr_out[0] == 1'b1 && (bl_mode_reg == 2'b10 ))
|
| 475 |
+
if (FAMILY == "SPARTAN6")
|
| 476 |
+
pipe_data_in[40:35] <= #TCQ {2'b0,bl_out[3:0] + 1};
|
| 477 |
+
else
|
| 478 |
+
pipe_data_in[40:35] <= #TCQ bl_out;
|
| 479 |
+
|
| 480 |
+
end //else instr_vld
|
| 481 |
+
end // always
|
| 482 |
+
|
| 483 |
+
always @ (posedge clk_i)
|
| 484 |
+
begin
|
| 485 |
+
if (rst_i[2])
|
| 486 |
+
pipe_data_in[41] <= #TCQ 'b0;
|
| 487 |
+
else if (cmd_vld)
|
| 488 |
+
pipe_data_in[41] <= #TCQ instr_vld;//instr_vld;
|
| 489 |
+
else if (rdy_i && pipe_out_vld)
|
| 490 |
+
pipe_data_in[41] <= #TCQ 1'b0;
|
| 491 |
+
end
|
| 492 |
+
|
| 493 |
+
always @ (posedge clk_i)
|
| 494 |
+
instr_vld_dly1 <= #TCQ instr_vld;
|
| 495 |
+
|
| 496 |
+
always @ (posedge clk_i) begin
|
| 497 |
+
if (rst_i[0]) begin
|
| 498 |
+
rd_data_counts_asked <= #TCQ 'b0;
|
| 499 |
+
end else if (instr_vld_dly1 && pipe_data_in[32]== 1) begin
|
| 500 |
+
if (pipe_data_in[40:35] == 0)
|
| 501 |
+
rd_data_counts_asked <= #TCQ rd_data_counts_asked + (64) ;
|
| 502 |
+
else
|
| 503 |
+
rd_data_counts_asked <= #TCQ rd_data_counts_asked + (pipe_data_in[40:35]) ;
|
| 504 |
+
|
| 505 |
+
end
|
| 506 |
+
end
|
| 507 |
+
|
| 508 |
+
always @ (posedge clk_i) begin
|
| 509 |
+
if (rst_i[0]) begin
|
| 510 |
+
rd_data_received_counts <= #TCQ 'b0;
|
| 511 |
+
rd_data_received_counts_total <= #TCQ 'b0;
|
| 512 |
+
end else if(reading_rd_data_i) begin
|
| 513 |
+
rd_data_received_counts <= #TCQ rd_data_received_counts + 1;
|
| 514 |
+
rd_data_received_counts_total <= #TCQ rd_data_received_counts_total + 1;
|
| 515 |
+
end
|
| 516 |
+
end
|
| 517 |
+
|
| 518 |
+
// calculate how many buf still available
|
| 519 |
+
always @ (posedge clk_i)
|
| 520 |
+
buf_avail_r <= #TCQ (rd_data_received_counts + 64) - rd_data_counts_asked;
|
| 521 |
+
|
| 522 |
+
localparam BRAM_ADDR = 2'b00;
|
| 523 |
+
localparam FIXED_ADDR = 2'b01;
|
| 524 |
+
localparam PRBS_ADDR = 2'b10;
|
| 525 |
+
localparam SEQUENTIAL_ADDR = 2'b11;
|
| 526 |
+
|
| 527 |
+
// registered the mode settings
|
| 528 |
+
always @ (posedge clk_i) begin
|
| 529 |
+
if (rst_i[3])
|
| 530 |
+
if (CMD_PATTERN == "CGEN_BRAM")
|
| 531 |
+
addr_mode_reg <= #TCQ 3'b000;
|
| 532 |
+
else
|
| 533 |
+
addr_mode_reg <= #TCQ 3'b011;
|
| 534 |
+
else if (mode_load_pulse)
|
| 535 |
+
addr_mode_reg <= #TCQ addr_mode_i;
|
| 536 |
+
end
|
| 537 |
+
|
| 538 |
+
always @ (posedge clk_i) begin
|
| 539 |
+
if (mode_load_pulse) begin
|
| 540 |
+
bl_mode_reg <= #TCQ bl_mode_i ;
|
| 541 |
+
end
|
| 542 |
+
mode_load_d1 <= #TCQ mode_load_i;
|
| 543 |
+
mode_load_d2 <= #TCQ mode_load_d1;
|
| 544 |
+
end
|
| 545 |
+
|
| 546 |
+
always @ (posedge clk_i)
|
| 547 |
+
mode_load_pulse <= #TCQ mode_load_d1 & ~mode_load_d2;
|
| 548 |
+
|
| 549 |
+
// MUX the addr pattern out depending on the addr_mode setting
|
| 550 |
+
|
| 551 |
+
// "000" = bram; takes the address from bram output
|
| 552 |
+
// "001" = fixed address from the fixed_addr input
|
| 553 |
+
// "010" = psuedo ramdom pattern; generated from internal 64 bit LFSR
|
| 554 |
+
// "011" = sequential
|
| 555 |
+
// "100" = mode that used for prbs addr , prbs bl and prbs data
|
| 556 |
+
//always @(addr_mode_reg,prbs_addr,seq_addr,fixed_addr,bram_addr_i,data_mode_i)
|
| 557 |
+
always @ (posedge clk_i) begin
|
| 558 |
+
if (rst_i[3])
|
| 559 |
+
addr_out <= #TCQ start_addr_i;
|
| 560 |
+
else
|
| 561 |
+
case({addr_mode_reg})
|
| 562 |
+
3'b000: addr_out <= #TCQ bram_addr_i;
|
| 563 |
+
3'b001: addr_out <= #TCQ fixed_addr;
|
| 564 |
+
3'b010: addr_out <= #TCQ prbs_addr;
|
| 565 |
+
3'b011: addr_out <= #TCQ {2'b0,seq_addr[29:0]};
|
| 566 |
+
3'b100: addr_out <= #TCQ {2'b00,seq_addr[6:2],seq_addr[23:0]};//{prbs_addr[31:6],6'b000000} ;
|
| 567 |
+
3'b101: addr_out <= #TCQ {prbs_addr[31:20],seq_addr[19:0]} ;
|
| 568 |
+
|
| 569 |
+
default : addr_out <= #TCQ 'b0;
|
| 570 |
+
endcase
|
| 571 |
+
end
|
| 572 |
+
|
| 573 |
+
// ADDR PRBS GENERATION
|
| 574 |
+
generate
|
| 575 |
+
if (CMD_PATTERN == "CGEN_PRBS" || CMD_PATTERN == "CGEN_ALL" ) begin: gen_prbs_addr
|
| 576 |
+
cmd_prbs_gen #
|
| 577 |
+
(
|
| 578 |
+
.TCQ (TCQ),
|
| 579 |
+
.FAMILY (FAMILY),
|
| 580 |
+
.ADDR_WIDTH (32),
|
| 581 |
+
.DWIDTH (DWIDTH),
|
| 582 |
+
.PRBS_WIDTH (32),
|
| 583 |
+
.SEED_WIDTH (32),
|
| 584 |
+
.PRBS_EADDR_MASK_POS (PRBS_EADDR_MASK_POS ),
|
| 585 |
+
.PRBS_SADDR_MASK_POS (PRBS_SADDR_MASK_POS ),
|
| 586 |
+
.PRBS_EADDR (PRBS_EADDR),
|
| 587 |
+
.PRBS_SADDR (PRBS_SADDR )
|
| 588 |
+
)
|
| 589 |
+
addr_prbs_gen
|
| 590 |
+
(
|
| 591 |
+
.clk_i (clk_i),
|
| 592 |
+
.clk_en (cmd_clk_en),
|
| 593 |
+
.prbs_seed_init (mode_load_pulse),
|
| 594 |
+
.prbs_seed_i (cmd_seed_i[31:0]),
|
| 595 |
+
.prbs_o (prbs_addr)
|
| 596 |
+
);
|
| 597 |
+
end
|
| 598 |
+
endgenerate
|
| 599 |
+
|
| 600 |
+
always @ (posedge clk_i) begin
|
| 601 |
+
if (addr_out[31:8] >= end_addr_i[31:8])
|
| 602 |
+
gen_addr_larger <= 1'b1;
|
| 603 |
+
else
|
| 604 |
+
gen_addr_larger <= 1'b0;
|
| 605 |
+
end
|
| 606 |
+
|
| 607 |
+
generate
|
| 608 |
+
if (FAMILY == "SPARTAN6" ) begin : INC_COUNTS_S
|
| 609 |
+
always @ (posedge clk_i)
|
| 610 |
+
if (mem_init_done)
|
| 611 |
+
INC_COUNTS <= #TCQ (DWIDTH/8)*(bl_out_reg);
|
| 612 |
+
else begin
|
| 613 |
+
if (fixed_bl_i == 0)
|
| 614 |
+
INC_COUNTS <= #TCQ (DWIDTH/8)*(64);
|
| 615 |
+
else
|
| 616 |
+
INC_COUNTS <= #TCQ (DWIDTH/8)*(fixed_bl_i);
|
| 617 |
+
end
|
| 618 |
+
end
|
| 619 |
+
endgenerate
|
| 620 |
+
//converting string to integer
|
| 621 |
+
//localparam MEM_BURST_INT = (MEM_BURST_LEN == "8")? 8 : 4;
|
| 622 |
+
localparam MEM_BURST_INT = MEM_BURST_LEN ;
|
| 623 |
+
|
| 624 |
+
|
| 625 |
+
generate
|
| 626 |
+
if (FAMILY == "VIRTEX6" ) begin : INC_COUNTS_V
|
| 627 |
+
always @ (posedge clk_i) begin
|
| 628 |
+
|
| 629 |
+
if ( (NUM_DQ_PINS >= 128 && NUM_DQ_PINS <= 144)) //256
|
| 630 |
+
INC_COUNTS <= #TCQ 64 * (MEM_BURST_INT/4);
|
| 631 |
+
|
| 632 |
+
else if ( (NUM_DQ_PINS >= 64 && NUM_DQ_PINS < 128)) //256
|
| 633 |
+
INC_COUNTS <= #TCQ 32 * (MEM_BURST_INT/4);
|
| 634 |
+
else if ((NUM_DQ_PINS >= 32) && (NUM_DQ_PINS < 64)) //128
|
| 635 |
+
INC_COUNTS <= #TCQ 16 * (MEM_BURST_INT/4) ;
|
| 636 |
+
else if ((NUM_DQ_PINS == 16) || (NUM_DQ_PINS == 24)) //64
|
| 637 |
+
INC_COUNTS <= #TCQ 8 * (MEM_BURST_INT/4);
|
| 638 |
+
else if ((NUM_DQ_PINS == 8) )
|
| 639 |
+
INC_COUNTS <= #TCQ 4 * (MEM_BURST_INT/4);
|
| 640 |
+
end
|
| 641 |
+
end
|
| 642 |
+
endgenerate
|
| 643 |
+
|
| 644 |
+
generate
|
| 645 |
+
// Sequential Address pattern
|
| 646 |
+
// It is generated when rdy_i is valid and write command is valid and bl_cmd is valid.
|
| 647 |
+
reg [31:0] end_addr_r;
|
| 648 |
+
|
| 649 |
+
always @ (posedge clk_i) begin
|
| 650 |
+
end_addr_r <= #TCQ end_addr_i - DWIDTH/8*fixed_bl_i +1;
|
| 651 |
+
end
|
| 652 |
+
|
| 653 |
+
always @ (posedge clk_i) begin
|
| 654 |
+
if (addr_out[31:24] >= end_addr_r[31:24])
|
| 655 |
+
AC3_G_E3 <= #TCQ 1'b1;
|
| 656 |
+
else
|
| 657 |
+
AC3_G_E3 <= #TCQ 1'b0;
|
| 658 |
+
|
| 659 |
+
if (addr_out[23:16] >= end_addr_r[23:16])
|
| 660 |
+
AC2_G_E2 <= #TCQ 1'b1;
|
| 661 |
+
else
|
| 662 |
+
AC2_G_E2 <= #TCQ 1'b0;
|
| 663 |
+
|
| 664 |
+
if (addr_out[15:8] >= end_addr_r[15:8])
|
| 665 |
+
AC1_G_E1 <= #TCQ 1'b1;
|
| 666 |
+
else
|
| 667 |
+
AC1_G_E1 <= #TCQ 1'b0;
|
| 668 |
+
end
|
| 669 |
+
|
| 670 |
+
//if (CMD_PATTERN == "CGEN_SEQUENTIAL" || CMD_PATTERN == "CGEN_ALL" ) begin : seq_addr_gen
|
| 671 |
+
assign seq_addr = addr_counts;
|
| 672 |
+
|
| 673 |
+
reg mode_load_pulse_r1;
|
| 674 |
+
|
| 675 |
+
always @ (posedge clk_i)
|
| 676 |
+
begin
|
| 677 |
+
mode_load_pulse_r1 <= #TCQ mode_load_pulse;
|
| 678 |
+
|
| 679 |
+
end
|
| 680 |
+
|
| 681 |
+
always @ (posedge clk_i)
|
| 682 |
+
end_addr_range <= #TCQ end_addr_i[15:0] - (DWIDTH/8 *bl_out_reg) + 1 ;
|
| 683 |
+
|
| 684 |
+
always @ (posedge clk_i)
|
| 685 |
+
addr_counts_next_r <= #TCQ addr_counts + INC_COUNTS ;
|
| 686 |
+
|
| 687 |
+
reg cmd_clk_en_r;
|
| 688 |
+
always @ (posedge clk_i)
|
| 689 |
+
cmd_clk_en_r <= #TCQ cmd_clk_en;
|
| 690 |
+
always @ (posedge clk_i) begin
|
| 691 |
+
if (rst_i[4]) begin
|
| 692 |
+
addr_counts <= #TCQ start_addr_i;
|
| 693 |
+
mem_init_done <= #TCQ 1'b0;
|
| 694 |
+
end else if (cmd_clk_en_r || mode_load_pulse_r1)
|
| 695 |
+
if(addr_counts_next_r>= end_addr_i) begin
|
| 696 |
+
addr_counts <= #TCQ start_addr_i;
|
| 697 |
+
mem_init_done <= #TCQ 1'b1;
|
| 698 |
+
end else if(addr_counts < end_addr_r) // address counts get incremented by burst_length and port size each wr command generated
|
| 699 |
+
addr_counts <= #TCQ addr_counts + INC_COUNTS;
|
| 700 |
+
end
|
| 701 |
+
|
| 702 |
+
// end begin
|
| 703 |
+
//end
|
| 704 |
+
endgenerate
|
| 705 |
+
|
| 706 |
+
generate
|
| 707 |
+
// Fixed Address pattern
|
| 708 |
+
if (CMD_PATTERN == "CGEN_FIXED" || CMD_PATTERN == "CGEN_ALL" ) begin : fixed_addr_gen
|
| 709 |
+
assign fixed_addr = (DWIDTH == 32)? {fixed_addr_i[31:2],2'b0} :
|
| 710 |
+
(DWIDTH == 64)? {fixed_addr_i[31:3],3'b0}:
|
| 711 |
+
(DWIDTH <= 128)? {fixed_addr_i[31:4],4'b0}:
|
| 712 |
+
(DWIDTH <= 256)? {fixed_addr_i[31:5],5'b0}:
|
| 713 |
+
{fixed_addr_i[31:6],6'b0};
|
| 714 |
+
end
|
| 715 |
+
endgenerate
|
| 716 |
+
|
| 717 |
+
generate
|
| 718 |
+
// BRAM Address pattern
|
| 719 |
+
if (CMD_PATTERN == "CGEN_BRAM" || CMD_PATTERN == "CGEN_ALL" ) begin : bram_addr_gen
|
| 720 |
+
assign bram_rdy_o = run_traffic_i & cmd_clk_en & bram_valid_i | mode_load_pulse;
|
| 721 |
+
end
|
| 722 |
+
endgenerate
|
| 723 |
+
|
| 724 |
+
///////////////////////////////////////////////////////////////////////////
|
| 725 |
+
// INSTR COMMAND GENERATION
|
| 726 |
+
|
| 727 |
+
// tap points are 3,2
|
| 728 |
+
//`define RD 3'b001
|
| 729 |
+
//`define RDP 3'b011
|
| 730 |
+
//`define WR 3'b000
|
| 731 |
+
//`define WRP 3'b010
|
| 732 |
+
//`define REFRESH 3'b100
|
| 733 |
+
// use 14 stages 1 sr16; tap position 1,3,5,14
|
| 734 |
+
|
| 735 |
+
reg [9:0]force_rd_counts;
|
| 736 |
+
reg force_rd;
|
| 737 |
+
always @ (posedge clk_i) begin
|
| 738 |
+
if (rst_i[4])
|
| 739 |
+
force_rd_counts <= #TCQ 'b0;
|
| 740 |
+
else if (instr_vld) begin
|
| 741 |
+
force_rd_counts <= #TCQ force_rd_counts + 1;
|
| 742 |
+
end
|
| 743 |
+
end
|
| 744 |
+
|
| 745 |
+
always @ (posedge clk_i) begin
|
| 746 |
+
if (rst_i[4])
|
| 747 |
+
force_rd <= #TCQ 1'b0;
|
| 748 |
+
else if (force_rd_counts[3])
|
| 749 |
+
force_rd <= #TCQ 1'b1;
|
| 750 |
+
else
|
| 751 |
+
force_rd <= #TCQ 1'b0;
|
| 752 |
+
end
|
| 753 |
+
|
| 754 |
+
|
| 755 |
+
// adding refresh timer to limit the amount of issuing refresh command.
|
| 756 |
+
always @ (posedge clk_i) begin
|
| 757 |
+
if (rst_i[4])
|
| 758 |
+
refresh_timer <= #TCQ 'b0;
|
| 759 |
+
else
|
| 760 |
+
refresh_timer <= #TCQ refresh_timer + 1'b1;
|
| 761 |
+
|
| 762 |
+
end
|
| 763 |
+
|
| 764 |
+
always @ (posedge clk_i) begin
|
| 765 |
+
if (rst_i[4])
|
| 766 |
+
refresh_cmd_en <= #TCQ 'b0;
|
| 767 |
+
//else if (refresh_timer >= 12'hff0 && refresh_timer <= 12'hfff)
|
| 768 |
+
else if (refresh_timer == 10'h3ff)
|
| 769 |
+
|
| 770 |
+
refresh_cmd_en <= #TCQ 'b1;
|
| 771 |
+
else if (cmd_clk_en && refresh_cmd_en)
|
| 772 |
+
refresh_cmd_en <= #TCQ 'b0;
|
| 773 |
+
|
| 774 |
+
end
|
| 775 |
+
|
| 776 |
+
always @ (posedge clk_i) begin
|
| 777 |
+
if (FAMILY == "SPARTAN6")
|
| 778 |
+
refresh_prbs <= #TCQ prbs_instr_b[3] & refresh_cmd_en;
|
| 779 |
+
else
|
| 780 |
+
refresh_prbs <= #TCQ 1'b0;
|
| 781 |
+
end
|
| 782 |
+
//synthesis translate_off
|
| 783 |
+
always @ (instr_mode_i)
|
| 784 |
+
if(instr_mode_i >2 && FAMILY == "VIRTEX6") begin
|
| 785 |
+
$display("Error ! Not valid instruction mode");
|
| 786 |
+
$stop;
|
| 787 |
+
end
|
| 788 |
+
//synthesis translate_on
|
| 789 |
+
|
| 790 |
+
always @ (posedge clk_i) begin
|
| 791 |
+
case(instr_mode_i)
|
| 792 |
+
0: instr_out <= #TCQ bram_instr_i;
|
| 793 |
+
1: instr_out <= #TCQ fixed_instr_i;
|
| 794 |
+
2: instr_out <= #TCQ {2'b00,(prbs_instr_a[0] | force_rd)};
|
| 795 |
+
3: instr_out <= #TCQ {2'b0,prbs_instr_a[0]}; //: WP/RP
|
| 796 |
+
4: instr_out <= #TCQ {1'b0,prbs_instr_b[0], prbs_instr_a[0]}; // W/WP/R/RP.
|
| 797 |
+
// may be add another PRBS for generating REFRESH
|
| 798 |
+
// 5: instr_out <= #TCQ {prbs_instr_b[3],prbs_instr_b[0], prbs_instr_a[0]}; // W/WP/R/RP/REFRESH W/WP/R/RP/REFRESH
|
| 799 |
+
5: instr_out <= #TCQ {refresh_prbs ,prbs_instr_b[0], prbs_instr_a[0]}; // W/WP/R/RP/REFRESH W/WP/R/RP/REFRESH
|
| 800 |
+
|
| 801 |
+
|
| 802 |
+
default : instr_out <= #TCQ {2'b00,prbs_instr_a[0]};
|
| 803 |
+
endcase
|
| 804 |
+
end
|
| 805 |
+
|
| 806 |
+
generate // PRBS INSTRUCTION generation
|
| 807 |
+
// use two PRBS generators and tap off 1 bit from each to create more randomness for
|
| 808 |
+
// generating actual read/write commands
|
| 809 |
+
if (CMD_PATTERN == "CGEN_PRBS" || CMD_PATTERN == "CGEN_ALL" ) begin: gen_prbs_instr
|
| 810 |
+
cmd_prbs_gen #
|
| 811 |
+
(
|
| 812 |
+
.TCQ (TCQ),
|
| 813 |
+
.PRBS_CMD ("INSTR"),
|
| 814 |
+
.ADDR_WIDTH (32),
|
| 815 |
+
.SEED_WIDTH (15),
|
| 816 |
+
.PRBS_WIDTH (20)
|
| 817 |
+
)
|
| 818 |
+
instr_prbs_gen_a
|
| 819 |
+
(
|
| 820 |
+
.clk_i (clk_i),
|
| 821 |
+
.clk_en (cmd_clk_en),
|
| 822 |
+
.prbs_seed_init (load_seed_i),
|
| 823 |
+
.prbs_seed_i (cmd_seed_i[14:0]),
|
| 824 |
+
.prbs_o (prbs_instr_a)
|
| 825 |
+
);
|
| 826 |
+
|
| 827 |
+
cmd_prbs_gen #
|
| 828 |
+
(
|
| 829 |
+
.PRBS_CMD ("INSTR"),
|
| 830 |
+
.SEED_WIDTH (15),
|
| 831 |
+
.PRBS_WIDTH (20)
|
| 832 |
+
)
|
| 833 |
+
instr_prbs_gen_b
|
| 834 |
+
(
|
| 835 |
+
.clk_i (clk_i),
|
| 836 |
+
.clk_en (cmd_clk_en),
|
| 837 |
+
.prbs_seed_init (load_seed_i),
|
| 838 |
+
.prbs_seed_i (cmd_seed_i[16:2]),
|
| 839 |
+
.prbs_o (prbs_instr_b)
|
| 840 |
+
);
|
| 841 |
+
end
|
| 842 |
+
endgenerate
|
| 843 |
+
|
| 844 |
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| 845 |
+
// BURST LENGTH GENERATION
|
| 846 |
+
// burst length code = user burst length input - 1
|
| 847 |
+
// mcb_flow_control does the minus before sending out to mcb\
|
| 848 |
+
// when filling up the memory, need to make sure bl doesn't go beyound its upper limit boundary
|
| 849 |
+
//assign force_bl1 = (addr_out[31:0] >= (end_addr_i[31:0] - 4*64)) ? 1'b1: 1'b0;
|
| 850 |
+
// for neighbour pattern, need to limit the bl to make sure it is within column size boundary.
|
| 851 |
+
|
| 852 |
+
// check bl validity
|
| 853 |
+
|
| 854 |
+
always @ (posedge clk_i) begin
|
| 855 |
+
if (addr_out[31:24] >= end_addr_i[31:24])
|
| 856 |
+
A3_G_E3 <= #TCQ 1'b1;
|
| 857 |
+
else
|
| 858 |
+
A3_G_E3 <= #TCQ 1'b0;
|
| 859 |
+
|
| 860 |
+
if (addr_out[23:16] >= end_addr_i[23:16])
|
| 861 |
+
A2_G_E2 <= #TCQ 1'b1;
|
| 862 |
+
else
|
| 863 |
+
A2_G_E2 <= #TCQ 1'b0;
|
| 864 |
+
|
| 865 |
+
if (addr_out[15:8] >= end_addr_i[15:8])
|
| 866 |
+
A1_G_E1 <= #TCQ 1'b1;
|
| 867 |
+
else
|
| 868 |
+
A1_G_E1 <= #TCQ 1'b0;
|
| 869 |
+
|
| 870 |
+
if (addr_out[7:0] > end_addr_i[7:0] - DWIDTH/8* bl_out + 1)
|
| 871 |
+
A0_G_E0 <= #TCQ 1'b1;
|
| 872 |
+
else
|
| 873 |
+
A0_G_E0 <= #TCQ 1'b0;
|
| 874 |
+
end
|
| 875 |
+
|
| 876 |
+
always @(addr_out,bl_out,end_addr_i,rst_i,buf_avail_r) begin
|
| 877 |
+
if (rst_i[5])
|
| 878 |
+
force_bl1 = 1'b0;
|
| 879 |
+
else if (((addr_out + bl_out* (DWIDTH/8)) >= end_addr_i) || (buf_avail_r <= 50 && PORT_MODE == "RD_MODE"))
|
| 880 |
+
force_bl1 = 1'b1;
|
| 881 |
+
else
|
| 882 |
+
force_bl1 = 1'b0;
|
| 883 |
+
end
|
| 884 |
+
|
| 885 |
+
always @(posedge clk_i) begin
|
| 886 |
+
if (rst_i[6])
|
| 887 |
+
bl_out_reg <= #TCQ fixed_bl_i;
|
| 888 |
+
else if (bl_out_vld)
|
| 889 |
+
bl_out_reg <= #TCQ bl_out;
|
| 890 |
+
end
|
| 891 |
+
|
| 892 |
+
always @ (posedge clk_i) begin
|
| 893 |
+
if (mode_load_pulse)
|
| 894 |
+
bl_out <= #TCQ fixed_bl_i ;
|
| 895 |
+
else if (cmd_clk_en) begin
|
| 896 |
+
case({bl_mode_reg})
|
| 897 |
+
0: bl_out <= #TCQ bram_bl_i ;
|
| 898 |
+
1: bl_out <= #TCQ fixed_bl_i ;
|
| 899 |
+
2: bl_out <= #TCQ prbs_brlen;
|
| 900 |
+
default : bl_out <= #TCQ 6'h1;
|
| 901 |
+
endcase
|
| 902 |
+
end
|
| 903 |
+
end
|
| 904 |
+
|
| 905 |
+
//synthesis translate_off
|
| 906 |
+
always @ (bl_out)
|
| 907 |
+
if(bl_out >2 && FAMILY == "VIRTEX6") begin
|
| 908 |
+
$display("Error ! Not valid burst length");
|
| 909 |
+
$stop;
|
| 910 |
+
end
|
| 911 |
+
//synthesis translate_on
|
| 912 |
+
|
| 913 |
+
generate
|
| 914 |
+
if (CMD_PATTERN == "CGEN_PRBS" || CMD_PATTERN == "CGEN_ALL" ) begin: gen_prbs_bl
|
| 915 |
+
cmd_prbs_gen #
|
| 916 |
+
(
|
| 917 |
+
.TCQ (TCQ),
|
| 918 |
+
.FAMILY (FAMILY),
|
| 919 |
+
.PRBS_CMD ("BLEN"),
|
| 920 |
+
.ADDR_WIDTH (32),
|
| 921 |
+
.SEED_WIDTH (15),
|
| 922 |
+
.PRBS_WIDTH (20)
|
| 923 |
+
)
|
| 924 |
+
bl_prbs_gen
|
| 925 |
+
(
|
| 926 |
+
.clk_i (clk_i),
|
| 927 |
+
.clk_en (cmd_clk_en),
|
| 928 |
+
.prbs_seed_init (load_seed_i),
|
| 929 |
+
.prbs_seed_i (cmd_seed_i[16:2]),
|
| 930 |
+
.prbs_o (prbs_bl)
|
| 931 |
+
);
|
| 932 |
+
end
|
| 933 |
+
|
| 934 |
+
always @ (prbs_bl)
|
| 935 |
+
if (FAMILY == "SPARTAN6") // supports 1 throug 64
|
| 936 |
+
prbs_brlen = (prbs_bl[5:0] == 6'b000000) ? 6'b000001: prbs_bl[5:0];
|
| 937 |
+
else // VIRTEX6 only supports 1 or 2 burst on user ports
|
| 938 |
+
prbs_brlen = 6'b000010;
|
| 939 |
+
endgenerate
|
| 940 |
+
|
| 941 |
+
endmodule
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/cmd_prbs_gen.v
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//*****************************************************************************
|
| 2 |
+
// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MIG
|
| 54 |
+
// / / Filename: cmd_prbs_gen.v
|
| 55 |
+
// /___/ /\ Date Last Modified:
|
| 56 |
+
// \ \ / \ Date Created:
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6
|
| 60 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
//Purpose: This moduel use LFSR to generate random address, isntructions
|
| 62 |
+
// or burst_length.
|
| 63 |
+
//Reference:
|
| 64 |
+
//Revision History: 1.1 Added condition to zero out the LSB address bits according to
|
| 65 |
+
// DWIDTH and FAMILY. 7/9/2009
|
| 66 |
+
//
|
| 67 |
+
//*****************************************************************************
|
| 68 |
+
|
| 69 |
+
`timescale 1ps/1ps
|
| 70 |
+
|
| 71 |
+
module cmd_prbs_gen #
|
| 72 |
+
(
|
| 73 |
+
parameter TCQ = 100,
|
| 74 |
+
parameter FAMILY = "SPARTAN6",
|
| 75 |
+
parameter ADDR_WIDTH = 29,
|
| 76 |
+
parameter DWIDTH = 32,
|
| 77 |
+
parameter PRBS_CMD = "ADDRESS", // "INSTR", "BLEN","ADDRESS"
|
| 78 |
+
parameter PRBS_WIDTH = 64, // 64,15,20
|
| 79 |
+
parameter SEED_WIDTH = 32, // 32,15,4
|
| 80 |
+
|
| 81 |
+
parameter PRBS_EADDR_MASK_POS = 32'hFFFFD000,
|
| 82 |
+
parameter PRBS_SADDR_MASK_POS = 32'h00002000,
|
| 83 |
+
parameter PRBS_EADDR = 32'h00002000,
|
| 84 |
+
parameter PRBS_SADDR = 32'h00002000
|
| 85 |
+
)
|
| 86 |
+
(
|
| 87 |
+
input clk_i,
|
| 88 |
+
input prbs_seed_init, // when high the prbs_x_seed will be loaded
|
| 89 |
+
input clk_en,
|
| 90 |
+
input [SEED_WIDTH-1:0] prbs_seed_i,
|
| 91 |
+
|
| 92 |
+
output[SEED_WIDTH-1:0] prbs_o // generated address
|
| 93 |
+
);
|
| 94 |
+
|
| 95 |
+
wire[ADDR_WIDTH - 1:0] ZEROS;
|
| 96 |
+
reg [SEED_WIDTH - 1:0] prbs;
|
| 97 |
+
reg [PRBS_WIDTH :1] lfsr_q;
|
| 98 |
+
|
| 99 |
+
assign ZEROS = 'b0;
|
| 100 |
+
//
|
| 101 |
+
//**************************************************************
|
| 102 |
+
//####################################################################################################################
|
| 103 |
+
// #
|
| 104 |
+
// #
|
| 105 |
+
// 64 taps: [64,63,61,60]: {{8'b01011000}, {56'b0}} #
|
| 106 |
+
// upper 32 bits are loadable #
|
| 107 |
+
// #
|
| 108 |
+
//
|
| 109 |
+
//
|
| 110 |
+
// ........................................................................................
|
| 111 |
+
// ^ ^ ^ ^ |
|
| 112 |
+
// | ____ | ___ ___ | ___ | ___ ___ ___ |
|
| 113 |
+
// | | | |---|<- | | | | |---|<- | | |---|<- | |...| | | | | The first 32 bits are parallel loadable.
|
| 114 |
+
// ----|64 |<--|xor|<-- |63 |-->|62 |-|xor|<--|61 |<-|xor|<--|60 |...|33 |<--|1|<<--
|
| 115 |
+
// |___| --- |___| |___| --- |___| --- |___|...|___| |___|
|
| 116 |
+
//
|
| 117 |
+
//
|
| 118 |
+
// <<-- shifting --
|
| 119 |
+
//#####################################################################################################################
|
| 120 |
+
|
| 121 |
+
// use SRLC32E for lower 32 stages and 32 registers for upper 32 stages.
|
| 122 |
+
// we need to provide 30 bits addres. SRLC32 has only one bit output.
|
| 123 |
+
// address seed will be loaded to upper 32 bits.
|
| 124 |
+
//
|
| 125 |
+
// parallel load and serial shift out to LFSR during INIT time
|
| 126 |
+
|
| 127 |
+
generate
|
| 128 |
+
if(PRBS_CMD == "ADDRESS" && PRBS_WIDTH == 64) begin :gen64_taps
|
| 129 |
+
always @ (posedge clk_i) begin
|
| 130 |
+
if(prbs_seed_init) begin//reset it to a known good state to prevent it locks up
|
| 131 |
+
lfsr_q <= #TCQ {31'b0,prbs_seed_i};
|
| 132 |
+
end else if(clk_en) begin
|
| 133 |
+
lfsr_q[64] <= #TCQ lfsr_q[64] ^ lfsr_q[63];
|
| 134 |
+
lfsr_q[63] <= #TCQ lfsr_q[62];
|
| 135 |
+
lfsr_q[62] <= #TCQ lfsr_q[64] ^ lfsr_q[61];
|
| 136 |
+
lfsr_q[61] <= #TCQ lfsr_q[64] ^ lfsr_q[60];
|
| 137 |
+
lfsr_q[60:2] <= #TCQ lfsr_q[59:1];
|
| 138 |
+
lfsr_q[1] <= #TCQ lfsr_q[64];
|
| 139 |
+
end
|
| 140 |
+
end
|
| 141 |
+
|
| 142 |
+
always @(lfsr_q[32:1]) begin
|
| 143 |
+
prbs = lfsr_q[32:1];
|
| 144 |
+
end
|
| 145 |
+
end
|
| 146 |
+
endgenerate
|
| 147 |
+
|
| 148 |
+
function integer logb2;
|
| 149 |
+
input [31:0] in;
|
| 150 |
+
integer i;
|
| 151 |
+
begin
|
| 152 |
+
i = in;
|
| 153 |
+
for(logb2=1; i>0; logb2=logb2+1)
|
| 154 |
+
i = i >> 1;
|
| 155 |
+
end
|
| 156 |
+
endfunction
|
| 157 |
+
|
| 158 |
+
generate
|
| 159 |
+
if(PRBS_CMD == "ADDRESS" && PRBS_WIDTH == 32) begin :gen32_taps
|
| 160 |
+
always @ (posedge clk_i) begin
|
| 161 |
+
if(prbs_seed_init) begin //reset it to a known good state to prevent it locks up
|
| 162 |
+
lfsr_q <= #TCQ {prbs_seed_i};
|
| 163 |
+
end else if(clk_en) begin
|
| 164 |
+
lfsr_q[32:9] <= #TCQ lfsr_q[31:8];
|
| 165 |
+
lfsr_q[8] <= #TCQ lfsr_q[32] ^ lfsr_q[7];
|
| 166 |
+
lfsr_q[7] <= #TCQ lfsr_q[32] ^ lfsr_q[6];
|
| 167 |
+
lfsr_q[6:4] <= #TCQ lfsr_q[5:3];
|
| 168 |
+
|
| 169 |
+
lfsr_q[3] <= #TCQ lfsr_q[32] ^ lfsr_q[2];
|
| 170 |
+
lfsr_q[2] <= #TCQ lfsr_q[1] ;
|
| 171 |
+
lfsr_q[1] <= #TCQ lfsr_q[32];
|
| 172 |
+
end
|
| 173 |
+
end
|
| 174 |
+
|
| 175 |
+
integer i;
|
| 176 |
+
always @(lfsr_q[32:1]) begin
|
| 177 |
+
|
| 178 |
+
if (FAMILY == "SPARTAN6" ) begin // for 32 bits
|
| 179 |
+
|
| 180 |
+
for(i = logb2(DWIDTH) + 1; i <= SEED_WIDTH - 1; i = i + 1)
|
| 181 |
+
|
| 182 |
+
if(PRBS_SADDR_MASK_POS[i] == 1)
|
| 183 |
+
prbs[i] = PRBS_SADDR[i] | lfsr_q[i+1];
|
| 184 |
+
else if(PRBS_EADDR_MASK_POS[i] == 1)
|
| 185 |
+
prbs[i] = PRBS_EADDR[i] & lfsr_q[i+1];
|
| 186 |
+
else
|
| 187 |
+
prbs[i] = lfsr_q[i+1];
|
| 188 |
+
|
| 189 |
+
prbs[logb2(DWIDTH ) :0] = {logb2(DWIDTH ) + 1{1'b0}};
|
| 190 |
+
|
| 191 |
+
end
|
| 192 |
+
else begin
|
| 193 |
+
for(i = logb2(DWIDTH)-4; i <= SEED_WIDTH - 1; i = i + 1)
|
| 194 |
+
if(PRBS_SADDR_MASK_POS[i] == 1)
|
| 195 |
+
prbs[i] = PRBS_SADDR[i] | lfsr_q[i+1];
|
| 196 |
+
else if(PRBS_EADDR_MASK_POS[i] == 1)
|
| 197 |
+
prbs[i] = PRBS_EADDR[i] & lfsr_q[i+1];
|
| 198 |
+
else
|
| 199 |
+
prbs[i] = lfsr_q[i+1];
|
| 200 |
+
prbs[logb2(DWIDTH)-5:0] = {logb2(DWIDTH) - 4{1'b0}};
|
| 201 |
+
|
| 202 |
+
end
|
| 203 |
+
|
| 204 |
+
end
|
| 205 |
+
end endgenerate
|
| 206 |
+
|
| 207 |
+
//////////////////////////////////////////////////////////////////////////
|
| 208 |
+
//####################################################################################################################
|
| 209 |
+
// #
|
| 210 |
+
// #
|
| 211 |
+
// 15 taps: [15,14]: #
|
| 212 |
+
// #
|
| 213 |
+
// #
|
| 214 |
+
//
|
| 215 |
+
//
|
| 216 |
+
// .............................................................
|
| 217 |
+
// ^ ^ . ^
|
| 218 |
+
// | ____ | ___ ___ ___ ___ ___ |
|
| 219 |
+
// | | | |---|<- | | | | | |...| | | | |
|
| 220 |
+
// ----|15 |<--|xor|<-- |14 |<--|13 |<--|12 |...|2 |<--|1 |<<--
|
| 221 |
+
// |___| --- |___| |___| |___|...|___| |___|
|
| 222 |
+
//
|
| 223 |
+
//
|
| 224 |
+
// <<-- shifting --
|
| 225 |
+
//#####################################################################################################################
|
| 226 |
+
|
| 227 |
+
generate
|
| 228 |
+
if(PRBS_CMD == "INSTR" | PRBS_CMD == "BLEN") begin :gen20_taps
|
| 229 |
+
always @(posedge clk_i) begin
|
| 230 |
+
if(prbs_seed_init) begin//reset it to a known good state to prevent it locks up
|
| 231 |
+
lfsr_q <= #TCQ {5'b0,prbs_seed_i[14:0]};
|
| 232 |
+
end else if(clk_en) begin
|
| 233 |
+
lfsr_q[20] <= #TCQ lfsr_q[19];
|
| 234 |
+
lfsr_q[19] <= #TCQ lfsr_q[18];
|
| 235 |
+
|
| 236 |
+
lfsr_q[18] <= #TCQ lfsr_q[20] ^lfsr_q[17];
|
| 237 |
+
|
| 238 |
+
lfsr_q[17:2] <= #TCQ lfsr_q[16:1];
|
| 239 |
+
lfsr_q[1] <= #TCQ lfsr_q[20];
|
| 240 |
+
end
|
| 241 |
+
end
|
| 242 |
+
|
| 243 |
+
always @ (lfsr_q[SEED_WIDTH - 1:1], ZEROS) begin
|
| 244 |
+
prbs = {ZEROS[SEED_WIDTH - 1:7],lfsr_q[6:1]};
|
| 245 |
+
end
|
| 246 |
+
end
|
| 247 |
+
endgenerate
|
| 248 |
+
|
| 249 |
+
assign prbs_o = prbs;
|
| 250 |
+
|
| 251 |
+
endmodule
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/data_prbs_gen.v
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//*****************************************************************************
|
| 2 |
+
// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MIG
|
| 54 |
+
// / / Filename: data_prbs_gen.v
|
| 55 |
+
// /___/ /\ Date Last Modified: $Date: 2011/06/02 07:16:33 $
|
| 56 |
+
// \ \ / \ Date Created: Fri Sep 01 2006
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6
|
| 60 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
//Purpose: This module is used LFSR to generate random data for memory
|
| 62 |
+
// data write or memory data read comparison.The first data is
|
| 63 |
+
// seeded by the input prbs_seed_i which is connected to memory address.
|
| 64 |
+
//Reference:
|
| 65 |
+
//Revision History:
|
| 66 |
+
//*****************************************************************************
|
| 67 |
+
|
| 68 |
+
`timescale 1ps/1ps
|
| 69 |
+
|
| 70 |
+
module data_prbs_gen #
|
| 71 |
+
(
|
| 72 |
+
parameter TCQ = 100,
|
| 73 |
+
|
| 74 |
+
parameter EYE_TEST = "FALSE",
|
| 75 |
+
parameter PRBS_WIDTH = 32, // "SEQUENTIAL_BUrst_i"
|
| 76 |
+
parameter SEED_WIDTH = 32
|
| 77 |
+
)
|
| 78 |
+
(
|
| 79 |
+
input clk_i,
|
| 80 |
+
input clk_en,
|
| 81 |
+
input rst_i,
|
| 82 |
+
input [31:0] prbs_fseed_i,
|
| 83 |
+
input prbs_seed_init, // when high the prbs_x_seed will be loaded
|
| 84 |
+
input [PRBS_WIDTH - 1:0] prbs_seed_i,
|
| 85 |
+
|
| 86 |
+
output [PRBS_WIDTH - 1:0] prbs_o // generated address
|
| 87 |
+
);
|
| 88 |
+
|
| 89 |
+
reg [PRBS_WIDTH - 1 :0] prbs;
|
| 90 |
+
reg [PRBS_WIDTH :1] lfsr_q;
|
| 91 |
+
integer i;
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
always @ (posedge clk_i)
|
| 96 |
+
begin
|
| 97 |
+
if (prbs_seed_init && EYE_TEST == "FALSE" || rst_i ) //reset it to a known good state to prevent it locks up
|
| 98 |
+
// if (rst_i ) //reset it to a known good state to prevent it locks up
|
| 99 |
+
|
| 100 |
+
begin
|
| 101 |
+
lfsr_q <= #TCQ {prbs_seed_i + prbs_fseed_i[31:0] + 32'h55555555};
|
| 102 |
+
|
| 103 |
+
end
|
| 104 |
+
else if (clk_en) begin
|
| 105 |
+
|
| 106 |
+
lfsr_q[32:9] <= #TCQ lfsr_q[31:8];
|
| 107 |
+
lfsr_q[8] <= #TCQ lfsr_q[32] ^ lfsr_q[7];
|
| 108 |
+
lfsr_q[7] <= #TCQ lfsr_q[32] ^ lfsr_q[6];
|
| 109 |
+
lfsr_q[6:4] <= #TCQ lfsr_q[5:3];
|
| 110 |
+
|
| 111 |
+
lfsr_q[3] <= #TCQ lfsr_q[32] ^ lfsr_q[2];
|
| 112 |
+
lfsr_q[2] <= #TCQ lfsr_q[1] ;
|
| 113 |
+
lfsr_q[1] <= #TCQ lfsr_q[32];
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
end
|
| 117 |
+
end
|
| 118 |
+
|
| 119 |
+
always @ (lfsr_q[PRBS_WIDTH:1]) begin
|
| 120 |
+
prbs = lfsr_q[PRBS_WIDTH:1];
|
| 121 |
+
end
|
| 122 |
+
|
| 123 |
+
assign prbs_o = prbs;
|
| 124 |
+
|
| 125 |
+
endmodule
|
| 126 |
+
|
| 127 |
+
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/init_mem_pattern_ctr.v
ADDED
|
@@ -0,0 +1,692 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//*****************************************************************************
|
| 2 |
+
// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MIG
|
| 54 |
+
// / / Filename: init_mem_pattern_ctr.v
|
| 55 |
+
// /___/ /\ Date Last Modified: $Date: 2011/06/02 07:16:33 $
|
| 56 |
+
// \ \ / \ Date Created: Fri Sep 01 2006
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6
|
| 60 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
//Purpose: This moduel has a small FSM to control the operation of
|
| 62 |
+
// mcb_traffic_gen module.It first fill up the memory with a selected
|
| 63 |
+
// DATA pattern and then starts the memory testing state.
|
| 64 |
+
//Reference:
|
| 65 |
+
//Revision History: 1.1 Modify to allow data_mode_o to be controlled by parameter DATA_MODE
|
| 66 |
+
// and the fixed_bl_o is fixed at 64 if data_mode_o == PRBA and FAMILY == "SPARTAN6"
|
| 67 |
+
// The fixed_bl_o in Virtex6 is determined by the MEM_BURST_LENGTH.
|
| 68 |
+
// 1.2 10-1-2009 Added parameter TST_MEM_INSTR_MODE to select instruction pattern during
|
| 69 |
+
// memory testing phase.
|
| 70 |
+
// 1.3 05/19/2010 If MEM_BURST_LEN value is passed with value of zero, it is treated as
|
| 71 |
+
// "OTF" Burst Mode and TG will only generate BL 8 traffic.
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
//*****************************************************************************
|
| 75 |
+
|
| 76 |
+
`timescale 1ps/1ps
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
module init_mem_pattern_ctr #
|
| 83 |
+
(
|
| 84 |
+
parameter TCQ = 100,
|
| 85 |
+
parameter FAMILY = "SPARTAN6", // VIRTEX6, SPARTAN6
|
| 86 |
+
parameter TST_MEM_INSTR_MODE = "R_W_INSTR_MODE", // Spartan6 Available commands:
|
| 87 |
+
// "FIXED_INSTR_R_MODE", "FIXED_INSTR_W_MODE"
|
| 88 |
+
// "R_W_INSTR_MODE", "RP_WP_INSTR_MODE
|
| 89 |
+
// "R_RP_W_WP_INSTR_MODE", "R_RP_W_WP_REF_INSTR_MODE"
|
| 90 |
+
// Virtex 6 Available commands:
|
| 91 |
+
// "FIXED_INSTR_R_MODE" - Only Read commands will be generated.
|
| 92 |
+
// "FIXED_INSTR_W_MODE" -- Only Write commands will be generated.
|
| 93 |
+
// "R_W_INSTR_MODE" - Random Read/Write commands will be generated.
|
| 94 |
+
parameter MEM_BURST_LEN = 8, // VIRTEX 6 Option.
|
| 95 |
+
parameter CMD_PATTERN = "CGEN_ALL", // "CGEN_ALL" option generates all available
|
| 96 |
+
// commands pattern.
|
| 97 |
+
parameter BEGIN_ADDRESS = 32'h00000000,
|
| 98 |
+
parameter END_ADDRESS = 32'h00000fff,
|
| 99 |
+
parameter ADDR_WIDTH = 30,
|
| 100 |
+
parameter DWIDTH = 32,
|
| 101 |
+
parameter CMD_SEED_VALUE = 32'h12345678,
|
| 102 |
+
parameter DATA_SEED_VALUE = 32'hca345675,
|
| 103 |
+
parameter DATA_MODE = 4'b0010,
|
| 104 |
+
parameter PORT_MODE = "BI_MODE", // V6 Option: "BI_MODE"; SP6 Option: "WR_MODE", "RD_MODE", "BI_MODE"
|
| 105 |
+
parameter EYE_TEST = "FALSE" // set EYE_TEST = "TRUE" to probe memory signals.
|
| 106 |
+
// Traffic Generator will only write to one single location and no
|
| 107 |
+
// read transactions will be generated.
|
| 108 |
+
|
| 109 |
+
)
|
| 110 |
+
(
|
| 111 |
+
input clk_i,
|
| 112 |
+
input rst_i,
|
| 113 |
+
|
| 114 |
+
input [ADDR_WIDTH-1:0] mcb_cmd_addr_i,
|
| 115 |
+
input [5:0] mcb_cmd_bl_i,
|
| 116 |
+
input mcb_cmd_en_i,
|
| 117 |
+
input [2:0] mcb_cmd_instr_i,
|
| 118 |
+
input mcb_wr_en_i,
|
| 119 |
+
input vio_modify_enable, // 0: default to ADDR as DATA PATTERN. No runtime change in data mode.
|
| 120 |
+
// 1: enable exteral VIO to control the data_mode pattern
|
| 121 |
+
// and address mode pattern during runtime.
|
| 122 |
+
input [2:0] vio_data_mode_value,
|
| 123 |
+
input [2:0] vio_addr_mode_value,
|
| 124 |
+
input [1:0] vio_bl_mode_value,
|
| 125 |
+
input [5:0] vio_fixed_bl_value, // valid range is: from 1 to 64.
|
| 126 |
+
|
| 127 |
+
input mcb_init_done_i,
|
| 128 |
+
input cmp_error,
|
| 129 |
+
output reg run_traffic_o,
|
| 130 |
+
// runtime parameter
|
| 131 |
+
output [31:0] start_addr_o, // define the start of address
|
| 132 |
+
output [31:0] end_addr_o,
|
| 133 |
+
output [31:0] cmd_seed_o, // same seed apply to all addr_prbs_gen, bl_prbs_gen, instr_prbs_gen
|
| 134 |
+
output [31:0] data_seed_o,
|
| 135 |
+
output reg load_seed_o, //
|
| 136 |
+
// upper layer inputs to determine the command bus and data pattern
|
| 137 |
+
// internal traffic generator initialize the memory with
|
| 138 |
+
output reg [2:0] addr_mode_o, // "00" = bram; takes the address from bram output
|
| 139 |
+
// "001" = fixed address from the fixed_addr input
|
| 140 |
+
// "010" = psuedo ramdom pattern; generated from internal 64 bit LFSR
|
| 141 |
+
// "011" = sequential
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
// for each instr_mode, traffic gen fill up with a predetermined pattern before starting the instr_pattern that defined
|
| 145 |
+
// in the instr_mode input. The runtime mode will be automatically loaded inside when it is in
|
| 146 |
+
output reg [3:0] instr_mode_o, // "0000" = Fixed
|
| 147 |
+
// "0001" = bram; takes instruction from bram output
|
| 148 |
+
// "0010" = R/W
|
| 149 |
+
// "0011" = RP/WP
|
| 150 |
+
// "0100" = R/RP/W/WP
|
| 151 |
+
// "0101" = R/RP/W/WP/REF
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
output reg [1:0] bl_mode_o, // "00" = bram; takes the burst length from bram output
|
| 155 |
+
// "01" = fixed , takes the burst length from the fixed_bl input
|
| 156 |
+
// "10" = psuedo ramdom pattern; generated from internal 16 bit LFSR
|
| 157 |
+
|
| 158 |
+
output reg [3:0] data_mode_o, // "00" = bram;
|
| 159 |
+
// "01" = fixed data from the fixed_data input
|
| 160 |
+
// "10" = psuedo ramdom pattern; generated from internal 32 bit LFSR
|
| 161 |
+
// "11" = sequential using the addrs as the starting data pattern
|
| 162 |
+
output reg mode_load_o,
|
| 163 |
+
|
| 164 |
+
// fixed pattern inputs interface
|
| 165 |
+
output reg [5:0] fixed_bl_o, // range from 1 to 64
|
| 166 |
+
output reg [2:0] fixed_instr_o, //RD 3'b001
|
| 167 |
+
//RDP 3'b011
|
| 168 |
+
//WR 3'b000
|
| 169 |
+
//WRP 3'b010
|
| 170 |
+
//REFRESH 3'b100
|
| 171 |
+
output [31:0] fixed_addr_o // only upper 30 bits will be used
|
| 172 |
+
|
| 173 |
+
);
|
| 174 |
+
|
| 175 |
+
//FSM State Defination
|
| 176 |
+
parameter IDLE = 5'b00001,
|
| 177 |
+
INIT_MEM_WRITE = 5'b00010,
|
| 178 |
+
INIT_MEM_READ = 5'b00100,
|
| 179 |
+
TEST_MEM = 5'b01000,
|
| 180 |
+
CMP_ERROR = 5'b10000;
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
localparam BRAM_ADDR = 2'b00;
|
| 184 |
+
localparam FIXED_ADDR = 2'b01;
|
| 185 |
+
localparam PRBS_ADDR = 2'b10;
|
| 186 |
+
localparam SEQUENTIAL_ADDR = 2'b11;
|
| 187 |
+
|
| 188 |
+
localparam BRAM_INSTR_MODE = 4'b0000;
|
| 189 |
+
localparam FIXED_INSTR_MODE = 4'b0001;
|
| 190 |
+
localparam R_W_INSTR_MODE = 4'b0010;
|
| 191 |
+
localparam RP_WP_INSTR_MODE = 4'b0011;
|
| 192 |
+
localparam R_RP_W_WP_INSTR_MODE = 4'b0100;
|
| 193 |
+
localparam R_RP_W_WP_REF_INSTR_MODE = 4'b0101;
|
| 194 |
+
|
| 195 |
+
localparam BRAM_BL_MODE = 2'b00;
|
| 196 |
+
localparam FIXED_BL_MODE = 2'b01;
|
| 197 |
+
localparam PRBS_BL_MODE = 2'b10;
|
| 198 |
+
|
| 199 |
+
localparam BRAM_DATAL_MODE = 4'b0000;
|
| 200 |
+
localparam FIXED_DATA_MODE = 4'b0001;
|
| 201 |
+
localparam ADDR_DATA_MODE = 4'b0010;
|
| 202 |
+
localparam HAMMER_DATA_MODE = 4'b0011;
|
| 203 |
+
localparam NEIGHBOR_DATA_MODE = 4'b0100;
|
| 204 |
+
localparam WALKING1_DATA_MODE = 4'b0101;
|
| 205 |
+
localparam WALKING0_DATA_MODE = 4'b0110;
|
| 206 |
+
localparam PRBS_DATA_MODE = 4'b0111;
|
| 207 |
+
|
| 208 |
+
// type fixed instruction
|
| 209 |
+
localparam RD_INSTR = 3'b001;
|
| 210 |
+
localparam RDP_INSTR = 3'b011;
|
| 211 |
+
localparam WR_INSTR = 3'b000;
|
| 212 |
+
|
| 213 |
+
localparam WRP_INSTR = 3'b010;
|
| 214 |
+
localparam REFRESH_INSTR = 3'b100;
|
| 215 |
+
localparam NOP_WR_INSTR = 3'b101;
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
reg [4:0] current_state;
|
| 219 |
+
reg [4:0] next_state;
|
| 220 |
+
reg mcb_init_done_reg;
|
| 221 |
+
reg mcb_init_done_reg1;
|
| 222 |
+
reg AC2_G_E2,AC1_G_E1,AC3_G_E3;
|
| 223 |
+
reg upper_end_matched;
|
| 224 |
+
reg [31:0] end_boundary_addr;
|
| 225 |
+
reg [31:0] mcb_cmd_addr_r;
|
| 226 |
+
|
| 227 |
+
reg mcb_cmd_en_r;
|
| 228 |
+
//reg [ADDR_WIDTH-1:0] mcb_cmd_addr_r;
|
| 229 |
+
reg [5:0] mcb_cmd_bl_r;
|
| 230 |
+
reg lower_end_matched;
|
| 231 |
+
reg end_addr_reached;
|
| 232 |
+
reg run_traffic;
|
| 233 |
+
reg bram_mode_enable;
|
| 234 |
+
wire tst_matched;
|
| 235 |
+
reg [31:0] current_address;
|
| 236 |
+
reg [5:0] fix_bl_value;
|
| 237 |
+
reg [3:0] data_mode_sel;
|
| 238 |
+
reg [2:0] addr_mode_sel;
|
| 239 |
+
reg [1:0] bl_mode_sel;
|
| 240 |
+
reg [2:0] addr_mode;
|
| 241 |
+
reg [10:0] INC_COUNTS;
|
| 242 |
+
wire [5:0] FIXEDBL;
|
| 243 |
+
wire [3:0] test_mem_instr_mode;
|
| 244 |
+
|
| 245 |
+
assign test_mem_instr_mode = (TST_MEM_INSTR_MODE == "BRAM_INSTR_MODE") ? 4'b0000:
|
| 246 |
+
(TST_MEM_INSTR_MODE == "FIXED_INSTR_R_MODE" ||
|
| 247 |
+
TST_MEM_INSTR_MODE == "FIXED_INSTR_W_MODE") ? 4'b0001:
|
| 248 |
+
(TST_MEM_INSTR_MODE == "R_W_INSTR_MODE") ? 4'b0010:
|
| 249 |
+
(TST_MEM_INSTR_MODE == "RP_WP_INSTR_MODE" && FAMILY == "SPARTAN6") ? 4'b0011:
|
| 250 |
+
(TST_MEM_INSTR_MODE == "R_RP_W_WP_INSTR_MODE" && FAMILY == "SPARTAN6") ? 4'b0100:
|
| 251 |
+
(TST_MEM_INSTR_MODE == "R_RP_W_WP_REF_INSTR_MODE" && FAMILY == "SPARTAN6") ? 4'b0101:
|
| 252 |
+
4'b0010;
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
assign FIXEDBL = 64; // This is fixed for current Spartan 6 Example Design
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
generate
|
| 273 |
+
if (FAMILY == "SPARTAN6" ) begin : INC_COUNTS_S
|
| 274 |
+
|
| 275 |
+
always @ (posedge clk_i)
|
| 276 |
+
INC_COUNTS <= (DWIDTH/8);
|
| 277 |
+
|
| 278 |
+
end
|
| 279 |
+
endgenerate
|
| 280 |
+
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
generate
|
| 287 |
+
if (FAMILY == "VIRTEX6" ) begin : INC_COUNTS_V
|
| 288 |
+
always @ (posedge clk_i)
|
| 289 |
+
begin
|
| 290 |
+
if ( (DWIDTH >= 256 && DWIDTH <= 576)) // 64 144
|
| 291 |
+
INC_COUNTS <= 32 ;
|
| 292 |
+
else if ((DWIDTH >= 128) && (DWIDTH <= 224)) // 32 dq pins or 566 dq pins
|
| 293 |
+
INC_COUNTS <= 16 ;
|
| 294 |
+
else if ((DWIDTH == 64) || (DWIDTH == 96)) // 16 dq pins or 24 dqpins
|
| 295 |
+
INC_COUNTS <= 8 ;
|
| 296 |
+
else if ((DWIDTH == 32) ) // 8 dq pins
|
| 297 |
+
INC_COUNTS <= 4 ;
|
| 298 |
+
end
|
| 299 |
+
end
|
| 300 |
+
endgenerate
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
always @ (posedge clk_i)
|
| 304 |
+
begin
|
| 305 |
+
if (rst_i)
|
| 306 |
+
current_address <= BEGIN_ADDRESS;
|
| 307 |
+
else if (mcb_wr_en_i && (current_state == INIT_MEM_WRITE && (PORT_MODE == "WR_MODE" || PORT_MODE == "BI_MODE"))
|
| 308 |
+
|| (mcb_wr_en_i && (current_state == IDLE && PORT_MODE == "RD_MODE")) )
|
| 309 |
+
current_address <= current_address + INC_COUNTS;
|
| 310 |
+
else
|
| 311 |
+
current_address <= current_address;
|
| 312 |
+
|
| 313 |
+
end
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
always @ (posedge clk_i)
|
| 317 |
+
begin
|
| 318 |
+
if (current_address[29:24] >= end_boundary_addr[29:24])
|
| 319 |
+
AC3_G_E3 <= 1'b1;
|
| 320 |
+
else
|
| 321 |
+
AC3_G_E3 <= 1'b0;
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
if (current_address[23:16] >= end_boundary_addr[23:16])
|
| 325 |
+
AC2_G_E2 <= 1'b1;
|
| 326 |
+
else
|
| 327 |
+
AC2_G_E2 <= 1'b0;
|
| 328 |
+
|
| 329 |
+
if (current_address[15:8] >= end_boundary_addr[15:8])
|
| 330 |
+
AC1_G_E1 <= 1'b1;
|
| 331 |
+
else
|
| 332 |
+
AC1_G_E1 <= 1'b0;
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
end
|
| 336 |
+
always @(posedge clk_i)
|
| 337 |
+
begin
|
| 338 |
+
if (rst_i)
|
| 339 |
+
upper_end_matched <= 1'b0;
|
| 340 |
+
|
| 341 |
+
else if (mcb_cmd_en_i)
|
| 342 |
+
upper_end_matched <= AC3_G_E3 & AC2_G_E2 & AC1_G_E1;
|
| 343 |
+
end
|
| 344 |
+
|
| 345 |
+
wire [6:0] FIXED_BL_VALUE;
|
| 346 |
+
assign FIXED_BL_VALUE = (FAMILY == "VIRTEX6" && (MEM_BURST_LEN == 8 || MEM_BURST_LEN == 0)) ? 2 :
|
| 347 |
+
(FAMILY == "VIRTEX6" && MEM_BURST_LEN == 4) ? 1 :
|
| 348 |
+
FIXEDBL;
|
| 349 |
+
|
| 350 |
+
always @(posedge clk_i)
|
| 351 |
+
begin
|
| 352 |
+
// end_boundary_addr <= (END_ADDRESS[31:0] - (DWIDTH/8)*FIXEDBL +1) ;
|
| 353 |
+
end_boundary_addr <= (END_ADDRESS[31:0] - (DWIDTH/8) +1) ;
|
| 354 |
+
|
| 355 |
+
end
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
always @(posedge clk_i)
|
| 360 |
+
begin
|
| 361 |
+
if (current_address[7:0] >= end_boundary_addr[7:0])
|
| 362 |
+
|
| 363 |
+
lower_end_matched <= 1'b1;
|
| 364 |
+
else
|
| 365 |
+
lower_end_matched <= 1'b0;
|
| 366 |
+
|
| 367 |
+
end
|
| 368 |
+
|
| 369 |
+
|
| 370 |
+
always @(posedge clk_i)
|
| 371 |
+
begin
|
| 372 |
+
if (mcb_cmd_en_i )
|
| 373 |
+
mcb_cmd_addr_r <= mcb_cmd_addr_i;
|
| 374 |
+
end
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
always @(posedge clk_i)
|
| 378 |
+
begin
|
| 379 |
+
if (mcb_cmd_en_i)
|
| 380 |
+
mcb_cmd_bl_r <= mcb_cmd_bl_i;
|
| 381 |
+
end
|
| 382 |
+
|
| 383 |
+
always @(posedge clk_i)
|
| 384 |
+
begin
|
| 385 |
+
if ((upper_end_matched && lower_end_matched && FAMILY == "SPARTAN6" && DWIDTH == 32) ||
|
| 386 |
+
(upper_end_matched && lower_end_matched && FAMILY == "SPARTAN6" && DWIDTH == 64) ||
|
| 387 |
+
(upper_end_matched && DWIDTH == 128 && FAMILY == "SPARTAN6") ||
|
| 388 |
+
(upper_end_matched && lower_end_matched && FAMILY == "VIRTEX6"))
|
| 389 |
+
end_addr_reached <= 1'b1;
|
| 390 |
+
else
|
| 391 |
+
end_addr_reached <= 1'b0;
|
| 392 |
+
|
| 393 |
+
end
|
| 394 |
+
|
| 395 |
+
|
| 396 |
+
assign tst_matched = upper_end_matched & lower_end_matched;
|
| 397 |
+
|
| 398 |
+
assign fixed_addr_o = 32'h00001234;
|
| 399 |
+
|
| 400 |
+
|
| 401 |
+
|
| 402 |
+
always @ (posedge clk_i)
|
| 403 |
+
begin
|
| 404 |
+
mcb_init_done_reg1 <= mcb_init_done_i;
|
| 405 |
+
mcb_init_done_reg <= mcb_init_done_reg1;
|
| 406 |
+
end
|
| 407 |
+
|
| 408 |
+
always @ (posedge clk_i)
|
| 409 |
+
run_traffic_o <= run_traffic;
|
| 410 |
+
|
| 411 |
+
|
| 412 |
+
|
| 413 |
+
always @ (posedge clk_i)
|
| 414 |
+
begin
|
| 415 |
+
if (rst_i)
|
| 416 |
+
current_state <= 5'b00001;
|
| 417 |
+
else
|
| 418 |
+
current_state <= next_state;
|
| 419 |
+
end
|
| 420 |
+
|
| 421 |
+
assign start_addr_o = BEGIN_ADDRESS;//BEGIN_ADDRESS;
|
| 422 |
+
assign end_addr_o = END_ADDRESS;
|
| 423 |
+
assign cmd_seed_o = CMD_SEED_VALUE;
|
| 424 |
+
assign data_seed_o = DATA_SEED_VALUE;
|
| 425 |
+
|
| 426 |
+
|
| 427 |
+
reg [2:0] syn1_vio_data_mode_value;
|
| 428 |
+
reg [2:0] syn1_vio_addr_mode_value;
|
| 429 |
+
|
| 430 |
+
|
| 431 |
+
always @ (posedge clk_i)
|
| 432 |
+
begin
|
| 433 |
+
if (rst_i) begin
|
| 434 |
+
syn1_vio_data_mode_value <= 3'b011;
|
| 435 |
+
syn1_vio_addr_mode_value <= 2'b11;
|
| 436 |
+
end
|
| 437 |
+
else if (vio_modify_enable == 1'b1) begin
|
| 438 |
+
syn1_vio_data_mode_value <= vio_data_mode_value;
|
| 439 |
+
syn1_vio_addr_mode_value <= vio_addr_mode_value;
|
| 440 |
+
end
|
| 441 |
+
end
|
| 442 |
+
|
| 443 |
+
|
| 444 |
+
always @ (posedge clk_i)
|
| 445 |
+
begin
|
| 446 |
+
if (rst_i) begin
|
| 447 |
+
data_mode_sel <= DATA_MODE;//ADDR_DATA_MODE;
|
| 448 |
+
addr_mode_sel <= 2'b11;
|
| 449 |
+
end
|
| 450 |
+
else if (vio_modify_enable == 1'b1) begin
|
| 451 |
+
data_mode_sel <= syn1_vio_data_mode_value[2:0];
|
| 452 |
+
addr_mode_sel <= vio_addr_mode_value;
|
| 453 |
+
end
|
| 454 |
+
end
|
| 455 |
+
|
| 456 |
+
always @ (posedge clk_i)
|
| 457 |
+
begin
|
| 458 |
+
if (rst_i || FAMILY == "VIRTEX6")
|
| 459 |
+
fix_bl_value <= FIXED_BL_VALUE;//ADDR_DATA_MODE;
|
| 460 |
+
|
| 461 |
+
else if (vio_modify_enable == 1'b1) begin
|
| 462 |
+
fix_bl_value <= vio_fixed_bl_value;
|
| 463 |
+
end
|
| 464 |
+
end
|
| 465 |
+
|
| 466 |
+
always @ (posedge clk_i)
|
| 467 |
+
begin
|
| 468 |
+
if (rst_i || (FAMILY == "VIRTEX6"))
|
| 469 |
+
if (FAMILY == "VIRTEX6")
|
| 470 |
+
bl_mode_sel <= FIXED_BL_MODE;
|
| 471 |
+
else
|
| 472 |
+
bl_mode_sel <= PRBS_BL_MODE;
|
| 473 |
+
else if (vio_modify_enable == 1'b1) begin
|
| 474 |
+
bl_mode_sel <= vio_bl_mode_value;
|
| 475 |
+
end
|
| 476 |
+
end
|
| 477 |
+
|
| 478 |
+
|
| 479 |
+
|
| 480 |
+
|
| 481 |
+
|
| 482 |
+
always @ (posedge clk_i)
|
| 483 |
+
begin
|
| 484 |
+
data_mode_o <= data_mode_sel;
|
| 485 |
+
addr_mode_o <= addr_mode;
|
| 486 |
+
|
| 487 |
+
// assuming if vio_modify_enable is enabled and vio_addr_mode_value is set to zero
|
| 488 |
+
// user wants to have bram interface.
|
| 489 |
+
if (syn1_vio_addr_mode_value == 0 && vio_modify_enable == 1'b1)
|
| 490 |
+
bram_mode_enable <= 1'b1;
|
| 491 |
+
else
|
| 492 |
+
bram_mode_enable <= 1'b0;
|
| 493 |
+
|
| 494 |
+
end
|
| 495 |
+
|
| 496 |
+
|
| 497 |
+
always @ (*)
|
| 498 |
+
begin
|
| 499 |
+
load_seed_o = 1'b0;
|
| 500 |
+
if (CMD_PATTERN == "CGEN_BRAM" || bram_mode_enable )
|
| 501 |
+
addr_mode = 'b0;
|
| 502 |
+
else
|
| 503 |
+
addr_mode = SEQUENTIAL_ADDR;
|
| 504 |
+
|
| 505 |
+
if (CMD_PATTERN == "CGEN_BRAM" || bram_mode_enable )
|
| 506 |
+
instr_mode_o = 'b0;
|
| 507 |
+
else
|
| 508 |
+
instr_mode_o = FIXED_INSTR_MODE;
|
| 509 |
+
|
| 510 |
+
|
| 511 |
+
if (CMD_PATTERN == "CGEN_BRAM" || bram_mode_enable )
|
| 512 |
+
bl_mode_o = 'b0;
|
| 513 |
+
else
|
| 514 |
+
bl_mode_o = FIXED_BL_MODE;
|
| 515 |
+
|
| 516 |
+
|
| 517 |
+
|
| 518 |
+
if (FAMILY == "VIRTEX6")
|
| 519 |
+
fixed_bl_o = FIXED_BL_VALUE;
|
| 520 |
+
// PRBS mode
|
| 521 |
+
else if (data_mode_o[2:0] == 3'b111 && FAMILY == "SPARTAN6")
|
| 522 |
+
fixed_bl_o = 64; // Our current PRBS algorithm wants to maximize the range bl from 1 to 64.
|
| 523 |
+
else
|
| 524 |
+
fixed_bl_o = fix_bl_value;
|
| 525 |
+
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
mode_load_o = 1'b0;
|
| 529 |
+
run_traffic = 1'b0;
|
| 530 |
+
next_state = IDLE;
|
| 531 |
+
|
| 532 |
+
if (PORT_MODE == "RD_MODE") begin
|
| 533 |
+
fixed_instr_o = RD_INSTR;
|
| 534 |
+
end
|
| 535 |
+
else if( PORT_MODE == "WR_MODE" || PORT_MODE == "BI_MODE") begin
|
| 536 |
+
fixed_instr_o = WR_INSTR;
|
| 537 |
+
end
|
| 538 |
+
|
| 539 |
+
case(current_state)
|
| 540 |
+
IDLE:
|
| 541 |
+
begin
|
| 542 |
+
if(mcb_init_done_reg ) //rdp_rdy_i comes from read_data path
|
| 543 |
+
begin
|
| 544 |
+
if (PORT_MODE == "WR_MODE" || PORT_MODE == "BI_MODE") begin
|
| 545 |
+
next_state = INIT_MEM_WRITE;
|
| 546 |
+
mode_load_o = 1'b1;
|
| 547 |
+
run_traffic = 1'b0;
|
| 548 |
+
load_seed_o = 1'b1;
|
| 549 |
+
end
|
| 550 |
+
else if (PORT_MODE == "RD_MODE" && end_addr_reached) begin
|
| 551 |
+
next_state = TEST_MEM;
|
| 552 |
+
mode_load_o = 1'b1;
|
| 553 |
+
run_traffic = 1'b1;
|
| 554 |
+
load_seed_o = 1'b1;
|
| 555 |
+
|
| 556 |
+
end
|
| 557 |
+
end
|
| 558 |
+
else
|
| 559 |
+
begin
|
| 560 |
+
next_state = IDLE;
|
| 561 |
+
run_traffic = 1'b0;
|
| 562 |
+
load_seed_o = 1'b0;
|
| 563 |
+
|
| 564 |
+
end
|
| 565 |
+
|
| 566 |
+
end
|
| 567 |
+
INIT_MEM_WRITE: begin
|
| 568 |
+
|
| 569 |
+
if (end_addr_reached && EYE_TEST == "FALSE" )
|
| 570 |
+
begin
|
| 571 |
+
next_state = TEST_MEM;
|
| 572 |
+
mode_load_o = 1'b1;
|
| 573 |
+
load_seed_o = 1'b1;
|
| 574 |
+
run_traffic = 1'b1;
|
| 575 |
+
|
| 576 |
+
end
|
| 577 |
+
else
|
| 578 |
+
begin
|
| 579 |
+
next_state = INIT_MEM_WRITE;
|
| 580 |
+
run_traffic = 1'b1;
|
| 581 |
+
mode_load_o = 1'b0;
|
| 582 |
+
load_seed_o = 1'b0;
|
| 583 |
+
if (EYE_TEST == "TRUE")
|
| 584 |
+
addr_mode = FIXED_ADDR;
|
| 585 |
+
else if (CMD_PATTERN == "CGEN_BRAM" || bram_mode_enable )
|
| 586 |
+
addr_mode = 'b0;
|
| 587 |
+
else
|
| 588 |
+
addr_mode = SEQUENTIAL_ADDR;
|
| 589 |
+
|
| 590 |
+
end
|
| 591 |
+
|
| 592 |
+
end
|
| 593 |
+
|
| 594 |
+
INIT_MEM_READ: begin
|
| 595 |
+
|
| 596 |
+
if (end_addr_reached )
|
| 597 |
+
begin
|
| 598 |
+
next_state = TEST_MEM;
|
| 599 |
+
mode_load_o = 1'b1;
|
| 600 |
+
load_seed_o = 1'b1;
|
| 601 |
+
|
| 602 |
+
end
|
| 603 |
+
else
|
| 604 |
+
begin
|
| 605 |
+
next_state = INIT_MEM_READ;
|
| 606 |
+
run_traffic = 1'b0;
|
| 607 |
+
mode_load_o = 1'b0;
|
| 608 |
+
load_seed_o = 1'b0;
|
| 609 |
+
|
| 610 |
+
end
|
| 611 |
+
|
| 612 |
+
end
|
| 613 |
+
TEST_MEM: begin
|
| 614 |
+
if (cmp_error)
|
| 615 |
+
next_state = CMP_ERROR;
|
| 616 |
+
|
| 617 |
+
else
|
| 618 |
+
next_state = TEST_MEM;
|
| 619 |
+
run_traffic = 1'b1;
|
| 620 |
+
|
| 621 |
+
|
| 622 |
+
if (PORT_MODE == "BI_MODE" && TST_MEM_INSTR_MODE == "FIXED_INSTR_W_MODE")
|
| 623 |
+
fixed_instr_o = WR_INSTR;
|
| 624 |
+
else if (PORT_MODE == "BI_MODE" && TST_MEM_INSTR_MODE == "FIXED_INSTR_R_MODE")
|
| 625 |
+
fixed_instr_o = RD_INSTR;
|
| 626 |
+
else if (PORT_MODE == "RD_MODE")
|
| 627 |
+
fixed_instr_o = RD_INSTR;
|
| 628 |
+
|
| 629 |
+
else if( PORT_MODE == "WR_MODE")
|
| 630 |
+
fixed_instr_o = WR_INSTR;
|
| 631 |
+
|
| 632 |
+
|
| 633 |
+
if (FAMILY == "VIRTEX6")
|
| 634 |
+
fixed_bl_o = fix_bl_value;
|
| 635 |
+
else if ((data_mode_o == 3'b111) && (FAMILY == "SPARTAN6"))
|
| 636 |
+
fixed_bl_o = 64; // Our current PRBS algorithm wants to maximize the range bl from 1 to 64.
|
| 637 |
+
else
|
| 638 |
+
fixed_bl_o = fix_bl_value;
|
| 639 |
+
|
| 640 |
+
bl_mode_o = bl_mode_sel;//FIXED_BL_MODE;//PRBS_BL_MODE;//PRBS_BL_MODE; //FIXED_BL_MODE;
|
| 641 |
+
|
| 642 |
+
if (bl_mode_o == PRBS_BL_MODE)
|
| 643 |
+
addr_mode = PRBS_ADDR;
|
| 644 |
+
else
|
| 645 |
+
addr_mode = addr_mode_sel;
|
| 646 |
+
|
| 647 |
+
|
| 648 |
+
|
| 649 |
+
if(PORT_MODE == "BI_MODE") begin
|
| 650 |
+
if(CMD_PATTERN == "CGEN_BRAM" || bram_mode_enable )
|
| 651 |
+
instr_mode_o = BRAM_INSTR_MODE;
|
| 652 |
+
else
|
| 653 |
+
instr_mode_o = test_mem_instr_mode;//R_RP_W_WP_REF_INSTR_MODE;//FIXED_INSTR_MODE;//R_W_INSTR_MODE;//R_RP_W_WP_INSTR_MODE;//R_W_INSTR_MODE;//R_W_INSTR_MODE; //FIXED_INSTR_MODE;//
|
| 654 |
+
end
|
| 655 |
+
else if (PORT_MODE == "RD_MODE" || PORT_MODE == "WR_MODE") begin
|
| 656 |
+
instr_mode_o = FIXED_INSTR_MODE;
|
| 657 |
+
end
|
| 658 |
+
|
| 659 |
+
end
|
| 660 |
+
|
| 661 |
+
|
| 662 |
+
|
| 663 |
+
|
| 664 |
+
|
| 665 |
+
CMP_ERROR:
|
| 666 |
+
begin
|
| 667 |
+
next_state = CMP_ERROR;
|
| 668 |
+
bl_mode_o = bl_mode_sel;//PRBS_BL_MODE;//PRBS_BL_MODE; //FIXED_BL_MODE;
|
| 669 |
+
fixed_instr_o = RD_INSTR;
|
| 670 |
+
addr_mode = SEQUENTIAL_ADDR;//PRBS_ADDR;//PRBS_ADDR;//PRBS_ADDR;//SEQUENTIAL_ADDR;
|
| 671 |
+
if(CMD_PATTERN == "CGEN_BRAM" || bram_mode_enable )
|
| 672 |
+
instr_mode_o = BRAM_INSTR_MODE;//
|
| 673 |
+
else
|
| 674 |
+
instr_mode_o = test_mem_instr_mode;//FIXED_INSTR_MODE;//R_W_INSTR_MODE;//R_RP_W_WP_INSTR_MODE;//R_W_INSTR_MODE;//R_W_INSTR_MODE; //FIXED_INSTR_MODE;//
|
| 675 |
+
|
| 676 |
+
run_traffic = 1'b1; // ?? keep it running or stop if error happened
|
| 677 |
+
|
| 678 |
+
end
|
| 679 |
+
default:
|
| 680 |
+
begin
|
| 681 |
+
next_state = IDLE;
|
| 682 |
+
//run_traffic = 1'b0;
|
| 683 |
+
|
| 684 |
+
end
|
| 685 |
+
|
| 686 |
+
endcase
|
| 687 |
+
end
|
| 688 |
+
|
| 689 |
+
|
| 690 |
+
|
| 691 |
+
|
| 692 |
+
endmodule
|
Frogwells_fpga_design/基于FPGA、D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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//*****************************************************************************
|
| 2 |
+
// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MIG
|
| 54 |
+
// / / Filename: mcb_flow_control.v
|
| 55 |
+
// /___/ /\ Date Last Modified: $Date: 2011/06/02 07:16:33 $
|
| 56 |
+
// \ \ / \ Date Created:
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6
|
| 60 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
//Purpose: This module is the main flow control between cmd_gen.v,
|
| 62 |
+
// write_data_path and read_data_path modules.
|
| 63 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 64 |
+
//Reference:
|
| 65 |
+
//Revision History:
|
| 66 |
+
//*****************************************************************************
|
| 67 |
+
|
| 68 |
+
`timescale 1ps/1ps
|
| 69 |
+
|
| 70 |
+
module mcb_flow_control #
|
| 71 |
+
(
|
| 72 |
+
parameter TCQ = 100,
|
| 73 |
+
parameter FAMILY = "SPARTAN6"
|
| 74 |
+
)
|
| 75 |
+
(
|
| 76 |
+
input clk_i,
|
| 77 |
+
input [9:0] rst_i,
|
| 78 |
+
// interface to cmd_gen, pipeline inserter
|
| 79 |
+
output reg cmd_rdy_o,
|
| 80 |
+
input cmd_valid_i,
|
| 81 |
+
input [2:0] cmd_i,
|
| 82 |
+
input [31:0] addr_i,
|
| 83 |
+
input [5:0] bl_i,
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
// interface to mcb_cmd port
|
| 87 |
+
input mcb_cmd_full,
|
| 88 |
+
output reg [2:0] cmd_o,
|
| 89 |
+
output reg [31:0] addr_o,
|
| 90 |
+
output reg [5:0] bl_o,
|
| 91 |
+
output cmd_en_o, // interface to write data path module
|
| 92 |
+
input last_word_wr_i,
|
| 93 |
+
input wdp_rdy_i,
|
| 94 |
+
output wdp_valid_o,
|
| 95 |
+
output wdp_validB_o,
|
| 96 |
+
output wdp_validC_o,
|
| 97 |
+
|
| 98 |
+
output [31:0] wr_addr_o,
|
| 99 |
+
output [5:0] wr_bl_o,
|
| 100 |
+
// interface to read data path module
|
| 101 |
+
input last_word_rd_i,
|
| 102 |
+
input rdp_rdy_i,
|
| 103 |
+
output rdp_valid_o,
|
| 104 |
+
output [31:0] rd_addr_o,
|
| 105 |
+
output [5:0] rd_bl_o
|
| 106 |
+
);
|
| 107 |
+
|
| 108 |
+
//FSM State Defination
|
| 109 |
+
localparam READY = 5'b00001,
|
| 110 |
+
READ = 5'b00010,
|
| 111 |
+
WRITE = 5'b00100,
|
| 112 |
+
CMD_WAIT = 5'b01000,
|
| 113 |
+
REFRESH_ST = 5'b10000;
|
| 114 |
+
|
| 115 |
+
localparam RD = 3'b001;
|
| 116 |
+
localparam RDP = 3'b011;
|
| 117 |
+
localparam WR = 3'b000;
|
| 118 |
+
localparam WRP = 3'b010;
|
| 119 |
+
localparam REFRESH = 3'b100;
|
| 120 |
+
localparam NOP = 3'b101; // this defination is local to this traffic gen and is not defined
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
reg cmd_fifo_rdy;
|
| 124 |
+
wire cmd_rd;
|
| 125 |
+
wire cmd_wr; // need equation
|
| 126 |
+
wire cmd_others;
|
| 127 |
+
reg push_cmd;
|
| 128 |
+
reg xfer_cmd;
|
| 129 |
+
reg rd_vld ;
|
| 130 |
+
reg wr_vld;
|
| 131 |
+
reg cmd_rdy;
|
| 132 |
+
reg [2:0] cmd_reg;
|
| 133 |
+
reg [31:0] addr_reg;
|
| 134 |
+
reg [5:0] bl_reg;
|
| 135 |
+
|
| 136 |
+
reg rdp_valid;
|
| 137 |
+
(*EQUIVALENT_REGISTER_REMOVAL="NO"*) reg wdp_valid,wdp_validB,wdp_validC;
|
| 138 |
+
|
| 139 |
+
reg [4:0] current_state;
|
| 140 |
+
reg [4:0] next_state;
|
| 141 |
+
reg [3:0] tstpointA;
|
| 142 |
+
reg push_cmd_r;
|
| 143 |
+
reg wait_done;
|
| 144 |
+
reg cmd_en_r1 ;
|
| 145 |
+
reg wr_in_progress;
|
| 146 |
+
reg tst_cmd_rdy_o;
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
// mcb_command bus outputs
|
| 152 |
+
assign cmd_en_o = cmd_en_r1;
|
| 153 |
+
|
| 154 |
+
always @ (posedge clk_i) begin
|
| 155 |
+
|
| 156 |
+
cmd_rdy_o <= #TCQ cmd_rdy;
|
| 157 |
+
tst_cmd_rdy_o <= #TCQ cmd_rdy;
|
| 158 |
+
|
| 159 |
+
end
|
| 160 |
+
|
| 161 |
+
always @ (posedge clk_i)
|
| 162 |
+
begin
|
| 163 |
+
if (rst_i[8])
|
| 164 |
+
cmd_en_r1 <= #TCQ 1'b0;
|
| 165 |
+
else if ( xfer_cmd)
|
| 166 |
+
cmd_en_r1 <= #TCQ 1'b1;
|
| 167 |
+
else if (!mcb_cmd_full)
|
| 168 |
+
cmd_en_r1 <= #TCQ 1'b0;
|
| 169 |
+
|
| 170 |
+
end
|
| 171 |
+
|
| 172 |
+
always @ (posedge clk_i)
|
| 173 |
+
begin
|
| 174 |
+
if (rst_i[9])
|
| 175 |
+
cmd_fifo_rdy <= #TCQ 1'b1;
|
| 176 |
+
else if (xfer_cmd)
|
| 177 |
+
cmd_fifo_rdy <= #TCQ 1'b0;
|
| 178 |
+
else if (!mcb_cmd_full)
|
| 179 |
+
cmd_fifo_rdy <= #TCQ 1'b1;
|
| 180 |
+
end
|
| 181 |
+
|
| 182 |
+
always @ (posedge clk_i)
|
| 183 |
+
begin
|
| 184 |
+
if (rst_i[9]) begin
|
| 185 |
+
addr_o <= #TCQ 'b0;
|
| 186 |
+
cmd_o <= #TCQ 'b0;
|
| 187 |
+
bl_o <= #TCQ 'b0;
|
| 188 |
+
end
|
| 189 |
+
else if (xfer_cmd ) begin
|
| 190 |
+
addr_o <= #TCQ addr_reg;
|
| 191 |
+
if (FAMILY == "SPARTAN6")
|
| 192 |
+
cmd_o <= #TCQ cmd_reg;
|
| 193 |
+
else
|
| 194 |
+
cmd_o <= #TCQ {2'b00,cmd_reg[0]};
|
| 195 |
+
bl_o <= #TCQ bl_reg;
|
| 196 |
+
end
|
| 197 |
+
|
| 198 |
+
end
|
| 199 |
+
|
| 200 |
+
// go directly to wr_datapath and rd_datapath modules
|
| 201 |
+
assign wr_addr_o = addr_i;
|
| 202 |
+
assign rd_addr_o = addr_i;
|
| 203 |
+
assign rd_bl_o = bl_i ;
|
| 204 |
+
assign wr_bl_o = bl_i ;
|
| 205 |
+
|
| 206 |
+
assign wdp_valid_o = wdp_valid;
|
| 207 |
+
assign wdp_validB_o = wdp_validB;
|
| 208 |
+
assign wdp_validC_o = wdp_validC;
|
| 209 |
+
|
| 210 |
+
assign rdp_valid_o = rdp_valid;
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
// internal control siganls
|
| 214 |
+
|
| 215 |
+
always @ (posedge clk_i)
|
| 216 |
+
begin
|
| 217 |
+
if (rst_i[8])
|
| 218 |
+
wait_done <= #TCQ 1'b1;
|
| 219 |
+
else if (push_cmd_r)
|
| 220 |
+
wait_done <= #TCQ 1'b1;
|
| 221 |
+
else if (cmd_rdy_o && cmd_valid_i && FAMILY == "SPARTAN6")
|
| 222 |
+
wait_done <= #TCQ 1'b0;
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
end
|
| 226 |
+
|
| 227 |
+
//
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
always @ (posedge clk_i)
|
| 231 |
+
begin
|
| 232 |
+
push_cmd_r <= #TCQ push_cmd;
|
| 233 |
+
// push_cmd_r2 <= #TCQ push_cmd_r;
|
| 234 |
+
end
|
| 235 |
+
always @ (posedge clk_i)
|
| 236 |
+
if (push_cmd)
|
| 237 |
+
begin
|
| 238 |
+
cmd_reg <= #TCQ cmd_i;
|
| 239 |
+
addr_reg <= #TCQ addr_i;
|
| 240 |
+
bl_reg <= #TCQ bl_i - 1;
|
| 241 |
+
|
| 242 |
+
end
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
//--Command Decodes--
|
| 247 |
+
assign cmd_wr = ((cmd_i == WR | cmd_i == WRP) & cmd_valid_i ) ? 1'b1 : 1'b0;
|
| 248 |
+
assign cmd_rd = ((cmd_i == RD | cmd_i == RDP) & cmd_valid_i) ? 1'b1 : 1'b0;
|
| 249 |
+
assign cmd_others = ((cmd_i[2] == 1'b1)& cmd_valid_i && (FAMILY == "SPARTAN6")) ? 1'b1 : 1'b0;
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
reg cmd_wr_pending_r1;
|
| 253 |
+
reg cmd_rd_pending_r1;
|
| 254 |
+
|
| 255 |
+
always @ (posedge clk_i)
|
| 256 |
+
begin
|
| 257 |
+
if (rst_i[0])
|
| 258 |
+
cmd_wr_pending_r1 <= #TCQ 1'b0;
|
| 259 |
+
|
| 260 |
+
//else if (current_state == WRITE && last_word_wr_i && !cmd_fifo_rdy)
|
| 261 |
+
//else if ( last_word_wr_i && !cmd_fifo_rdy)
|
| 262 |
+
else if ( last_word_wr_i )
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
cmd_wr_pending_r1 <= #TCQ 1'b1;
|
| 266 |
+
else if (push_cmd)//xfer_cmd)
|
| 267 |
+
cmd_wr_pending_r1 <= #TCQ 1'b0;
|
| 268 |
+
end
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
// corner case if fixed read command with fixed bl 64
|
| 272 |
+
|
| 273 |
+
always @ (posedge clk_i)
|
| 274 |
+
begin
|
| 275 |
+
if (cmd_rd & push_cmd)
|
| 276 |
+
cmd_rd_pending_r1 <= #TCQ 1'b1;
|
| 277 |
+
else if (xfer_cmd)
|
| 278 |
+
cmd_rd_pending_r1 <= #TCQ 1'b0;
|
| 279 |
+
|
| 280 |
+
end
|
| 281 |
+
|
| 282 |
+
always @ (posedge clk_i)
|
| 283 |
+
begin
|
| 284 |
+
if (rst_i[0])
|
| 285 |
+
wr_in_progress <= #TCQ 1'b0;
|
| 286 |
+
else if (last_word_wr_i)
|
| 287 |
+
wr_in_progress <= #TCQ 1'b0;
|
| 288 |
+
else if (current_state == WRITE)
|
| 289 |
+
wr_in_progress <= #TCQ 1'b1;
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
end
|
| 293 |
+
always @ (posedge clk_i)
|
| 294 |
+
begin
|
| 295 |
+
if (rst_i[0])
|
| 296 |
+
current_state <= #TCQ 4'b0001;
|
| 297 |
+
else
|
| 298 |
+
current_state <= #TCQ next_state;
|
| 299 |
+
end
|
| 300 |
+
|
| 301 |
+
// mcb_flow_control statemachine
|
| 302 |
+
always @ (*)
|
| 303 |
+
begin
|
| 304 |
+
push_cmd = 1'b0;
|
| 305 |
+
xfer_cmd = 1'b0;
|
| 306 |
+
|
| 307 |
+
wdp_valid = 1'b0;
|
| 308 |
+
wdp_validB = 1'b0;
|
| 309 |
+
wdp_validC = 1'b0;
|
| 310 |
+
|
| 311 |
+
rdp_valid = 1'b0;
|
| 312 |
+
cmd_rdy = 1'b0;
|
| 313 |
+
next_state = current_state;
|
| 314 |
+
case(current_state)
|
| 315 |
+
READY:
|
| 316 |
+
begin
|
| 317 |
+
if(rdp_rdy_i & cmd_rd & cmd_fifo_rdy) //rdp_rdy_i comes from read_data path
|
| 318 |
+
|
| 319 |
+
begin
|
| 320 |
+
next_state = READ;
|
| 321 |
+
push_cmd = 1'b1;
|
| 322 |
+
xfer_cmd = 1'b0;
|
| 323 |
+
rdp_valid = 1'b1;
|
| 324 |
+
|
| 325 |
+
end
|
| 326 |
+
else if (wdp_rdy_i & cmd_wr & cmd_fifo_rdy)
|
| 327 |
+
begin
|
| 328 |
+
next_state = WRITE;
|
| 329 |
+
push_cmd = 1'b1;
|
| 330 |
+
wdp_valid = 1'b1;
|
| 331 |
+
wdp_validB = 1'b1;
|
| 332 |
+
wdp_validC = 1'b1;
|
| 333 |
+
|
| 334 |
+
end
|
| 335 |
+
else if ( cmd_others & cmd_fifo_rdy)
|
| 336 |
+
begin
|
| 337 |
+
next_state = REFRESH_ST;
|
| 338 |
+
push_cmd = 1'b1;
|
| 339 |
+
xfer_cmd = 1'b0;
|
| 340 |
+
|
| 341 |
+
end
|
| 342 |
+
|
| 343 |
+
else
|
| 344 |
+
begin
|
| 345 |
+
next_state = READY;
|
| 346 |
+
push_cmd = 1'b0;
|
| 347 |
+
end
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
if (cmd_fifo_rdy)
|
| 351 |
+
cmd_rdy = 1'b1;
|
| 352 |
+
else
|
| 353 |
+
cmd_rdy = 1'b0;
|
| 354 |
+
|
| 355 |
+
|
| 356 |
+
end
|
| 357 |
+
|
| 358 |
+
REFRESH_ST : begin
|
| 359 |
+
|
| 360 |
+
if (rdp_rdy_i && cmd_rd && cmd_fifo_rdy )
|
| 361 |
+
begin
|
| 362 |
+
next_state = READ;
|
| 363 |
+
push_cmd = 1'b1;
|
| 364 |
+
rdp_valid = 1'b1;
|
| 365 |
+
wdp_valid = 1'b0;
|
| 366 |
+
xfer_cmd = 1'b1;
|
| 367 |
+
// tstpointA = 4'b0101;
|
| 368 |
+
|
| 369 |
+
end
|
| 370 |
+
else if (cmd_fifo_rdy && cmd_wr && wdp_rdy_i )
|
| 371 |
+
begin
|
| 372 |
+
next_state = WRITE;
|
| 373 |
+
push_cmd = 1'b1;
|
| 374 |
+
xfer_cmd = 1'b1;
|
| 375 |
+
|
| 376 |
+
wdp_valid = 1'b1;
|
| 377 |
+
wdp_validB = 1'b1;
|
| 378 |
+
wdp_validC = 1'b1;
|
| 379 |
+
|
| 380 |
+
// tstpointA = 4'b0110;
|
| 381 |
+
|
| 382 |
+
end
|
| 383 |
+
|
| 384 |
+
else if (cmd_fifo_rdy && cmd_others)
|
| 385 |
+
begin
|
| 386 |
+
push_cmd = 1'b1;
|
| 387 |
+
xfer_cmd = 1'b1;
|
| 388 |
+
end
|
| 389 |
+
else if (!cmd_fifo_rdy)
|
| 390 |
+
|
| 391 |
+
begin
|
| 392 |
+
next_state = CMD_WAIT;
|
| 393 |
+
tstpointA = 4'b1001;
|
| 394 |
+
|
| 395 |
+
end
|
| 396 |
+
else
|
| 397 |
+
next_state = READ;
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
|
| 401 |
+
if (cmd_fifo_rdy && ((rdp_rdy_i && cmd_rd) || (wdp_rdy_i && cmd_wr) || (cmd_others)))
|
| 402 |
+
cmd_rdy = 1'b1;
|
| 403 |
+
else
|
| 404 |
+
cmd_rdy = 1'b0;
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
|
| 408 |
+
end
|
| 409 |
+
READ: begin
|
| 410 |
+
|
| 411 |
+
if (rdp_rdy_i && cmd_rd && cmd_fifo_rdy )
|
| 412 |
+
begin
|
| 413 |
+
next_state = READ;
|
| 414 |
+
push_cmd = 1'b1;
|
| 415 |
+
rdp_valid = 1'b1;
|
| 416 |
+
wdp_valid = 1'b0;
|
| 417 |
+
xfer_cmd = 1'b1;
|
| 418 |
+
tstpointA = 4'b0101;
|
| 419 |
+
|
| 420 |
+
end
|
| 421 |
+
else if (cmd_fifo_rdy && cmd_wr && wdp_rdy_i )
|
| 422 |
+
begin
|
| 423 |
+
next_state = WRITE;
|
| 424 |
+
push_cmd = 1'b1;
|
| 425 |
+
xfer_cmd = 1'b1;
|
| 426 |
+
|
| 427 |
+
wdp_valid = 1'b1;
|
| 428 |
+
wdp_validB = 1'b1;
|
| 429 |
+
wdp_validC = 1'b1;
|
| 430 |
+
|
| 431 |
+
tstpointA = 4'b0110;
|
| 432 |
+
|
| 433 |
+
end
|
| 434 |
+
|
| 435 |
+
else if (!rdp_rdy_i )
|
| 436 |
+
begin
|
| 437 |
+
next_state = READ;
|
| 438 |
+
push_cmd = 1'b0;
|
| 439 |
+
xfer_cmd = 1'b0;
|
| 440 |
+
|
| 441 |
+
tstpointA = 4'b0111;
|
| 442 |
+
|
| 443 |
+
wdp_valid = 1'b0;
|
| 444 |
+
wdp_validB = 1'b0;
|
| 445 |
+
wdp_validC = 1'b0;
|
| 446 |
+
rdp_valid = 1'b0;
|
| 447 |
+
end
|
| 448 |
+
else if (last_word_rd_i && cmd_others && cmd_fifo_rdy )
|
| 449 |
+
|
| 450 |
+
begin
|
| 451 |
+
next_state = REFRESH_ST;
|
| 452 |
+
push_cmd = 1'b1;
|
| 453 |
+
xfer_cmd = 1'b1;
|
| 454 |
+
wdp_valid = 1'b0;
|
| 455 |
+
wdp_validB = 1'b0;
|
| 456 |
+
wdp_validC = 1'b0;
|
| 457 |
+
rdp_valid = 1'b0;
|
| 458 |
+
tstpointA = 4'b1000;
|
| 459 |
+
|
| 460 |
+
end
|
| 461 |
+
else if (!cmd_fifo_rdy || !wdp_rdy_i)
|
| 462 |
+
|
| 463 |
+
begin
|
| 464 |
+
next_state = CMD_WAIT;
|
| 465 |
+
tstpointA = 4'b1001;
|
| 466 |
+
|
| 467 |
+
end
|
| 468 |
+
else
|
| 469 |
+
next_state = READ;
|
| 470 |
+
|
| 471 |
+
|
| 472 |
+
|
| 473 |
+
if ((rdp_rdy_i && cmd_rd || cmd_wr && wdp_rdy_i || cmd_others) && cmd_fifo_rdy)
|
| 474 |
+
cmd_rdy = wait_done;//1'b1;
|
| 475 |
+
else
|
| 476 |
+
cmd_rdy = 1'b0;
|
| 477 |
+
|
| 478 |
+
|
| 479 |
+
end
|
| 480 |
+
WRITE: begin // for write, always wait until the last_word_wr
|
| 481 |
+
if (cmd_fifo_rdy && cmd_rd && rdp_rdy_i && last_word_wr_i)
|
| 482 |
+
begin
|
| 483 |
+
next_state = READ;
|
| 484 |
+
push_cmd = 1'b1;
|
| 485 |
+
xfer_cmd = 1'b1;
|
| 486 |
+
rdp_valid = 1'b1;
|
| 487 |
+
tstpointA = 4'b0000;
|
| 488 |
+
end
|
| 489 |
+
else if (!wdp_rdy_i || (wdp_rdy_i && cmd_wr && cmd_fifo_rdy && last_word_wr_i) )
|
| 490 |
+
begin
|
| 491 |
+
next_state = WRITE;
|
| 492 |
+
tstpointA = 4'b0001;
|
| 493 |
+
|
| 494 |
+
if (cmd_wr && last_word_wr_i) begin
|
| 495 |
+
wdp_valid = 1'b1;
|
| 496 |
+
wdp_validB = 1'b1;
|
| 497 |
+
wdp_validC = 1'b1;
|
| 498 |
+
|
| 499 |
+
end
|
| 500 |
+
else begin
|
| 501 |
+
wdp_valid = 1'b0;
|
| 502 |
+
wdp_validB = 1'b0;
|
| 503 |
+
wdp_validC = 1'b0;
|
| 504 |
+
|
| 505 |
+
end
|
| 506 |
+
|
| 507 |
+
if (last_word_wr_i ) begin
|
| 508 |
+
push_cmd = 1'b1;
|
| 509 |
+
xfer_cmd = 1'b1;
|
| 510 |
+
end
|
| 511 |
+
else begin
|
| 512 |
+
push_cmd = 1'b0;
|
| 513 |
+
xfer_cmd = 1'b0;
|
| 514 |
+
end
|
| 515 |
+
|
| 516 |
+
end
|
| 517 |
+
else if (last_word_wr_i && cmd_others && cmd_fifo_rdy)
|
| 518 |
+
begin
|
| 519 |
+
next_state = REFRESH_ST;
|
| 520 |
+
push_cmd = 1'b1;
|
| 521 |
+
xfer_cmd = 1'b1;
|
| 522 |
+
tstpointA = 4'b0010;
|
| 523 |
+
|
| 524 |
+
wdp_valid = 1'b0;
|
| 525 |
+
wdp_validB = 1'b0;
|
| 526 |
+
wdp_validC = 1'b0;
|
| 527 |
+
|
| 528 |
+
rdp_valid = 1'b0;
|
| 529 |
+
|
| 530 |
+
end
|
| 531 |
+
|
| 532 |
+
else if (!cmd_fifo_rdy && last_word_wr_i || !rdp_rdy_i || (!cmd_valid_i && wait_done) )
|
| 533 |
+
|
| 534 |
+
begin
|
| 535 |
+
next_state = CMD_WAIT;
|
| 536 |
+
push_cmd = 1'b0;
|
| 537 |
+
xfer_cmd = 1'b0;
|
| 538 |
+
tstpointA = 4'b0011;
|
| 539 |
+
|
| 540 |
+
end
|
| 541 |
+
|
| 542 |
+
else begin
|
| 543 |
+
next_state = WRITE;
|
| 544 |
+
tstpointA = 4'b0100;
|
| 545 |
+
|
| 546 |
+
end
|
| 547 |
+
|
| 548 |
+
// need to include rdp_rdy_i to prevent sending read command if
|
| 549 |
+
// read_data_port fifo is full in MCB
|
| 550 |
+
if (last_word_wr_i && (cmd_others || rdp_rdy_i && cmd_rd || cmd_wr && wdp_rdy_i) && cmd_fifo_rdy)
|
| 551 |
+
cmd_rdy = wait_done;//1'b1;
|
| 552 |
+
else
|
| 553 |
+
cmd_rdy = 1'b0;
|
| 554 |
+
|
| 555 |
+
|
| 556 |
+
end
|
| 557 |
+
|
| 558 |
+
|
| 559 |
+
|
| 560 |
+
|
| 561 |
+
|
| 562 |
+
CMD_WAIT: if (!cmd_fifo_rdy || wr_in_progress)
|
| 563 |
+
begin
|
| 564 |
+
next_state = CMD_WAIT;
|
| 565 |
+
cmd_rdy = 1'b0;
|
| 566 |
+
tstpointA = 4'b1010;
|
| 567 |
+
|
| 568 |
+
end
|
| 569 |
+
else if (cmd_fifo_rdy && rdp_rdy_i && cmd_rd)
|
| 570 |
+
begin
|
| 571 |
+
next_state = READ;
|
| 572 |
+
push_cmd = 1'b1;
|
| 573 |
+
xfer_cmd = 1'b1;
|
| 574 |
+
cmd_rdy = 1'b1;
|
| 575 |
+
rdp_valid = 1'b1;
|
| 576 |
+
|
| 577 |
+
tstpointA = 4'b1011;
|
| 578 |
+
end
|
| 579 |
+
else if (cmd_fifo_rdy && cmd_wr && (wait_done || cmd_wr_pending_r1))
|
| 580 |
+
|
| 581 |
+
begin
|
| 582 |
+
next_state = WRITE;
|
| 583 |
+
push_cmd = 1'b1;
|
| 584 |
+
xfer_cmd = 1'b1;
|
| 585 |
+
wdp_valid = 1'b1;
|
| 586 |
+
wdp_validB = 1'b1;
|
| 587 |
+
wdp_validC = 1'b1;
|
| 588 |
+
|
| 589 |
+
cmd_rdy = 1'b1;
|
| 590 |
+
tstpointA = 4'b1100;
|
| 591 |
+
|
| 592 |
+
end
|
| 593 |
+
else if (cmd_fifo_rdy && cmd_others)
|
| 594 |
+
begin
|
| 595 |
+
next_state = REFRESH_ST;
|
| 596 |
+
push_cmd = 1'b1; /////////////////
|
| 597 |
+
xfer_cmd = 1'b1;
|
| 598 |
+
tstpointA = 4'b1101;
|
| 599 |
+
cmd_rdy = 1'b1;
|
| 600 |
+
|
| 601 |
+
end
|
| 602 |
+
else
|
| 603 |
+
begin
|
| 604 |
+
next_state = CMD_WAIT;
|
| 605 |
+
tstpointA = 4'b1110;
|
| 606 |
+
|
| 607 |
+
if ((wdp_rdy_i && rdp_rdy_i))
|
| 608 |
+
cmd_rdy = 1'b1;
|
| 609 |
+
else
|
| 610 |
+
cmd_rdy = 1'b0;
|
| 611 |
+
|
| 612 |
+
|
| 613 |
+
end
|
| 614 |
+
|
| 615 |
+
|
| 616 |
+
default:
|
| 617 |
+
begin
|
| 618 |
+
push_cmd = 1'b0;
|
| 619 |
+
xfer_cmd = 1'b0;
|
| 620 |
+
|
| 621 |
+
wdp_valid = 1'b0;
|
| 622 |
+
wdp_validB = 1'b0;
|
| 623 |
+
wdp_validC = 1'b0;
|
| 624 |
+
next_state = READY;
|
| 625 |
+
// cmd_rdy = 1'b0;
|
| 626 |
+
|
| 627 |
+
|
| 628 |
+
|
| 629 |
+
end
|
| 630 |
+
|
| 631 |
+
endcase
|
| 632 |
+
end
|
| 633 |
+
|
| 634 |
+
endmodule
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/mcb_traffic_gen.v
ADDED
|
@@ -0,0 +1,756 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//*****************************************************************************
|
| 2 |
+
// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MEMC
|
| 54 |
+
// / / Filename: mcb_traffic_gen.v
|
| 55 |
+
// /___/ /\ Date Last Modified: $Date:
|
| 56 |
+
// \ \ / \ Date Created:
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6/Virtex6
|
| 60 |
+
//Design Name: mcb_traffic_gen
|
| 61 |
+
//Purpose: This is top level module of memory traffic generator which can
|
| 62 |
+
// generate different CMD_PATTERN and DATA_PATTERN to Spartan 6
|
| 63 |
+
// hard memory controller core.
|
| 64 |
+
//Reference:
|
| 65 |
+
//Revision History: 1.1 Brought out internal signals cmp_data and cmp_error as outputs.
|
| 66 |
+
// 1.2 7/1/2009 Added EYE_TEST parameter for signal SI probing.
|
| 67 |
+
// 1.3 10/1/2009 Added dq_error_bytelane_cmp,cumlative_dq_lane_error signals for V6.
|
| 68 |
+
// Any comparison error on user read data bus are mapped back to
|
| 69 |
+
// dq bus. The cumulative_dq_lane_error accumulate any errors on
|
| 70 |
+
// DQ bus. And the dq_error_bytelane_cmp shows error during current
|
| 71 |
+
// command cycle. The error can be cleared by input signal "manual_clear_error".
|
| 72 |
+
// 1.4 04/10/2010 Removed local generated version of mcb_rd_empty and mcb_wr_full in TG.
|
| 73 |
+
// 1.5 05/19/2010 If MEM_BURST_LEN value is passed with value of zero, it is treated as
|
| 74 |
+
// "OTF" Burst Mode and TG will only generate BL 8 traffic.
|
| 75 |
+
|
| 76 |
+
//*****************************************************************************
|
| 77 |
+
`timescale 1ps/1ps
|
| 78 |
+
|
| 79 |
+
module mcb_traffic_gen #
|
| 80 |
+
(
|
| 81 |
+
parameter TCQ = 100, // SIMULATION tCQ delay.
|
| 82 |
+
parameter FAMILY = "SPARTAN6", // "VIRTEX6", "SPARTAN6"
|
| 83 |
+
parameter SIMULATION = "FALSE",
|
| 84 |
+
parameter MEM_BURST_LEN = 8, // For VIRTEX6 Only in this traffic gen.
|
| 85 |
+
// This traffic gen doesn't support DDR3 OTF Burst mode.
|
| 86 |
+
|
| 87 |
+
parameter PORT_MODE = "BI_MODE", // SPARTAN6: "BI_MODE", "WR_MODE", "RD_MODE"
|
| 88 |
+
// VIRTEX6: "BI_MODE"
|
| 89 |
+
parameter DATA_PATTERN = "DGEN_ALL", // "DGEN__HAMMER", "DGEN_WALING1","DGEN_WALING0","DGEN_ADDR","DGEN_NEIGHBOR","DGEN_PRBS","DGEN_ALL"
|
| 90 |
+
parameter CMD_PATTERN = "CGEN_ALL", // "CGEN_RPBS","CGEN_FIXED", "CGEN_BRAM", "CGEN_SEQUENTIAL", "CGEN_ALL",
|
| 91 |
+
|
| 92 |
+
parameter ADDR_WIDTH = 30, // Spartan 6 Addr width is 30
|
| 93 |
+
|
| 94 |
+
parameter CMP_DATA_PIPE_STAGES = 0, // parameter for MPMC, it should always set to 0
|
| 95 |
+
|
| 96 |
+
// memory type specific
|
| 97 |
+
parameter MEM_COL_WIDTH = 10, // memory column width
|
| 98 |
+
parameter NUM_DQ_PINS = 16, // Spartan 6 Options: 4,8,16;
|
| 99 |
+
// Virtex 6 DDR2/DDR3 Options: 8,16,24,32,.....144
|
| 100 |
+
parameter DQ_ERROR_WIDTH = 1,
|
| 101 |
+
|
| 102 |
+
parameter SEL_VICTIM_LINE = 3, // SEL_VICTIM_LINE LINE is one of the DQ pins is selected to be different than hammer pattern
|
| 103 |
+
// SEL_VICTIM_LINE is only for V6.
|
| 104 |
+
// Virtex 6 option: 8,9,16,17,32,36,64,72
|
| 105 |
+
parameter DWIDTH = 32, //NUM_DQ_PINS*4, // Spartan 6 Options: 32,64,128;
|
| 106 |
+
// Virtex 6 Always: 4* NUM_DQ_PINS
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
// the following parameter is to limit the range of generated PRBS Address
|
| 110 |
+
//
|
| 111 |
+
// e.g PRBS_SADDR_MASK_POS = 32'h0000_7000 the bit 14:12 of PRBS_SADDR will be ORed with
|
| 112 |
+
// PRBS_SADDR = 32'h0000_5000 the LFSR[14:12] to add the starting address offset.
|
| 113 |
+
|
| 114 |
+
// PRBS_EADDR = 32'h0000_7fff
|
| 115 |
+
// PRBS_EADDR_MASK_POS = 32'hffff_7000 => mark all the leading 0's in PRBS_EADDR to 1 to
|
| 116 |
+
// zero out the LFSR[31:15]
|
| 117 |
+
|
| 118 |
+
parameter PRBS_EADDR_MASK_POS = 32'hFFFFD000,
|
| 119 |
+
parameter PRBS_SADDR_MASK_POS = 32'h00002000,
|
| 120 |
+
parameter PRBS_EADDR = 32'h00002000,
|
| 121 |
+
parameter PRBS_SADDR = 32'h00005000,
|
| 122 |
+
parameter EYE_TEST = "FALSE" // set EYE_TEST = "TRUE" to probe memory signals.
|
| 123 |
+
// Traffic Generator will only write to one single location and no
|
| 124 |
+
// read transactions will be generated.
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
+
(
|
| 130 |
+
|
| 131 |
+
input clk_i,
|
| 132 |
+
input rst_i,
|
| 133 |
+
input run_traffic_i,
|
| 134 |
+
input manual_clear_error,
|
| 135 |
+
// *** runtime parameter ***
|
| 136 |
+
input [31:0] start_addr_i, // define the start of address
|
| 137 |
+
input [31:0] end_addr_i, // define upper limit addressboundary
|
| 138 |
+
input [31:0] cmd_seed_i, // seed for cmd PRBS generators
|
| 139 |
+
input [31:0] data_seed_i, // data seed will be added to generated address
|
| 140 |
+
// for PRBS data generation
|
| 141 |
+
// seed for cmd PRBS generators
|
| 142 |
+
input load_seed_i, // when asserted the cmd_seed and data_seed inputs will be registered.
|
| 143 |
+
|
| 144 |
+
// upper layer inputs to determine the command bus and data pattern
|
| 145 |
+
// internal traffic generator initialize the memory with
|
| 146 |
+
input [2:0] addr_mode_i, // "00" = bram; takes the address from bram interface
|
| 147 |
+
// "01" = fixed address from the fixed_addr input
|
| 148 |
+
// "10" = psuedo ramdom pattern; generated from internal 64 bit LFSR
|
| 149 |
+
// "11" = sequential
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
// for each instr_mode, traffic gen fill up with a predetermined pattern before starting the instr_pattern that defined
|
| 153 |
+
// in the instr_mode input. The runtime mode will be automatically loaded inside when it is in
|
| 154 |
+
input [3:0] instr_mode_i, // "0000" = Fixed
|
| 155 |
+
// "0001" = bram; takes instruction from bram output
|
| 156 |
+
// "0010" = R/W
|
| 157 |
+
// "0011" = RP/WP
|
| 158 |
+
// "0100" = R/RP/W/WP
|
| 159 |
+
// "0101" = R/RP/W/WP/REF
|
| 160 |
+
// "0110" = PRBS
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
input [1:0] bl_mode_i, // "00" = bram; takes the burst length from bram output
|
| 164 |
+
// "01" = fixed , takes the burst length from the fixed_bl input
|
| 165 |
+
// "10" = psuedo ramdom pattern; generated from internal 16 bit LFSR
|
| 166 |
+
|
| 167 |
+
input [3:0] data_mode_i, // "000" = address as data
|
| 168 |
+
// "001" = hammer
|
| 169 |
+
// "010" = neighbour
|
| 170 |
+
// "011" = prbs
|
| 171 |
+
// "100" = walking 0's
|
| 172 |
+
// "101" = walking 1's
|
| 173 |
+
// "110" =
|
| 174 |
+
// "111" =
|
| 175 |
+
|
| 176 |
+
input mode_load_i,
|
| 177 |
+
|
| 178 |
+
// fixed pattern inputs interface
|
| 179 |
+
input [5:0] fixed_bl_i, // range from 1 to 64
|
| 180 |
+
input [2:0] fixed_instr_i, //RD 3'b001
|
| 181 |
+
//RDP 3'b011
|
| 182 |
+
//WR 3'b000
|
| 183 |
+
//WRP 3'b010
|
| 184 |
+
//REFRESH 3'b100
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
input [31:0] fixed_addr_i, // only upper 30 bits will be used
|
| 188 |
+
input [DWIDTH-1:0] fixed_data_i, //
|
| 189 |
+
|
| 190 |
+
// BRAM interface.
|
| 191 |
+
// bram bus formats:
|
| 192 |
+
// Only SP6 has been tested.
|
| 193 |
+
input [38:0] bram_cmd_i, // {{bl}, {cmd}, {address[28:2]}}
|
| 194 |
+
input bram_valid_i,
|
| 195 |
+
output bram_rdy_o, //
|
| 196 |
+
|
| 197 |
+
/////////////////////////////////////////////////////////////////////////////
|
| 198 |
+
// MCB INTERFACE
|
| 199 |
+
// interface to mcb command port
|
| 200 |
+
output mcb_cmd_en_o,
|
| 201 |
+
output [2:0] mcb_cmd_instr_o,
|
| 202 |
+
output [ADDR_WIDTH-1:0] mcb_cmd_addr_o,
|
| 203 |
+
output [5:0] mcb_cmd_bl_o, // this output is for Spartan 6
|
| 204 |
+
|
| 205 |
+
input mcb_cmd_full_i,
|
| 206 |
+
|
| 207 |
+
// interface to mcb wr data port
|
| 208 |
+
output mcb_wr_en_o,
|
| 209 |
+
output [DWIDTH-1:0] mcb_wr_data_o,
|
| 210 |
+
output mcb_wr_data_end_o,
|
| 211 |
+
output [(DWIDTH/8) - 1:0] mcb_wr_mask_o,
|
| 212 |
+
|
| 213 |
+
input mcb_wr_full_i,
|
| 214 |
+
input [6:0] mcb_wr_fifo_counts,
|
| 215 |
+
|
| 216 |
+
// interface to mcb rd data port
|
| 217 |
+
output mcb_rd_en_o,
|
| 218 |
+
input [DWIDTH-1:0] mcb_rd_data_i,
|
| 219 |
+
input mcb_rd_empty_i,
|
| 220 |
+
input [6:0] mcb_rd_fifo_counts,
|
| 221 |
+
/////////////////////////////////////////////////////////////////////////////
|
| 222 |
+
// status feedback
|
| 223 |
+
input counts_rst,
|
| 224 |
+
output reg [47:0] wr_data_counts,
|
| 225 |
+
output reg [47:0] rd_data_counts,
|
| 226 |
+
output cmp_error,
|
| 227 |
+
output cmp_data_valid,
|
| 228 |
+
output error, // asserted whenever the read back data is not correct.
|
| 229 |
+
output [64 + (2*DWIDTH - 1):0] error_status ,// TBD how signals mapped
|
| 230 |
+
output [DWIDTH-1:0] cmp_data,
|
| 231 |
+
output [DWIDTH-1:0] mem_rd_data,
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
// **** V6 Signals
|
| 235 |
+
output [DQ_ERROR_WIDTH - 1:0] dq_error_bytelane_cmp, // V6: real time compare error byte lane
|
| 236 |
+
output [DQ_ERROR_WIDTH - 1:0] cumlative_dq_lane_error // V6: latched error byte lane that occure on
|
| 237 |
+
// first error
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
);
|
| 242 |
+
|
| 243 |
+
localparam MEM_BLEN = (MEM_BURST_LEN == 4) ? 4 :
|
| 244 |
+
(MEM_BURST_LEN == 8) ? 8 :
|
| 245 |
+
8;
|
| 246 |
+
|
| 247 |
+
wire [DWIDTH-1:0] rdpath_rd_data_i;
|
| 248 |
+
wire rdpath_data_valid_i;
|
| 249 |
+
wire mcb_wr_en;
|
| 250 |
+
wire cmd2flow_valid;
|
| 251 |
+
wire [2:0] cmd2flow_cmd;
|
| 252 |
+
wire [31:0] cmd2flow_addr;
|
| 253 |
+
wire [5:0] cmd2flow_bl;
|
| 254 |
+
wire last_word_rd;
|
| 255 |
+
wire last_word_wr;
|
| 256 |
+
wire flow2cmd_rdy;
|
| 257 |
+
wire [31:0] wr_addr;
|
| 258 |
+
wire [31:0] rd_addr;
|
| 259 |
+
wire [5:0] wr_bl;
|
| 260 |
+
wire [5:0] rd_bl;
|
| 261 |
+
reg run_traffic_reg;
|
| 262 |
+
wire wr_validB, wr_valid,wr_validC;
|
| 263 |
+
wire [31:0] bram_addr_i;
|
| 264 |
+
wire [2:0] bram_instr_i;
|
| 265 |
+
wire [5:0] bram_bl_i;
|
| 266 |
+
reg AC2_G_E2,AC1_G_E1,AC3_G_E3;
|
| 267 |
+
reg upper_end_matched;
|
| 268 |
+
reg [7:0] end_boundary_addr;
|
| 269 |
+
reg lower_end_matched;
|
| 270 |
+
wire [31:0] addr_o;
|
| 271 |
+
wire [31:0] m_addr;
|
| 272 |
+
wire dcount_rst;
|
| 273 |
+
wire [31:0] rd_addr_error;
|
| 274 |
+
wire rd_rdy;
|
| 275 |
+
//wire cmp_error;
|
| 276 |
+
wire cmd_full;
|
| 277 |
+
wire rd_mdata_fifo_rd_en;
|
| 278 |
+
wire rd_mdata_fifo_empty;
|
| 279 |
+
wire rd_mdata_fifo_afull;
|
| 280 |
+
wire [DWIDTH-1:0] rd_v6_mdata;
|
| 281 |
+
|
| 282 |
+
//
|
| 283 |
+
wire [31:0] cmp_addr;
|
| 284 |
+
wire [5:0] cmp_bl;
|
| 285 |
+
// synthesis attribute keep of rst_ra is "true";
|
| 286 |
+
// synthesis attribute keep of rst_rb is "true";
|
| 287 |
+
|
| 288 |
+
reg [9:0] rst_ra,rst_rb;
|
| 289 |
+
// synthesis attribute keep of mcb_wr_full_r1 is "true";
|
| 290 |
+
// synthesis attribute keep of mcb_wr_full_r2 is "true";
|
| 291 |
+
|
| 292 |
+
reg mcb_wr_full_r1,mcb_wr_full_r2;
|
| 293 |
+
reg mcb_rd_empty_r;
|
| 294 |
+
wire force_wrcmd_gen;
|
| 295 |
+
wire [6:0] rd_buff_avail;
|
| 296 |
+
|
| 297 |
+
reg [3:0] data_mode_r_a;
|
| 298 |
+
reg [3:0] data_mode_r_b;
|
| 299 |
+
reg [3:0] data_mode_r_c;
|
| 300 |
+
reg rd_mdata_afull_set;
|
| 301 |
+
reg error_access_range = 1'b0;
|
| 302 |
+
//synthesis translate_off
|
| 303 |
+
|
| 304 |
+
initial begin
|
| 305 |
+
if((MEM_BURST_LEN !== 4) && (MEM_BURST_LEN !== 8)) begin
|
| 306 |
+
$display("Current Traffic Generator logic does not support OTF (On The Fly) Burst Mode!");
|
| 307 |
+
$display("If memory is set to OTF (On The Fly) , Traffic Generator only generates BL8 traffic");
|
| 308 |
+
|
| 309 |
+
end
|
| 310 |
+
end
|
| 311 |
+
|
| 312 |
+
always @ (mcb_cmd_en_o,mcb_cmd_addr_o,mcb_cmd_bl_o,end_addr_i)
|
| 313 |
+
|
| 314 |
+
if (mcb_cmd_en_o && (mcb_cmd_addr_o + mcb_cmd_bl_o * (DWIDTH/8)) > end_addr_i[ADDR_WIDTH-1:0])
|
| 315 |
+
begin
|
| 316 |
+
$display("Error ! Data access beyond address range");
|
| 317 |
+
error_access_range = 1'b1;
|
| 318 |
+
$stop;
|
| 319 |
+
end
|
| 320 |
+
|
| 321 |
+
//synthesis translate_on
|
| 322 |
+
|
| 323 |
+
wire mcb_rd_empty;
|
| 324 |
+
assign mcb_rd_empty = mcb_rd_empty_i;
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
wire mcb_wr_full;
|
| 330 |
+
assign mcb_wr_full = mcb_wr_full_i;
|
| 331 |
+
|
| 332 |
+
|
| 333 |
+
always @ (posedge clk_i)
|
| 334 |
+
begin
|
| 335 |
+
data_mode_r_a <= #TCQ data_mode_i;
|
| 336 |
+
data_mode_r_b <= #TCQ data_mode_i;
|
| 337 |
+
data_mode_r_c <= #TCQ data_mode_i;
|
| 338 |
+
end
|
| 339 |
+
always @ (posedge clk_i)
|
| 340 |
+
begin
|
| 341 |
+
if (rst_ra[0])
|
| 342 |
+
mcb_wr_full_r1 <= #TCQ 1'b0;
|
| 343 |
+
else if (mcb_wr_fifo_counts >= 63) begin
|
| 344 |
+
mcb_wr_full_r1 <= #TCQ 1'b1;
|
| 345 |
+
mcb_wr_full_r2 <= #TCQ 1'b1;
|
| 346 |
+
end
|
| 347 |
+
else begin
|
| 348 |
+
mcb_wr_full_r1 <= #TCQ 1'b0;
|
| 349 |
+
mcb_wr_full_r2 <= #TCQ 1'b0;
|
| 350 |
+
end
|
| 351 |
+
end
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
always @ (posedge clk_i)
|
| 355 |
+
begin
|
| 356 |
+
if (rst_ra[0])
|
| 357 |
+
mcb_rd_empty_r <= #TCQ 1'b1;
|
| 358 |
+
|
| 359 |
+
else if (mcb_rd_fifo_counts <= 1)
|
| 360 |
+
mcb_rd_empty_r <= #TCQ 1'b1;
|
| 361 |
+
else
|
| 362 |
+
mcb_rd_empty_r <= #TCQ 1'b0;
|
| 363 |
+
end
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
|
| 367 |
+
// synthesis attribute MAX_FANOUT of rst_ra is 20;
|
| 368 |
+
// synthesis attribute MAX_FANOUT of rst_rb is 20;
|
| 369 |
+
|
| 370 |
+
|
| 371 |
+
//reg GSR = 1'b0;
|
| 372 |
+
always @(posedge clk_i)
|
| 373 |
+
begin
|
| 374 |
+
rst_ra <= #TCQ {rst_i,rst_i,rst_i,rst_i,rst_i,rst_i,rst_i,rst_i,rst_i,rst_i};
|
| 375 |
+
rst_rb <= #TCQ {rst_i,rst_i,rst_i,rst_i,rst_i,rst_i,rst_i,rst_i,rst_i,rst_i};
|
| 376 |
+
|
| 377 |
+
end
|
| 378 |
+
// register it . Just in case the calling modules didn't syn with clk_i
|
| 379 |
+
always @(posedge clk_i)
|
| 380 |
+
begin
|
| 381 |
+
run_traffic_reg <= #TCQ run_traffic_i;
|
| 382 |
+
end
|
| 383 |
+
|
| 384 |
+
assign bram_addr_i = {bram_cmd_i[29:0],2'b00};
|
| 385 |
+
assign bram_instr_i = bram_cmd_i[32:30];
|
| 386 |
+
assign bram_bl_i[5:0] = bram_cmd_i[38:33];
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
//
|
| 390 |
+
//
|
| 391 |
+
assign dcount_rst = counts_rst | rst_ra[0];
|
| 392 |
+
always @ (posedge clk_i)
|
| 393 |
+
begin
|
| 394 |
+
if (dcount_rst)
|
| 395 |
+
wr_data_counts <= #TCQ 'b0;
|
| 396 |
+
else if (mcb_wr_en)
|
| 397 |
+
wr_data_counts <= #TCQ wr_data_counts + DWIDTH/8;
|
| 398 |
+
|
| 399 |
+
end
|
| 400 |
+
|
| 401 |
+
always @ (posedge clk_i)
|
| 402 |
+
begin
|
| 403 |
+
if (dcount_rst)
|
| 404 |
+
rd_data_counts <= #TCQ 'b0;
|
| 405 |
+
else if (mcb_rd_en_o)
|
| 406 |
+
rd_data_counts <= #TCQ rd_data_counts + DWIDTH/8;
|
| 407 |
+
|
| 408 |
+
end
|
| 409 |
+
|
| 410 |
+
|
| 411 |
+
|
| 412 |
+
// **** for debug
|
| 413 |
+
// this part of logic is to check there are no commands been duplicated or dropped
|
| 414 |
+
// in the cmd_flow_control logic
|
| 415 |
+
generate
|
| 416 |
+
if (SIMULATION == "TRUE") begin: cmd_check
|
| 417 |
+
reg fifo_error;
|
| 418 |
+
wire [31:0] xfer_addr;
|
| 419 |
+
wire cmd_fifo_rd;
|
| 420 |
+
|
| 421 |
+
assign cmd_fifo_wr = flow2cmd_rdy & cmd2flow_valid;
|
| 422 |
+
|
| 423 |
+
always @ (posedge clk_i)
|
| 424 |
+
begin
|
| 425 |
+
if ( mcb_cmd_en_o)
|
| 426 |
+
if ( xfer_addr != mcb_cmd_addr_o)
|
| 427 |
+
fifo_error <= #TCQ 1'b1;
|
| 428 |
+
else
|
| 429 |
+
fifo_error <= #TCQ 1'b0;
|
| 430 |
+
|
| 431 |
+
end
|
| 432 |
+
|
| 433 |
+
wire cmd_fifo_empty;
|
| 434 |
+
assign cmd_fifo_rd = mcb_cmd_en_o & ~mcb_cmd_full_i & ~cmd_fifo_empty;
|
| 435 |
+
|
| 436 |
+
afifo #
|
| 437 |
+
(.TCQ (TCQ),
|
| 438 |
+
.DSIZE (38),
|
| 439 |
+
.FIFO_DEPTH (16),
|
| 440 |
+
.ASIZE (4),
|
| 441 |
+
.SYNC (1) // set the SYNC to 1 because rd_clk = wr_clk to reduce latency
|
| 442 |
+
|
| 443 |
+
|
| 444 |
+
)
|
| 445 |
+
cmd_fifo
|
| 446 |
+
(
|
| 447 |
+
.wr_clk (clk_i),
|
| 448 |
+
.rst (rst_ra[0]),
|
| 449 |
+
.wr_en (cmd_fifo_wr),
|
| 450 |
+
.wr_data ({cmd2flow_bl,cmd2flow_addr}),
|
| 451 |
+
.rd_en (cmd_fifo_rd),
|
| 452 |
+
.rd_clk (clk_i),
|
| 453 |
+
.rd_data ({xfer_cmd_bl,xfer_addr}),
|
| 454 |
+
.full (cmd_fifo_full),
|
| 455 |
+
.empty (cmd_fifo_empty)
|
| 456 |
+
|
| 457 |
+
);
|
| 458 |
+
|
| 459 |
+
|
| 460 |
+
end
|
| 461 |
+
endgenerate
|
| 462 |
+
|
| 463 |
+
reg [31:0] end_addr_r;
|
| 464 |
+
always @ (posedge clk_i)
|
| 465 |
+
end_addr_r <= end_addr_i;
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
cmd_gen
|
| 469 |
+
#(
|
| 470 |
+
.TCQ (TCQ),
|
| 471 |
+
.FAMILY (FAMILY) ,
|
| 472 |
+
.MEM_BURST_LEN (MEM_BLEN),
|
| 473 |
+
.PORT_MODE (PORT_MODE),
|
| 474 |
+
|
| 475 |
+
.NUM_DQ_PINS (NUM_DQ_PINS),
|
| 476 |
+
.DATA_PATTERN (DATA_PATTERN),
|
| 477 |
+
.CMD_PATTERN (CMD_PATTERN),
|
| 478 |
+
.ADDR_WIDTH (ADDR_WIDTH),
|
| 479 |
+
.DWIDTH (DWIDTH),
|
| 480 |
+
.MEM_COL_WIDTH (MEM_COL_WIDTH),
|
| 481 |
+
.PRBS_EADDR_MASK_POS (PRBS_EADDR_MASK_POS ),
|
| 482 |
+
.PRBS_SADDR_MASK_POS (PRBS_SADDR_MASK_POS ),
|
| 483 |
+
.PRBS_EADDR (PRBS_EADDR),
|
| 484 |
+
.PRBS_SADDR (PRBS_SADDR )
|
| 485 |
+
|
| 486 |
+
)
|
| 487 |
+
u_c_gen
|
| 488 |
+
(
|
| 489 |
+
.clk_i (clk_i),
|
| 490 |
+
.rst_i (rst_ra),
|
| 491 |
+
.rd_buff_avail_i (rd_buff_avail),
|
| 492 |
+
.reading_rd_data_i (mcb_rd_en_o),
|
| 493 |
+
.force_wrcmd_gen_i (force_wrcmd_gen),
|
| 494 |
+
.run_traffic_i (run_traffic_reg),
|
| 495 |
+
.start_addr_i (start_addr_i),
|
| 496 |
+
.end_addr_i (end_addr_r),
|
| 497 |
+
.cmd_seed_i (cmd_seed_i),
|
| 498 |
+
.data_seed_i (data_seed_i),
|
| 499 |
+
.load_seed_i (load_seed_i),
|
| 500 |
+
.addr_mode_i (addr_mode_i),
|
| 501 |
+
.data_mode_i (data_mode_r_a),
|
| 502 |
+
|
| 503 |
+
.instr_mode_i (instr_mode_i),
|
| 504 |
+
.bl_mode_i (bl_mode_i),
|
| 505 |
+
.mode_load_i (mode_load_i),
|
| 506 |
+
// fixed pattern inputs interface
|
| 507 |
+
.fixed_bl_i (fixed_bl_i),
|
| 508 |
+
.fixed_addr_i (fixed_addr_i),
|
| 509 |
+
.fixed_instr_i (fixed_instr_i),
|
| 510 |
+
// BRAM FIFO input : Holist vector inputs
|
| 511 |
+
|
| 512 |
+
.bram_addr_i (bram_addr_i),
|
| 513 |
+
.bram_instr_i (bram_instr_i ),
|
| 514 |
+
.bram_bl_i (bram_bl_i ),
|
| 515 |
+
.bram_valid_i (bram_valid_i ),
|
| 516 |
+
.bram_rdy_o (bram_rdy_o ),
|
| 517 |
+
|
| 518 |
+
.rdy_i (flow2cmd_rdy),
|
| 519 |
+
.instr_o (cmd2flow_cmd),
|
| 520 |
+
.addr_o (cmd2flow_addr),
|
| 521 |
+
.bl_o (cmd2flow_bl),
|
| 522 |
+
// .m_addr_o (m_addr),
|
| 523 |
+
.cmd_o_vld (cmd2flow_valid)
|
| 524 |
+
|
| 525 |
+
);
|
| 526 |
+
|
| 527 |
+
assign mcb_cmd_addr_o = addr_o[ADDR_WIDTH-1:0];
|
| 528 |
+
|
| 529 |
+
|
| 530 |
+
|
| 531 |
+
assign cmd_full = mcb_cmd_full_i;
|
| 532 |
+
mcb_flow_control #
|
| 533 |
+
(
|
| 534 |
+
.TCQ (TCQ),
|
| 535 |
+
.FAMILY (FAMILY)
|
| 536 |
+
|
| 537 |
+
)
|
| 538 |
+
mcb_control
|
| 539 |
+
(
|
| 540 |
+
.clk_i (clk_i),
|
| 541 |
+
.rst_i (rst_ra),
|
| 542 |
+
|
| 543 |
+
.cmd_rdy_o (flow2cmd_rdy),
|
| 544 |
+
.cmd_valid_i (cmd2flow_valid),
|
| 545 |
+
.cmd_i (cmd2flow_cmd),
|
| 546 |
+
.addr_i (cmd2flow_addr),
|
| 547 |
+
.bl_i (cmd2flow_bl),
|
| 548 |
+
// interface to mcb_cmd port
|
| 549 |
+
.mcb_cmd_full (cmd_full),// (~rd_rdy ), // mcb_cmd_full
|
| 550 |
+
// .mcb_cmd_empty ( ),
|
| 551 |
+
.cmd_o (mcb_cmd_instr_o),
|
| 552 |
+
.addr_o (addr_o),//(mcb_cmd_instr_o),
|
| 553 |
+
.bl_o (mcb_cmd_bl_o),
|
| 554 |
+
.cmd_en_o (mcb_cmd_en_o),//(mcb_cmd_bl_o),
|
| 555 |
+
// interface to write data path module
|
| 556 |
+
|
| 557 |
+
.last_word_wr_i (last_word_wr),
|
| 558 |
+
.wdp_rdy_i (wr_rdy),//(wr_rdy),
|
| 559 |
+
.wdp_valid_o (wr_valid),
|
| 560 |
+
.wdp_validB_o (wr_validB),
|
| 561 |
+
.wdp_validC_o (wr_validC),
|
| 562 |
+
|
| 563 |
+
.wr_addr_o (wr_addr),
|
| 564 |
+
.wr_bl_o (wr_bl),
|
| 565 |
+
// interface to read data path module
|
| 566 |
+
|
| 567 |
+
.last_word_rd_i (last_word_rd),
|
| 568 |
+
.rdp_rdy_i (rd_rdy),// (rd_rdy),
|
| 569 |
+
.rdp_valid_o (rd_valid),
|
| 570 |
+
.rd_addr_o (rd_addr),
|
| 571 |
+
.rd_bl_o (rd_bl)
|
| 572 |
+
|
| 573 |
+
);
|
| 574 |
+
|
| 575 |
+
|
| 576 |
+
afifo #
|
| 577 |
+
(
|
| 578 |
+
|
| 579 |
+
.TCQ (TCQ),
|
| 580 |
+
.DSIZE (DWIDTH),
|
| 581 |
+
.FIFO_DEPTH (32),
|
| 582 |
+
.ASIZE (5),
|
| 583 |
+
.SYNC (1) // set the SYNC to 1 because rd_clk = wr_clk to reduce latency
|
| 584 |
+
|
| 585 |
+
|
| 586 |
+
)
|
| 587 |
+
rd_mdata_fifo
|
| 588 |
+
(
|
| 589 |
+
.wr_clk (clk_i),
|
| 590 |
+
.rst (rst_rb[0]),
|
| 591 |
+
.wr_en (!mcb_rd_empty),
|
| 592 |
+
.wr_data (mcb_rd_data_i),
|
| 593 |
+
.rd_en (mcb_rd_en_o),
|
| 594 |
+
.rd_clk (clk_i),
|
| 595 |
+
.rd_data (rd_v6_mdata),
|
| 596 |
+
.full (),
|
| 597 |
+
.almost_full (rd_mdata_fifo_afull),
|
| 598 |
+
.empty (rd_mdata_fifo_empty)
|
| 599 |
+
|
| 600 |
+
);
|
| 601 |
+
|
| 602 |
+
|
| 603 |
+
wire cmd_rd_en;
|
| 604 |
+
|
| 605 |
+
always @ (posedge clk_i)
|
| 606 |
+
begin
|
| 607 |
+
if (rst_rb[0])
|
| 608 |
+
rd_mdata_afull_set <= #TCQ 1'b0;
|
| 609 |
+
else if (rd_mdata_fifo_afull)
|
| 610 |
+
rd_mdata_afull_set <= #TCQ 1'b1;
|
| 611 |
+
end
|
| 612 |
+
assign cmd_rd_en = ~mcb_cmd_full_i & mcb_cmd_en_o;
|
| 613 |
+
|
| 614 |
+
|
| 615 |
+
assign rdpath_data_valid_i =(FAMILY == "VIRTEX6" && MEM_BLEN == 4) ? (!rd_mdata_fifo_empty & rd_mdata_afull_set) :!mcb_rd_empty ;
|
| 616 |
+
assign rdpath_rd_data_i =(FAMILY == "VIRTEX6" && MEM_BLEN == 4) ? rd_v6_mdata : mcb_rd_data_i ;
|
| 617 |
+
|
| 618 |
+
generate
|
| 619 |
+
if (PORT_MODE == "RD_MODE" || PORT_MODE == "BI_MODE") begin : RD_PATH
|
| 620 |
+
read_data_path
|
| 621 |
+
#(
|
| 622 |
+
.TCQ (TCQ),
|
| 623 |
+
.FAMILY (FAMILY) ,
|
| 624 |
+
.MEM_BURST_LEN (MEM_BLEN),
|
| 625 |
+
|
| 626 |
+
.CMP_DATA_PIPE_STAGES (CMP_DATA_PIPE_STAGES),
|
| 627 |
+
.ADDR_WIDTH (ADDR_WIDTH),
|
| 628 |
+
.SEL_VICTIM_LINE (SEL_VICTIM_LINE),
|
| 629 |
+
.DATA_PATTERN (DATA_PATTERN),
|
| 630 |
+
.DWIDTH (DWIDTH),
|
| 631 |
+
.NUM_DQ_PINS (NUM_DQ_PINS),
|
| 632 |
+
.DQ_ERROR_WIDTH (DQ_ERROR_WIDTH),
|
| 633 |
+
.MEM_COL_WIDTH (MEM_COL_WIDTH)
|
| 634 |
+
|
| 635 |
+
)
|
| 636 |
+
read_data_path
|
| 637 |
+
(
|
| 638 |
+
.clk_i (clk_i),
|
| 639 |
+
.rst_i (rst_rb),
|
| 640 |
+
.manual_clear_error (manual_clear_error),
|
| 641 |
+
.cmd_rdy_o (rd_rdy),
|
| 642 |
+
.cmd_valid_i (rd_valid),
|
| 643 |
+
.prbs_fseed_i (data_seed_i),
|
| 644 |
+
.cmd_sent (mcb_cmd_instr_o),
|
| 645 |
+
.bl_sent (mcb_cmd_bl_o),
|
| 646 |
+
.cmd_en_i (cmd_rd_en),
|
| 647 |
+
|
| 648 |
+
.data_mode_i (data_mode_r_b),
|
| 649 |
+
.last_word_rd_o (last_word_rd),
|
| 650 |
+
// .m_addr_i (m_addr),
|
| 651 |
+
.fixed_data_i (fixed_data_i),
|
| 652 |
+
|
| 653 |
+
.addr_i (rd_addr),
|
| 654 |
+
.bl_i (rd_bl),
|
| 655 |
+
.data_rdy_o (mcb_rd_en_o),
|
| 656 |
+
|
| 657 |
+
.data_valid_i (rdpath_data_valid_i),
|
| 658 |
+
.data_i (rdpath_rd_data_i),
|
| 659 |
+
|
| 660 |
+
|
| 661 |
+
.data_error_o (cmp_error),
|
| 662 |
+
.cmp_data_valid (cmp_data_valid),
|
| 663 |
+
.cmp_data_o (cmp_data),
|
| 664 |
+
.rd_mdata_o (mem_rd_data ),
|
| 665 |
+
.cmp_addr_o (cmp_addr),
|
| 666 |
+
.cmp_bl_o (cmp_bl),
|
| 667 |
+
.force_wrcmd_gen_o (force_wrcmd_gen),
|
| 668 |
+
.rd_buff_avail_o (rd_buff_avail),
|
| 669 |
+
.dq_error_bytelane_cmp (dq_error_bytelane_cmp),
|
| 670 |
+
.cumlative_dq_lane_error_r (cumlative_dq_lane_error)
|
| 671 |
+
|
| 672 |
+
);
|
| 673 |
+
|
| 674 |
+
end
|
| 675 |
+
else begin: WR_ONLY_PATH
|
| 676 |
+
|
| 677 |
+
assign cmp_error = 1'b0;
|
| 678 |
+
end
|
| 679 |
+
endgenerate
|
| 680 |
+
|
| 681 |
+
|
| 682 |
+
|
| 683 |
+
|
| 684 |
+
|
| 685 |
+
generate
|
| 686 |
+
if (PORT_MODE == "WR_MODE" || PORT_MODE == "BI_MODE") begin : WR_PATH
|
| 687 |
+
|
| 688 |
+
write_data_path
|
| 689 |
+
#(
|
| 690 |
+
|
| 691 |
+
.TCQ (TCQ),
|
| 692 |
+
.FAMILY (FAMILY),
|
| 693 |
+
.MEM_BURST_LEN (MEM_BLEN),
|
| 694 |
+
.ADDR_WIDTH (ADDR_WIDTH),
|
| 695 |
+
.DATA_PATTERN (DATA_PATTERN),
|
| 696 |
+
.DWIDTH (DWIDTH),
|
| 697 |
+
.NUM_DQ_PINS (NUM_DQ_PINS),
|
| 698 |
+
.SEL_VICTIM_LINE (SEL_VICTIM_LINE),
|
| 699 |
+
.MEM_COL_WIDTH (MEM_COL_WIDTH),
|
| 700 |
+
.EYE_TEST (EYE_TEST)
|
| 701 |
+
|
| 702 |
+
)
|
| 703 |
+
write_data_path
|
| 704 |
+
(
|
| 705 |
+
.clk_i(clk_i),
|
| 706 |
+
.rst_i (rst_rb),
|
| 707 |
+
.cmd_rdy_o (wr_rdy),
|
| 708 |
+
.cmd_valid_i (wr_valid),
|
| 709 |
+
.cmd_validB_i (wr_validB),
|
| 710 |
+
.cmd_validC_i (wr_validC),
|
| 711 |
+
.prbs_fseed_i (data_seed_i),
|
| 712 |
+
.data_mode_i (data_mode_r_c),
|
| 713 |
+
.last_word_wr_o (last_word_wr),
|
| 714 |
+
// .m_addr_i (m_addr),//(rd_addr),
|
| 715 |
+
.fixed_data_i (fixed_data_i),
|
| 716 |
+
.addr_i (wr_addr),
|
| 717 |
+
.bl_i (wr_bl),
|
| 718 |
+
.data_rdy_i (!mcb_wr_full),
|
| 719 |
+
.data_valid_o (mcb_wr_en),
|
| 720 |
+
.data_o (mcb_wr_data_o),
|
| 721 |
+
.data_mask_o (mcb_wr_mask_o),
|
| 722 |
+
.data_wr_end_o (mcb_wr_data_end_o)
|
| 723 |
+
);
|
| 724 |
+
|
| 725 |
+
end
|
| 726 |
+
endgenerate
|
| 727 |
+
|
| 728 |
+
assign mcb_wr_en_o = mcb_wr_en;
|
| 729 |
+
|
| 730 |
+
|
| 731 |
+
|
| 732 |
+
tg_status
|
| 733 |
+
#(
|
| 734 |
+
|
| 735 |
+
.TCQ (TCQ),
|
| 736 |
+
.DWIDTH (DWIDTH)
|
| 737 |
+
)
|
| 738 |
+
tg_status
|
| 739 |
+
(
|
| 740 |
+
.clk_i (clk_i),
|
| 741 |
+
.rst_i (rst_ra[2]),
|
| 742 |
+
.manual_clear_error (manual_clear_error),
|
| 743 |
+
.data_error_i (cmp_error),
|
| 744 |
+
.cmp_data_i (cmp_data),
|
| 745 |
+
.rd_data_i (mem_rd_data ),
|
| 746 |
+
.cmp_addr_i (cmp_addr),
|
| 747 |
+
.cmp_bl_i (cmp_bl),
|
| 748 |
+
.mcb_cmd_full_i (mcb_cmd_full_i),
|
| 749 |
+
.mcb_wr_full_i (mcb_wr_full), // mcb_wr_full_r2 ???
|
| 750 |
+
.mcb_rd_empty_i (mcb_rd_empty),
|
| 751 |
+
.error_status (error_status),
|
| 752 |
+
.error (error)
|
| 753 |
+
);
|
| 754 |
+
|
| 755 |
+
|
| 756 |
+
endmodule // mcb_traffic_gen
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/rd_data_gen.v
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//*****************************************************************************
|
| 2 |
+
// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MIG
|
| 54 |
+
// / / Filename: rd_data_gen.v
|
| 55 |
+
// /___/ /\ Date Last Modified:
|
| 56 |
+
// \ \ / \ Date Created:
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6
|
| 60 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
//Purpose: This module has all the timing control for generating "compare data"
|
| 62 |
+
// to compare the read data from memory.
|
| 63 |
+
//Reference:
|
| 64 |
+
//Revision History:
|
| 65 |
+
//*****************************************************************************
|
| 66 |
+
|
| 67 |
+
`timescale 1ps/1ps
|
| 68 |
+
|
| 69 |
+
module rd_data_gen #
|
| 70 |
+
(
|
| 71 |
+
parameter TCQ = 100,
|
| 72 |
+
parameter FAMILY = "SPARTAN6", // "SPARTAN6", "VIRTEX6"
|
| 73 |
+
parameter MEM_BURST_LEN = 8,
|
| 74 |
+
|
| 75 |
+
parameter ADDR_WIDTH = 32,
|
| 76 |
+
parameter BL_WIDTH = 6,
|
| 77 |
+
parameter DWIDTH = 32,
|
| 78 |
+
parameter DATA_PATTERN = "DGEN_ALL", //"DGEN__HAMMER", "DGEN_WALING1","DGEN_WALING0","DGEN_ADDR","DGEN_NEIGHBOR","DGEN_PRBS","DGEN_ALL"
|
| 79 |
+
parameter NUM_DQ_PINS = 8,
|
| 80 |
+
parameter SEL_VICTIM_LINE = 3, // VICTIM LINE is one of the DQ pins is selected to be different than hammer pattern
|
| 81 |
+
|
| 82 |
+
parameter COLUMN_WIDTH = 10
|
| 83 |
+
|
| 84 |
+
)
|
| 85 |
+
(
|
| 86 |
+
input clk_i, //
|
| 87 |
+
input [4:0] rst_i,
|
| 88 |
+
input [31:0] prbs_fseed_i,
|
| 89 |
+
input [3:0] data_mode_i, // "00" = bram;
|
| 90 |
+
|
| 91 |
+
output cmd_rdy_o, // ready to receive command. It should assert when data_port is ready at the // beginning and will be deasserted once see the cmd_valid_i is asserted.
|
| 92 |
+
// And then it should reasserted when
|
| 93 |
+
// it is generating the last_word.
|
| 94 |
+
input cmd_valid_i, // when both cmd_valid_i and cmd_rdy_o is high, the command is valid.
|
| 95 |
+
output last_word_o,
|
| 96 |
+
|
| 97 |
+
// input [ADDR_WIDTH-1:0] m_addr_i, // generated address used to determine data pattern.
|
| 98 |
+
input [DWIDTH-1:0] fixed_data_i,
|
| 99 |
+
input [ADDR_WIDTH-1:0] addr_i, // generated address used to determine data pattern.
|
| 100 |
+
input [BL_WIDTH-1:0] bl_i, // generated burst length for control the burst data
|
| 101 |
+
output user_bl_cnt_is_1_o,
|
| 102 |
+
input data_rdy_i, // connect from mcb_wr_full when used as wr_data_gen in sp6
|
| 103 |
+
// connect from mcb_rd_empty when used as rd_data_gen in sp6
|
| 104 |
+
// connect from rd_data_valid in v6
|
| 105 |
+
// When both data_rdy and data_valid is asserted, the ouput data is valid.
|
| 106 |
+
output reg data_valid_o, // connect to wr_en or rd_en and is asserted whenever the
|
| 107 |
+
// pattern is available.
|
| 108 |
+
output [DWIDTH-1:0] data_o, // generated data pattern
|
| 109 |
+
input rd_mdata_en
|
| 110 |
+
);
|
| 111 |
+
//
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
wire [31:0] prbs_data;
|
| 116 |
+
reg cmd_start;
|
| 117 |
+
reg [31:0] adata;
|
| 118 |
+
reg [31:0] hdata;
|
| 119 |
+
reg [31:0] ndata;
|
| 120 |
+
reg [31:0] w1data;
|
| 121 |
+
reg [NUM_DQ_PINS*4-1:0] v6_w1data;
|
| 122 |
+
|
| 123 |
+
reg [31:0] w0data;
|
| 124 |
+
reg [DWIDTH-1:0] data;
|
| 125 |
+
reg cmd_rdy;
|
| 126 |
+
reg data_valid;
|
| 127 |
+
reg [6:0]user_burst_cnt;
|
| 128 |
+
reg data_rdy_r1,data_rdy_r2;
|
| 129 |
+
reg next_count_is_one;
|
| 130 |
+
reg cmd_valid_r1;
|
| 131 |
+
reg [31:0] w3data;
|
| 132 |
+
|
| 133 |
+
assign data_port_fifo_rdy = data_rdy_i;
|
| 134 |
+
|
| 135 |
+
//assign cmd_start = cmd_valid_i & cmd_rdy ;
|
| 136 |
+
always @ (posedge clk_i)
|
| 137 |
+
begin
|
| 138 |
+
data_rdy_r1 <= #TCQ data_rdy_i;
|
| 139 |
+
data_rdy_r2 <= #TCQ data_rdy_r1;
|
| 140 |
+
cmd_valid_r1 <= #TCQ cmd_valid_i;
|
| 141 |
+
end
|
| 142 |
+
|
| 143 |
+
always @ (posedge clk_i)
|
| 144 |
+
begin
|
| 145 |
+
if (user_burst_cnt == 2 && data_rdy_i)
|
| 146 |
+
next_count_is_one <= #TCQ 1'b1;
|
| 147 |
+
else
|
| 148 |
+
next_count_is_one <= #TCQ 1'b0;
|
| 149 |
+
end
|
| 150 |
+
|
| 151 |
+
reg user_bl_cnt_is_1;
|
| 152 |
+
assign user_bl_cnt_is_1_o = user_bl_cnt_is_1;
|
| 153 |
+
always @ (posedge clk_i)
|
| 154 |
+
begin
|
| 155 |
+
if ((user_burst_cnt == 2 && data_port_fifo_rdy && FAMILY == "SPARTAN6")
|
| 156 |
+
|| (user_burst_cnt == 2 && data_port_fifo_rdy && FAMILY == "VIRTEX6")
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
user_bl_cnt_is_1 <= #TCQ 1'b1;
|
| 160 |
+
else
|
| 161 |
+
user_bl_cnt_is_1 <= #TCQ 1'b0;
|
| 162 |
+
end
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
reg cmd_start_b;
|
| 166 |
+
always @(cmd_valid_i,cmd_valid_r1,cmd_rdy,user_bl_cnt_is_1,rd_mdata_en)
|
| 167 |
+
begin
|
| 168 |
+
if (FAMILY == "SPARTAN6") begin
|
| 169 |
+
cmd_start = cmd_valid_i & cmd_rdy ;
|
| 170 |
+
cmd_start_b = cmd_valid_i & cmd_rdy ;
|
| 171 |
+
end
|
| 172 |
+
else if (MEM_BURST_LEN == 4 && FAMILY == "VIRTEX6") begin
|
| 173 |
+
cmd_start = rd_mdata_en; // need to wait for extra cycle for data coming out from rd_post_fifo in V6 interface
|
| 174 |
+
cmd_start_b = rd_mdata_en; // need to wait for extra cycle for data coming out from rd_post_fifo in V6 interface
|
| 175 |
+
end
|
| 176 |
+
else if (MEM_BURST_LEN == 8 && FAMILY == "VIRTEX6") begin
|
| 177 |
+
|
| 178 |
+
cmd_start = (~cmd_valid_r1 & cmd_valid_i) | user_bl_cnt_is_1; // need to wait for extra cycle for data coming out from rd_post_fifo in V6 interface
|
| 179 |
+
cmd_start_b = (~cmd_valid_r1 & cmd_valid_i) | user_bl_cnt_is_1; // need to wait for extra cycle for data coming out from rd_post_fifo in V6 interface
|
| 180 |
+
end
|
| 181 |
+
|
| 182 |
+
end
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
// counter to count user burst length
|
| 186 |
+
always @( posedge clk_i)
|
| 187 |
+
begin
|
| 188 |
+
if ( rst_i[0] )
|
| 189 |
+
user_burst_cnt <= #TCQ 'd0;
|
| 190 |
+
else if(cmd_start) begin
|
| 191 |
+
if (bl_i == 6'b000000)
|
| 192 |
+
user_burst_cnt <= #TCQ 7'b1000000;
|
| 193 |
+
else
|
| 194 |
+
user_burst_cnt <= #TCQ bl_i;
|
| 195 |
+
end
|
| 196 |
+
else if(data_port_fifo_rdy)
|
| 197 |
+
if (user_burst_cnt != 6'd0)
|
| 198 |
+
user_burst_cnt <= #TCQ user_burst_cnt - 1'b1;
|
| 199 |
+
else
|
| 200 |
+
user_burst_cnt <= #TCQ 'd0;
|
| 201 |
+
|
| 202 |
+
end
|
| 203 |
+
|
| 204 |
+
reg u_bcount_2;
|
| 205 |
+
always @ (posedge clk_i)
|
| 206 |
+
begin
|
| 207 |
+
if ((user_burst_cnt == 2 && data_rdy_i )|| (cmd_start && bl_i == 1))
|
| 208 |
+
u_bcount_2 <= #TCQ 1'b1;
|
| 209 |
+
else if (last_word_o)
|
| 210 |
+
u_bcount_2 <= #TCQ 1'b0;
|
| 211 |
+
end
|
| 212 |
+
|
| 213 |
+
assign last_word_o = u_bcount_2 & data_rdy_i;
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
// cmd_rdy_o assert when the dat fifo is not full and deassert once cmd_valid_i
|
| 219 |
+
// is assert and reassert during the last data
|
| 220 |
+
|
| 221 |
+
//data_valid_o logic
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
assign cmd_rdy_o = cmd_rdy;
|
| 226 |
+
|
| 227 |
+
always @( posedge clk_i)
|
| 228 |
+
begin
|
| 229 |
+
if ( rst_i[0] )
|
| 230 |
+
cmd_rdy <= #TCQ 1'b1;
|
| 231 |
+
else if (cmd_start)
|
| 232 |
+
cmd_rdy <= #TCQ 1'b0;
|
| 233 |
+
else if ((data_port_fifo_rdy && user_burst_cnt == 1))
|
| 234 |
+
cmd_rdy <= #TCQ 1'b1;
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
end
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
always @ (posedge clk_i)
|
| 242 |
+
begin
|
| 243 |
+
if (rst_i[0])
|
| 244 |
+
data_valid <= #TCQ 'd0;
|
| 245 |
+
else if (user_burst_cnt == 6'd1 && data_port_fifo_rdy)
|
| 246 |
+
data_valid <= #TCQ 1'b0;
|
| 247 |
+
else if(( user_burst_cnt >= 6'd1) || cmd_start)
|
| 248 |
+
data_valid <= #TCQ 1'b1;
|
| 249 |
+
end
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
always @ (data_valid, data_port_fifo_rdy)
|
| 253 |
+
if (FAMILY == "SPARTAN6")
|
| 254 |
+
data_valid_o = data_valid;
|
| 255 |
+
else
|
| 256 |
+
data_valid_o = data_port_fifo_rdy;
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
generate
|
| 261 |
+
if (FAMILY == "SPARTAN6") begin : SP6_DGEN
|
| 262 |
+
sp6_data_gen #
|
| 263 |
+
|
| 264 |
+
(
|
| 265 |
+
.TCQ (TCQ),
|
| 266 |
+
.ADDR_WIDTH (32 ),
|
| 267 |
+
.BL_WIDTH (BL_WIDTH ),
|
| 268 |
+
.DWIDTH (DWIDTH ),
|
| 269 |
+
.DATA_PATTERN (DATA_PATTERN ),
|
| 270 |
+
.NUM_DQ_PINS (NUM_DQ_PINS ),
|
| 271 |
+
.COLUMN_WIDTH (COLUMN_WIDTH)
|
| 272 |
+
|
| 273 |
+
)
|
| 274 |
+
sp6_data_gen
|
| 275 |
+
(
|
| 276 |
+
.clk_i (clk_i ),
|
| 277 |
+
.rst_i (rst_i[1] ),
|
| 278 |
+
.data_rdy_i (data_rdy_i ),
|
| 279 |
+
.prbs_fseed_i (prbs_fseed_i),
|
| 280 |
+
|
| 281 |
+
.data_mode_i (data_mode_i ),
|
| 282 |
+
.cmd_startA (cmd_start ),
|
| 283 |
+
.cmd_startB (cmd_start ),
|
| 284 |
+
.cmd_startC (cmd_start ),
|
| 285 |
+
.cmd_startD (cmd_start ),
|
| 286 |
+
.cmd_startE (cmd_start ),
|
| 287 |
+
.fixed_data_i (fixed_data_i),
|
| 288 |
+
|
| 289 |
+
.addr_i (addr_i ),
|
| 290 |
+
.user_burst_cnt (user_burst_cnt),
|
| 291 |
+
.fifo_rdy_i (data_port_fifo_rdy ),
|
| 292 |
+
.data_o (data_o )
|
| 293 |
+
);
|
| 294 |
+
|
| 295 |
+
end
|
| 296 |
+
endgenerate
|
| 297 |
+
generate
|
| 298 |
+
if (FAMILY == "VIRTEX6") begin : V6_DGEN
|
| 299 |
+
v6_data_gen #
|
| 300 |
+
|
| 301 |
+
(
|
| 302 |
+
.TCQ (TCQ),
|
| 303 |
+
.ADDR_WIDTH (32 ),
|
| 304 |
+
.BL_WIDTH (BL_WIDTH ),
|
| 305 |
+
.MEM_BURST_LEN (MEM_BURST_LEN),
|
| 306 |
+
.DWIDTH (DWIDTH ),
|
| 307 |
+
.DATA_PATTERN (DATA_PATTERN ),
|
| 308 |
+
.NUM_DQ_PINS (NUM_DQ_PINS ),
|
| 309 |
+
.SEL_VICTIM_LINE (SEL_VICTIM_LINE),
|
| 310 |
+
|
| 311 |
+
.COLUMN_WIDTH (COLUMN_WIDTH)
|
| 312 |
+
|
| 313 |
+
)
|
| 314 |
+
v6_data_gen
|
| 315 |
+
(
|
| 316 |
+
.clk_i (clk_i ),
|
| 317 |
+
.rst_i (rst_i[1] ),
|
| 318 |
+
.data_rdy_i (data_rdy_i ),
|
| 319 |
+
.prbs_fseed_i (prbs_fseed_i),
|
| 320 |
+
|
| 321 |
+
.data_mode_i (data_mode_i ),
|
| 322 |
+
.cmd_startA (cmd_start ),
|
| 323 |
+
.cmd_startB (cmd_start ),
|
| 324 |
+
.cmd_startC (cmd_start ),
|
| 325 |
+
.cmd_startD (cmd_start ),
|
| 326 |
+
.cmd_startE (cmd_start ),
|
| 327 |
+
.m_addr_i (addr_i),//(m_addr_i ),
|
| 328 |
+
.fixed_data_i (fixed_data_i),
|
| 329 |
+
|
| 330 |
+
.addr_i (addr_i ),
|
| 331 |
+
.user_burst_cnt (user_burst_cnt),
|
| 332 |
+
.fifo_rdy_i (data_port_fifo_rdy ),
|
| 333 |
+
.data_o (data_o )
|
| 334 |
+
);
|
| 335 |
+
|
| 336 |
+
end
|
| 337 |
+
endgenerate
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
endmodule
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/read_data_path.v
ADDED
|
@@ -0,0 +1,513 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//*****************************************************************************
|
| 2 |
+
// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//
|
| 49 |
+
//*****************************************************************************
|
| 50 |
+
// ____ ____
|
| 51 |
+
// / /\/ /
|
| 52 |
+
// /___/ \ / Vendor: Xilinx
|
| 53 |
+
// \ \ \/ Version: %version
|
| 54 |
+
// \ \ Application: MIG
|
| 55 |
+
// / / Filename: read_data_path.v
|
| 56 |
+
// /___/ /\ Date Last Modified:
|
| 57 |
+
// \ \ / \ Date Created:
|
| 58 |
+
// \___\/\___\
|
| 59 |
+
//
|
| 60 |
+
//Device: Spartan6
|
| 61 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 62 |
+
//Purpose: This is top level of read path and also consist of comparison logic
|
| 63 |
+
// for read data.
|
| 64 |
+
//Reference:
|
| 65 |
+
//Revision History:
|
| 66 |
+
//*****************************************************************************
|
| 67 |
+
|
| 68 |
+
`timescale 1ps/1ps
|
| 69 |
+
|
| 70 |
+
module read_data_path #(
|
| 71 |
+
parameter TCQ = 100,
|
| 72 |
+
|
| 73 |
+
parameter FAMILY = "VIRTEX6",
|
| 74 |
+
parameter MEM_BURST_LEN = 8,
|
| 75 |
+
parameter ADDR_WIDTH = 32,
|
| 76 |
+
parameter CMP_DATA_PIPE_STAGES = 3,
|
| 77 |
+
parameter DWIDTH = 32,
|
| 78 |
+
parameter DATA_PATTERN = "DGEN_ALL", //"DGEN__HAMMER", "DGEN_WALING1","DGEN_WALING0","DGEN_ADDR","DGEN_NEIGHBOR","DGEN_PRBS","DGEN_ALL"
|
| 79 |
+
parameter NUM_DQ_PINS = 8,
|
| 80 |
+
parameter DQ_ERROR_WIDTH = 1,
|
| 81 |
+
parameter SEL_VICTIM_LINE = 3, // VICTIM LINE is one of the DQ pins is selected to be different than hammer pattern
|
| 82 |
+
|
| 83 |
+
parameter MEM_COL_WIDTH = 10
|
| 84 |
+
|
| 85 |
+
)
|
| 86 |
+
(
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
input clk_i,
|
| 90 |
+
input [9:0] rst_i,
|
| 91 |
+
input manual_clear_error,
|
| 92 |
+
output cmd_rdy_o,
|
| 93 |
+
input cmd_valid_i,
|
| 94 |
+
input [31:0] prbs_fseed_i,
|
| 95 |
+
|
| 96 |
+
input [3:0] data_mode_i,
|
| 97 |
+
input [2:0] cmd_sent,
|
| 98 |
+
input [5:0] bl_sent ,
|
| 99 |
+
input cmd_en_i ,
|
| 100 |
+
// input [31:0] m_addr_i,
|
| 101 |
+
input [DWIDTH-1:0] fixed_data_i,
|
| 102 |
+
input [31:0] addr_i,
|
| 103 |
+
input [5:0] bl_i,
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
output data_rdy_o,
|
| 107 |
+
input data_valid_i,
|
| 108 |
+
input [DWIDTH-1:0] data_i,
|
| 109 |
+
output last_word_rd_o,
|
| 110 |
+
output data_error_o, //data_error on user data bus side
|
| 111 |
+
output [DWIDTH-1:0] cmp_data_o,
|
| 112 |
+
output [DWIDTH-1:0] rd_mdata_o ,
|
| 113 |
+
output cmp_data_valid,
|
| 114 |
+
output [31:0] cmp_addr_o,
|
| 115 |
+
output [5 :0] cmp_bl_o,
|
| 116 |
+
output force_wrcmd_gen_o,
|
| 117 |
+
output [6:0] rd_buff_avail_o,
|
| 118 |
+
output [DQ_ERROR_WIDTH - 1:0] dq_error_bytelane_cmp, // V6: real time compare error byte lane
|
| 119 |
+
output [DQ_ERROR_WIDTH - 1:0] cumlative_dq_lane_error_r // V6: latched error byte lane that occure on
|
| 120 |
+
// first error
|
| 121 |
+
|
| 122 |
+
);
|
| 123 |
+
|
| 124 |
+
wire gen_rdy;
|
| 125 |
+
wire gen_valid;
|
| 126 |
+
wire [31:0] gen_addr;
|
| 127 |
+
wire [5:0] gen_bl;
|
| 128 |
+
|
| 129 |
+
wire cmp_rdy;
|
| 130 |
+
wire cmp_valid;
|
| 131 |
+
wire [31:0] cmp_addr;
|
| 132 |
+
wire [5:0] cmp_bl;
|
| 133 |
+
|
| 134 |
+
reg data_error;
|
| 135 |
+
wire [DWIDTH-1:0] cmp_data;
|
| 136 |
+
reg [DWIDTH-1:0] cmp_data_r;
|
| 137 |
+
reg [DWIDTH-1:0] cmp_data_r2;
|
| 138 |
+
reg [DWIDTH-1:0] cmp_data_r3;
|
| 139 |
+
reg [DWIDTH-1:0] cmp_data_r4;
|
| 140 |
+
reg last_word_rd;
|
| 141 |
+
reg [5:0] bl_counter;
|
| 142 |
+
wire cmd_rdy;
|
| 143 |
+
wire user_bl_cnt_is_1;
|
| 144 |
+
wire data_rdy;
|
| 145 |
+
reg [DWIDTH:0] delayed_data;
|
| 146 |
+
wire rd_mdata_en;
|
| 147 |
+
reg [DWIDTH-1:0] rd_data_r;
|
| 148 |
+
reg [DWIDTH-1:0] rd_data_r2;
|
| 149 |
+
reg [DWIDTH-1:0] rd_data_r3;
|
| 150 |
+
reg [DWIDTH-1:0] rd_data_r4;
|
| 151 |
+
reg force_wrcmd_gen;
|
| 152 |
+
reg wait_bl_end;
|
| 153 |
+
reg wait_bl_end_r1;
|
| 154 |
+
reg l_data_error ;
|
| 155 |
+
reg u_data_error;
|
| 156 |
+
reg v6_data_cmp_valid;
|
| 157 |
+
wire [DWIDTH -1 :0] rd_v6_mdata;
|
| 158 |
+
reg [DWIDTH -1 :0] rd_v6_mdata_r1;
|
| 159 |
+
reg [DWIDTH -1 :0] rd_v6_mdata_r2;
|
| 160 |
+
reg [DWIDTH -1 :0] rd_v6_mdata_r3;
|
| 161 |
+
reg [DWIDTH -1 :0] rd_v6_mdata_r4;
|
| 162 |
+
reg [DWIDTH -1 :0] cmpdata_r;
|
| 163 |
+
wire [DWIDTH -1 :0] rd_mdata;
|
| 164 |
+
wire rd_mdata_fifo_empty;
|
| 165 |
+
reg cmp_data_en;
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
wire [ DQ_ERROR_WIDTH-1:0] dq_lane_error;
|
| 169 |
+
reg [ DQ_ERROR_WIDTH-1:0] dq_lane_error_r1;
|
| 170 |
+
reg [ DQ_ERROR_WIDTH-1:0] dq_lane_error_r2;
|
| 171 |
+
wire [ DQ_ERROR_WIDTH-1:0] cum_dq_lane_error_mask;
|
| 172 |
+
wire [ DQ_ERROR_WIDTH-1:0] cumlative_dq_lane_error_c;
|
| 173 |
+
reg [ DQ_ERROR_WIDTH-1:0] cumlative_dq_lane_error_reg;
|
| 174 |
+
|
| 175 |
+
reg data_valid_r;
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
always @ (posedge clk_i) begin
|
| 179 |
+
wait_bl_end_r1 <= #TCQ wait_bl_end;
|
| 180 |
+
rd_data_r <= #TCQ data_i;
|
| 181 |
+
rd_data_r2 <= #TCQ rd_data_r;
|
| 182 |
+
rd_data_r3 <= #TCQ rd_data_r2;
|
| 183 |
+
rd_data_r4 <= #TCQ rd_data_r3;
|
| 184 |
+
end
|
| 185 |
+
|
| 186 |
+
assign force_wrcmd_gen_o = force_wrcmd_gen;
|
| 187 |
+
reg [7:0] force_wrcmd_timeout_cnts ;
|
| 188 |
+
|
| 189 |
+
always @ (posedge clk_i) begin
|
| 190 |
+
if (rst_i[0])
|
| 191 |
+
force_wrcmd_gen <= #TCQ 1'b0;
|
| 192 |
+
else if ((wait_bl_end == 1'b0 && wait_bl_end_r1 == 1'b1) || force_wrcmd_timeout_cnts == 8'b11111111)
|
| 193 |
+
force_wrcmd_gen <= #TCQ 1'b0;
|
| 194 |
+
|
| 195 |
+
else if ((cmd_valid_i && bl_i > 16) || wait_bl_end )
|
| 196 |
+
force_wrcmd_gen <= #TCQ 1'b1;
|
| 197 |
+
end
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
always @ (posedge clk_i) begin
|
| 201 |
+
if (rst_i[0])
|
| 202 |
+
force_wrcmd_timeout_cnts <= #TCQ 'b0;
|
| 203 |
+
else if (wait_bl_end == 1'b0 && wait_bl_end_r1 == 1'b1)
|
| 204 |
+
force_wrcmd_timeout_cnts <= #TCQ 'b0;
|
| 205 |
+
|
| 206 |
+
else if (force_wrcmd_gen)
|
| 207 |
+
force_wrcmd_timeout_cnts <= #TCQ force_wrcmd_timeout_cnts + 1;
|
| 208 |
+
end
|
| 209 |
+
|
| 210 |
+
always @ (posedge clk_i)
|
| 211 |
+
if (rst_i[0])
|
| 212 |
+
wait_bl_end <= #TCQ 1'b0;
|
| 213 |
+
else if (force_wrcmd_timeout_cnts == 8'b11111111)
|
| 214 |
+
wait_bl_end <= #TCQ 1'b0;
|
| 215 |
+
|
| 216 |
+
else if (gen_rdy && gen_valid && gen_bl > 16)
|
| 217 |
+
wait_bl_end <= #TCQ 1'b1;
|
| 218 |
+
else if (wait_bl_end && user_bl_cnt_is_1)
|
| 219 |
+
wait_bl_end <= #TCQ 1'b0;
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
assign cmd_rdy_o = cmd_rdy;
|
| 223 |
+
read_posted_fifo #(
|
| 224 |
+
.TCQ (TCQ),
|
| 225 |
+
.FAMILY (FAMILY),
|
| 226 |
+
.MEM_BURST_LEN (MEM_BURST_LEN),
|
| 227 |
+
.ADDR_WIDTH(32),
|
| 228 |
+
.BL_WIDTH(6)
|
| 229 |
+
)
|
| 230 |
+
read_postedfifo(
|
| 231 |
+
.clk_i (clk_i),
|
| 232 |
+
.rst_i (rst_i[0]),
|
| 233 |
+
.cmd_rdy_o (cmd_rdy ),
|
| 234 |
+
.cmd_valid_i (cmd_valid_i ),
|
| 235 |
+
.data_valid_i (data_rdy ), // input to
|
| 236 |
+
.addr_i (addr_i ),
|
| 237 |
+
.bl_i (bl_i ),
|
| 238 |
+
|
| 239 |
+
.cmd_sent (cmd_sent),
|
| 240 |
+
.bl_sent (bl_sent ),
|
| 241 |
+
.cmd_en_i (cmd_en_i),
|
| 242 |
+
|
| 243 |
+
.user_bl_cnt_is_1 (user_bl_cnt_is_1),
|
| 244 |
+
.gen_rdy_i (gen_rdy ),
|
| 245 |
+
.gen_valid_o (gen_valid ),
|
| 246 |
+
.gen_addr_o (gen_addr ),
|
| 247 |
+
.gen_bl_o (gen_bl ),
|
| 248 |
+
.rd_buff_avail_o (rd_buff_avail_o),
|
| 249 |
+
.rd_mdata_fifo_empty (rd_mdata_fifo_empty),
|
| 250 |
+
.rd_mdata_en (rd_mdata_en)
|
| 251 |
+
);
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
rd_data_gen #(
|
| 257 |
+
.TCQ (TCQ),
|
| 258 |
+
.FAMILY (FAMILY),
|
| 259 |
+
.MEM_BURST_LEN (MEM_BURST_LEN),
|
| 260 |
+
.NUM_DQ_PINS (NUM_DQ_PINS),
|
| 261 |
+
.SEL_VICTIM_LINE (SEL_VICTIM_LINE),
|
| 262 |
+
|
| 263 |
+
.DATA_PATTERN (DATA_PATTERN),
|
| 264 |
+
.DWIDTH(DWIDTH),
|
| 265 |
+
.COLUMN_WIDTH (MEM_COL_WIDTH)
|
| 266 |
+
|
| 267 |
+
)
|
| 268 |
+
rd_datagen(
|
| 269 |
+
.clk_i (clk_i ),
|
| 270 |
+
.rst_i (rst_i[4:0]),
|
| 271 |
+
.prbs_fseed_i (prbs_fseed_i),
|
| 272 |
+
.data_mode_i (data_mode_i ),
|
| 273 |
+
.cmd_rdy_o (gen_rdy ),
|
| 274 |
+
.cmd_valid_i (gen_valid ),
|
| 275 |
+
.last_word_o (last_word_rd_o ),
|
| 276 |
+
|
| 277 |
+
// .m_addr_i (m_addr_i ),
|
| 278 |
+
.fixed_data_i (fixed_data_i),
|
| 279 |
+
|
| 280 |
+
.addr_i (gen_addr ),
|
| 281 |
+
.bl_i (gen_bl ),
|
| 282 |
+
.user_bl_cnt_is_1_o (user_bl_cnt_is_1),
|
| 283 |
+
.data_rdy_i (data_valid_i ), // input to
|
| 284 |
+
.data_valid_o (cmp_valid ),
|
| 285 |
+
.data_o (cmp_data ),
|
| 286 |
+
.rd_mdata_en (rd_mdata_en)
|
| 287 |
+
);
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
afifo #
|
| 291 |
+
(
|
| 292 |
+
.TCQ (TCQ),
|
| 293 |
+
.DSIZE (DWIDTH),
|
| 294 |
+
.FIFO_DEPTH (32),
|
| 295 |
+
.ASIZE (5),
|
| 296 |
+
.SYNC (1) // set the SYNC to 1 because rd_clk = wr_clk to reduce latency
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
)
|
| 300 |
+
rd_mdata_fifo
|
| 301 |
+
(
|
| 302 |
+
.wr_clk (clk_i),
|
| 303 |
+
.rst (rst_i[0]),
|
| 304 |
+
.wr_en (data_valid_i),
|
| 305 |
+
.wr_data (data_i),
|
| 306 |
+
.rd_en (rd_mdata_en),
|
| 307 |
+
.rd_clk (clk_i),
|
| 308 |
+
.rd_data (rd_v6_mdata),
|
| 309 |
+
.full (),
|
| 310 |
+
.empty (rd_mdata_fifo_empty),
|
| 311 |
+
.almost_full ()
|
| 312 |
+
);
|
| 313 |
+
|
| 314 |
+
always @ (posedge clk_i)
|
| 315 |
+
begin
|
| 316 |
+
// delayed_data <= #TCQ {cmp_valid & data_valid_i,cmp_data};
|
| 317 |
+
cmp_data_r <= #TCQ cmp_data;
|
| 318 |
+
cmp_data_r2 <= #TCQ cmp_data_r;
|
| 319 |
+
cmp_data_r3 <= #TCQ cmp_data_r2;
|
| 320 |
+
cmp_data_r4 <= #TCQ cmp_data_r3;
|
| 321 |
+
end
|
| 322 |
+
|
| 323 |
+
assign rd_mdata_o = rd_mdata;
|
| 324 |
+
|
| 325 |
+
assign rd_mdata = (FAMILY == "SPARTAN6") ? rd_data_r3:
|
| 326 |
+
(FAMILY == "VIRTEX6" && MEM_BURST_LEN == 4)? rd_v6_mdata_r2:
|
| 327 |
+
rd_data_r;
|
| 328 |
+
|
| 329 |
+
assign cmp_data_valid = (FAMILY == "SPARTAN6") ? cmp_data_en :
|
| 330 |
+
(FAMILY == "VIRTEX6" && MEM_BURST_LEN == 4)? v6_data_cmp_valid :data_valid_i;
|
| 331 |
+
|
| 332 |
+
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
assign cmp_data_o = (FAMILY == "SPARTAN6") ? cmp_data_r3 : cmp_data_r2;
|
| 336 |
+
assign cmp_addr_o = gen_addr;
|
| 337 |
+
assign cmp_bl_o = gen_bl;
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
assign data_rdy_o = data_rdy;
|
| 342 |
+
assign data_rdy = cmp_valid & data_valid_i;
|
| 343 |
+
|
| 344 |
+
always @ (posedge clk_i)
|
| 345 |
+
v6_data_cmp_valid <= #TCQ rd_mdata_en;
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
always @ (posedge clk_i)
|
| 349 |
+
cmp_data_en <= #TCQ data_rdy;
|
| 350 |
+
|
| 351 |
+
generate
|
| 352 |
+
if (FAMILY == "SPARTAN6") begin: gen_error_1
|
| 353 |
+
always @ (posedge clk_i)
|
| 354 |
+
begin
|
| 355 |
+
if (cmp_data_en)
|
| 356 |
+
l_data_error <= #TCQ (rd_data_r[DWIDTH/2-1:0] !== cmp_data_r[DWIDTH/2-1:0]);
|
| 357 |
+
else
|
| 358 |
+
l_data_error <= #TCQ 1'b0;
|
| 359 |
+
|
| 360 |
+
if (cmp_data_en)
|
| 361 |
+
u_data_error <= #TCQ (rd_data_r[DWIDTH-1:DWIDTH/2] !== cmp_data_r[DWIDTH-1:DWIDTH/2]);
|
| 362 |
+
else
|
| 363 |
+
u_data_error <= #TCQ 1'b0;
|
| 364 |
+
|
| 365 |
+
data_error <= #TCQ l_data_error | u_data_error;
|
| 366 |
+
//synthesis translate_off
|
| 367 |
+
if (data_error)
|
| 368 |
+
$display ("ERROR: Expected data=%h and recieved data= %h @ %t" ,cmp_data_r4, rd_data_r4, $time);
|
| 369 |
+
//synthesis translate_on
|
| 370 |
+
|
| 371 |
+
end
|
| 372 |
+
|
| 373 |
+
end
|
| 374 |
+
endgenerate
|
| 375 |
+
wire [NUM_DQ_PINS/2 - 1:0] error_byte;
|
| 376 |
+
reg [NUM_DQ_PINS/2 - 1:0] error_byte_r1;
|
| 377 |
+
|
| 378 |
+
genvar i;
|
| 379 |
+
generate
|
| 380 |
+
if (FAMILY == "VIRTEX6" && MEM_BURST_LEN == 4) begin: gen_error_2
|
| 381 |
+
|
| 382 |
+
|
| 383 |
+
for (i = 0; i < NUM_DQ_PINS/2; i = i + 1) begin: gen_cmp
|
| 384 |
+
assign error_byte[i]
|
| 385 |
+
= (~rd_mdata_fifo_empty && rd_mdata_en && (rd_v6_mdata[8*(i+1)-1:8*i] !== cmp_data[8*(i+1)-1:8*i]) );
|
| 386 |
+
|
| 387 |
+
|
| 388 |
+
end
|
| 389 |
+
|
| 390 |
+
always @ (posedge clk_i)
|
| 391 |
+
begin
|
| 392 |
+
rd_v6_mdata_r1 <= rd_v6_mdata;
|
| 393 |
+
rd_v6_mdata_r2 <= rd_v6_mdata_r1;
|
| 394 |
+
rd_v6_mdata_r3 <= rd_v6_mdata_r2;
|
| 395 |
+
rd_v6_mdata_r4 <= rd_v6_mdata_r3;
|
| 396 |
+
end
|
| 397 |
+
|
| 398 |
+
always @ (posedge clk_i)
|
| 399 |
+
begin
|
| 400 |
+
if (rst_i[1] || manual_clear_error) begin
|
| 401 |
+
|
| 402 |
+
error_byte_r1 <= #TCQ 'b0;
|
| 403 |
+
data_error <= #TCQ 1'b0;
|
| 404 |
+
end
|
| 405 |
+
else begin
|
| 406 |
+
error_byte_r1 <= #TCQ error_byte;
|
| 407 |
+
data_error <= #TCQ | error_byte_r1;
|
| 408 |
+
|
| 409 |
+
|
| 410 |
+
//synthesis translate_off
|
| 411 |
+
if (data_error)
|
| 412 |
+
$display ("ERROR: Expected data=%h and recieved data= %h @ %t" ,cmp_data_r2,rd_v6_mdata_r2,$time);
|
| 413 |
+
//synthesis translate_on
|
| 414 |
+
end
|
| 415 |
+
|
| 416 |
+
end
|
| 417 |
+
|
| 418 |
+
// remap the app_rd_data error byte locastion to dq bus side.
|
| 419 |
+
for ( i = 0; i < DQ_ERROR_WIDTH; i = i+1) begin: gen_dq_error_map
|
| 420 |
+
assign dq_lane_error[i] = (error_byte_r1[i] | error_byte_r1[i+DQ_ERROR_WIDTH] |
|
| 421 |
+
error_byte_r1[i+ (NUM_DQ_PINS*2/8)] |
|
| 422 |
+
error_byte_r1[i+ (NUM_DQ_PINS*3/8)]);
|
| 423 |
+
|
| 424 |
+
assign cumlative_dq_lane_error_c[i] = cumlative_dq_lane_error_r[i] | dq_lane_error_r1[i];
|
| 425 |
+
end
|
| 426 |
+
|
| 427 |
+
|
| 428 |
+
always @ (posedge clk_i)
|
| 429 |
+
begin
|
| 430 |
+
if (rst_i[1] || manual_clear_error) begin
|
| 431 |
+
|
| 432 |
+
dq_lane_error_r1 <= #TCQ 'b0;
|
| 433 |
+
dq_lane_error_r2 <= #TCQ 'b0;
|
| 434 |
+
data_valid_r <= #TCQ 1'b0;
|
| 435 |
+
cumlative_dq_lane_error_reg <= #TCQ 'b0;
|
| 436 |
+
end
|
| 437 |
+
else begin
|
| 438 |
+
data_valid_r <= #TCQ data_valid_i;
|
| 439 |
+
|
| 440 |
+
dq_lane_error_r1 <= #TCQ dq_lane_error;
|
| 441 |
+
cumlative_dq_lane_error_reg <= #TCQ cumlative_dq_lane_error_c;
|
| 442 |
+
end
|
| 443 |
+
end
|
| 444 |
+
end
|
| 445 |
+
//end
|
| 446 |
+
endgenerate
|
| 447 |
+
|
| 448 |
+
generate
|
| 449 |
+
if (FAMILY == "VIRTEX6" && MEM_BURST_LEN == 8) begin: gen_error_3
|
| 450 |
+
for (i = 0; i < NUM_DQ_PINS/2; i = i + 1) begin: gen_cmp
|
| 451 |
+
assign error_byte[i]
|
| 452 |
+
= (data_valid_i && (data_i[8*(i+1)-1:8*i] !== cmp_data[8*(i+1)-1:8*i]) );
|
| 453 |
+
end
|
| 454 |
+
|
| 455 |
+
|
| 456 |
+
|
| 457 |
+
|
| 458 |
+
always @ (posedge clk_i)
|
| 459 |
+
begin
|
| 460 |
+
if (rst_i[1] || manual_clear_error) begin
|
| 461 |
+
|
| 462 |
+
error_byte_r1 <= #TCQ 'b0;
|
| 463 |
+
data_error <= #TCQ 1'b0;
|
| 464 |
+
end
|
| 465 |
+
else begin
|
| 466 |
+
|
| 467 |
+
error_byte_r1 <= #TCQ error_byte;
|
| 468 |
+
data_error <= #TCQ | error_byte_r1;
|
| 469 |
+
|
| 470 |
+
//synthesis translate_off
|
| 471 |
+
if (data_error)
|
| 472 |
+
$display ("ERROR: Expected data=%h and recieved data= %h @ %t" ,cmp_data_r2,rd_data_r2,$time);
|
| 473 |
+
//synthesis translate_on
|
| 474 |
+
|
| 475 |
+
end
|
| 476 |
+
end
|
| 477 |
+
|
| 478 |
+
|
| 479 |
+
for ( i = 0; i < DQ_ERROR_WIDTH; i = i+1) begin: gen_dq_error_map
|
| 480 |
+
assign dq_lane_error[i] = (error_byte_r1[i] | error_byte_r1[i+DQ_ERROR_WIDTH] |
|
| 481 |
+
error_byte_r1[i+ (NUM_DQ_PINS*2/8)] |
|
| 482 |
+
error_byte_r1[i+ (NUM_DQ_PINS*3/8)]);
|
| 483 |
+
|
| 484 |
+
assign cumlative_dq_lane_error_c[i] = cumlative_dq_lane_error_r[i] | dq_lane_error_r1[i];
|
| 485 |
+
end
|
| 486 |
+
|
| 487 |
+
|
| 488 |
+
always @ (posedge clk_i)
|
| 489 |
+
begin
|
| 490 |
+
if (rst_i[1] || manual_clear_error) begin
|
| 491 |
+
|
| 492 |
+
dq_lane_error_r1 <= #TCQ 'b0;
|
| 493 |
+
dq_lane_error_r2 <= #TCQ 'b0;
|
| 494 |
+
data_valid_r <= #TCQ 1'b0;
|
| 495 |
+
cumlative_dq_lane_error_reg <= #TCQ 'b0;
|
| 496 |
+
end
|
| 497 |
+
else begin
|
| 498 |
+
data_valid_r <= #TCQ data_valid_i;
|
| 499 |
+
dq_lane_error_r1 <= #TCQ dq_lane_error;
|
| 500 |
+
cumlative_dq_lane_error_reg <= #TCQ cumlative_dq_lane_error_c;
|
| 501 |
+
end
|
| 502 |
+
end
|
| 503 |
+
end
|
| 504 |
+
//end
|
| 505 |
+
endgenerate
|
| 506 |
+
|
| 507 |
+
assign cumlative_dq_lane_error_r = cumlative_dq_lane_error_reg;
|
| 508 |
+
assign dq_error_bytelane_cmp = dq_lane_error_r1;
|
| 509 |
+
assign data_error_o = data_error;
|
| 510 |
+
|
| 511 |
+
|
| 512 |
+
endmodule
|
| 513 |
+
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/read_posted_fifo.v
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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************************
|
| 2 |
+
// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MIG
|
| 54 |
+
// / / Filename: read_posted_fifo.v
|
| 55 |
+
// /___/ /\ Date Last Modified:
|
| 56 |
+
// \ \ / \ Date Created:
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6
|
| 60 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
//Purpose: This module instantiated by read_data_path module and sits between
|
| 62 |
+
// mcb_flow_control module and read_data_gen module to buffer up the
|
| 63 |
+
// commands that has sent to memory controller.
|
| 64 |
+
//Reference:
|
| 65 |
+
//Revision History:
|
| 66 |
+
// 2010/01/09/ Corrected dfifo_has_enough_room threshold logic.
|
| 67 |
+
// It has to set higher in Read Only port.
|
| 68 |
+
//*****************************************************************************
|
| 69 |
+
`timescale 1ps/1ps
|
| 70 |
+
|
| 71 |
+
module read_posted_fifo #
|
| 72 |
+
(
|
| 73 |
+
parameter TCQ = 100,
|
| 74 |
+
parameter FAMILY = "SPARTAN6",
|
| 75 |
+
parameter MEM_BURST_LEN = 4,
|
| 76 |
+
|
| 77 |
+
parameter ADDR_WIDTH = 32,
|
| 78 |
+
parameter BL_WIDTH = 6
|
| 79 |
+
)
|
| 80 |
+
(
|
| 81 |
+
input clk_i,
|
| 82 |
+
input rst_i,
|
| 83 |
+
output reg cmd_rdy_o,
|
| 84 |
+
input cmd_valid_i,
|
| 85 |
+
input data_valid_i,
|
| 86 |
+
input [ADDR_WIDTH-1:0] addr_i,
|
| 87 |
+
input [BL_WIDTH-1:0] bl_i,
|
| 88 |
+
input user_bl_cnt_is_1,
|
| 89 |
+
input [2:0] cmd_sent,
|
| 90 |
+
input [5:0] bl_sent ,
|
| 91 |
+
input cmd_en_i ,
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
input gen_rdy_i,
|
| 95 |
+
output gen_valid_o,
|
| 96 |
+
output [ADDR_WIDTH-1:0] gen_addr_o,
|
| 97 |
+
output [BL_WIDTH-1:0] gen_bl_o,
|
| 98 |
+
output [6:0] rd_buff_avail_o,
|
| 99 |
+
input rd_mdata_fifo_empty,
|
| 100 |
+
output rd_mdata_en
|
| 101 |
+
|
| 102 |
+
);
|
| 103 |
+
|
| 104 |
+
reg empty_r;
|
| 105 |
+
reg rd_first_data;
|
| 106 |
+
|
| 107 |
+
wire full;
|
| 108 |
+
wire empty;
|
| 109 |
+
wire wr_en;
|
| 110 |
+
reg rd_en;
|
| 111 |
+
reg data_valid_r;
|
| 112 |
+
reg user_bl_cnt_not_1;
|
| 113 |
+
reg [6:0] buf_avail_r;
|
| 114 |
+
reg [6:0] rd_data_received_counts;
|
| 115 |
+
reg [6:0] rd_data_counts_asked;
|
| 116 |
+
|
| 117 |
+
reg dfifo_has_enough_room;
|
| 118 |
+
reg [1:0] wait_cnt;
|
| 119 |
+
reg wait_done;
|
| 120 |
+
|
| 121 |
+
assign rd_mdata_en = rd_en;
|
| 122 |
+
|
| 123 |
+
assign rd_buff_avail_o = buf_avail_r;
|
| 124 |
+
always @ (posedge clk_i)
|
| 125 |
+
cmd_rdy_o <= #TCQ !full & dfifo_has_enough_room & wait_done;
|
| 126 |
+
|
| 127 |
+
always @ (posedge clk_i)
|
| 128 |
+
begin
|
| 129 |
+
if (rst_i)
|
| 130 |
+
wait_cnt <= #TCQ 'b0;
|
| 131 |
+
else if (cmd_rdy_o && cmd_valid_i)
|
| 132 |
+
wait_cnt <= #TCQ 2'b10;
|
| 133 |
+
else if (wait_cnt > 0)
|
| 134 |
+
wait_cnt <= #TCQ wait_cnt - 1;
|
| 135 |
+
|
| 136 |
+
end
|
| 137 |
+
|
| 138 |
+
always @(posedge clk_i)
|
| 139 |
+
begin
|
| 140 |
+
if (rst_i)
|
| 141 |
+
wait_done <= #TCQ 1'b1;
|
| 142 |
+
else if (cmd_rdy_o && cmd_valid_i)
|
| 143 |
+
wait_done <= #TCQ 1'b0;
|
| 144 |
+
else if (wait_cnt == 0)
|
| 145 |
+
wait_done <= #TCQ 1'b1;
|
| 146 |
+
else
|
| 147 |
+
wait_done <= #TCQ 1'b0;
|
| 148 |
+
|
| 149 |
+
end
|
| 150 |
+
|
| 151 |
+
reg dfifo_has_enough_room_d1;
|
| 152 |
+
always @ (posedge clk_i)
|
| 153 |
+
begin // prbs_blen from cmd_gen is random, it can be two 64 in consecutive
|
| 154 |
+
// the logic here to prevent cmd_gen send any further read command if
|
| 155 |
+
// any large bl command has been sent.
|
| 156 |
+
|
| 157 |
+
dfifo_has_enough_room <= #TCQ (buf_avail_r >= 62 ) ? 1'b1: 1'b0;
|
| 158 |
+
|
| 159 |
+
dfifo_has_enough_room_d1 <= #TCQ dfifo_has_enough_room ;
|
| 160 |
+
end
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
assign wr_en = cmd_valid_i & !full & dfifo_has_enough_room_d1 & wait_done;
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
always @ (posedge clk_i)
|
| 167 |
+
data_valid_r <= #TCQ data_valid_i;
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
always @ (posedge clk_i)
|
| 171 |
+
begin
|
| 172 |
+
if (data_valid_i && user_bl_cnt_is_1) // current count is 1 and data_is_valie, then next cycle is not 1
|
| 173 |
+
user_bl_cnt_not_1 <= #TCQ 1'b1;
|
| 174 |
+
else
|
| 175 |
+
user_bl_cnt_not_1 <= #TCQ 1'b0;
|
| 176 |
+
end
|
| 177 |
+
|
| 178 |
+
always @ (posedge clk_i)
|
| 179 |
+
begin
|
| 180 |
+
if (rst_i) begin
|
| 181 |
+
rd_data_counts_asked <= #TCQ 'b0;
|
| 182 |
+
end
|
| 183 |
+
else if (cmd_en_i && cmd_sent[0] == 1) begin
|
| 184 |
+
|
| 185 |
+
rd_data_counts_asked <= #TCQ rd_data_counts_asked + (bl_sent + 7'b0000001) ;
|
| 186 |
+
|
| 187 |
+
end
|
| 188 |
+
end
|
| 189 |
+
|
| 190 |
+
always @ (posedge clk_i)
|
| 191 |
+
begin
|
| 192 |
+
if (rst_i) begin
|
| 193 |
+
rd_data_received_counts <= #TCQ 'b0;
|
| 194 |
+
end
|
| 195 |
+
else if (data_valid_i) begin
|
| 196 |
+
rd_data_received_counts <= #TCQ rd_data_received_counts + 1;
|
| 197 |
+
end
|
| 198 |
+
end
|
| 199 |
+
|
| 200 |
+
// calculate how many buf still available
|
| 201 |
+
always @ (posedge clk_i)
|
| 202 |
+
// MCB FIFO size is 64.
|
| 203 |
+
// buf_available is calculated by:
|
| 204 |
+
// FIFO DEPTH - ( Write Poitner - Read Pointer)
|
| 205 |
+
buf_avail_r <= #TCQ 64 - (rd_data_counts_asked - rd_data_received_counts);
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
always @(gen_rdy_i, empty,empty_r,rd_mdata_fifo_empty,rd_first_data ,data_valid_i,data_valid_r,user_bl_cnt_not_1)
|
| 210 |
+
begin
|
| 211 |
+
if (FAMILY == "SPARTAN6")
|
| 212 |
+
rd_en = gen_rdy_i & !empty;
|
| 213 |
+
else
|
| 214 |
+
if ( MEM_BURST_LEN == 4)
|
| 215 |
+
rd_en = (~empty & empty_r & ~rd_first_data) | (~rd_mdata_fifo_empty & ~empty ) | (user_bl_cnt_not_1 & data_valid_i);
|
| 216 |
+
else
|
| 217 |
+
rd_en = (data_valid_i & ~data_valid_r) | (user_bl_cnt_not_1 & data_valid_i);
|
| 218 |
+
|
| 219 |
+
end
|
| 220 |
+
|
| 221 |
+
always @ (posedge clk_i)
|
| 222 |
+
empty_r <= #TCQ empty;
|
| 223 |
+
|
| 224 |
+
always @ (posedge clk_i)
|
| 225 |
+
begin
|
| 226 |
+
if (rst_i)
|
| 227 |
+
rd_first_data <= #TCQ 1'b0;
|
| 228 |
+
else if (~empty && empty_r)
|
| 229 |
+
rd_first_data <= #TCQ 1'b1;
|
| 230 |
+
end
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
assign gen_valid_o = !empty;
|
| 235 |
+
afifo #
|
| 236 |
+
(
|
| 237 |
+
.TCQ (TCQ),
|
| 238 |
+
.DSIZE (BL_WIDTH+ADDR_WIDTH),
|
| 239 |
+
.FIFO_DEPTH (16),
|
| 240 |
+
.ASIZE (4),
|
| 241 |
+
.SYNC (1) // set the SYNC to 1 because rd_clk = wr_clk to reduce latency
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
)
|
| 245 |
+
rd_fifo
|
| 246 |
+
(
|
| 247 |
+
.wr_clk (clk_i),
|
| 248 |
+
.rst (rst_i),
|
| 249 |
+
.wr_en (wr_en),
|
| 250 |
+
.wr_data ({bl_i,addr_i}),
|
| 251 |
+
.rd_en (rd_en),
|
| 252 |
+
.rd_clk (clk_i),
|
| 253 |
+
.rd_data ({gen_bl_o,gen_addr_o}),
|
| 254 |
+
.full (full),
|
| 255 |
+
.empty (empty),
|
| 256 |
+
.almost_full ()
|
| 257 |
+
|
| 258 |
+
);
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
endmodule
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/sp6_data_gen.v
ADDED
|
@@ -0,0 +1,781 @@
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//*****************************************************************************
|
| 2 |
+
// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MIG
|
| 54 |
+
// / / Filename: data_gen.v
|
| 55 |
+
// /___/ /\ Date Last Modified:
|
| 56 |
+
// \ \ / \ Date Created:
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6
|
| 60 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
//Purpose: This module generates different data pattern as described in
|
| 62 |
+
// parameter DATA_PATTERN and is set up for Spartan 6 family.
|
| 63 |
+
//Reference:
|
| 64 |
+
//Revision History:
|
| 65 |
+
//*****************************************************************************
|
| 66 |
+
|
| 67 |
+
`timescale 1ps/1ps
|
| 68 |
+
|
| 69 |
+
module sp6_data_gen #
|
| 70 |
+
|
| 71 |
+
(
|
| 72 |
+
parameter TCQ = 100,
|
| 73 |
+
parameter ADDR_WIDTH = 32,
|
| 74 |
+
parameter BL_WIDTH = 6,
|
| 75 |
+
parameter DWIDTH = 32,
|
| 76 |
+
parameter DATA_PATTERN = "DGEN_ALL", //"DGEN__HAMMER", "DGEN_WALING1","DGEN_WALING0","DGEN_ADDR","DGEN_NEIGHBOR","DGEN_PRBS","DGEN_ALL"
|
| 77 |
+
parameter NUM_DQ_PINS = 8,
|
| 78 |
+
parameter COLUMN_WIDTH = 10
|
| 79 |
+
|
| 80 |
+
)
|
| 81 |
+
(
|
| 82 |
+
input clk_i, //
|
| 83 |
+
input rst_i,
|
| 84 |
+
input [31:0] prbs_fseed_i,
|
| 85 |
+
|
| 86 |
+
input [3:0] data_mode_i, // "00" = bram;
|
| 87 |
+
input data_rdy_i,
|
| 88 |
+
input cmd_startA,
|
| 89 |
+
input cmd_startB,
|
| 90 |
+
input cmd_startC,
|
| 91 |
+
input cmd_startD,
|
| 92 |
+
input cmd_startE,
|
| 93 |
+
input [DWIDTH-1:0] fixed_data_i,
|
| 94 |
+
|
| 95 |
+
input [ADDR_WIDTH-1:0] addr_i, // generated address used to determine data pattern.
|
| 96 |
+
input [6:0] user_burst_cnt, // generated burst length for control the burst data
|
| 97 |
+
|
| 98 |
+
input fifo_rdy_i, // connect from mcb_wr_full when used as wr_data_gen
|
| 99 |
+
// connect from mcb_rd_empty when used as rd_data_gen
|
| 100 |
+
// When both data_rdy and data_valid is asserted, the ouput data is valid.
|
| 101 |
+
output [DWIDTH-1:0] data_o // generated data pattern
|
| 102 |
+
);
|
| 103 |
+
//
|
| 104 |
+
wire [31:0] prbs_data;
|
| 105 |
+
|
| 106 |
+
reg [31:0] adata;
|
| 107 |
+
reg [DWIDTH-1:0] hdata;
|
| 108 |
+
reg [DWIDTH-1:0] ndata;
|
| 109 |
+
reg [DWIDTH - 1:0] w1data;
|
| 110 |
+
reg [DWIDTH-1:0] data;
|
| 111 |
+
reg burst_count_reached2;
|
| 112 |
+
|
| 113 |
+
reg data_valid;
|
| 114 |
+
reg [2:0] walk_cnt;
|
| 115 |
+
reg [ADDR_WIDTH-1:0] user_address;
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
integer i,j;
|
| 119 |
+
reg [BL_WIDTH-1:0] user_bl;
|
| 120 |
+
reg [7:0] BLANK;
|
| 121 |
+
|
| 122 |
+
reg [7:0] SHIFT_0;
|
| 123 |
+
reg [7:0] SHIFT_1;
|
| 124 |
+
reg [7:0] SHIFT_2;
|
| 125 |
+
reg [7:0] SHIFT_3;
|
| 126 |
+
reg [7:0] SHIFT_4;
|
| 127 |
+
reg [7:0] SHIFT_5;
|
| 128 |
+
reg [7:0] SHIFT_6;
|
| 129 |
+
reg [7:0] SHIFT_7;
|
| 130 |
+
reg [31:0] SHIFTB_0 ;
|
| 131 |
+
reg [31:0] SHIFTB_1;
|
| 132 |
+
reg [31:0] SHIFTB_2;
|
| 133 |
+
reg [31:0] SHIFTB_3;
|
| 134 |
+
reg [31:0] SHIFTB_4;
|
| 135 |
+
reg [31:0] SHIFTB_5;
|
| 136 |
+
reg [31:0] SHIFTB_6;
|
| 137 |
+
reg [31:0] SHIFTB_7;
|
| 138 |
+
reg [3:0] TSTB;
|
| 139 |
+
//*********************************************************************************************
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
assign data_o = data;
|
| 146 |
+
|
| 147 |
+
generate
|
| 148 |
+
|
| 149 |
+
if (DWIDTH==32) begin: data_out32
|
| 150 |
+
always @ (adata,hdata,ndata,w1data,prbs_data,data_mode_i,fixed_data_i)
|
| 151 |
+
begin
|
| 152 |
+
case(data_mode_i)
|
| 153 |
+
// 4'b0000: data = 32'b0; //reserved
|
| 154 |
+
4'b0001: data = fixed_data_i; // fixed
|
| 155 |
+
4'b0010: data = adata; // address as data
|
| 156 |
+
4'b0011: data = hdata; // DGEN_HAMMER
|
| 157 |
+
4'b0100: data = ndata; // DGEN_NEIGHBOUR
|
| 158 |
+
4'b0101: data = w1data; // DGEN_WALKING1
|
| 159 |
+
4'b0110: data = w1data; // DGEN_WALKING0
|
| 160 |
+
4'b0111: data = prbs_data;
|
| 161 |
+
default : data = 'b0;
|
| 162 |
+
endcase
|
| 163 |
+
end
|
| 164 |
+
end
|
| 165 |
+
|
| 166 |
+
endgenerate
|
| 167 |
+
|
| 168 |
+
generate
|
| 169 |
+
if (DWIDTH==64) begin: data_out64
|
| 170 |
+
always @ (adata,hdata,ndata,w1data,prbs_data,data_mode_i,fixed_data_i)
|
| 171 |
+
begin
|
| 172 |
+
case(data_mode_i)
|
| 173 |
+
4'b0000: data = 'b0; //reserved
|
| 174 |
+
4'b0001: data = fixed_data_i; // fixed
|
| 175 |
+
4'b0010: data = {adata,adata}; // address as data
|
| 176 |
+
4'b0011: data = hdata; // DGEN_HAMMER
|
| 177 |
+
4'b0100: data = ndata; // DGEN_NEIGHBOUR
|
| 178 |
+
4'b0101: data = w1data; // DGEN_WALKING1
|
| 179 |
+
4'b0110: data = w1data; // DGEN_WALKING0
|
| 180 |
+
4'b0111: data = {prbs_data,prbs_data};
|
| 181 |
+
default : data = 'b0;
|
| 182 |
+
endcase
|
| 183 |
+
end
|
| 184 |
+
end
|
| 185 |
+
endgenerate
|
| 186 |
+
|
| 187 |
+
generate
|
| 188 |
+
if (DWIDTH==128) begin: data_out128
|
| 189 |
+
always @ (adata,hdata,ndata,w1data,prbs_data,data_mode_i,fixed_data_i)
|
| 190 |
+
begin
|
| 191 |
+
case(data_mode_i)
|
| 192 |
+
4'b0000: data = 'b0; //reserved
|
| 193 |
+
4'b0001: data = fixed_data_i; // fixed
|
| 194 |
+
4'b0010: data = {adata,adata,adata,adata}; // address as data
|
| 195 |
+
4'b0011: data = hdata; // DGEN_HAMMER
|
| 196 |
+
4'b0100: data = ndata; // DGEN_NEIGHBOUR
|
| 197 |
+
4'b0101: data = w1data; // DGEN_WALKING1
|
| 198 |
+
4'b0110: data = w1data; // DGEN_WALKING0
|
| 199 |
+
4'b0111: data = {prbs_data,prbs_data,prbs_data,prbs_data};
|
| 200 |
+
default : data = 'b0;
|
| 201 |
+
endcase
|
| 202 |
+
end
|
| 203 |
+
end
|
| 204 |
+
endgenerate
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
// WALKING ONES:
|
| 208 |
+
|
| 209 |
+
generate
|
| 210 |
+
if ((DWIDTH == 64) ||(DWIDTH == 128)) begin: SHIFT_VALUE
|
| 211 |
+
|
| 212 |
+
always @ (data_mode_i) begin
|
| 213 |
+
if (data_mode_i == 3'b101 || data_mode_i == 3'b100) begin // WALKING ONE
|
| 214 |
+
BLANK = 8'h00;
|
| 215 |
+
SHIFT_0 = 8'h01;
|
| 216 |
+
SHIFT_1 = 8'h02;
|
| 217 |
+
SHIFT_2 = 8'h04;
|
| 218 |
+
SHIFT_3 = 8'h08;
|
| 219 |
+
SHIFT_4 = 8'h10;
|
| 220 |
+
SHIFT_5 = 8'h20;
|
| 221 |
+
SHIFT_6 = 8'h40;
|
| 222 |
+
SHIFT_7 = 8'h80;
|
| 223 |
+
|
| 224 |
+
end
|
| 225 |
+
else if (data_mode_i == 3'b100)begin // NEIGHBOR ONE
|
| 226 |
+
BLANK = 8'h00;
|
| 227 |
+
SHIFT_0 = 8'h01;
|
| 228 |
+
SHIFT_1 = 8'h02;
|
| 229 |
+
SHIFT_2 = 8'h04;
|
| 230 |
+
SHIFT_3 = 8'h08;
|
| 231 |
+
SHIFT_4 = 8'h10;
|
| 232 |
+
SHIFT_5 = 8'h20;
|
| 233 |
+
SHIFT_6 = 8'h40;
|
| 234 |
+
SHIFT_7 = 8'h80;
|
| 235 |
+
end
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
else if (data_mode_i == 3'b110) begin // WALKING ZERO
|
| 240 |
+
BLANK = 8'hff;
|
| 241 |
+
SHIFT_0 = 8'hfe;
|
| 242 |
+
SHIFT_1 = 8'hfd;
|
| 243 |
+
SHIFT_2 = 8'hfb;
|
| 244 |
+
SHIFT_3 = 8'hf7;
|
| 245 |
+
SHIFT_4 = 8'hef;
|
| 246 |
+
SHIFT_5 = 8'hdf;
|
| 247 |
+
SHIFT_6 = 8'hbf;
|
| 248 |
+
SHIFT_7 = 8'h7f;
|
| 249 |
+
end
|
| 250 |
+
else begin
|
| 251 |
+
BLANK = 8'hff;
|
| 252 |
+
SHIFT_0 = 8'hfe;
|
| 253 |
+
SHIFT_1 = 8'hfd;
|
| 254 |
+
SHIFT_2 = 8'hfb;
|
| 255 |
+
SHIFT_3 = 8'hf7;
|
| 256 |
+
SHIFT_4 = 8'hef;
|
| 257 |
+
SHIFT_5 = 8'hdf;
|
| 258 |
+
SHIFT_6 = 8'hbf;
|
| 259 |
+
SHIFT_7 = 8'h7f;
|
| 260 |
+
end
|
| 261 |
+
|
| 262 |
+
end
|
| 263 |
+
end
|
| 264 |
+
endgenerate
|
| 265 |
+
|
| 266 |
+
always @ (data_mode_i) begin
|
| 267 |
+
|
| 268 |
+
if (data_mode_i == 3'b101 ) begin // WALKING ONE
|
| 269 |
+
|
| 270 |
+
SHIFTB_0 = 32'h0002_0001;
|
| 271 |
+
SHIFTB_1 = 32'h0008_0004;
|
| 272 |
+
SHIFTB_2 = 32'h0020_0010;
|
| 273 |
+
SHIFTB_3 = 32'h0080_0040;
|
| 274 |
+
SHIFTB_4 = 32'h0200_0100;
|
| 275 |
+
SHIFTB_5 = 32'h0800_0400;
|
| 276 |
+
SHIFTB_6 = 32'h2000_1000;
|
| 277 |
+
SHIFTB_7 = 32'h8000_4000;
|
| 278 |
+
end
|
| 279 |
+
else if (data_mode_i == 3'b100)begin // NEIGHBOR ONE
|
| 280 |
+
|
| 281 |
+
SHIFTB_0 = 32'h0000_0001;
|
| 282 |
+
SHIFTB_1 = 32'h0000_0002;
|
| 283 |
+
SHIFTB_2 = 32'h0000_0004;
|
| 284 |
+
SHIFTB_3 = 32'h0000_0008;
|
| 285 |
+
SHIFTB_4 = 32'h0000_0010;
|
| 286 |
+
SHIFTB_5 = 32'h0000_0020;
|
| 287 |
+
SHIFTB_6 = 32'h0000_0040;
|
| 288 |
+
SHIFTB_7 = 32'h0000_0080;
|
| 289 |
+
end
|
| 290 |
+
|
| 291 |
+
else begin // WALKING ZERO
|
| 292 |
+
SHIFTB_0 = 32'hfffd_fffe;
|
| 293 |
+
SHIFTB_1 = 32'hfff7_fffb;
|
| 294 |
+
SHIFTB_2 = 32'hffdf_ffef;
|
| 295 |
+
SHIFTB_3 = 32'hff7f_ffbf;
|
| 296 |
+
SHIFTB_4 = 32'hfdff_feff;
|
| 297 |
+
SHIFTB_5 = 32'hf7ff_fbff;
|
| 298 |
+
SHIFTB_6 = 32'hdfff_efff;
|
| 299 |
+
SHIFTB_7 = 32'h7fff_bfff;
|
| 300 |
+
end
|
| 301 |
+
|
| 302 |
+
end
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
reg [DWIDTH-1:0] tmpdata ;
|
| 309 |
+
reg ndata_rising;
|
| 310 |
+
reg shift_en;
|
| 311 |
+
generate
|
| 312 |
+
if (DWIDTH == 32 && (DATA_PATTERN == "DGEN_WALKING0" || DATA_PATTERN == "DGEN_WALKING1" ||
|
| 313 |
+
DATA_PATTERN == "DGEN_ALL")) begin : WALKING_ONE_32_PATTERN
|
| 314 |
+
|
| 315 |
+
always @ (posedge clk_i)
|
| 316 |
+
begin
|
| 317 |
+
if (rst_i) begin
|
| 318 |
+
w1data <= #TCQ 'b0;
|
| 319 |
+
ndata_rising <= #TCQ 1'b1;
|
| 320 |
+
shift_en <= #TCQ 1'b0;
|
| 321 |
+
end
|
| 322 |
+
else if((fifo_rdy_i && user_burst_cnt != 6'd0) || cmd_startC )
|
| 323 |
+
if (NUM_DQ_PINS == 16)
|
| 324 |
+
begin
|
| 325 |
+
if(cmd_startC)
|
| 326 |
+
begin
|
| 327 |
+
case (addr_i[4:2])
|
| 328 |
+
0: w1data <= #TCQ SHIFTB_0;
|
| 329 |
+
1: w1data <= #TCQ SHIFTB_1;
|
| 330 |
+
2: w1data <= #TCQ SHIFTB_2;
|
| 331 |
+
3: w1data <= #TCQ SHIFTB_3;
|
| 332 |
+
4: w1data <= #TCQ SHIFTB_4;
|
| 333 |
+
5: w1data <= #TCQ SHIFTB_5;
|
| 334 |
+
6: w1data <= #TCQ SHIFTB_6;
|
| 335 |
+
7: w1data <= #TCQ SHIFTB_7;
|
| 336 |
+
|
| 337 |
+
default :w1data <= #TCQ SHIFTB_0;
|
| 338 |
+
endcase
|
| 339 |
+
|
| 340 |
+
ndata_rising <= #TCQ 1'b0;
|
| 341 |
+
end //(NUM_DQ_PINS == 16) (cmd_startC)
|
| 342 |
+
else //shifting
|
| 343 |
+
if (data_mode_i == 3'b100)
|
| 344 |
+
w1data <= #TCQ {16'h0000,w1data[14:0],w1data[15]};
|
| 345 |
+
else
|
| 346 |
+
w1data <= #TCQ {w1data[29:16],w1data[31:30],w1data[13:0],w1data[15:14]};
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
end //(DQ_PINS == 16
|
| 350 |
+
else if (NUM_DQ_PINS == 8) begin
|
| 351 |
+
if(cmd_startC) // loading data pattern according the incoming address
|
| 352 |
+
begin
|
| 353 |
+
case (addr_i[2])
|
| 354 |
+
0: w1data <= #TCQ SHIFTB_0;
|
| 355 |
+
1: w1data <= #TCQ SHIFTB_1;
|
| 356 |
+
default :w1data <= #TCQ SHIFTB_0;
|
| 357 |
+
endcase
|
| 358 |
+
end // (cmd_startC)
|
| 359 |
+
else // Shifting
|
| 360 |
+
// need neigbour pattern ********************
|
| 361 |
+
w1data <= #TCQ {w1data[27:24],w1data[31:28],w1data[19:16],w1data[23:20],
|
| 362 |
+
w1data[11:8] ,w1data[15:12],w1data[3:0] ,w1data[7:4]};
|
| 363 |
+
|
| 364 |
+
end //(NUM_DQ_PINS == 8)
|
| 365 |
+
else if (NUM_DQ_PINS == 4) begin // NUM_DQ_PINS == 4
|
| 366 |
+
// need neigbour pattern ********************
|
| 367 |
+
if (data_mode_i == 3'b100)
|
| 368 |
+
w1data <= #TCQ 32'h0804_0201;
|
| 369 |
+
else
|
| 370 |
+
w1data <= #TCQ 32'h8421_8421;
|
| 371 |
+
end // (NUM_DQ_PINS_4
|
| 372 |
+
|
| 373 |
+
end
|
| 374 |
+
end
|
| 375 |
+
endgenerate // DWIDTH == 32
|
| 376 |
+
|
| 377 |
+
generate
|
| 378 |
+
if (DWIDTH == 64 && (DATA_PATTERN == "DGEN_WALKING0" || DATA_PATTERN == "DGEN_WALKING1"
|
| 379 |
+
|| DATA_PATTERN == "DGEN_ALL")) begin : WALKING_ONE_64_PATTERN
|
| 380 |
+
|
| 381 |
+
always @ (posedge clk_i)
|
| 382 |
+
begin
|
| 383 |
+
if (rst_i)
|
| 384 |
+
w1data <= #TCQ 'b0;
|
| 385 |
+
|
| 386 |
+
else if((fifo_rdy_i && user_burst_cnt != 6'd0) || cmd_startC )
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
|
| 390 |
+
if (NUM_DQ_PINS == 16)
|
| 391 |
+
begin
|
| 392 |
+
if(cmd_startC)
|
| 393 |
+
begin
|
| 394 |
+
|
| 395 |
+
case (addr_i[4:3])
|
| 396 |
+
|
| 397 |
+
|
| 398 |
+
0: begin
|
| 399 |
+
// 7:0
|
| 400 |
+
w1data[2*DWIDTH/4-1:0*DWIDTH/4] <= #TCQ SHIFTB_0;
|
| 401 |
+
w1data[4*DWIDTH/4-1:2*DWIDTH/4] <= #TCQ SHIFTB_1;
|
| 402 |
+
|
| 403 |
+
end
|
| 404 |
+
1: begin
|
| 405 |
+
w1data[2*DWIDTH/4-1:0*DWIDTH/4] <= #TCQ SHIFTB_2;
|
| 406 |
+
w1data[4*DWIDTH/4-1:2*DWIDTH/4] <= #TCQ SHIFTB_3;
|
| 407 |
+
end
|
| 408 |
+
|
| 409 |
+
2: begin
|
| 410 |
+
w1data[2*DWIDTH/4-1:0*DWIDTH/4] <= #TCQ SHIFTB_4;
|
| 411 |
+
w1data[4*DWIDTH/4-1:2*DWIDTH/4] <= #TCQ SHIFTB_5;
|
| 412 |
+
end
|
| 413 |
+
3: begin
|
| 414 |
+
w1data[2*DWIDTH/4-1:0*DWIDTH/4] <= #TCQ SHIFTB_6;
|
| 415 |
+
w1data[4*DWIDTH/4-1:2*DWIDTH/4] <= #TCQ SHIFTB_7;
|
| 416 |
+
|
| 417 |
+
end
|
| 418 |
+
|
| 419 |
+
|
| 420 |
+
default :begin
|
| 421 |
+
w1data <= #TCQ BLANK; //15:8
|
| 422 |
+
end
|
| 423 |
+
|
| 424 |
+
endcase
|
| 425 |
+
|
| 426 |
+
|
| 427 |
+
end //(NUM_DQ_PINS == 16) (cmd_startC)
|
| 428 |
+
else begin //shifting
|
| 429 |
+
if (data_mode_i == 3'b100)
|
| 430 |
+
begin
|
| 431 |
+
w1data[63:48] <= #TCQ {16'h0000};
|
| 432 |
+
w1data[47:32] <= #TCQ {w1data[45:32],w1data[47:46]};
|
| 433 |
+
w1data[31:16] <= #TCQ {16'h0000};
|
| 434 |
+
w1data[15:0] <= #TCQ {w1data[13:0],w1data[15:14]};
|
| 435 |
+
|
| 436 |
+
end
|
| 437 |
+
else
|
| 438 |
+
|
| 439 |
+
w1data[DWIDTH - 1:0] <= #TCQ {
|
| 440 |
+
w1data[4*DWIDTH/4 - 5:4*DWIDTH/4 - 16],
|
| 441 |
+
w1data[4*DWIDTH/4 - 1 :4*DWIDTH/4 - 4],
|
| 442 |
+
|
| 443 |
+
w1data[3*DWIDTH/4 - 5:3*DWIDTH/4 - 16],
|
| 444 |
+
w1data[3*DWIDTH/4 - 1 :3*DWIDTH/4 - 4],
|
| 445 |
+
|
| 446 |
+
w1data[2*DWIDTH/4 - 5:2*DWIDTH/4 - 16],
|
| 447 |
+
w1data[2*DWIDTH/4 - 1 :2*DWIDTH/4 - 4],
|
| 448 |
+
|
| 449 |
+
w1data[1*DWIDTH/4 - 5:1*DWIDTH/4 - 16],
|
| 450 |
+
w1data[1*DWIDTH/4 - 1 :1*DWIDTH/4 - 4]
|
| 451 |
+
|
| 452 |
+
};
|
| 453 |
+
|
| 454 |
+
|
| 455 |
+
end
|
| 456 |
+
|
| 457 |
+
end //(DQ_PINS == 16
|
| 458 |
+
else if (NUM_DQ_PINS == 8) begin
|
| 459 |
+
if(cmd_startC) // loading data pattern according the incoming address
|
| 460 |
+
|
| 461 |
+
if (data_mode_i == 3'b100)
|
| 462 |
+
|
| 463 |
+
case (addr_i[3])
|
| 464 |
+
|
| 465 |
+
|
| 466 |
+
0: w1data <= #TCQ {
|
| 467 |
+
BLANK,SHIFT_3,BLANK,SHIFT_2,
|
| 468 |
+
BLANK,SHIFT_1,BLANK,SHIFT_0
|
| 469 |
+
};
|
| 470 |
+
|
| 471 |
+
1: w1data <= #TCQ {
|
| 472 |
+
BLANK,SHIFT_7,BLANK,SHIFT_6,
|
| 473 |
+
BLANK,SHIFT_5,BLANK,SHIFT_4
|
| 474 |
+
};
|
| 475 |
+
|
| 476 |
+
default :begin
|
| 477 |
+
w1data <= #TCQ 'b0; //15:8
|
| 478 |
+
end
|
| 479 |
+
|
| 480 |
+
endcase
|
| 481 |
+
|
| 482 |
+
else
|
| 483 |
+
w1data <= #TCQ {32'h8040_2010,32'h0804_0201}; //**** checked
|
| 484 |
+
else // Shifting
|
| 485 |
+
if (data_mode_i == 3'b100)
|
| 486 |
+
|
| 487 |
+
begin
|
| 488 |
+
w1data[63:56] <= #TCQ {8'h00};
|
| 489 |
+
w1data[55:48] <= #TCQ {w1data[51:48],w1data[55:52]};
|
| 490 |
+
|
| 491 |
+
w1data[47:40] <= #TCQ {8'h00};
|
| 492 |
+
w1data[39:32] <= #TCQ {w1data[35:32],w1data[39:36]};
|
| 493 |
+
|
| 494 |
+
w1data[31:24] <= #TCQ {8'h00};
|
| 495 |
+
w1data[23:16] <= #TCQ {w1data[19:16],w1data[23:20]};
|
| 496 |
+
|
| 497 |
+
w1data[15:8] <= #TCQ {8'h00};
|
| 498 |
+
w1data[7:0] <= #TCQ {w1data[3:0],w1data[7:4]};
|
| 499 |
+
|
| 500 |
+
end
|
| 501 |
+
else
|
| 502 |
+
w1data <= #TCQ w1data;
|
| 503 |
+
end //(NUM_DQ_PINS == 8)
|
| 504 |
+
else if (NUM_DQ_PINS == 4) // NUM_DQ_PINS == 4
|
| 505 |
+
if (data_mode_i == 3'b100)
|
| 506 |
+
w1data <= #TCQ 64'h0804_0201_0804_0201;
|
| 507 |
+
else
|
| 508 |
+
w1data <= #TCQ 64'h8421_8421_8421_8421;
|
| 509 |
+
|
| 510 |
+
end
|
| 511 |
+
end
|
| 512 |
+
endgenerate
|
| 513 |
+
|
| 514 |
+
generate
|
| 515 |
+
|
| 516 |
+
if (DWIDTH == 128 && (DATA_PATTERN == "DGEN_WALKING0" || DATA_PATTERN == "DGEN_WALKING1" || DATA_PATTERN == "DGEN_ALL")) begin : WALKING_ONE_128_PATTERN
|
| 517 |
+
|
| 518 |
+
always @ (posedge clk_i)
|
| 519 |
+
begin
|
| 520 |
+
if (rst_i)
|
| 521 |
+
w1data <= #TCQ 'b0;
|
| 522 |
+
|
| 523 |
+
else if((fifo_rdy_i && user_burst_cnt != 6'd0) || cmd_startC )
|
| 524 |
+
|
| 525 |
+
|
| 526 |
+
|
| 527 |
+
if (NUM_DQ_PINS == 16)
|
| 528 |
+
begin
|
| 529 |
+
if(cmd_startC)
|
| 530 |
+
begin
|
| 531 |
+
case (addr_i[4])
|
| 532 |
+
|
| 533 |
+
|
| 534 |
+
0: begin
|
| 535 |
+
|
| 536 |
+
w1data[1*DWIDTH/4-1:0*DWIDTH/4] <= #TCQ SHIFTB_0;
|
| 537 |
+
w1data[2*DWIDTH/4-1:1*DWIDTH/4] <= #TCQ SHIFTB_1; // 32
|
| 538 |
+
w1data[3*DWIDTH/4-1:2*DWIDTH/4] <= #TCQ SHIFTB_2;
|
| 539 |
+
w1data[4*DWIDTH/4-1:3*DWIDTH/4] <= #TCQ SHIFTB_3;
|
| 540 |
+
|
| 541 |
+
|
| 542 |
+
end
|
| 543 |
+
1: begin
|
| 544 |
+
|
| 545 |
+
w1data[1*DWIDTH/4-1:0*DWIDTH/4] <= #TCQ SHIFTB_4;
|
| 546 |
+
w1data[2*DWIDTH/4-1:1*DWIDTH/4] <= #TCQ SHIFTB_5; // 32
|
| 547 |
+
w1data[3*DWIDTH/4-1:2*DWIDTH/4] <= #TCQ SHIFTB_6;
|
| 548 |
+
w1data[4*DWIDTH/4-1:3*DWIDTH/4] <= #TCQ SHIFTB_7;
|
| 549 |
+
|
| 550 |
+
end
|
| 551 |
+
|
| 552 |
+
default :begin
|
| 553 |
+
w1data <= #TCQ BLANK; //15:8
|
| 554 |
+
|
| 555 |
+
end
|
| 556 |
+
|
| 557 |
+
endcase
|
| 558 |
+
|
| 559 |
+
end //(NUM_DQ_PINS == 16) (cmd_startC)
|
| 560 |
+
else begin //shifting
|
| 561 |
+
if (data_mode_i == 3'b100)
|
| 562 |
+
begin
|
| 563 |
+
w1data[127:112] <= #TCQ {16'h0000};
|
| 564 |
+
w1data[111:96] <= #TCQ {w1data[107:96],w1data[111:108]};
|
| 565 |
+
w1data[95:80] <= #TCQ {16'h0000};
|
| 566 |
+
w1data[79:64] <= #TCQ {w1data[75:64],w1data[79:76]};
|
| 567 |
+
|
| 568 |
+
|
| 569 |
+
w1data[63:48] <= #TCQ {16'h0000};
|
| 570 |
+
w1data[47:32] <= #TCQ {w1data[43:32],w1data[47:44]};
|
| 571 |
+
w1data[31:16] <= #TCQ {16'h0000};
|
| 572 |
+
w1data[15:0] <= #TCQ {w1data[11:0],w1data[15:12]};
|
| 573 |
+
|
| 574 |
+
end
|
| 575 |
+
else begin
|
| 576 |
+
w1data[DWIDTH - 1:0] <= #TCQ {
|
| 577 |
+
w1data[4*DWIDTH/4 - 9:4*DWIDTH/4 - 16],
|
| 578 |
+
w1data[4*DWIDTH/4 - 1 :4*DWIDTH/4 - 8],
|
| 579 |
+
w1data[4*DWIDTH/4 - 25:4*DWIDTH/4 -32],
|
| 580 |
+
w1data[4*DWIDTH/4 - 17:4*DWIDTH/4 -24],
|
| 581 |
+
|
| 582 |
+
w1data[3*DWIDTH/4 - 9:3*DWIDTH/4 - 16],
|
| 583 |
+
w1data[3*DWIDTH/4 - 1 :3*DWIDTH/4 - 8],
|
| 584 |
+
w1data[3*DWIDTH/4 - 25:3*DWIDTH/4 - 32],
|
| 585 |
+
w1data[3*DWIDTH/4 - 17:3*DWIDTH/4 - 24],
|
| 586 |
+
|
| 587 |
+
w1data[2*DWIDTH/4 - 9:2*DWIDTH/4 - 16],
|
| 588 |
+
w1data[2*DWIDTH/4 - 1 :2*DWIDTH/4 - 8],
|
| 589 |
+
w1data[2*DWIDTH/4 - 25:2*DWIDTH/4 - 32],
|
| 590 |
+
w1data[2*DWIDTH/4 - 17:2*DWIDTH/4 - 24],
|
| 591 |
+
|
| 592 |
+
|
| 593 |
+
w1data[1*DWIDTH/4 - 9:1*DWIDTH/4 - 16],
|
| 594 |
+
w1data[1*DWIDTH/4 - 1 :1*DWIDTH/4 - 8],
|
| 595 |
+
w1data[1*DWIDTH/4 - 25:1*DWIDTH/4 - 32],
|
| 596 |
+
w1data[1*DWIDTH/4 - 17 :1*DWIDTH/4 - 24]
|
| 597 |
+
};
|
| 598 |
+
end
|
| 599 |
+
|
| 600 |
+
end
|
| 601 |
+
|
| 602 |
+
end //(DQ_PINS == 16
|
| 603 |
+
else if (NUM_DQ_PINS == 8) begin
|
| 604 |
+
if(cmd_startC) // loading data pattern according the incoming address
|
| 605 |
+
begin
|
| 606 |
+
if (data_mode_i == 3'b100)
|
| 607 |
+
w1data <= #TCQ {
|
| 608 |
+
BLANK,SHIFT_7,BLANK,SHIFT_6,
|
| 609 |
+
BLANK,SHIFT_5,BLANK,SHIFT_4,
|
| 610 |
+
BLANK,SHIFT_3,BLANK,SHIFT_2,
|
| 611 |
+
BLANK,SHIFT_1,BLANK,SHIFT_0
|
| 612 |
+
};
|
| 613 |
+
else
|
| 614 |
+
// w1data <= #TCQ {32'h8040_2010,32'h0804_0201,32'h8040_2010,32'h0804_0201};
|
| 615 |
+
w1data <= #TCQ {
|
| 616 |
+
SHIFT_7,SHIFT_6,SHIFT_5,SHIFT_4,
|
| 617 |
+
SHIFT_3,SHIFT_2,SHIFT_1,SHIFT_0,
|
| 618 |
+
SHIFT_7,SHIFT_6,SHIFT_5,SHIFT_4,
|
| 619 |
+
SHIFT_3,SHIFT_2,SHIFT_1,SHIFT_0
|
| 620 |
+
};
|
| 621 |
+
|
| 622 |
+
|
| 623 |
+
end // (cmd_startC)
|
| 624 |
+
else // Shifting
|
| 625 |
+
|
| 626 |
+
begin
|
| 627 |
+
|
| 628 |
+
w1data <= #TCQ w1data;//{w1data[96:64], w1data[127:97],w1data[31:0], w1data[63:32]};
|
| 629 |
+
end // else
|
| 630 |
+
end //(NUM_DQ_PINS == 8)
|
| 631 |
+
else
|
| 632 |
+
if (data_mode_i == 3'b100)
|
| 633 |
+
w1data <= #TCQ 128'h0804_0201_0804_0201_0804_0201_0804_0201;
|
| 634 |
+
else
|
| 635 |
+
w1data <= #TCQ 128'h8421_8421_8421_8421_8421_8421_8421_8421;
|
| 636 |
+
|
| 637 |
+
end
|
| 638 |
+
end
|
| 639 |
+
endgenerate
|
| 640 |
+
|
| 641 |
+
// HAMMER_PATTERN: Alternating 1s and 0s on DQ pins
|
| 642 |
+
// => the rsing data pattern will be 32'b11111111_11111111_11111111_11111111
|
| 643 |
+
// => the falling data pattern will be 32'b00000000_00000000_00000000_00000000
|
| 644 |
+
generate
|
| 645 |
+
if ( DWIDTH == 32 &&( DATA_PATTERN == "DGEN_HAMMER" || DATA_PATTERN == "DGEN_ALL")) begin : HAMMER_PATTERN_32
|
| 646 |
+
always @ (posedge clk_i)
|
| 647 |
+
begin
|
| 648 |
+
if (rst_i)
|
| 649 |
+
hdata <= #TCQ 'd0;
|
| 650 |
+
else if((fifo_rdy_i && user_burst_cnt != 6'd0) || cmd_startC ) begin
|
| 651 |
+
if (NUM_DQ_PINS == 16)
|
| 652 |
+
hdata <= #TCQ 32'h0000_FFFF;
|
| 653 |
+
else if (NUM_DQ_PINS == 8)
|
| 654 |
+
hdata <= #TCQ 32'h00FF_00FF;
|
| 655 |
+
else if (NUM_DQ_PINS == 4) // NUM_DQ_PINS == 4
|
| 656 |
+
hdata <= #TCQ 32'h0F0F_0F0F;
|
| 657 |
+
end
|
| 658 |
+
end
|
| 659 |
+
end
|
| 660 |
+
endgenerate
|
| 661 |
+
|
| 662 |
+
|
| 663 |
+
generate
|
| 664 |
+
if ( DWIDTH == 64 && (DATA_PATTERN == "DGEN_HAMMER" || DATA_PATTERN == "DGEN_ALL")) begin : HAMMER_PATTERN_64
|
| 665 |
+
always @ (posedge clk_i)
|
| 666 |
+
begin
|
| 667 |
+
if (rst_i)
|
| 668 |
+
hdata <= #TCQ 'd0;
|
| 669 |
+
else if((fifo_rdy_i && user_burst_cnt != 6'd0) || cmd_startC )
|
| 670 |
+
if (NUM_DQ_PINS == 16)
|
| 671 |
+
hdata <= #TCQ 64'h0000FFFF_0000FFFF;
|
| 672 |
+
else if (NUM_DQ_PINS == 8)
|
| 673 |
+
hdata <= #TCQ 64'h00FF00FF_00FF00FF;
|
| 674 |
+
else if (NUM_DQ_PINS == 4) // NUM_DQ_PINS == 4
|
| 675 |
+
hdata <= #TCQ 64'h0F0F_0F0F_0F0F_0F0F;
|
| 676 |
+
|
| 677 |
+
end
|
| 678 |
+
end
|
| 679 |
+
endgenerate
|
| 680 |
+
|
| 681 |
+
|
| 682 |
+
generate
|
| 683 |
+
if ( DWIDTH == 128 && (DATA_PATTERN == "DGEN_HAMMER" || DATA_PATTERN == "DGEN_ALL")) begin : HAMMER_PATTERN_128
|
| 684 |
+
always @ (posedge clk_i)
|
| 685 |
+
begin
|
| 686 |
+
if (rst_i)
|
| 687 |
+
hdata <= #TCQ 'd0;
|
| 688 |
+
else if((fifo_rdy_i && user_burst_cnt != 6'd0) || cmd_startC )
|
| 689 |
+
if (NUM_DQ_PINS == 16)
|
| 690 |
+
hdata <= #TCQ 128'h0000FFFF_0000FFFF_0000FFFF_0000FFFF;
|
| 691 |
+
else if (NUM_DQ_PINS == 8)
|
| 692 |
+
hdata <= #TCQ 128'h00FF00FF_00FF00FF_00FF00FF_00FF00FF;
|
| 693 |
+
else if (NUM_DQ_PINS == 4) // NUM_DQ_PINS == 4
|
| 694 |
+
hdata <= #TCQ 128'h0F0F_0F0F_0F0F_0F0F_0F0F_0F0F_0F0F_0F0F;
|
| 695 |
+
|
| 696 |
+
end
|
| 697 |
+
end
|
| 698 |
+
endgenerate
|
| 699 |
+
|
| 700 |
+
|
| 701 |
+
always @ (w1data,hdata)
|
| 702 |
+
begin
|
| 703 |
+
for (i=0; i <= DWIDTH - 1; i= i+1)
|
| 704 |
+
ndata[i] = hdata[i] ^ w1data[i];
|
| 705 |
+
|
| 706 |
+
end
|
| 707 |
+
|
| 708 |
+
|
| 709 |
+
|
| 710 |
+
|
| 711 |
+
// HAMMER_PATTERN_MINUS: generate walking HAMMER data pattern except 1 bit for the whole burst. The incoming addr_i[5:2] determine
|
| 712 |
+
// the position of the pin driving oppsite polarity
|
| 713 |
+
// addr_i[6:2] = 5'h0f ; 32 bit data port
|
| 714 |
+
// => the rsing data pattern will be 32'b11111111_11111111_01111111_11111111
|
| 715 |
+
// => the falling data pattern will be 32'b00000000_00000000_00000000_00000000
|
| 716 |
+
|
| 717 |
+
// ADDRESS_PATTERN: use the address as the 1st data pattern for the whole burst. For example
|
| 718 |
+
// Dataport 32 bit width with starting addr_i = 30'h12345678, user burst length 4
|
| 719 |
+
// => the 1st data pattern : 32'h12345678
|
| 720 |
+
// => the 2nd data pattern : 32'h12345679
|
| 721 |
+
// => the 3rd data pattern : 32'h1234567a
|
| 722 |
+
// => the 4th data pattern : 32'h1234567b
|
| 723 |
+
generate
|
| 724 |
+
|
| 725 |
+
//data_rdy_i
|
| 726 |
+
|
| 727 |
+
if (DATA_PATTERN == "DGEN_ADDR" || DATA_PATTERN == "DGEN_ALL") begin : ADDRESS_PATTERN
|
| 728 |
+
//data_o logic
|
| 729 |
+
always @ (posedge clk_i)
|
| 730 |
+
begin
|
| 731 |
+
if (cmd_startD)
|
| 732 |
+
adata <= #TCQ addr_i;
|
| 733 |
+
else if(fifo_rdy_i && data_rdy_i && user_burst_cnt > 6'd1)
|
| 734 |
+
if (DWIDTH == 128)
|
| 735 |
+
adata <= #TCQ adata + 16;
|
| 736 |
+
else if (DWIDTH == 64)
|
| 737 |
+
adata <= #TCQ adata + 8;
|
| 738 |
+
else // DWIDTH == 32
|
| 739 |
+
adata <= #TCQ adata + 4;
|
| 740 |
+
end
|
| 741 |
+
end
|
| 742 |
+
endgenerate
|
| 743 |
+
|
| 744 |
+
|
| 745 |
+
// PRBS_PATTERN: use the address as the PRBS seed data pattern for the whole burst. For example
|
| 746 |
+
// Dataport 32 bit width with starting addr_i = 30'h12345678, user burst length 4
|
| 747 |
+
//
|
| 748 |
+
|
| 749 |
+
generate
|
| 750 |
+
if (DATA_PATTERN == "DGEN_PRBS" || DATA_PATTERN == "DGEN_ALL") begin : PRBS_PATTERN
|
| 751 |
+
|
| 752 |
+
// PRBS DATA GENERATION
|
| 753 |
+
// xor all the tap positions before feedback to 1st stage.
|
| 754 |
+
|
| 755 |
+
|
| 756 |
+
|
| 757 |
+
assign data_clk_en = fifo_rdy_i && data_rdy_i && user_burst_cnt > 6'd1;
|
| 758 |
+
|
| 759 |
+
|
| 760 |
+
data_prbs_gen #
|
| 761 |
+
(
|
| 762 |
+
.TCQ (TCQ),
|
| 763 |
+
.PRBS_WIDTH (32),
|
| 764 |
+
.SEED_WIDTH (32)
|
| 765 |
+
)
|
| 766 |
+
data_prbs_gen
|
| 767 |
+
(
|
| 768 |
+
.clk_i (clk_i),
|
| 769 |
+
.clk_en (data_clk_en),
|
| 770 |
+
.rst_i (rst_i),
|
| 771 |
+
.prbs_fseed_i (prbs_fseed_i),
|
| 772 |
+
.prbs_seed_init (cmd_startE),
|
| 773 |
+
.prbs_seed_i (addr_i[31:0]),
|
| 774 |
+
.prbs_o (prbs_data)
|
| 775 |
+
|
| 776 |
+
);
|
| 777 |
+
end
|
| 778 |
+
endgenerate
|
| 779 |
+
|
| 780 |
+
|
| 781 |
+
endmodule
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/tg_status.v
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//*****************************************************************************
|
| 2 |
+
// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MIG
|
| 54 |
+
// / / Filename: tg_status.v
|
| 55 |
+
// /___/ /\ Date Last Modified:
|
| 56 |
+
// \ \ / \ Date Created:
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6
|
| 60 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
//Purpose: This module compare the memory read data agaisnt compare data that generated from data_gen module.
|
| 62 |
+
// Error signal will be asserted if the comparsion is not equal.
|
| 63 |
+
//Reference:
|
| 64 |
+
//Revision History:
|
| 65 |
+
//*****************************************************************************
|
| 66 |
+
|
| 67 |
+
`timescale 1ps/1ps
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
module tg_status #(
|
| 71 |
+
parameter TCQ = 100,
|
| 72 |
+
|
| 73 |
+
parameter DWIDTH = 32
|
| 74 |
+
)
|
| 75 |
+
(
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
input clk_i ,
|
| 79 |
+
input rst_i ,
|
| 80 |
+
input manual_clear_error,
|
| 81 |
+
input data_error_i ,
|
| 82 |
+
input [DWIDTH-1:0] cmp_data_i,
|
| 83 |
+
input [DWIDTH-1:0] rd_data_i ,
|
| 84 |
+
input [31:0] cmp_addr_i ,
|
| 85 |
+
input [5:0] cmp_bl_i ,
|
| 86 |
+
input mcb_cmd_full_i ,
|
| 87 |
+
input mcb_wr_full_i,
|
| 88 |
+
input mcb_rd_empty_i,
|
| 89 |
+
output reg [64 + (2*DWIDTH - 1):0] error_status,
|
| 90 |
+
output error
|
| 91 |
+
);
|
| 92 |
+
|
| 93 |
+
reg data_error_r;
|
| 94 |
+
reg error_set;
|
| 95 |
+
assign error = error_set;
|
| 96 |
+
|
| 97 |
+
always @ (posedge clk_i)
|
| 98 |
+
data_error_r <= #TCQ data_error_i;
|
| 99 |
+
|
| 100 |
+
always @ (posedge clk_i)
|
| 101 |
+
begin
|
| 102 |
+
|
| 103 |
+
if (rst_i || manual_clear_error) begin
|
| 104 |
+
error_status <= #TCQ 'b0;
|
| 105 |
+
error_set <= #TCQ 1'b0;
|
| 106 |
+
end
|
| 107 |
+
else begin
|
| 108 |
+
// latch the first error only
|
| 109 |
+
if (data_error_i && ~data_error_r && ~error_set ) begin
|
| 110 |
+
error_status[31:0] <= #TCQ cmp_addr_i;
|
| 111 |
+
error_status[37:32] <= #TCQ cmp_bl_i;
|
| 112 |
+
error_status[40] <= #TCQ mcb_cmd_full_i;
|
| 113 |
+
error_status[41] <= #TCQ mcb_wr_full_i;
|
| 114 |
+
error_status[42] <= #TCQ mcb_rd_empty_i;
|
| 115 |
+
error_set <= #TCQ 1'b1;
|
| 116 |
+
error_status[64 + (DWIDTH - 1) :64] <= #TCQ cmp_data_i;
|
| 117 |
+
error_status[64 + (2*DWIDTH - 1):64 + DWIDTH] <= #TCQ rd_data_i;
|
| 118 |
+
|
| 119 |
+
end
|
| 120 |
+
|
| 121 |
+
error_status[39:38] <= #TCQ 'b0; // reserved
|
| 122 |
+
error_status[63:43] <= #TCQ 'b0; // reserved
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
end end
|
| 126 |
+
|
| 127 |
+
endmodule
|
| 128 |
+
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/v6_data_gen.v
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/rtl/traffic_gen/wr_data_gen.v
ADDED
|
@@ -0,0 +1,410 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MIG
|
| 54 |
+
// / / Filename: wr_data_gen.v
|
| 55 |
+
// /___/ /\ Date Last Modified:
|
| 56 |
+
// \ \ / \ Date Created:
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6
|
| 60 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
//Purpose:
|
| 62 |
+
//Reference:
|
| 63 |
+
//Revision History:
|
| 64 |
+
//*****************************************************************************
|
| 65 |
+
|
| 66 |
+
`timescale 1ps/1ps
|
| 67 |
+
|
| 68 |
+
module wr_data_gen #
|
| 69 |
+
|
| 70 |
+
(
|
| 71 |
+
parameter TCQ = 100,
|
| 72 |
+
parameter FAMILY = "SPARTAN6", // "SPARTAN6", "VIRTEX6"
|
| 73 |
+
parameter MEM_BURST_LEN = 8,
|
| 74 |
+
|
| 75 |
+
parameter MODE = "WR", //"WR", "RD"
|
| 76 |
+
parameter ADDR_WIDTH = 32,
|
| 77 |
+
parameter BL_WIDTH = 6,
|
| 78 |
+
parameter DWIDTH = 32,
|
| 79 |
+
parameter DATA_PATTERN = "DGEN_PRBS", //"DGEN__HAMMER", "DGEN_WALING1","DGEN_WALING0","DGEN_ADDR","DGEN_NEIGHBOR","DGEN_PRBS","DGEN_ALL"
|
| 80 |
+
parameter NUM_DQ_PINS = 8,
|
| 81 |
+
parameter SEL_VICTIM_LINE = 3, // VICTIM LINE is one of the DQ pins is selected to be different than hammer pattern
|
| 82 |
+
|
| 83 |
+
parameter COLUMN_WIDTH = 10,
|
| 84 |
+
parameter EYE_TEST = "FALSE"
|
| 85 |
+
|
| 86 |
+
)
|
| 87 |
+
(
|
| 88 |
+
input clk_i, //
|
| 89 |
+
input [4:0] rst_i,
|
| 90 |
+
input [31:0] prbs_fseed_i,
|
| 91 |
+
|
| 92 |
+
input [3:0] data_mode_i, // "00" = bram;
|
| 93 |
+
|
| 94 |
+
output cmd_rdy_o, // ready to receive command. It should assert when data_port is ready at the // beginning and will be deasserted once see the cmd_valid_i is asserted.
|
| 95 |
+
// And then it should reasserted when
|
| 96 |
+
// it is generating the last_word.
|
| 97 |
+
input cmd_valid_i, // when both cmd_valid_i and cmd_rdy_o is high, the command is valid.
|
| 98 |
+
input cmd_validB_i,
|
| 99 |
+
input cmd_validC_i,
|
| 100 |
+
|
| 101 |
+
output last_word_o,
|
| 102 |
+
|
| 103 |
+
// input [5:0] port_data_counts_i,// connect to data port fifo counts
|
| 104 |
+
// input [ADDR_WIDTH-1:0] m_addr_i,
|
| 105 |
+
input [DWIDTH-1:0] fixed_data_i,
|
| 106 |
+
|
| 107 |
+
input [ADDR_WIDTH-1:0] addr_i, // generated address used to determine data pattern.
|
| 108 |
+
input [BL_WIDTH-1:0] bl_i, // generated burst length for control the burst data
|
| 109 |
+
|
| 110 |
+
input data_rdy_i, // connect from mcb_wr_full when used as wr_data_gen
|
| 111 |
+
// connect from mcb_rd_empty when used as rd_data_gen
|
| 112 |
+
// When both data_rdy and data_valid is asserted, the ouput data is valid.
|
| 113 |
+
output data_valid_o, // connect to wr_en or rd_en and is asserted whenever the
|
| 114 |
+
// pattern is available.
|
| 115 |
+
output [DWIDTH-1:0] data_o, // generated data pattern
|
| 116 |
+
output reg data_wr_end_o
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
);
|
| 120 |
+
//
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
reg [DWIDTH-1:0] data;
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
(*EQUIVALENT_REGISTER_REMOVAL="NO"*) reg cmd_rdy,cmd_rdyB, cmd_rdyC,cmd_rdyD,cmd_rdyE,cmd_rdyF;
|
| 128 |
+
(*EQUIVALENT_REGISTER_REMOVAL="NO"*) reg cmd_start,cmd_startB,cmd_startC,cmd_startD,cmd_startE,cmd_startF;
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
reg burst_count_reached2;
|
| 134 |
+
|
| 135 |
+
reg data_valid;
|
| 136 |
+
reg [6:0]user_burst_cnt;
|
| 137 |
+
reg [2:0] walk_cnt;
|
| 138 |
+
|
| 139 |
+
wire fifo_not_full;
|
| 140 |
+
integer i,j;
|
| 141 |
+
reg [31:0] w3data;
|
| 142 |
+
|
| 143 |
+
assign fifo_not_full = data_rdy_i;
|
| 144 |
+
|
| 145 |
+
always @( posedge clk_i)
|
| 146 |
+
begin
|
| 147 |
+
if ((user_burst_cnt == 2 || (cmd_start && bl_i == 1 && FAMILY == "VIRTEX6")) && (fifo_not_full))
|
| 148 |
+
data_wr_end_o <= #TCQ 1'b1;
|
| 149 |
+
else
|
| 150 |
+
data_wr_end_o <= #TCQ 1'b0;
|
| 151 |
+
end
|
| 152 |
+
|
| 153 |
+
always @ (posedge clk_i)
|
| 154 |
+
begin
|
| 155 |
+
cmd_start <= #TCQ cmd_validC_i & cmd_rdyC ;
|
| 156 |
+
cmd_startB <= #TCQ cmd_valid_i & cmd_rdyB;
|
| 157 |
+
cmd_startC <= #TCQ cmd_validB_i & cmd_rdyC;
|
| 158 |
+
cmd_startD <= #TCQ cmd_validB_i & cmd_rdyD;
|
| 159 |
+
cmd_startE <= #TCQ cmd_validB_i & cmd_rdyE;
|
| 160 |
+
cmd_startF <= #TCQ cmd_validB_i & cmd_rdyF;
|
| 161 |
+
end
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
// counter to count user burst length
|
| 165 |
+
always @( posedge clk_i)
|
| 166 |
+
begin
|
| 167 |
+
if ( rst_i[0] )
|
| 168 |
+
user_burst_cnt <= #TCQ 'd0;
|
| 169 |
+
else if(cmd_start)
|
| 170 |
+
if (FAMILY == "SPARTAN6") begin
|
| 171 |
+
if (bl_i == 6'b000000)
|
| 172 |
+
user_burst_cnt <= #TCQ 7'b1000000;
|
| 173 |
+
else
|
| 174 |
+
user_burst_cnt <= #TCQ bl_i;
|
| 175 |
+
|
| 176 |
+
end
|
| 177 |
+
else
|
| 178 |
+
user_burst_cnt <= #TCQ bl_i;
|
| 179 |
+
else if(fifo_not_full)
|
| 180 |
+
if (user_burst_cnt != 6'd0)
|
| 181 |
+
user_burst_cnt <= #TCQ user_burst_cnt - 1'b1;
|
| 182 |
+
else
|
| 183 |
+
user_burst_cnt <=#TCQ 'd0;
|
| 184 |
+
|
| 185 |
+
end
|
| 186 |
+
|
| 187 |
+
reg u_bcount_2;
|
| 188 |
+
wire last_word_t;
|
| 189 |
+
always @ (posedge clk_i)
|
| 190 |
+
begin
|
| 191 |
+
if ((user_burst_cnt == 2 && fifo_not_full )|| (cmd_startC && bl_i == 1))
|
| 192 |
+
u_bcount_2 <= #TCQ 1'b1;
|
| 193 |
+
else if (last_word_o)
|
| 194 |
+
u_bcount_2 <= #TCQ 1'b0;
|
| 195 |
+
end
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
assign last_word_o = u_bcount_2 & fifo_not_full;
|
| 200 |
+
|
| 201 |
+
// cmd_rdy_o assert when the dat fifo is not full and deassert once cmd_valid_i
|
| 202 |
+
// is assert and reassert during the last data
|
| 203 |
+
|
| 204 |
+
assign cmd_rdy_o = cmd_rdy & fifo_not_full;
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
always @( posedge clk_i)
|
| 208 |
+
begin
|
| 209 |
+
if ( rst_i[0] )
|
| 210 |
+
cmd_rdy <= #TCQ 1'b1;
|
| 211 |
+
else if (cmd_start)
|
| 212 |
+
if (bl_i == 1)
|
| 213 |
+
cmd_rdy <= #TCQ 1'b1;
|
| 214 |
+
else
|
| 215 |
+
cmd_rdy <= #TCQ 1'b0;
|
| 216 |
+
else if ((user_burst_cnt == 6'd2 && fifo_not_full ) )
|
| 217 |
+
|
| 218 |
+
cmd_rdy <= #TCQ 1'b1;
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
end
|
| 222 |
+
|
| 223 |
+
always @( posedge clk_i)
|
| 224 |
+
begin
|
| 225 |
+
if ( rst_i [0])
|
| 226 |
+
cmd_rdyB <= #TCQ 1'b1;
|
| 227 |
+
else if (cmd_startB)
|
| 228 |
+
if (bl_i == 1)
|
| 229 |
+
cmd_rdyB <= #TCQ 1'b1;
|
| 230 |
+
else
|
| 231 |
+
cmd_rdyB <= #TCQ 1'b0;
|
| 232 |
+
else if ((user_burst_cnt == 6'd2 && fifo_not_full ) )
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
cmd_rdyB <= #TCQ 1'b1;
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
end
|
| 239 |
+
|
| 240 |
+
always @( posedge clk_i)
|
| 241 |
+
begin
|
| 242 |
+
if ( rst_i[0] )
|
| 243 |
+
cmd_rdyC <= #TCQ 1'b1;
|
| 244 |
+
else if (cmd_startC)
|
| 245 |
+
if (bl_i == 1)
|
| 246 |
+
cmd_rdyC <= #TCQ 1'b1;
|
| 247 |
+
else
|
| 248 |
+
cmd_rdyC <= #TCQ 1'b0;
|
| 249 |
+
else if ((user_burst_cnt == 6'd2 && fifo_not_full ) )
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
cmd_rdyC <= #TCQ 1'b1;
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
end
|
| 256 |
+
|
| 257 |
+
always @( posedge clk_i)
|
| 258 |
+
begin
|
| 259 |
+
if ( rst_i[0] )
|
| 260 |
+
cmd_rdyD <= #TCQ 1'b1;
|
| 261 |
+
else if (cmd_startD)
|
| 262 |
+
if (bl_i == 1)
|
| 263 |
+
cmd_rdyD <= #TCQ 1'b1;
|
| 264 |
+
else
|
| 265 |
+
cmd_rdyD <= #TCQ 1'b0;
|
| 266 |
+
else if ((user_burst_cnt == 6'd2 && fifo_not_full ) )
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
cmd_rdyD <= #TCQ 1'b1;
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
end
|
| 273 |
+
|
| 274 |
+
always @( posedge clk_i)
|
| 275 |
+
begin
|
| 276 |
+
if ( rst_i[0] )
|
| 277 |
+
cmd_rdyE <= #TCQ 1'b1;
|
| 278 |
+
else if (cmd_startE)
|
| 279 |
+
if (bl_i == 1)
|
| 280 |
+
cmd_rdyE <= #TCQ 1'b1;
|
| 281 |
+
else
|
| 282 |
+
cmd_rdyE <= #TCQ 1'b0;
|
| 283 |
+
else if ((user_burst_cnt == 6'd2 && fifo_not_full ) )
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
cmd_rdyE <= #TCQ 1'b1;
|
| 287 |
+
|
| 288 |
+
|
| 289 |
+
end
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
|
| 293 |
+
always @( posedge clk_i)
|
| 294 |
+
begin
|
| 295 |
+
if ( rst_i[0] )
|
| 296 |
+
cmd_rdyF <= #TCQ 1'b1;
|
| 297 |
+
else if (cmd_startF)
|
| 298 |
+
if (bl_i == 1)
|
| 299 |
+
cmd_rdyF <= #TCQ 1'b1;
|
| 300 |
+
else
|
| 301 |
+
cmd_rdyF <= #TCQ 1'b0;
|
| 302 |
+
else if ((user_burst_cnt == 6'd2 && fifo_not_full ) )
|
| 303 |
+
|
| 304 |
+
cmd_rdyF <= #TCQ 1'b1;
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
end
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
always @ (posedge clk_i)
|
| 312 |
+
begin
|
| 313 |
+
if (rst_i[1])
|
| 314 |
+
data_valid <= #TCQ 'd0;
|
| 315 |
+
else if(cmd_start)
|
| 316 |
+
data_valid <= #TCQ 1'b1;
|
| 317 |
+
else if (fifo_not_full && user_burst_cnt <= 6'd1)
|
| 318 |
+
data_valid <= #TCQ 1'b0;
|
| 319 |
+
end
|
| 320 |
+
|
| 321 |
+
assign data_valid_o = data_valid & fifo_not_full;
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
generate
|
| 325 |
+
if (FAMILY == "SPARTAN6") begin : SP6_WDGEN
|
| 326 |
+
|
| 327 |
+
sp6_data_gen #
|
| 328 |
+
|
| 329 |
+
(
|
| 330 |
+
.TCQ (TCQ),
|
| 331 |
+
.ADDR_WIDTH (32 ),
|
| 332 |
+
|
| 333 |
+
.BL_WIDTH (BL_WIDTH ),
|
| 334 |
+
.DWIDTH (DWIDTH ),
|
| 335 |
+
.DATA_PATTERN (DATA_PATTERN ),
|
| 336 |
+
.NUM_DQ_PINS (NUM_DQ_PINS ),
|
| 337 |
+
.COLUMN_WIDTH (COLUMN_WIDTH)
|
| 338 |
+
|
| 339 |
+
)
|
| 340 |
+
sp6_data_gen
|
| 341 |
+
(
|
| 342 |
+
.clk_i (clk_i ),
|
| 343 |
+
.rst_i (rst_i[1] ),
|
| 344 |
+
.data_rdy_i (data_rdy_i ),
|
| 345 |
+
.prbs_fseed_i (prbs_fseed_i),
|
| 346 |
+
|
| 347 |
+
.data_mode_i (data_mode_i ),
|
| 348 |
+
.cmd_startA (cmd_start ),
|
| 349 |
+
.cmd_startB (cmd_startB ),
|
| 350 |
+
.cmd_startC (cmd_startC ),
|
| 351 |
+
.cmd_startD (cmd_startD ),
|
| 352 |
+
.cmd_startE (cmd_startE ),
|
| 353 |
+
.fixed_data_i (fixed_data_i),
|
| 354 |
+
|
| 355 |
+
.addr_i (addr_i ),
|
| 356 |
+
.user_burst_cnt (user_burst_cnt),
|
| 357 |
+
.fifo_rdy_i (fifo_not_full ),
|
| 358 |
+
.data_o (data_o )
|
| 359 |
+
);
|
| 360 |
+
end
|
| 361 |
+
|
| 362 |
+
|
| 363 |
+
endgenerate
|
| 364 |
+
|
| 365 |
+
generate
|
| 366 |
+
if (FAMILY == "VIRTEX6") begin : V6_WDGEN
|
| 367 |
+
|
| 368 |
+
v6_data_gen #
|
| 369 |
+
|
| 370 |
+
(
|
| 371 |
+
.TCQ (TCQ),
|
| 372 |
+
.ADDR_WIDTH (32 ),
|
| 373 |
+
.BL_WIDTH (BL_WIDTH ),
|
| 374 |
+
.DWIDTH (DWIDTH ),
|
| 375 |
+
.MEM_BURST_LEN (MEM_BURST_LEN),
|
| 376 |
+
|
| 377 |
+
.DATA_PATTERN (DATA_PATTERN ),
|
| 378 |
+
.NUM_DQ_PINS (NUM_DQ_PINS ),
|
| 379 |
+
.SEL_VICTIM_LINE (SEL_VICTIM_LINE),
|
| 380 |
+
|
| 381 |
+
.COLUMN_WIDTH (COLUMN_WIDTH),
|
| 382 |
+
.EYE_TEST (EYE_TEST)
|
| 383 |
+
|
| 384 |
+
)
|
| 385 |
+
v6_data_gen
|
| 386 |
+
(
|
| 387 |
+
.clk_i (clk_i ),
|
| 388 |
+
.rst_i (rst_i[1] ),
|
| 389 |
+
.data_rdy_i (data_rdy_i ),
|
| 390 |
+
.prbs_fseed_i (prbs_fseed_i),
|
| 391 |
+
|
| 392 |
+
.data_mode_i (data_mode_i ),
|
| 393 |
+
.cmd_startA (cmd_start ),
|
| 394 |
+
.cmd_startB (cmd_startB ),
|
| 395 |
+
.cmd_startC (cmd_startC ),
|
| 396 |
+
.cmd_startD (cmd_startD ),
|
| 397 |
+
.cmd_startE (cmd_startE ),
|
| 398 |
+
.m_addr_i (addr_i/*m_addr_i*/),
|
| 399 |
+
.fixed_data_i (fixed_data_i),
|
| 400 |
+
|
| 401 |
+
.addr_i (addr_i ),
|
| 402 |
+
.user_burst_cnt (user_burst_cnt),
|
| 403 |
+
.fifo_rdy_i (fifo_not_full ),
|
| 404 |
+
.data_o (data_o )
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//*****************************************************************************
|
| 2 |
+
// (c) Copyright 2008-2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor: Xilinx
|
| 52 |
+
// \ \ \/ Version: %version
|
| 53 |
+
// \ \ Application: MIG
|
| 54 |
+
// / / Filename: write_data_path.v
|
| 55 |
+
// /___/ /\ Date Last Modified:
|
| 56 |
+
// \ \ / \ Date Created:
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
//Device: Spartan6
|
| 60 |
+
//Design Name: DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
//Purpose: This is top level of write path .
|
| 62 |
+
|
| 63 |
+
//Reference:
|
| 64 |
+
//Revision History:
|
| 65 |
+
//*****************************************************************************
|
| 66 |
+
|
| 67 |
+
`timescale 1ps/1ps
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
module write_data_path #(
|
| 71 |
+
parameter TCQ = 100,
|
| 72 |
+
parameter FAMILY = "SPARTAN6",
|
| 73 |
+
parameter ADDR_WIDTH = 32,
|
| 74 |
+
parameter MEM_BURST_LEN = 8,
|
| 75 |
+
parameter DWIDTH = 32,
|
| 76 |
+
parameter DATA_PATTERN = "DGEN_ALL", //"DGEN__HAMMER", "DGEN_WALING1","DGEN_WALING0","DGEN_ADDR","DGEN_NEIGHBOR","DGEN_PRBS","DGEN_ALL"
|
| 77 |
+
parameter NUM_DQ_PINS = 8,
|
| 78 |
+
parameter SEL_VICTIM_LINE = 3, // VICTIM LINE is one of the DQ pins is selected to be different than hammer pattern
|
| 79 |
+
|
| 80 |
+
parameter MEM_COL_WIDTH = 10,
|
| 81 |
+
parameter EYE_TEST = "FALSE"
|
| 82 |
+
|
| 83 |
+
)
|
| 84 |
+
(
|
| 85 |
+
|
| 86 |
+
input clk_i,
|
| 87 |
+
input [9:0] rst_i,
|
| 88 |
+
output cmd_rdy_o,
|
| 89 |
+
input cmd_valid_i,
|
| 90 |
+
input cmd_validB_i,
|
| 91 |
+
input cmd_validC_i,
|
| 92 |
+
input [31:0] prbs_fseed_i,
|
| 93 |
+
input [3:0] data_mode_i,
|
| 94 |
+
// input [31:0] m_addr_i,
|
| 95 |
+
input [DWIDTH-1:0] fixed_data_i,
|
| 96 |
+
|
| 97 |
+
input [31:0] addr_i,
|
| 98 |
+
input [5:0] bl_i,
|
| 99 |
+
|
| 100 |
+
// input [5:0] port_data_counts_i,// connect to data port fifo counts
|
| 101 |
+
|
| 102 |
+
input data_rdy_i,
|
| 103 |
+
output data_valid_o,
|
| 104 |
+
output last_word_wr_o,
|
| 105 |
+
output [DWIDTH-1:0] data_o,
|
| 106 |
+
output [(DWIDTH/8) - 1:0] data_mask_o,
|
| 107 |
+
output data_wr_end_o
|
| 108 |
+
|
| 109 |
+
);
|
| 110 |
+
|
| 111 |
+
wire data_valid;
|
| 112 |
+
reg cmd_rdy;
|
| 113 |
+
|
| 114 |
+
assign data_valid_o = data_valid & data_rdy_i;
|
| 115 |
+
assign data_mask_o = 'b0; // for now
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
wr_data_gen #(
|
| 119 |
+
.TCQ (TCQ),
|
| 120 |
+
.FAMILY (FAMILY),
|
| 121 |
+
.NUM_DQ_PINS (NUM_DQ_PINS),
|
| 122 |
+
.MEM_BURST_LEN (MEM_BURST_LEN),
|
| 123 |
+
|
| 124 |
+
.SEL_VICTIM_LINE (SEL_VICTIM_LINE),
|
| 125 |
+
.DATA_PATTERN (DATA_PATTERN),
|
| 126 |
+
.DWIDTH (DWIDTH),
|
| 127 |
+
.COLUMN_WIDTH (MEM_COL_WIDTH),
|
| 128 |
+
.EYE_TEST (EYE_TEST)
|
| 129 |
+
|
| 130 |
+
)
|
| 131 |
+
wr_data_gen(
|
| 132 |
+
.clk_i (clk_i ),
|
| 133 |
+
.rst_i (rst_i[9:5]),
|
| 134 |
+
.prbs_fseed_i (prbs_fseed_i),
|
| 135 |
+
|
| 136 |
+
.data_mode_i (data_mode_i ),
|
| 137 |
+
.cmd_rdy_o (cmd_rdy_o ),
|
| 138 |
+
.cmd_valid_i (cmd_valid_i ),
|
| 139 |
+
.cmd_validB_i (cmd_validB_i ),
|
| 140 |
+
.cmd_validC_i (cmd_validC_i ),
|
| 141 |
+
|
| 142 |
+
.last_word_o (last_word_wr_o ),
|
| 143 |
+
// .port_data_counts_i (port_data_counts_i),
|
| 144 |
+
// .m_addr_i (m_addr_i ),
|
| 145 |
+
.fixed_data_i (fixed_data_i),
|
| 146 |
+
|
| 147 |
+
.addr_i (addr_i ),
|
| 148 |
+
.bl_i (bl_i ),
|
| 149 |
+
.data_rdy_i (data_rdy_i ),
|
| 150 |
+
.data_valid_o ( data_valid ),
|
| 151 |
+
.data_o (data_o ),
|
| 152 |
+
.data_wr_end_o (data_wr_end_o)
|
| 153 |
+
);
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
endmodule
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/sim/functional/ddr3_model_c3.v
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/sim/functional/ddr3_model_parameters_c3.vh
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/sim/functional/isim.tcl
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
###############################################################################
|
| 2 |
+
## (c) Copyright 2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
##
|
| 4 |
+
## This file contains confidential and proprietary information
|
| 5 |
+
## of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
## international copyright and other intellectual property
|
| 7 |
+
## laws.
|
| 8 |
+
##
|
| 9 |
+
## DISCLAIMER
|
| 10 |
+
## This disclaimer is not a license and does not grant any
|
| 11 |
+
## rights to the materials distributed herewith. Except as
|
| 12 |
+
## otherwise provided in a valid license issued to you by
|
| 13 |
+
## Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
## law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
## WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
## AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
## BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
## INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
## (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
## including negligence, or under any other theory of
|
| 21 |
+
## liability) for any loss or damage of any kind or nature
|
| 22 |
+
## related to, arising under or in connection with these
|
| 23 |
+
## materials, including for any direct, or any indirect,
|
| 24 |
+
## special, incidental, or consequential loss or damage
|
| 25 |
+
## (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
## loss or damage suffered as a result of any action brought
|
| 27 |
+
## by a third party) even if such damage or loss was
|
| 28 |
+
## reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
## possibility of the same.
|
| 30 |
+
##
|
| 31 |
+
## CRITICAL APPLICATIONS
|
| 32 |
+
## Xilinx products are not designed or intended to be fail-
|
| 33 |
+
## safe, or for use in any application requiring fail-safe
|
| 34 |
+
## performance, such as life-support or safety devices or
|
| 35 |
+
## systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
## applications related to the deployment of airbags, or any
|
| 37 |
+
## other applications that could lead to death, personal
|
| 38 |
+
## injury, or severe property or environmental damage
|
| 39 |
+
## (individually and collectively, "Critical
|
| 40 |
+
## Applications"). Customer assumes the sole risk and
|
| 41 |
+
## liability of any use of Xilinx products in Critical
|
| 42 |
+
## Applications, subject only to applicable laws and
|
| 43 |
+
## regulations governing limitations on product liability.
|
| 44 |
+
##
|
| 45 |
+
## THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
## PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
##
|
| 48 |
+
###############################################################################
|
| 49 |
+
## ____ ____
|
| 50 |
+
## / /\/ /
|
| 51 |
+
## /___/ \ / Vendor : Xilinx
|
| 52 |
+
## \ \ \/ Version : 3.92
|
| 53 |
+
## \ \ Application : MIG
|
| 54 |
+
## / / Filename : isim.tcl
|
| 55 |
+
## /___/ /\ Date Last Modified : $Date: 2011/06/02 07:16:58 $
|
| 56 |
+
## \ \ / \ Date Created : Mon Mar 2 2009
|
| 57 |
+
## \___\/\___\
|
| 58 |
+
##
|
| 59 |
+
## Device : Spartan-6
|
| 60 |
+
## Design Name : DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
## Purpose : To give commands to ISIM Simulator through batch mode
|
| 62 |
+
## Assumptions:
|
| 63 |
+
## - Simulation takes place in \sim folder of MIG output directory
|
| 64 |
+
## Reference :
|
| 65 |
+
## Revision History:
|
| 66 |
+
###############################################################################
|
| 67 |
+
|
| 68 |
+
onerror {resume}
|
| 69 |
+
isim set radix hex
|
| 70 |
+
wave add /sim_tb_top
|
| 71 |
+
run 200 us
|
| 72 |
+
quit
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/sim/functional/readme.txt
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
###############################################################################
|
| 2 |
+
## (c) Copyright 2009 Xilinx, Inc. All rights reserved.
|
| 3 |
+
##
|
| 4 |
+
## This file contains confidential and proprietary information
|
| 5 |
+
## of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
## international copyright and other intellectual property
|
| 7 |
+
## laws.
|
| 8 |
+
##
|
| 9 |
+
## DISCLAIMER
|
| 10 |
+
## This disclaimer is not a license and does not grant any
|
| 11 |
+
## rights to the materials distributed herewith. Except as
|
| 12 |
+
## otherwise provided in a valid license issued to you by
|
| 13 |
+
## Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
## law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
## WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
## AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
## BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
## INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
## (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
## including negligence, or under any other theory of
|
| 21 |
+
## liability) for any loss or damage of any kind or nature
|
| 22 |
+
## related to, arising under or in connection with these
|
| 23 |
+
## materials, including for any direct, or any indirect,
|
| 24 |
+
## special, incidental, or consequential loss or damage
|
| 25 |
+
## (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
## loss or damage suffered as a result of any action brought
|
| 27 |
+
## by a third party) even if such damage or loss was
|
| 28 |
+
## reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
## possibility of the same.
|
| 30 |
+
##
|
| 31 |
+
## CRITICAL APPLICATIONS
|
| 32 |
+
## Xilinx products are not designed or intended to be fail-
|
| 33 |
+
## safe, or for use in any application requiring fail-safe
|
| 34 |
+
## performance, such as life-support or safety devices or
|
| 35 |
+
## systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
## applications related to the deployment of airbags, or any
|
| 37 |
+
## other applications that could lead to death, personal
|
| 38 |
+
## injury, or severe property or environmental damage
|
| 39 |
+
## (individually and collectively, "Critical
|
| 40 |
+
## Applications"). Customer assumes the sole risk and
|
| 41 |
+
## liability of any use of Xilinx products in Critical
|
| 42 |
+
## Applications, subject only to applicable laws and
|
| 43 |
+
## regulations governing limitations on product liability.
|
| 44 |
+
##
|
| 45 |
+
## THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
## PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
##
|
| 48 |
+
###############################################################################
|
| 49 |
+
## ____ ____
|
| 50 |
+
## / /\/ /
|
| 51 |
+
## /___/ \ / Vendor : Xilinx
|
| 52 |
+
## \ \ \/ Version : 3.92
|
| 53 |
+
## \ \ Application : MIG
|
| 54 |
+
## / / Filename : readme.txt
|
| 55 |
+
## /___/ /\ Date Last Modified : $Date: 2011/06/02 07:16:58 $
|
| 56 |
+
## \ \ / \ Date Created : Mon Oct 19 2009
|
| 57 |
+
## \___\/\___\
|
| 58 |
+
##
|
| 59 |
+
## Device : Spartan-6
|
| 60 |
+
## Design Name : DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
## Purpose : Steps to run simulation using ISIM/Modelsim simualtor in this folder
|
| 62 |
+
## Assumptions:
|
| 63 |
+
## - Simulation takes place in \sim\<functional/timing> folder of MIG output directory
|
| 64 |
+
## Reference :
|
| 65 |
+
## Revision History:
|
| 66 |
+
###############################################################################
|
| 67 |
+
|
| 68 |
+
The sim/functional folder has files to perform functional simulation of the design.
|
| 69 |
+
|
| 70 |
+
1. Simulation using Modelsim simulator
|
| 71 |
+
|
| 72 |
+
A) sim.do File :
|
| 73 |
+
|
| 74 |
+
1) The 'sim.do' file has commands to compile and simulate memory interface
|
| 75 |
+
design and run the simulation for specified period of time.
|
| 76 |
+
|
| 77 |
+
2) It has the syntax to Map the required libraries.
|
| 78 |
+
Also, $XILINX environment variable must be set in order to compile glbl.v file
|
| 79 |
+
|
| 80 |
+
3) Displays the waveforms that are listed with "add wave" command.
|
| 81 |
+
|
| 82 |
+
B) Steps to run the Modelsim simulation:
|
| 83 |
+
|
| 84 |
+
1) The user should invoke the Modelsim simulator GUI.
|
| 85 |
+
2) Change the present working directory path to the sim/functional folder.
|
| 86 |
+
In Transcript window, at Modelsim prompt, type the following command to
|
| 87 |
+
change directory path.
|
| 88 |
+
cd <sim/functional directory path>
|
| 89 |
+
|
| 90 |
+
2) Run the simulation using sim.do file.
|
| 91 |
+
At Modelsim prompt, type the following command:
|
| 92 |
+
do sim.do
|
| 93 |
+
|
| 94 |
+
3) To exit simulation, type the following command at Modelsim prompt:
|
| 95 |
+
quit -f
|
| 96 |
+
|
| 97 |
+
4) Verify the transcript file for the memory transactions.
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
2. Simulation using ISIM simulator
|
| 101 |
+
|
| 102 |
+
A) Following files are provided :
|
| 103 |
+
|
| 104 |
+
1) The '.prj' file contains the list of all the files associated with the design.
|
| 105 |
+
It also contains the hdl, library and the source file name.
|
| 106 |
+
|
| 107 |
+
2) The '.tcl' file contains the Tcl commands for simulation and
|
| 108 |
+
resume on error.
|
| 109 |
+
|
| 110 |
+
3) The 'isim.bat' has commands which use '.prj' and '.tcl' files.
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
B) Steps to run the ISIM simulation:
|
| 114 |
+
|
| 115 |
+
The user should execute the file isim.bat, which does the following steps:
|
| 116 |
+
1) Compiles, elaborates the design and generates the simulation executable using
|
| 117 |
+
the fuse command in 'isim.bat' file.
|
| 118 |
+
|
| 119 |
+
2) Invokes the ISIM GUI.
|
| 120 |
+
|
| 121 |
+
3) User can add required signals from objects window to the waveform viewer and run
|
| 122 |
+
simulation for specified time using the command "run <time>" in ISIM GUI.
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/sim/functional/sim_tb_top.v
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
| 3 |
+
//
|
| 4 |
+
// This file contains confidential and proprietary information
|
| 5 |
+
// of Xilinx, Inc. and is protected under U.S. and
|
| 6 |
+
// international copyright and other intellectual property
|
| 7 |
+
// laws.
|
| 8 |
+
//
|
| 9 |
+
// DISCLAIMER
|
| 10 |
+
// This disclaimer is not a license and does not grant any
|
| 11 |
+
// rights to the materials distributed herewith. Except as
|
| 12 |
+
// otherwise provided in a valid license issued to you by
|
| 13 |
+
// Xilinx, and to the maximum extent permitted by applicable
|
| 14 |
+
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 15 |
+
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 16 |
+
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 17 |
+
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 18 |
+
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 19 |
+
// (2) Xilinx shall not be liable (whether in contract or tort,
|
| 20 |
+
// including negligence, or under any other theory of
|
| 21 |
+
// liability) for any loss or damage of any kind or nature
|
| 22 |
+
// related to, arising under or in connection with these
|
| 23 |
+
// materials, including for any direct, or any indirect,
|
| 24 |
+
// special, incidental, or consequential loss or damage
|
| 25 |
+
// (including loss of data, profits, goodwill, or any type of
|
| 26 |
+
// loss or damage suffered as a result of any action brought
|
| 27 |
+
// by a third party) even if such damage or loss was
|
| 28 |
+
// reasonably foreseeable or Xilinx had been advised of the
|
| 29 |
+
// possibility of the same.
|
| 30 |
+
//
|
| 31 |
+
// CRITICAL APPLICATIONS
|
| 32 |
+
// Xilinx products are not designed or intended to be fail-
|
| 33 |
+
// safe, or for use in any application requiring fail-safe
|
| 34 |
+
// performance, such as life-support or safety devices or
|
| 35 |
+
// systems, Class III medical devices, nuclear facilities,
|
| 36 |
+
// applications related to the deployment of airbags, or any
|
| 37 |
+
// other applications that could lead to death, personal
|
| 38 |
+
// injury, or severe property or environmental damage
|
| 39 |
+
// (individually and collectively, "Critical
|
| 40 |
+
// Applications"). Customer assumes the sole risk and
|
| 41 |
+
// liability of any use of Xilinx products in Critical
|
| 42 |
+
// Applications, subject only to applicable laws and
|
| 43 |
+
// regulations governing limitations on product liability.
|
| 44 |
+
//
|
| 45 |
+
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 46 |
+
// PART OF THIS FILE AT ALL TIMES.
|
| 47 |
+
//
|
| 48 |
+
//*****************************************************************************
|
| 49 |
+
// ____ ____
|
| 50 |
+
// / /\/ /
|
| 51 |
+
// /___/ \ / Vendor : Xilinx
|
| 52 |
+
// \ \ \/ Version : 3.92
|
| 53 |
+
// \ \ Application : MIG
|
| 54 |
+
// / / Filename : sim_tb_top.v
|
| 55 |
+
// /___/ /\ Date Last Modified : $Date: 2011/06/02 07:16:58 $
|
| 56 |
+
// \ \ / \ Date Created : Mon Mar 2 2009
|
| 57 |
+
// \___\/\___\
|
| 58 |
+
//
|
| 59 |
+
// Device : Spartan-6
|
| 60 |
+
// Design Name : DDR/DDR2/DDR3/LPDDR
|
| 61 |
+
// Purpose : This is the simulation testbench which is used to verify the
|
| 62 |
+
// design. The basic clocks and resets to the interface are
|
| 63 |
+
// generated here. This also connects the memory interface to the
|
| 64 |
+
// memory model.
|
| 65 |
+
//*****************************************************************************
|
| 66 |
+
|
| 67 |
+
`timescale 1ps/1ps
|
| 68 |
+
module sim_tb_top;
|
| 69 |
+
|
| 70 |
+
// ========================================================================== //
|
| 71 |
+
// Parameters //
|
| 72 |
+
// ========================================================================== //
|
| 73 |
+
parameter DEBUG_EN = 0;
|
| 74 |
+
localparam DBG_WR_STS_WIDTH = 32;
|
| 75 |
+
localparam DBG_RD_STS_WIDTH = 32;
|
| 76 |
+
localparam C3_P1_MASK_SIZE =16;
|
| 77 |
+
localparam C3_P1_DATA_PORT_SIZE =128;
|
| 78 |
+
parameter C3_MEMCLK_PERIOD = 3200;
|
| 79 |
+
parameter C3_RST_ACT_LOW = 0;
|
| 80 |
+
parameter C3_INPUT_CLK_TYPE = "SINGLE_ENDED";
|
| 81 |
+
parameter C3_NUM_DQ_PINS = 16;
|
| 82 |
+
parameter C3_MEM_ADDR_WIDTH = 14;
|
| 83 |
+
parameter C3_MEM_BANKADDR_WIDTH = 3;
|
| 84 |
+
parameter C3_MEM_ADDR_ORDER = "ROW_BANK_COLUMN";
|
| 85 |
+
parameter C3_P0_MASK_SIZE = 16;
|
| 86 |
+
parameter C3_P0_DATA_PORT_SIZE = 128;
|
| 87 |
+
parameter C3_CALIB_SOFT_IP = "TRUE";
|
| 88 |
+
parameter C3_SIMULATION = "TRUE";
|
| 89 |
+
parameter C3_HW_TESTING = "FALSE";
|
| 90 |
+
|
| 91 |
+
// ========================================================================== //
|
| 92 |
+
// Signal Declarations //
|
| 93 |
+
// ========================================================================== //
|
| 94 |
+
// Clocks
|
| 95 |
+
reg c3_sys_clk;
|
| 96 |
+
wire c3_sys_clk_p;
|
| 97 |
+
wire c3_sys_clk_n;
|
| 98 |
+
// System Reset
|
| 99 |
+
reg c3_sys_rst;
|
| 100 |
+
wire c3_sys_rst_i;
|
| 101 |
+
|
| 102 |
+
// Design-Top Port Map
|
| 103 |
+
wire [C3_MEM_ADDR_WIDTH-1:0] mcb3_dram_a;
|
| 104 |
+
wire [C3_MEM_BANKADDR_WIDTH-1:0] mcb3_dram_ba;
|
| 105 |
+
wire mcb3_dram_ck;
|
| 106 |
+
wire mcb3_dram_ck_n;
|
| 107 |
+
wire [C3_NUM_DQ_PINS-1:0] mcb3_dram_dq;
|
| 108 |
+
wire mcb3_dram_dqs;
|
| 109 |
+
wire mcb3_dram_dqs_n;
|
| 110 |
+
wire mcb3_dram_dm;
|
| 111 |
+
wire mcb3_dram_ras_n;
|
| 112 |
+
wire mcb3_dram_cas_n;
|
| 113 |
+
wire mcb3_dram_we_n;
|
| 114 |
+
wire mcb3_dram_cke;
|
| 115 |
+
wire mcb3_dram_odt;
|
| 116 |
+
wire mcb3_dram_reset_n;
|
| 117 |
+
|
| 118 |
+
wire mcb3_dram_udqs; // for X16 parts
|
| 119 |
+
wire mcb3_dram_udqs_n; // for X16 parts
|
| 120 |
+
wire mcb3_dram_udm; // for X16 parts
|
| 121 |
+
|
| 122 |
+
// Error & Calib Signals
|
| 123 |
+
wire error;
|
| 124 |
+
wire calib_done;
|
| 125 |
+
wire rzq3; wire zio3;
|
| 126 |
+
|
| 127 |
+
// ========================================================================== //
|
| 128 |
+
// Clocks Generation //
|
| 129 |
+
// ========================================================================== //
|
| 130 |
+
|
| 131 |
+
initial
|
| 132 |
+
c3_sys_clk = 1'b0;
|
| 133 |
+
always
|
| 134 |
+
#(C3_MEMCLK_PERIOD/2) c3_sys_clk = ~c3_sys_clk;
|
| 135 |
+
|
| 136 |
+
assign c3_sys_clk_p = c3_sys_clk;
|
| 137 |
+
assign c3_sys_clk_n = ~c3_sys_clk;
|
| 138 |
+
|
| 139 |
+
// ========================================================================== //
|
| 140 |
+
// Reset Generation //
|
| 141 |
+
// ========================================================================== //
|
| 142 |
+
|
| 143 |
+
initial begin
|
| 144 |
+
c3_sys_rst = 1'b0;
|
| 145 |
+
#20000;
|
| 146 |
+
c3_sys_rst = 1'b1;
|
| 147 |
+
end
|
| 148 |
+
assign c3_sys_rst_i = C3_RST_ACT_LOW ? c3_sys_rst : ~c3_sys_rst;
|
| 149 |
+
|
| 150 |
+
// ========================================================================== //
|
| 151 |
+
// Error Grouping //
|
| 152 |
+
// ========================================================================== //
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
// The PULLDOWN component is connected to the ZIO signal primarily to avoid the
|
| 161 |
+
// unknown state in simulation. In real hardware, ZIO should be a no connect(NC) pin.
|
| 162 |
+
PULLDOWN zio_pulldown3 (.O(zio3)); PULLDOWN rzq_pulldown3 (.O(rzq3));
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
// ========================================================================== //
|
| 166 |
+
// DESIGN TOP INSTANTIATION //
|
| 167 |
+
// ========================================================================== //
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
example_top #(
|
| 172 |
+
|
| 173 |
+
.C3_P0_MASK_SIZE (C3_P0_MASK_SIZE ),
|
| 174 |
+
.C3_P0_DATA_PORT_SIZE (C3_P0_DATA_PORT_SIZE ),
|
| 175 |
+
.C3_MEMCLK_PERIOD (C3_MEMCLK_PERIOD),
|
| 176 |
+
.C3_RST_ACT_LOW (C3_RST_ACT_LOW),
|
| 177 |
+
.C3_INPUT_CLK_TYPE (C3_INPUT_CLK_TYPE),
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
.DEBUG_EN (DEBUG_EN),
|
| 181 |
+
|
| 182 |
+
.C3_MEM_ADDR_ORDER (C3_MEM_ADDR_ORDER ),
|
| 183 |
+
.C3_NUM_DQ_PINS (C3_NUM_DQ_PINS ),
|
| 184 |
+
.C3_MEM_ADDR_WIDTH (C3_MEM_ADDR_WIDTH ),
|
| 185 |
+
.C3_MEM_BANKADDR_WIDTH (C3_MEM_BANKADDR_WIDTH),
|
| 186 |
+
|
| 187 |
+
.C3_HW_TESTING (C3_HW_TESTING),
|
| 188 |
+
.C3_SIMULATION (C3_SIMULATION),
|
| 189 |
+
.C3_CALIB_SOFT_IP (C3_CALIB_SOFT_IP )
|
| 190 |
+
)
|
| 191 |
+
design_top (
|
| 192 |
+
|
| 193 |
+
.c3_sys_clk (c3_sys_clk),
|
| 194 |
+
.c3_sys_rst_i (c3_sys_rst_i),
|
| 195 |
+
|
| 196 |
+
.mcb3_dram_dq (mcb3_dram_dq),
|
| 197 |
+
.mcb3_dram_a (mcb3_dram_a),
|
| 198 |
+
.mcb3_dram_ba (mcb3_dram_ba),
|
| 199 |
+
.mcb3_dram_ras_n (mcb3_dram_ras_n),
|
| 200 |
+
.mcb3_dram_cas_n (mcb3_dram_cas_n),
|
| 201 |
+
.mcb3_dram_we_n (mcb3_dram_we_n),
|
| 202 |
+
.mcb3_dram_odt (mcb3_dram_odt),
|
| 203 |
+
.mcb3_dram_cke (mcb3_dram_cke),
|
| 204 |
+
.mcb3_dram_ck (mcb3_dram_ck),
|
| 205 |
+
.mcb3_dram_ck_n (mcb3_dram_ck_n),
|
| 206 |
+
.mcb3_dram_dqs (mcb3_dram_dqs),
|
| 207 |
+
.mcb3_dram_dqs_n (mcb3_dram_dqs_n),
|
| 208 |
+
.calib_done (calib_done),
|
| 209 |
+
.error (error),
|
| 210 |
+
.mcb3_dram_udqs (mcb3_dram_udqs), // for X16 parts
|
| 211 |
+
.mcb3_dram_udqs_n (mcb3_dram_udqs_n), // for X16 parts
|
| 212 |
+
.mcb3_dram_udm (mcb3_dram_udm), // for X16 parts
|
| 213 |
+
.mcb3_dram_dm (mcb3_dram_dm),
|
| 214 |
+
.mcb3_rzq (rzq3),
|
| 215 |
+
|
| 216 |
+
.mcb3_zio (zio3),
|
| 217 |
+
|
| 218 |
+
.mcb3_dram_reset_n (mcb3_dram_reset_n)
|
| 219 |
+
);
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
// ========================================================================== //
|
| 224 |
+
// Memory model instances //
|
| 225 |
+
// ========================================================================== //
|
| 226 |
+
|
| 227 |
+
generate
|
| 228 |
+
if(C3_NUM_DQ_PINS == 16) begin : MEM_INST3
|
| 229 |
+
ddr3_model_c3 u_mem_c3(
|
| 230 |
+
.ck (mcb3_dram_ck),
|
| 231 |
+
.ck_n (mcb3_dram_ck_n),
|
| 232 |
+
.cke (mcb3_dram_cke),
|
| 233 |
+
.cs_n (1'b0),
|
| 234 |
+
.ras_n (mcb3_dram_ras_n),
|
| 235 |
+
.cas_n (mcb3_dram_cas_n),
|
| 236 |
+
.we_n (mcb3_dram_we_n),
|
| 237 |
+
.dm_tdqs ({mcb3_dram_udm,mcb3_dram_dm}),
|
| 238 |
+
.ba (mcb3_dram_ba),
|
| 239 |
+
.addr (mcb3_dram_a),
|
| 240 |
+
.dq (mcb3_dram_dq),
|
| 241 |
+
.dqs ({mcb3_dram_udqs,mcb3_dram_dqs}),
|
| 242 |
+
.dqs_n ({mcb3_dram_udqs_n,mcb3_dram_dqs_n}),
|
| 243 |
+
.tdqs_n (),
|
| 244 |
+
.odt (mcb3_dram_odt),
|
| 245 |
+
.rst_n (mcb3_dram_reset_n)
|
| 246 |
+
);
|
| 247 |
+
end else begin
|
| 248 |
+
ddr3_model_c3 u_mem_c3(
|
| 249 |
+
.ck (mcb3_dram_ck),
|
| 250 |
+
.ck_n (mcb3_dram_ck_n),
|
| 251 |
+
.cke (mcb3_dram_cke),
|
| 252 |
+
.cs_n (1'b0),
|
| 253 |
+
.ras_n (mcb3_dram_ras_n),
|
| 254 |
+
.cas_n (mcb3_dram_cas_n),
|
| 255 |
+
.we_n (mcb3_dram_we_n),
|
| 256 |
+
.dm_tdqs (mcb3_dram_dm),
|
| 257 |
+
.ba (mcb3_dram_ba),
|
| 258 |
+
.addr (mcb3_dram_a),
|
| 259 |
+
.dq (mcb3_dram_dq),
|
| 260 |
+
.dqs (mcb3_dram_dqs),
|
| 261 |
+
.dqs_n (mcb3_dram_dqs_n),
|
| 262 |
+
.tdqs_n (),
|
| 263 |
+
.odt (mcb3_dram_odt),
|
| 264 |
+
.rst_n (mcb3_dram_reset_n)
|
| 265 |
+
);
|
| 266 |
+
end
|
| 267 |
+
endgenerate
|
| 268 |
+
|
| 269 |
+
// ========================================================================== //
|
| 270 |
+
// Reporting the test case status
|
| 271 |
+
// ========================================================================== //
|
| 272 |
+
initial
|
| 273 |
+
begin : Logging
|
| 274 |
+
fork
|
| 275 |
+
begin : calibration_done
|
| 276 |
+
wait (calib_done);
|
| 277 |
+
$display("Calibration Done");
|
| 278 |
+
#50000000;
|
| 279 |
+
if (!error) begin
|
| 280 |
+
$display("TEST PASSED");
|
| 281 |
+
end
|
| 282 |
+
else begin
|
| 283 |
+
$display("TEST FAILED: DATA ERROR");
|
| 284 |
+
end
|
| 285 |
+
disable calib_not_done;
|
| 286 |
+
$finish;
|
| 287 |
+
end
|
| 288 |
+
|
| 289 |
+
begin : calib_not_done
|
| 290 |
+
#200000000;
|
| 291 |
+
if (!calib_done) begin
|
| 292 |
+
$display("TEST FAILED: INITIALIZATION DID NOT COMPLETE");
|
| 293 |
+
end
|
| 294 |
+
disable calibration_done;
|
| 295 |
+
$finish;
|
| 296 |
+
end
|
| 297 |
+
join
|
| 298 |
+
end
|
| 299 |
+
|
| 300 |
+
endmodule
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/synth/mem_interface_top_synp.sdc
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Synplicity, Inc. constraint file
|
| 2 |
+
# Written on Mon Jun 27 15:50:39 2005
|
| 3 |
+
|
| 4 |
+
define_attribute {v:work.example_top} syn_hier {hard}
|
| 5 |
+
define_attribute {v:work.infrastructure} syn_hier {hard}
|
| 6 |
+
define_attribute {v:work.memc_tb_top} syn_hier {hard}
|
| 7 |
+
define_attribute {v:work.memc_wrapper} syn_hier {hard}
|
| 8 |
+
define_attribute {v:work.iodrp_controller} syn_hier {hard}
|
| 9 |
+
define_attribute {v:work.iodrp_mcb_controller} syn_hier {hard}
|
| 10 |
+
define_attribute {v:work.mcb_raw_wrapper} syn_hier {hard}
|
| 11 |
+
define_attribute {v:work.mcb_soft_calibration} syn_hier {hard}
|
| 12 |
+
define_attribute {v:work.mcb_soft_calibration_top} syn_hier {hard}
|
| 13 |
+
define_attribute {v:work.mcb_ui_top} syn_hier {hard}
|
| 14 |
+
define_attribute {v:work.afifo} syn_hier {hard}
|
| 15 |
+
define_attribute {v:work.cmd_gen} syn_hier {hard}
|
| 16 |
+
define_attribute {v:work.cmd_prbs_gen} syn_hier {hard}
|
| 17 |
+
define_attribute {v:work.data_prbs_gen} syn_hier {hard}
|
| 18 |
+
define_attribute {v:work.init_mem_pattern_ctr} syn_hier {hard}
|
| 19 |
+
define_attribute {v:work.mcb_flow_control} syn_hier {hard}
|
| 20 |
+
define_attribute {v:work.mcb_traffic_gen} syn_hier {hard}
|
| 21 |
+
define_attribute {v:work.rd_data_gen} syn_hier {hard}
|
| 22 |
+
define_attribute {v:work.read_data_path} syn_hier {hard}
|
| 23 |
+
define_attribute {v:work.read_posted_fifo} syn_hier {hard}
|
| 24 |
+
define_attribute {v:work.sp6_data_gen} syn_hier {hard}
|
| 25 |
+
define_attribute {v:work.tg_status} syn_hier {hard}
|
| 26 |
+
define_attribute {v:work.v6_data_gen} syn_hier {hard}
|
| 27 |
+
define_attribute {v:work.wr_data_gen} syn_hier {hard}
|
| 28 |
+
define_attribute {v:work.write_data_path} syn_hier {hard}
|
| 29 |
+
|
| 30 |
+
# clock Constraints
|
| 31 |
+
define_clock -disable -name {memc3_infrastructure_inst} -period 3200 -clockgroup default_clkgroup_1
|
| 32 |
+
define_clock -name {memc3_infrastructure_inst.SYS_CLK_INST} -period 3200 -clockgroup default_clkgroup_2
|
| 33 |
+
define_clock -disable -name {memc3_infrastructure_inst.u_pll_adv} -period 3200 -clockgroup default_clkgroup_3
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ddr_test/synth/script_synp.tcl
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
project -new
|
| 2 |
+
add_file -verilog "../rtl/example_top.v"
|
| 3 |
+
add_file -verilog "../rtl/infrastructure.v"
|
| 4 |
+
add_file -verilog "../rtl/memc_tb_top.v"
|
| 5 |
+
add_file -verilog "../rtl/memc_wrapper.v"
|
| 6 |
+
add_file -verilog "../rtl/mcb_controller/iodrp_controller.v"
|
| 7 |
+
add_file -verilog "../rtl/mcb_controller/iodrp_mcb_controller.v"
|
| 8 |
+
add_file -verilog "../rtl/mcb_controller/mcb_raw_wrapper.v"
|
| 9 |
+
add_file -verilog "../rtl/mcb_controller/mcb_soft_calibration.v"
|
| 10 |
+
add_file -verilog "../rtl/mcb_controller/mcb_soft_calibration_top.v"
|
| 11 |
+
add_file -verilog "../rtl/mcb_controller/mcb_ui_top.v"
|
| 12 |
+
add_file -verilog "../rtl/traffic_gen/afifo.v"
|
| 13 |
+
add_file -verilog "../rtl/traffic_gen/cmd_gen.v"
|
| 14 |
+
add_file -verilog "../rtl/traffic_gen/cmd_prbs_gen.v"
|
| 15 |
+
add_file -verilog "../rtl/traffic_gen/data_prbs_gen.v"
|
| 16 |
+
add_file -verilog "../rtl/traffic_gen/init_mem_pattern_ctr.v"
|
| 17 |
+
add_file -verilog "../rtl/traffic_gen/mcb_flow_control.v"
|
| 18 |
+
add_file -verilog "../rtl/traffic_gen/mcb_traffic_gen.v"
|
| 19 |
+
add_file -verilog "../rtl/traffic_gen/rd_data_gen.v"
|
| 20 |
+
add_file -verilog "../rtl/traffic_gen/read_data_path.v"
|
| 21 |
+
add_file -verilog "../rtl/traffic_gen/read_posted_fifo.v"
|
| 22 |
+
add_file -verilog "../rtl/traffic_gen/sp6_data_gen.v"
|
| 23 |
+
add_file -verilog "../rtl/traffic_gen/tg_status.v"
|
| 24 |
+
add_file -verilog "../rtl/traffic_gen/v6_data_gen.v"
|
| 25 |
+
add_file -verilog "../rtl/traffic_gen/wr_data_gen.v"
|
| 26 |
+
add_file -verilog "../rtl/traffic_gen/write_data_path.v"
|
| 27 |
+
add_file -constraint "../synth/mem_interface_top_synp.sdc"
|
| 28 |
+
impl -add rev_1
|
| 29 |
+
set_option -technology spartan6
|
| 30 |
+
set_option -part xc6slx45
|
| 31 |
+
set_option -package csg324
|
| 32 |
+
set_option -speed_grade -2
|
| 33 |
+
set_option -default_enum_encoding default
|
| 34 |
+
#AXI_ENABLE synp definition is not required for Native Interface
|
| 35 |
+
set_option -symbolic_fsm_compiler 1
|
| 36 |
+
set_option -resource_sharing 0
|
| 37 |
+
set_option -use_fsm_explorer 0
|
| 38 |
+
set_option -top_module "example_top"
|
| 39 |
+
set_option -frequency 312.5
|
| 40 |
+
set_option -fanout_limit 1000
|
| 41 |
+
set_option -disable_io_insertion 0
|
| 42 |
+
set_option -pipe 1
|
| 43 |
+
set_option -fixgatedclocks 0
|
| 44 |
+
set_option -retiming 0
|
| 45 |
+
set_option -modular 0
|
| 46 |
+
set_option -update_models_cp 0
|
| 47 |
+
set_option -verification_mode 0
|
| 48 |
+
set_option -write_verilog 0
|
| 49 |
+
set_option -write_vhdl 0
|
| 50 |
+
set_option -write_apr_constraint 0
|
| 51 |
+
project -result_file "../synth/rev_1/example_top.edf"
|
| 52 |
+
set_option -vlog_std v2001
|
| 53 |
+
set_option -auto_constrain_io 0
|
| 54 |
+
impl -active "../synth/rev_1"
|
| 55 |
+
project -run
|
| 56 |
+
project -save
|
| 57 |
+
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_icon_pro/icon_pro.vhd
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-------------------------------------------------------------------------------
|
| 2 |
+
-- Copyright (c) 2017 Xilinx, Inc.
|
| 3 |
+
-- All Rights Reserved
|
| 4 |
+
-------------------------------------------------------------------------------
|
| 5 |
+
-- ____ ____
|
| 6 |
+
-- / /\/ /
|
| 7 |
+
-- /___/ \ / Vendor : Xilinx
|
| 8 |
+
-- \ \ \/ Version : 14.7
|
| 9 |
+
-- \ \ Application: XILINX CORE Generator
|
| 10 |
+
-- / / Filename : icon_pro.vhd
|
| 11 |
+
-- /___/ /\ Timestamp : Sun Jun 25 16:19:20 �й���ʱ�� 2017
|
| 12 |
+
-- \ \ / \
|
| 13 |
+
-- \___\/\___\
|
| 14 |
+
--
|
| 15 |
+
-- Design Name: VHDL Synthesis Wrapper
|
| 16 |
+
-------------------------------------------------------------------------------
|
| 17 |
+
-- This wrapper is used to integrate with Project Navigator and PlanAhead
|
| 18 |
+
|
| 19 |
+
LIBRARY ieee;
|
| 20 |
+
USE ieee.std_logic_1164.ALL;
|
| 21 |
+
ENTITY icon_pro IS
|
| 22 |
+
port (
|
| 23 |
+
CONTROL0: inout std_logic_vector(35 downto 0));
|
| 24 |
+
END icon_pro;
|
| 25 |
+
|
| 26 |
+
ARCHITECTURE icon_pro_a OF icon_pro IS
|
| 27 |
+
BEGIN
|
| 28 |
+
|
| 29 |
+
END icon_pro_a;
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_icon_pro/icon_pro_flist.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Output products list for <icon_pro>
|
| 2 |
+
icon_pro.gise
|
| 3 |
+
icon_pro.ngc
|
| 4 |
+
icon_pro.ucf
|
| 5 |
+
icon_pro.vhd
|
| 6 |
+
icon_pro.vho
|
| 7 |
+
icon_pro.xco
|
| 8 |
+
icon_pro.xise
|
| 9 |
+
icon_pro_flist.txt
|
| 10 |
+
icon_pro_readme.txt
|
| 11 |
+
icon_pro_xmdf.tcl
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_icon_pro/icon_pro_readme.txt
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The following files were generated for 'icon_pro' in directory
|
| 2 |
+
E:\05_USB\26_ov5640_vga\26_ov5640_vga_normal\_ngo\cs_icon_pro\
|
| 3 |
+
|
| 4 |
+
XCO file generator:
|
| 5 |
+
Generate an XCO file for compatibility with legacy flows.
|
| 6 |
+
|
| 7 |
+
* icon_pro.xco
|
| 8 |
+
|
| 9 |
+
Creates an implementation netlist:
|
| 10 |
+
Creates an implementation netlist for the IP.
|
| 11 |
+
|
| 12 |
+
* icon_pro.ngc
|
| 13 |
+
* icon_pro.ucf
|
| 14 |
+
* icon_pro.vhd
|
| 15 |
+
* icon_pro.vho
|
| 16 |
+
|
| 17 |
+
Creates an HDL instantiation template:
|
| 18 |
+
Creates an HDL instantiation template for the IP.
|
| 19 |
+
|
| 20 |
+
* icon_pro.vho
|
| 21 |
+
|
| 22 |
+
Generate ISE metadata:
|
| 23 |
+
Create a metadata file for use when including this core in ISE designs
|
| 24 |
+
|
| 25 |
+
* icon_pro_xmdf.tcl
|
| 26 |
+
|
| 27 |
+
Generate ISE subproject:
|
| 28 |
+
Create an ISE subproject for use when including this core in ISE designs
|
| 29 |
+
|
| 30 |
+
* icon_pro.gise
|
| 31 |
+
* icon_pro.xise
|
| 32 |
+
|
| 33 |
+
Deliver Readme:
|
| 34 |
+
Readme file for the IP.
|
| 35 |
+
|
| 36 |
+
* icon_pro_readme.txt
|
| 37 |
+
|
| 38 |
+
Generate FLIST file:
|
| 39 |
+
Text file listing all of the output files produced when a customized core was
|
| 40 |
+
generated in the CORE Generator.
|
| 41 |
+
|
| 42 |
+
* icon_pro_flist.txt
|
| 43 |
+
|
| 44 |
+
Please see the Xilinx CORE Generator online help for further details on
|
| 45 |
+
generated files and how to use them.
|
| 46 |
+
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_icon_pro/icon_pro_xmdf.tcl
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The package naming convention is <core_name>_xmdf
|
| 2 |
+
package provide icon_pro_xmdf 1.0
|
| 3 |
+
|
| 4 |
+
# This includes some utilities that support common XMDF operations
|
| 5 |
+
package require utilities_xmdf
|
| 6 |
+
|
| 7 |
+
# Define a namespace for this package. The name of the name space
|
| 8 |
+
# is <core_name>_xmdf
|
| 9 |
+
namespace eval ::icon_pro_xmdf {
|
| 10 |
+
# Use this to define any statics
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
# Function called by client to rebuild the params and port arrays
|
| 14 |
+
# Optional when the use context does not require the param or ports
|
| 15 |
+
# arrays to be available.
|
| 16 |
+
proc ::icon_pro_xmdf::xmdfInit { instance } {
|
| 17 |
+
# Variable containing name of library into which module is compiled
|
| 18 |
+
# Recommendation: <module_name>
|
| 19 |
+
# Required
|
| 20 |
+
utilities_xmdf::xmdfSetData $instance Module Attributes Name icon_pro
|
| 21 |
+
}
|
| 22 |
+
# ::icon_pro_xmdf::xmdfInit
|
| 23 |
+
|
| 24 |
+
# Function called by client to fill in all the xmdf* data variables
|
| 25 |
+
# based on the current settings of the parameters
|
| 26 |
+
proc ::icon_pro_xmdf::xmdfApplyParams { instance } {
|
| 27 |
+
|
| 28 |
+
set fcount 0
|
| 29 |
+
# Array containing libraries that are assumed to exist
|
| 30 |
+
# Examples include unisim and xilinxcorelib
|
| 31 |
+
# Optional
|
| 32 |
+
# In this example, we assume that the unisim library will
|
| 33 |
+
# be available to the simulation and synthesis tool
|
| 34 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type logical_library
|
| 35 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount logical_library unisim
|
| 36 |
+
incr fcount
|
| 37 |
+
|
| 38 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path icon_pro.ngc
|
| 39 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type ngc
|
| 40 |
+
incr fcount
|
| 41 |
+
|
| 42 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path icon_pro.ucf
|
| 43 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type ucf
|
| 44 |
+
incr fcount
|
| 45 |
+
|
| 46 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path icon_pro.vhd
|
| 47 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type vhdl
|
| 48 |
+
incr fcount
|
| 49 |
+
|
| 50 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path icon_pro.vho
|
| 51 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type vhdl_template
|
| 52 |
+
incr fcount
|
| 53 |
+
|
| 54 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path icon_pro.xco
|
| 55 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type coregen_ip
|
| 56 |
+
incr fcount
|
| 57 |
+
|
| 58 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path icon_pro_xmdf.tcl
|
| 59 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type AnyView
|
| 60 |
+
incr fcount
|
| 61 |
+
|
| 62 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount associated_module icon_pro
|
| 63 |
+
incr fcount
|
| 64 |
+
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
# ::gen_comp_name_xmdf::xmdfApplyParams
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_ila_pro_0/ila_pro_0.vhd
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-------------------------------------------------------------------------------
|
| 2 |
+
-- Copyright (c) 2017 Xilinx, Inc.
|
| 3 |
+
-- All Rights Reserved
|
| 4 |
+
-------------------------------------------------------------------------------
|
| 5 |
+
-- ____ ____
|
| 6 |
+
-- / /\/ /
|
| 7 |
+
-- /___/ \ / Vendor : Xilinx
|
| 8 |
+
-- \ \ \/ Version : 14.7
|
| 9 |
+
-- \ \ Application: XILINX CORE Generator
|
| 10 |
+
-- / / Filename : ila_pro_0.vhd
|
| 11 |
+
-- /___/ /\ Timestamp : Sun Jun 25 16:22:15 �й���ʱ�� 2017
|
| 12 |
+
-- \ \ / \
|
| 13 |
+
-- \___\/\___\
|
| 14 |
+
--
|
| 15 |
+
-- Design Name: VHDL Synthesis Wrapper
|
| 16 |
+
-------------------------------------------------------------------------------
|
| 17 |
+
-- This wrapper is used to integrate with Project Navigator and PlanAhead
|
| 18 |
+
|
| 19 |
+
LIBRARY ieee;
|
| 20 |
+
USE ieee.std_logic_1164.ALL;
|
| 21 |
+
ENTITY ila_pro_0 IS
|
| 22 |
+
port (
|
| 23 |
+
CONTROL: inout std_logic_vector(35 downto 0);
|
| 24 |
+
CLK: in std_logic;
|
| 25 |
+
TRIG0: in std_logic_vector(3 downto 0);
|
| 26 |
+
TRIG1: in std_logic_vector(3 downto 0);
|
| 27 |
+
TRIG2: in std_logic_vector(10 downto 0);
|
| 28 |
+
TRIG3: in std_logic_vector(9 downto 0);
|
| 29 |
+
TRIG4: in std_logic_vector(15 downto 0);
|
| 30 |
+
TRIG5: in std_logic_vector(4 downto 0);
|
| 31 |
+
TRIG6: in std_logic_vector(63 downto 0));
|
| 32 |
+
END ila_pro_0;
|
| 33 |
+
|
| 34 |
+
ARCHITECTURE ila_pro_0_a OF ila_pro_0 IS
|
| 35 |
+
BEGIN
|
| 36 |
+
|
| 37 |
+
END ila_pro_0_a;
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_ila_pro_0/ila_pro_0_flist.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Output products list for <ila_pro_0>
|
| 2 |
+
ila_pro_0.cdc
|
| 3 |
+
ila_pro_0.gise
|
| 4 |
+
ila_pro_0.ngc
|
| 5 |
+
ila_pro_0.ucf
|
| 6 |
+
ila_pro_0.vhd
|
| 7 |
+
ila_pro_0.vho
|
| 8 |
+
ila_pro_0.xco
|
| 9 |
+
ila_pro_0.xise
|
| 10 |
+
ila_pro_0_flist.txt
|
| 11 |
+
ila_pro_0_readme.txt
|
| 12 |
+
ila_pro_0_xmdf.tcl
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_ila_pro_0/ila_pro_0_readme.txt
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The following files were generated for 'ila_pro_0' in directory
|
| 2 |
+
E:\05_USB\26_ov5640_vga\26_ov5640_vga_normal\_ngo\cs_ila_pro_0\
|
| 3 |
+
|
| 4 |
+
XCO file generator:
|
| 5 |
+
Generate an XCO file for compatibility with legacy flows.
|
| 6 |
+
|
| 7 |
+
* ila_pro_0.xco
|
| 8 |
+
|
| 9 |
+
Creates an implementation netlist:
|
| 10 |
+
Creates an implementation netlist for the IP.
|
| 11 |
+
|
| 12 |
+
* ila_pro_0.cdc
|
| 13 |
+
* ila_pro_0.ngc
|
| 14 |
+
* ila_pro_0.ucf
|
| 15 |
+
* ila_pro_0.vhd
|
| 16 |
+
* ila_pro_0.vho
|
| 17 |
+
|
| 18 |
+
Creates an HDL instantiation template:
|
| 19 |
+
Creates an HDL instantiation template for the IP.
|
| 20 |
+
|
| 21 |
+
* ila_pro_0.vho
|
| 22 |
+
|
| 23 |
+
Generate ISE metadata:
|
| 24 |
+
Create a metadata file for use when including this core in ISE designs
|
| 25 |
+
|
| 26 |
+
* ila_pro_0_xmdf.tcl
|
| 27 |
+
|
| 28 |
+
Generate ISE subproject:
|
| 29 |
+
Create an ISE subproject for use when including this core in ISE designs
|
| 30 |
+
|
| 31 |
+
* ila_pro_0.gise
|
| 32 |
+
* ila_pro_0.xise
|
| 33 |
+
|
| 34 |
+
Deliver Readme:
|
| 35 |
+
Readme file for the IP.
|
| 36 |
+
|
| 37 |
+
* ila_pro_0_readme.txt
|
| 38 |
+
|
| 39 |
+
Generate FLIST file:
|
| 40 |
+
Text file listing all of the output files produced when a customized core was
|
| 41 |
+
generated in the CORE Generator.
|
| 42 |
+
|
| 43 |
+
* ila_pro_0_flist.txt
|
| 44 |
+
|
| 45 |
+
Please see the Xilinx CORE Generator online help for further details on
|
| 46 |
+
generated files and how to use them.
|
| 47 |
+
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/_ngo/cs_ila_pro_0/ila_pro_0_xmdf.tcl
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The package naming convention is <core_name>_xmdf
|
| 2 |
+
package provide ila_pro_0_xmdf 1.0
|
| 3 |
+
|
| 4 |
+
# This includes some utilities that support common XMDF operations
|
| 5 |
+
package require utilities_xmdf
|
| 6 |
+
|
| 7 |
+
# Define a namespace for this package. The name of the name space
|
| 8 |
+
# is <core_name>_xmdf
|
| 9 |
+
namespace eval ::ila_pro_0_xmdf {
|
| 10 |
+
# Use this to define any statics
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
# Function called by client to rebuild the params and port arrays
|
| 14 |
+
# Optional when the use context does not require the param or ports
|
| 15 |
+
# arrays to be available.
|
| 16 |
+
proc ::ila_pro_0_xmdf::xmdfInit { instance } {
|
| 17 |
+
# Variable containing name of library into which module is compiled
|
| 18 |
+
# Recommendation: <module_name>
|
| 19 |
+
# Required
|
| 20 |
+
utilities_xmdf::xmdfSetData $instance Module Attributes Name ila_pro_0
|
| 21 |
+
}
|
| 22 |
+
# ::ila_pro_0_xmdf::xmdfInit
|
| 23 |
+
|
| 24 |
+
# Function called by client to fill in all the xmdf* data variables
|
| 25 |
+
# based on the current settings of the parameters
|
| 26 |
+
proc ::ila_pro_0_xmdf::xmdfApplyParams { instance } {
|
| 27 |
+
|
| 28 |
+
set fcount 0
|
| 29 |
+
# Array containing libraries that are assumed to exist
|
| 30 |
+
# Examples include unisim and xilinxcorelib
|
| 31 |
+
# Optional
|
| 32 |
+
# In this example, we assume that the unisim library will
|
| 33 |
+
# be available to the simulation and synthesis tool
|
| 34 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type logical_library
|
| 35 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount logical_library unisim
|
| 36 |
+
incr fcount
|
| 37 |
+
|
| 38 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path ila_pro_0.cdc
|
| 39 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type AnyView
|
| 40 |
+
incr fcount
|
| 41 |
+
|
| 42 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path ila_pro_0.ngc
|
| 43 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type ngc
|
| 44 |
+
incr fcount
|
| 45 |
+
|
| 46 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path ila_pro_0.ucf
|
| 47 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type ucf
|
| 48 |
+
incr fcount
|
| 49 |
+
|
| 50 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path ila_pro_0.vhd
|
| 51 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type vhdl
|
| 52 |
+
incr fcount
|
| 53 |
+
|
| 54 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path ila_pro_0.vho
|
| 55 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type vhdl_template
|
| 56 |
+
incr fcount
|
| 57 |
+
|
| 58 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path ila_pro_0.xco
|
| 59 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type coregen_ip
|
| 60 |
+
incr fcount
|
| 61 |
+
|
| 62 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount relative_path ila_pro_0_xmdf.tcl
|
| 63 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount type AnyView
|
| 64 |
+
incr fcount
|
| 65 |
+
|
| 66 |
+
utilities_xmdf::xmdfSetData $instance FileSet $fcount associated_module ila_pro_0
|
| 67 |
+
incr fcount
|
| 68 |
+
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
# ::gen_comp_name_xmdf::xmdfApplyParams
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/camera_capture.v
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 3 |
+
// Module Name: camera_capture
|
| 4 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 5 |
+
module camera_capture(
|
| 6 |
+
input reg_conf_done,
|
| 7 |
+
input camera_pclk,
|
| 8 |
+
input camera_href,
|
| 9 |
+
input camera_vsync,
|
| 10 |
+
input [7:0] camera_data,
|
| 11 |
+
output reg ddr_wren, //ddr cameraд���ź�, ��д
|
| 12 |
+
output reg [63:0] ddr_data_camera, //ddr camera�����
|
| 13 |
+
output reg ddr_addr_wr_set, //ddr ��ַ��λ�ź�,�߸�λddr��д��ַ
|
| 14 |
+
output reg [11:0] camera_h_count, //only for chipscope debug
|
| 15 |
+
output reg [10:0] camera_v_count, //only for chipscope debug
|
| 16 |
+
output reg [1:0] frame_switch,
|
| 17 |
+
input output_done ,
|
| 18 |
+
input nframe
|
| 19 |
+
);
|
| 20 |
+
|
| 21 |
+
//reg ddr_wren;
|
| 22 |
+
//reg [63:0] ddr_data_camera;
|
| 23 |
+
//reg ddr_addr_wr_set;
|
| 24 |
+
|
| 25 |
+
reg [63:0] camera_data_reg;
|
| 26 |
+
reg [3:0] counter;
|
| 27 |
+
|
| 28 |
+
reg camera_vsync_buf1;
|
| 29 |
+
reg camera_vsync_buf2;
|
| 30 |
+
reg flag_data ;
|
| 31 |
+
reg [7:0]camera_data_buf ;
|
| 32 |
+
reg [2:0]nframe_counter ;
|
| 33 |
+
reg nframe_flag ;
|
| 34 |
+
reg output_done_buf1 ;
|
| 35 |
+
reg output_done_buf2 ;
|
| 36 |
+
reg output_done_flag ;
|
| 37 |
+
reg output_done_buf_flag = 1 ;
|
| 38 |
+
reg change_nframe_switch;
|
| 39 |
+
reg change_nframe_switch_buf1;
|
| 40 |
+
reg change_nframe_switch_buf2;
|
| 41 |
+
/*always @ ( posedge camera_pclk )
|
| 42 |
+
begin
|
| 43 |
+
change_nframe_switch_buf1 <= frame_switch[0] ;
|
| 44 |
+
change_nframe_switch_buf2 <= change_nframe_switch_buf1 ;
|
| 45 |
+
change_nframe_switch <= change_nframe_switch_buf1 ^ change_nframe_switch_buf2;
|
| 46 |
+
end*/
|
| 47 |
+
always @ ( posedge camera_pclk or posedge nframe )
|
| 48 |
+
begin
|
| 49 |
+
if ( nframe )
|
| 50 |
+
output_done_buf_flag <= 0 ;
|
| 51 |
+
else
|
| 52 |
+
if ( output_done_flag )
|
| 53 |
+
output_done_buf_flag <= 1 ;
|
| 54 |
+
|
| 55 |
+
end
|
| 56 |
+
always @ ( posedge camera_pclk or posedge nframe )
|
| 57 |
+
begin
|
| 58 |
+
if ( nframe )
|
| 59 |
+
begin
|
| 60 |
+
output_done_buf1 <= 0 ;
|
| 61 |
+
output_done_buf2 <= 0 ;
|
| 62 |
+
output_done_flag <= 0 ;
|
| 63 |
+
end
|
| 64 |
+
else
|
| 65 |
+
begin
|
| 66 |
+
output_done_buf1 <= output_done ;
|
| 67 |
+
output_done_buf2 <= output_done_buf1 ;
|
| 68 |
+
output_done_flag <= output_done_buf2 && output_done_buf1 ;
|
| 69 |
+
end
|
| 70 |
+
end
|
| 71 |
+
//always @ ( posedge camera_pclk )
|
| 72 |
+
// begin
|
| 73 |
+
// if ( camera_vsync_buf1&~camera_vsync_buf2)
|
| 74 |
+
// begin
|
| 75 |
+
// camera_data_buf <= 8'h00 ;
|
| 76 |
+
// flag_data <= 0 ;
|
| 77 |
+
// end
|
| 78 |
+
// else
|
| 79 |
+
// if ( camera_v_count== 1 )
|
| 80 |
+
// begin
|
| 81 |
+
// {camera_data_buf,flag_data} <= {camera_data_buf,flag_data} + 1 ;
|
| 82 |
+
// end
|
| 83 |
+
// else
|
| 84 |
+
// if ( camera_v_count== 720 )
|
| 85 |
+
// begin
|
| 86 |
+
// {camera_data_buf,flag_data} <= {camera_data_buf,flag_data} + camera_href ;
|
| 87 |
+
// end
|
| 88 |
+
// else
|
| 89 |
+
// if ( camera_v_count== 2 )
|
| 90 |
+
// begin
|
| 91 |
+
// camera_data_buf <= 8'h00 ;
|
| 92 |
+
// end
|
| 93 |
+
// else
|
| 94 |
+
// if ( camera_v_count== 3 )
|
| 95 |
+
// begin
|
| 96 |
+
// camera_data_buf <= 8'hBB ;
|
| 97 |
+
// end
|
| 98 |
+
// else
|
| 99 |
+
// begin
|
| 100 |
+
// camera_data_buf <= 8'h00 ;
|
| 101 |
+
// end
|
| 102 |
+
// end
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
//����camera���
|
| 106 |
+
always @(posedge camera_pclk)
|
| 107 |
+
begin
|
| 108 |
+
if (!reg_conf_done)
|
| 109 |
+
camera_h_count<=1;
|
| 110 |
+
else if((camera_href==1'b1) & (camera_vsync==1'b0))
|
| 111 |
+
camera_h_count<=camera_h_count+1'b1;
|
| 112 |
+
else
|
| 113 |
+
camera_h_count<=1;
|
| 114 |
+
|
| 115 |
+
end
|
| 116 |
+
reg v_buf1;
|
| 117 |
+
reg v_buf2;
|
| 118 |
+
reg v_buf_flag;
|
| 119 |
+
always @ ( posedge camera_pclk )
|
| 120 |
+
begin
|
| 121 |
+
v_buf1 <= (camera_href==1'b1) & (camera_vsync==1'b0) ;
|
| 122 |
+
v_buf2 <= v_buf1 ;
|
| 123 |
+
v_buf_flag <= v_buf2 && (~v_buf1) ;
|
| 124 |
+
end
|
| 125 |
+
//����camera���
|
| 126 |
+
always @(posedge camera_pclk)
|
| 127 |
+
begin
|
| 128 |
+
if (camera_vsync_buf2&~camera_vsync_buf1)
|
| 129 |
+
begin
|
| 130 |
+
camera_v_count<=1;
|
| 131 |
+
//camera_data_buf <= 0 ;
|
| 132 |
+
end
|
| 133 |
+
else if(camera_h_count == 2560)
|
| 134 |
+
begin
|
| 135 |
+
camera_v_count<=camera_v_count+1'b1;
|
| 136 |
+
//camera_data_buf <= camera_data_buf + 1 ;
|
| 137 |
+
end
|
| 138 |
+
else
|
| 139 |
+
camera_v_count<=camera_v_count;
|
| 140 |
+
|
| 141 |
+
end
|
| 142 |
+
|
| 143 |
+
//����camera���ݴ洢��DDR�е������ź� 8->64
|
| 144 |
+
always @(posedge camera_pclk)
|
| 145 |
+
begin
|
| 146 |
+
if (!reg_conf_done) begin
|
| 147 |
+
camera_data_reg<=0;
|
| 148 |
+
ddr_wren<=1'b0;
|
| 149 |
+
counter<=0;
|
| 150 |
+
end
|
| 151 |
+
else if((camera_href==1'b1) & (camera_vsync==1'b0) )begin//& (output_done_buf_flag == 1) ) begin
|
| 152 |
+
if(counter<7) begin //��ȡǰ0~6��camera����
|
| 153 |
+
camera_data_reg<={camera_data_reg[55:0],camera_data};
|
| 154 |
+
counter<=counter+1'b1;
|
| 155 |
+
ddr_wren<=1'b0;
|
| 156 |
+
end
|
| 157 |
+
else begin //��ȡ��7��camera����
|
| 158 |
+
ddr_data_camera<={camera_data_reg[55:0],camera_data};
|
| 159 |
+
camera_data_reg<=0;
|
| 160 |
+
counter<=0;
|
| 161 |
+
ddr_wren<=1'b1; //���յ�8��bytes����,����ddrд�ź�
|
| 162 |
+
end
|
| 163 |
+
end
|
| 164 |
+
else begin
|
| 165 |
+
camera_data_reg<=0;
|
| 166 |
+
ddr_wren<=1'b0;
|
| 167 |
+
counter<=0;
|
| 168 |
+
end
|
| 169 |
+
end
|
| 170 |
+
|
| 171 |
+
//----------------------------------------------------
|
| 172 |
+
//����camera���ݴ洢�ĵ�ַ��λ�ź�
|
| 173 |
+
always @(posedge camera_pclk)
|
| 174 |
+
if (!reg_conf_done) begin
|
| 175 |
+
camera_vsync_buf1<=1'b0;
|
| 176 |
+
camera_vsync_buf2<=1'b0;
|
| 177 |
+
ddr_addr_wr_set<=1'b0;
|
| 178 |
+
frame_switch<=0;
|
| 179 |
+
nframe_counter <= 0 ;
|
| 180 |
+
nframe_flag <= 0 ;
|
| 181 |
+
end
|
| 182 |
+
else begin
|
| 183 |
+
camera_vsync_buf1<=camera_vsync;
|
| 184 |
+
camera_vsync_buf2<=camera_vsync_buf1;
|
| 185 |
+
if (camera_vsync_buf2&(~camera_vsync_buf1)) //���vsync���½���,ddr��д��ַ��λ
|
| 186 |
+
ddr_addr_wr_set<=~ddr_addr_wr_set;
|
| 187 |
+
// ddr_addr_wr_set<=1'b1;
|
| 188 |
+
// else
|
| 189 |
+
// ddr_addr_wr_set<=1'b0;
|
| 190 |
+
|
| 191 |
+
if (camera_vsync_buf1& (~camera_vsync_buf2) ) //���vsync���Ͻ���,Frame����д�ĵ�ַ�ռ佻��
|
| 192 |
+
frame_switch<=frame_switch + output_done_buf_flag;
|
| 193 |
+
|
| 194 |
+
end
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
endmodule
|
| 198 |
+
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/chipscope_icon.v
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
///////////////////////////////////////////////////////////////////////////////
|
| 2 |
+
// Copyright (c) 2015 Xilinx, Inc.
|
| 3 |
+
// All Rights Reserved
|
| 4 |
+
///////////////////////////////////////////////////////////////////////////////
|
| 5 |
+
// ____ ____
|
| 6 |
+
// / /\/ /
|
| 7 |
+
// /___/ \ / Vendor : Xilinx
|
| 8 |
+
// \ \ \/ Version : 14.7
|
| 9 |
+
// \ \ Application: Xilinx CORE Generator
|
| 10 |
+
// / / Filename : chipscope_icon.v
|
| 11 |
+
// /___/ /\ Timestamp : Mon Apr 20 14:17:02 �й���ʱ�� 2015
|
| 12 |
+
// \ \ / \
|
| 13 |
+
// \___\/\___\
|
| 14 |
+
//
|
| 15 |
+
// Design Name: Verilog Synthesis Wrapper
|
| 16 |
+
///////////////////////////////////////////////////////////////////////////////
|
| 17 |
+
// This wrapper is used to integrate with Project Navigator and PlanAhead
|
| 18 |
+
|
| 19 |
+
`timescale 1ns/1ps
|
| 20 |
+
|
| 21 |
+
module chipscope_icon(
|
| 22 |
+
CONTROL0) /* synthesis syn_black_box syn_noprune=1 */;
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
inout [35 : 0] CONTROL0;
|
| 26 |
+
|
| 27 |
+
endmodule
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/chipscope_ila.v
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
///////////////////////////////////////////////////////////////////////////////
|
| 2 |
+
// Copyright (c) 2015 Xilinx, Inc.
|
| 3 |
+
// All Rights Reserved
|
| 4 |
+
///////////////////////////////////////////////////////////////////////////////
|
| 5 |
+
// ____ ____
|
| 6 |
+
// / /\/ /
|
| 7 |
+
// /___/ \ / Vendor : Xilinx
|
| 8 |
+
// \ \ \/ Version : 14.7
|
| 9 |
+
// \ \ Application: Xilinx CORE Generator
|
| 10 |
+
// / / Filename : chipscope_ila.v
|
| 11 |
+
// /___/ /\ Timestamp : Mon Apr 20 14:20:30 �й���ʱ�� 2015
|
| 12 |
+
// \ \ / \
|
| 13 |
+
// \___\/\___\
|
| 14 |
+
//
|
| 15 |
+
// Design Name: Verilog Synthesis Wrapper
|
| 16 |
+
///////////////////////////////////////////////////////////////////////////////
|
| 17 |
+
// This wrapper is used to integrate with Project Navigator and PlanAhead
|
| 18 |
+
|
| 19 |
+
`timescale 1ns/1ps
|
| 20 |
+
|
| 21 |
+
module chipscope_ila(
|
| 22 |
+
CONTROL,
|
| 23 |
+
CLK,
|
| 24 |
+
TRIG0) /* synthesis syn_black_box syn_noprune=1 */;
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
inout [35 : 0] CONTROL;
|
| 28 |
+
input CLK;
|
| 29 |
+
input [255 : 0] TRIG0;
|
| 30 |
+
|
| 31 |
+
endmodule
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/create_ddr.tcl
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##
|
| 2 |
+
## Core Generator Run Script, generator for Project Navigator create command
|
| 3 |
+
##
|
| 4 |
+
|
| 5 |
+
proc findRtfPath { relativePath } {
|
| 6 |
+
set xilenv ""
|
| 7 |
+
if { [info exists ::env(XILINX) ] } {
|
| 8 |
+
if { [info exists ::env(MYXILINX)] } {
|
| 9 |
+
set xilenv [join [list $::env(MYXILINX) $::env(XILINX)] $::xilinx::path_sep ]
|
| 10 |
+
} else {
|
| 11 |
+
set xilenv $::env(XILINX)
|
| 12 |
+
}
|
| 13 |
+
}
|
| 14 |
+
foreach path [ split $xilenv $::xilinx::path_sep ] {
|
| 15 |
+
set fullPath [ file join $path $relativePath ]
|
| 16 |
+
if { [ file exists $fullPath ] } {
|
| 17 |
+
return $fullPath
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
return ""
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
source [ findRtfPath "data/projnav/scripts/dpm_cgUtils.tcl" ]
|
| 24 |
+
|
| 25 |
+
set result [ run_cg_create "xilinx.com:ip:mig:3.92" "ddr" "MIG Virtex-6 and Spartan-6" "MIG Virtex-6 and Spartan-6 (xilinx.com:ip:mig:3.92) generated by Project Navigator" xc6slx45-2csg324 Verilog ]
|
| 26 |
+
|
| 27 |
+
if { $result == 0 } {
|
| 28 |
+
puts "Core Generator create command completed successfully."
|
| 29 |
+
} elseif { $result == 1 } {
|
| 30 |
+
puts "Core Generator create command failed."
|
| 31 |
+
} elseif { $result == 3 || $result == 4 } {
|
| 32 |
+
# convert 'version check' result to real return range, bypassing any messages.
|
| 33 |
+
set result [ expr $result - 3 ]
|
| 34 |
+
} else {
|
| 35 |
+
puts "Core Generator create cancelled."
|
| 36 |
+
}
|
| 37 |
+
exit $result
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/create_ff.tcl
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##
|
| 2 |
+
## Core Generator Run Script, generator for Project Navigator create command
|
| 3 |
+
##
|
| 4 |
+
|
| 5 |
+
proc findRtfPath { relativePath } {
|
| 6 |
+
set xilenv ""
|
| 7 |
+
if { [info exists ::env(XILINX) ] } {
|
| 8 |
+
if { [info exists ::env(MYXILINX)] } {
|
| 9 |
+
set xilenv [join [list $::env(MYXILINX) $::env(XILINX)] $::xilinx::path_sep ]
|
| 10 |
+
} else {
|
| 11 |
+
set xilenv $::env(XILINX)
|
| 12 |
+
}
|
| 13 |
+
}
|
| 14 |
+
foreach path [ split $xilenv $::xilinx::path_sep ] {
|
| 15 |
+
set fullPath [ file join $path $relativePath ]
|
| 16 |
+
if { [ file exists $fullPath ] } {
|
| 17 |
+
return $fullPath
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
return ""
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
source [ findRtfPath "data/projnav/scripts/dpm_cgUtils.tcl" ]
|
| 24 |
+
|
| 25 |
+
set result [ run_cg_create "xilinx.com:ip:mig:3.92" "ff" "MIG Virtex-6 and Spartan-6" "MIG Virtex-6 and Spartan-6 (xilinx.com:ip:mig:3.92) generated by Project Navigator" xc6slx45-2csg324 Verilog ]
|
| 26 |
+
|
| 27 |
+
if { $result == 0 } {
|
| 28 |
+
puts "Core Generator create command completed successfully."
|
| 29 |
+
} elseif { $result == 1 } {
|
| 30 |
+
puts "Core Generator create command failed."
|
| 31 |
+
} elseif { $result == 3 || $result == 4 } {
|
| 32 |
+
# convert 'version check' result to real return range, bypassing any messages.
|
| 33 |
+
set result [ expr $result - 3 ]
|
| 34 |
+
} else {
|
| 35 |
+
puts "Core Generator create cancelled."
|
| 36 |
+
}
|
| 37 |
+
exit $result
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/create_ffgg.tcl
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##
|
| 2 |
+
## Core Generator Run Script, generator for Project Navigator create command
|
| 3 |
+
##
|
| 4 |
+
|
| 5 |
+
proc findRtfPath { relativePath } {
|
| 6 |
+
set xilenv ""
|
| 7 |
+
if { [info exists ::env(XILINX) ] } {
|
| 8 |
+
if { [info exists ::env(MYXILINX)] } {
|
| 9 |
+
set xilenv [join [list $::env(MYXILINX) $::env(XILINX)] $::xilinx::path_sep ]
|
| 10 |
+
} else {
|
| 11 |
+
set xilenv $::env(XILINX)
|
| 12 |
+
}
|
| 13 |
+
}
|
| 14 |
+
foreach path [ split $xilenv $::xilinx::path_sep ] {
|
| 15 |
+
set fullPath [ file join $path $relativePath ]
|
| 16 |
+
if { [ file exists $fullPath ] } {
|
| 17 |
+
return $fullPath
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
return ""
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
source [ findRtfPath "data/projnav/scripts/dpm_cgUtils.tcl" ]
|
| 24 |
+
|
| 25 |
+
set result [ run_cg_create "xilinx.com:ip:mig:3.92" "ffgg" "MIG Virtex-6 and Spartan-6" "MIG Virtex-6 and Spartan-6 (xilinx.com:ip:mig:3.92) generated by Project Navigator" xc6slx45-2csg324 Verilog ]
|
| 26 |
+
|
| 27 |
+
if { $result == 0 } {
|
| 28 |
+
puts "Core Generator create command completed successfully."
|
| 29 |
+
} elseif { $result == 1 } {
|
| 30 |
+
puts "Core Generator create command failed."
|
| 31 |
+
} elseif { $result == 3 || $result == 4 } {
|
| 32 |
+
# convert 'version check' result to real return range, bypassing any messages.
|
| 33 |
+
set result [ expr $result - 3 ]
|
| 34 |
+
} else {
|
| 35 |
+
puts "Core Generator create cancelled."
|
| 36 |
+
}
|
| 37 |
+
exit $result
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/create_fgg.tcl
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##
|
| 2 |
+
## Core Generator Run Script, generator for Project Navigator create command
|
| 3 |
+
##
|
| 4 |
+
|
| 5 |
+
proc findRtfPath { relativePath } {
|
| 6 |
+
set xilenv ""
|
| 7 |
+
if { [info exists ::env(XILINX) ] } {
|
| 8 |
+
if { [info exists ::env(MYXILINX)] } {
|
| 9 |
+
set xilenv [join [list $::env(MYXILINX) $::env(XILINX)] $::xilinx::path_sep ]
|
| 10 |
+
} else {
|
| 11 |
+
set xilenv $::env(XILINX)
|
| 12 |
+
}
|
| 13 |
+
}
|
| 14 |
+
foreach path [ split $xilenv $::xilinx::path_sep ] {
|
| 15 |
+
set fullPath [ file join $path $relativePath ]
|
| 16 |
+
if { [ file exists $fullPath ] } {
|
| 17 |
+
return $fullPath
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
return ""
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
source [ findRtfPath "data/projnav/scripts/dpm_cgUtils.tcl" ]
|
| 24 |
+
|
| 25 |
+
set result [ run_cg_create "xilinx.com:ip:mig:3.92" "fgg" "MIG Virtex-6 and Spartan-6" "MIG Virtex-6 and Spartan-6 (xilinx.com:ip:mig:3.92) generated by Project Navigator" xc6slx45-2csg324 Verilog ]
|
| 26 |
+
|
| 27 |
+
if { $result == 0 } {
|
| 28 |
+
puts "Core Generator create command completed successfully."
|
| 29 |
+
} elseif { $result == 1 } {
|
| 30 |
+
puts "Core Generator create command failed."
|
| 31 |
+
} elseif { $result == 3 || $result == 4 } {
|
| 32 |
+
# convert 'version check' result to real return range, bypassing any messages.
|
| 33 |
+
set result [ expr $result - 3 ]
|
| 34 |
+
} else {
|
| 35 |
+
puts "Core Generator create cancelled."
|
| 36 |
+
}
|
| 37 |
+
exit $result
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/create_jj.tcl
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##
|
| 2 |
+
## Core Generator Run Script, generator for Project Navigator create command
|
| 3 |
+
##
|
| 4 |
+
|
| 5 |
+
proc findRtfPath { relativePath } {
|
| 6 |
+
set xilenv ""
|
| 7 |
+
if { [info exists ::env(XILINX) ] } {
|
| 8 |
+
if { [info exists ::env(MYXILINX)] } {
|
| 9 |
+
set xilenv [join [list $::env(MYXILINX) $::env(XILINX)] $::xilinx::path_sep ]
|
| 10 |
+
} else {
|
| 11 |
+
set xilenv $::env(XILINX)
|
| 12 |
+
}
|
| 13 |
+
}
|
| 14 |
+
foreach path [ split $xilenv $::xilinx::path_sep ] {
|
| 15 |
+
set fullPath [ file join $path $relativePath ]
|
| 16 |
+
if { [ file exists $fullPath ] } {
|
| 17 |
+
return $fullPath
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
return ""
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
source [ findRtfPath "data/projnav/scripts/dpm_cgUtils.tcl" ]
|
| 24 |
+
|
| 25 |
+
set result [ run_cg_create "xilinx.com:ip:mig:3.92" "jj" "MIG Virtex-6 and Spartan-6" "MIG Virtex-6 and Spartan-6 (xilinx.com:ip:mig:3.92) generated by Project Navigator" xc6slx45-2csg324 Verilog ]
|
| 26 |
+
|
| 27 |
+
if { $result == 0 } {
|
| 28 |
+
puts "Core Generator create command completed successfully."
|
| 29 |
+
} elseif { $result == 1 } {
|
| 30 |
+
puts "Core Generator create command failed."
|
| 31 |
+
} elseif { $result == 3 || $result == 4 } {
|
| 32 |
+
# convert 'version check' result to real return range, bypassing any messages.
|
| 33 |
+
set result [ expr $result - 3 ]
|
| 34 |
+
} else {
|
| 35 |
+
puts "Core Generator create cancelled."
|
| 36 |
+
}
|
| 37 |
+
exit $result
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/create_pixel_fifo.tcl
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##
|
| 2 |
+
## Core Generator Run Script, generator for Project Navigator create command
|
| 3 |
+
##
|
| 4 |
+
|
| 5 |
+
proc findRtfPath { relativePath } {
|
| 6 |
+
set xilenv ""
|
| 7 |
+
if { [info exists ::env(XILINX) ] } {
|
| 8 |
+
if { [info exists ::env(MYXILINX)] } {
|
| 9 |
+
set xilenv [join [list $::env(MYXILINX) $::env(XILINX)] $::xilinx::path_sep ]
|
| 10 |
+
} else {
|
| 11 |
+
set xilenv $::env(XILINX)
|
| 12 |
+
}
|
| 13 |
+
}
|
| 14 |
+
foreach path [ split $xilenv $::xilinx::path_sep ] {
|
| 15 |
+
set fullPath [ file join $path $relativePath ]
|
| 16 |
+
if { [ file exists $fullPath ] } {
|
| 17 |
+
return $fullPath
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
return ""
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
source [ findRtfPath "data/projnav/scripts/dpm_cgUtils.tcl" ]
|
| 24 |
+
|
| 25 |
+
set result [ run_cg_create "xilinx.com:ip:fifo_generator:9.3" "pixel_fifo" "FIFO Generator" "FIFO Generator (xilinx.com:ip:fifo_generator:9.3) generated by Project Navigator" xc6slx45-2csg324 Verilog ]
|
| 26 |
+
|
| 27 |
+
if { $result == 0 } {
|
| 28 |
+
puts "Core Generator create command completed successfully."
|
| 29 |
+
} elseif { $result == 1 } {
|
| 30 |
+
puts "Core Generator create command failed."
|
| 31 |
+
} elseif { $result == 3 || $result == 4 } {
|
| 32 |
+
# convert 'version check' result to real return range, bypassing any messages.
|
| 33 |
+
set result [ expr $result - 3 ]
|
| 34 |
+
} else {
|
| 35 |
+
puts "Core Generator create cancelled."
|
| 36 |
+
}
|
| 37 |
+
exit $result
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo.v
ADDED
|
@@ -0,0 +1,489 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*******************************************************************************
|
| 2 |
+
* This file is owned and controlled by Xilinx and must be used solely *
|
| 3 |
+
* for design, simulation, implementation and creation of design files *
|
| 4 |
+
* limited to Xilinx devices or technologies. Use with non-Xilinx *
|
| 5 |
+
* devices or technologies is expressly prohibited and immediately *
|
| 6 |
+
* terminates your license. *
|
| 7 |
+
* *
|
| 8 |
+
* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" SOLELY *
|
| 9 |
+
* FOR USE IN DEVELOPING PROGRAMS AND SOLUTIONS FOR XILINX DEVICES. BY *
|
| 10 |
+
* PROVIDING THIS DESIGN, CODE, OR INFORMATION AS ONE POSSIBLE *
|
| 11 |
+
* IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, XILINX IS *
|
| 12 |
+
* MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE FROM ANY *
|
| 13 |
+
* CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING ANY *
|
| 14 |
+
* RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY *
|
| 15 |
+
* DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE *
|
| 16 |
+
* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR *
|
| 17 |
+
* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF *
|
| 18 |
+
* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
|
| 19 |
+
* PARTICULAR PURPOSE. *
|
| 20 |
+
* *
|
| 21 |
+
* Xilinx products are not intended for use in life support appliances, *
|
| 22 |
+
* devices, or systems. Use in such applications are expressly *
|
| 23 |
+
* prohibited. *
|
| 24 |
+
* *
|
| 25 |
+
* (c) Copyright 1995-2017 Xilinx, Inc. *
|
| 26 |
+
* All rights reserved. *
|
| 27 |
+
*******************************************************************************/
|
| 28 |
+
// You must compile the wrapper file pixel_fifo.v when simulating
|
| 29 |
+
// the core, pixel_fifo. When compiling the wrapper file, be sure to
|
| 30 |
+
// reference the XilinxCoreLib Verilog simulation library. For detailed
|
| 31 |
+
// instructions, please refer to the "CORE Generator Help".
|
| 32 |
+
|
| 33 |
+
// The synthesis directives "translate_off/translate_on" specified below are
|
| 34 |
+
// supported by Xilinx, Mentor Graphics and Synplicity synthesis
|
| 35 |
+
// tools. Ensure they are correct for your synthesis tool(s).
|
| 36 |
+
|
| 37 |
+
`timescale 1ns/1ps
|
| 38 |
+
|
| 39 |
+
module pixel_fifo(
|
| 40 |
+
rst,
|
| 41 |
+
wr_clk,
|
| 42 |
+
rd_clk,
|
| 43 |
+
din,
|
| 44 |
+
wr_en,
|
| 45 |
+
rd_en,
|
| 46 |
+
dout,
|
| 47 |
+
full,
|
| 48 |
+
empty,
|
| 49 |
+
prog_full
|
| 50 |
+
);
|
| 51 |
+
|
| 52 |
+
input rst;
|
| 53 |
+
input wr_clk;
|
| 54 |
+
input rd_clk;
|
| 55 |
+
input [63 : 0] din;
|
| 56 |
+
input wr_en;
|
| 57 |
+
input rd_en;
|
| 58 |
+
output [63 : 0] dout;
|
| 59 |
+
output full;
|
| 60 |
+
output empty;
|
| 61 |
+
output prog_full;
|
| 62 |
+
|
| 63 |
+
// synthesis translate_off
|
| 64 |
+
|
| 65 |
+
FIFO_GENERATOR_V9_3 #(
|
| 66 |
+
.C_ADD_NGC_CONSTRAINT(0),
|
| 67 |
+
.C_APPLICATION_TYPE_AXIS(0),
|
| 68 |
+
.C_APPLICATION_TYPE_RACH(0),
|
| 69 |
+
.C_APPLICATION_TYPE_RDCH(0),
|
| 70 |
+
.C_APPLICATION_TYPE_WACH(0),
|
| 71 |
+
.C_APPLICATION_TYPE_WDCH(0),
|
| 72 |
+
.C_APPLICATION_TYPE_WRCH(0),
|
| 73 |
+
.C_AXI_ADDR_WIDTH(32),
|
| 74 |
+
.C_AXI_ARUSER_WIDTH(1),
|
| 75 |
+
.C_AXI_AWUSER_WIDTH(1),
|
| 76 |
+
.C_AXI_BUSER_WIDTH(1),
|
| 77 |
+
.C_AXI_DATA_WIDTH(64),
|
| 78 |
+
.C_AXI_ID_WIDTH(4),
|
| 79 |
+
.C_AXI_RUSER_WIDTH(1),
|
| 80 |
+
.C_AXI_TYPE(0),
|
| 81 |
+
.C_AXI_WUSER_WIDTH(1),
|
| 82 |
+
.C_AXIS_TDATA_WIDTH(64),
|
| 83 |
+
.C_AXIS_TDEST_WIDTH(4),
|
| 84 |
+
.C_AXIS_TID_WIDTH(8),
|
| 85 |
+
.C_AXIS_TKEEP_WIDTH(4),
|
| 86 |
+
.C_AXIS_TSTRB_WIDTH(4),
|
| 87 |
+
.C_AXIS_TUSER_WIDTH(4),
|
| 88 |
+
.C_AXIS_TYPE(0),
|
| 89 |
+
.C_COMMON_CLOCK(0),
|
| 90 |
+
.C_COUNT_TYPE(0),
|
| 91 |
+
.C_DATA_COUNT_WIDTH(7),
|
| 92 |
+
.C_DEFAULT_VALUE("BlankString"),
|
| 93 |
+
.C_DIN_WIDTH(64),
|
| 94 |
+
.C_DIN_WIDTH_AXIS(1),
|
| 95 |
+
.C_DIN_WIDTH_RACH(32),
|
| 96 |
+
.C_DIN_WIDTH_RDCH(64),
|
| 97 |
+
.C_DIN_WIDTH_WACH(32),
|
| 98 |
+
.C_DIN_WIDTH_WDCH(64),
|
| 99 |
+
.C_DIN_WIDTH_WRCH(2),
|
| 100 |
+
.C_DOUT_RST_VAL("0"),
|
| 101 |
+
.C_DOUT_WIDTH(64),
|
| 102 |
+
.C_ENABLE_RLOCS(0),
|
| 103 |
+
.C_ENABLE_RST_SYNC(1),
|
| 104 |
+
.C_ERROR_INJECTION_TYPE(0),
|
| 105 |
+
.C_ERROR_INJECTION_TYPE_AXIS(0),
|
| 106 |
+
.C_ERROR_INJECTION_TYPE_RACH(0),
|
| 107 |
+
.C_ERROR_INJECTION_TYPE_RDCH(0),
|
| 108 |
+
.C_ERROR_INJECTION_TYPE_WACH(0),
|
| 109 |
+
.C_ERROR_INJECTION_TYPE_WDCH(0),
|
| 110 |
+
.C_ERROR_INJECTION_TYPE_WRCH(0),
|
| 111 |
+
.C_FAMILY("spartan6"),
|
| 112 |
+
.C_FULL_FLAGS_RST_VAL(1),
|
| 113 |
+
.C_HAS_ALMOST_EMPTY(0),
|
| 114 |
+
.C_HAS_ALMOST_FULL(0),
|
| 115 |
+
.C_HAS_AXI_ARUSER(0),
|
| 116 |
+
.C_HAS_AXI_AWUSER(0),
|
| 117 |
+
.C_HAS_AXI_BUSER(0),
|
| 118 |
+
.C_HAS_AXI_RD_CHANNEL(0),
|
| 119 |
+
.C_HAS_AXI_RUSER(0),
|
| 120 |
+
.C_HAS_AXI_WR_CHANNEL(0),
|
| 121 |
+
.C_HAS_AXI_WUSER(0),
|
| 122 |
+
.C_HAS_AXIS_TDATA(0),
|
| 123 |
+
.C_HAS_AXIS_TDEST(0),
|
| 124 |
+
.C_HAS_AXIS_TID(0),
|
| 125 |
+
.C_HAS_AXIS_TKEEP(0),
|
| 126 |
+
.C_HAS_AXIS_TLAST(0),
|
| 127 |
+
.C_HAS_AXIS_TREADY(1),
|
| 128 |
+
.C_HAS_AXIS_TSTRB(0),
|
| 129 |
+
.C_HAS_AXIS_TUSER(0),
|
| 130 |
+
.C_HAS_BACKUP(0),
|
| 131 |
+
.C_HAS_DATA_COUNT(0),
|
| 132 |
+
.C_HAS_DATA_COUNTS_AXIS(0),
|
| 133 |
+
.C_HAS_DATA_COUNTS_RACH(0),
|
| 134 |
+
.C_HAS_DATA_COUNTS_RDCH(0),
|
| 135 |
+
.C_HAS_DATA_COUNTS_WACH(0),
|
| 136 |
+
.C_HAS_DATA_COUNTS_WDCH(0),
|
| 137 |
+
.C_HAS_DATA_COUNTS_WRCH(0),
|
| 138 |
+
.C_HAS_INT_CLK(0),
|
| 139 |
+
.C_HAS_MASTER_CE(0),
|
| 140 |
+
.C_HAS_MEMINIT_FILE(0),
|
| 141 |
+
.C_HAS_OVERFLOW(0),
|
| 142 |
+
.C_HAS_PROG_FLAGS_AXIS(0),
|
| 143 |
+
.C_HAS_PROG_FLAGS_RACH(0),
|
| 144 |
+
.C_HAS_PROG_FLAGS_RDCH(0),
|
| 145 |
+
.C_HAS_PROG_FLAGS_WACH(0),
|
| 146 |
+
.C_HAS_PROG_FLAGS_WDCH(0),
|
| 147 |
+
.C_HAS_PROG_FLAGS_WRCH(0),
|
| 148 |
+
.C_HAS_RD_DATA_COUNT(0),
|
| 149 |
+
.C_HAS_RD_RST(0),
|
| 150 |
+
.C_HAS_RST(1),
|
| 151 |
+
.C_HAS_SLAVE_CE(0),
|
| 152 |
+
.C_HAS_SRST(0),
|
| 153 |
+
.C_HAS_UNDERFLOW(0),
|
| 154 |
+
.C_HAS_VALID(0),
|
| 155 |
+
.C_HAS_WR_ACK(0),
|
| 156 |
+
.C_HAS_WR_DATA_COUNT(0),
|
| 157 |
+
.C_HAS_WR_RST(0),
|
| 158 |
+
.C_IMPLEMENTATION_TYPE(2),
|
| 159 |
+
.C_IMPLEMENTATION_TYPE_AXIS(1),
|
| 160 |
+
.C_IMPLEMENTATION_TYPE_RACH(1),
|
| 161 |
+
.C_IMPLEMENTATION_TYPE_RDCH(1),
|
| 162 |
+
.C_IMPLEMENTATION_TYPE_WACH(1),
|
| 163 |
+
.C_IMPLEMENTATION_TYPE_WDCH(1),
|
| 164 |
+
.C_IMPLEMENTATION_TYPE_WRCH(1),
|
| 165 |
+
.C_INIT_WR_PNTR_VAL(0),
|
| 166 |
+
.C_INTERFACE_TYPE(0),
|
| 167 |
+
.C_MEMORY_TYPE(1),
|
| 168 |
+
.C_MIF_FILE_NAME("BlankString"),
|
| 169 |
+
.C_MSGON_VAL(1),
|
| 170 |
+
.C_OPTIMIZATION_MODE(0),
|
| 171 |
+
.C_OVERFLOW_LOW(0),
|
| 172 |
+
.C_PRELOAD_LATENCY(1),
|
| 173 |
+
.C_PRELOAD_REGS(0),
|
| 174 |
+
.C_PRIM_FIFO_TYPE("512x72"),
|
| 175 |
+
.C_PROG_EMPTY_THRESH_ASSERT_VAL(2),
|
| 176 |
+
.C_PROG_EMPTY_THRESH_ASSERT_VAL_AXIS(1022),
|
| 177 |
+
.C_PROG_EMPTY_THRESH_ASSERT_VAL_RACH(1022),
|
| 178 |
+
.C_PROG_EMPTY_THRESH_ASSERT_VAL_RDCH(1022),
|
| 179 |
+
.C_PROG_EMPTY_THRESH_ASSERT_VAL_WACH(1022),
|
| 180 |
+
.C_PROG_EMPTY_THRESH_ASSERT_VAL_WDCH(1022),
|
| 181 |
+
.C_PROG_EMPTY_THRESH_ASSERT_VAL_WRCH(1022),
|
| 182 |
+
.C_PROG_EMPTY_THRESH_NEGATE_VAL(3),
|
| 183 |
+
.C_PROG_EMPTY_TYPE(0),
|
| 184 |
+
.C_PROG_EMPTY_TYPE_AXIS(0),
|
| 185 |
+
.C_PROG_EMPTY_TYPE_RACH(0),
|
| 186 |
+
.C_PROG_EMPTY_TYPE_RDCH(0),
|
| 187 |
+
.C_PROG_EMPTY_TYPE_WACH(0),
|
| 188 |
+
.C_PROG_EMPTY_TYPE_WDCH(0),
|
| 189 |
+
.C_PROG_EMPTY_TYPE_WRCH(0),
|
| 190 |
+
.C_PROG_FULL_THRESH_ASSERT_VAL(10),
|
| 191 |
+
.C_PROG_FULL_THRESH_ASSERT_VAL_AXIS(1023),
|
| 192 |
+
.C_PROG_FULL_THRESH_ASSERT_VAL_RACH(1023),
|
| 193 |
+
.C_PROG_FULL_THRESH_ASSERT_VAL_RDCH(1023),
|
| 194 |
+
.C_PROG_FULL_THRESH_ASSERT_VAL_WACH(1023),
|
| 195 |
+
.C_PROG_FULL_THRESH_ASSERT_VAL_WDCH(1023),
|
| 196 |
+
.C_PROG_FULL_THRESH_ASSERT_VAL_WRCH(1023),
|
| 197 |
+
.C_PROG_FULL_THRESH_NEGATE_VAL(9),
|
| 198 |
+
.C_PROG_FULL_TYPE(1),
|
| 199 |
+
.C_PROG_FULL_TYPE_AXIS(0),
|
| 200 |
+
.C_PROG_FULL_TYPE_RACH(0),
|
| 201 |
+
.C_PROG_FULL_TYPE_RDCH(0),
|
| 202 |
+
.C_PROG_FULL_TYPE_WACH(0),
|
| 203 |
+
.C_PROG_FULL_TYPE_WDCH(0),
|
| 204 |
+
.C_PROG_FULL_TYPE_WRCH(0),
|
| 205 |
+
.C_RACH_TYPE(0),
|
| 206 |
+
.C_RD_DATA_COUNT_WIDTH(7),
|
| 207 |
+
.C_RD_DEPTH(128),
|
| 208 |
+
.C_RD_FREQ(1),
|
| 209 |
+
.C_RD_PNTR_WIDTH(7),
|
| 210 |
+
.C_RDCH_TYPE(0),
|
| 211 |
+
.C_REG_SLICE_MODE_AXIS(0),
|
| 212 |
+
.C_REG_SLICE_MODE_RACH(0),
|
| 213 |
+
.C_REG_SLICE_MODE_RDCH(0),
|
| 214 |
+
.C_REG_SLICE_MODE_WACH(0),
|
| 215 |
+
.C_REG_SLICE_MODE_WDCH(0),
|
| 216 |
+
.C_REG_SLICE_MODE_WRCH(0),
|
| 217 |
+
.C_SYNCHRONIZER_STAGE(2),
|
| 218 |
+
.C_UNDERFLOW_LOW(0),
|
| 219 |
+
.C_USE_COMMON_OVERFLOW(0),
|
| 220 |
+
.C_USE_COMMON_UNDERFLOW(0),
|
| 221 |
+
.C_USE_DEFAULT_SETTINGS(0),
|
| 222 |
+
.C_USE_DOUT_RST(1),
|
| 223 |
+
.C_USE_ECC(0),
|
| 224 |
+
.C_USE_ECC_AXIS(0),
|
| 225 |
+
.C_USE_ECC_RACH(0),
|
| 226 |
+
.C_USE_ECC_RDCH(0),
|
| 227 |
+
.C_USE_ECC_WACH(0),
|
| 228 |
+
.C_USE_ECC_WDCH(0),
|
| 229 |
+
.C_USE_ECC_WRCH(0),
|
| 230 |
+
.C_USE_EMBEDDED_REG(0),
|
| 231 |
+
.C_USE_FIFO16_FLAGS(0),
|
| 232 |
+
.C_USE_FWFT_DATA_COUNT(0),
|
| 233 |
+
.C_VALID_LOW(0),
|
| 234 |
+
.C_WACH_TYPE(0),
|
| 235 |
+
.C_WDCH_TYPE(0),
|
| 236 |
+
.C_WR_ACK_LOW(0),
|
| 237 |
+
.C_WR_DATA_COUNT_WIDTH(7),
|
| 238 |
+
.C_WR_DEPTH(128),
|
| 239 |
+
.C_WR_DEPTH_AXIS(1024),
|
| 240 |
+
.C_WR_DEPTH_RACH(16),
|
| 241 |
+
.C_WR_DEPTH_RDCH(1024),
|
| 242 |
+
.C_WR_DEPTH_WACH(16),
|
| 243 |
+
.C_WR_DEPTH_WDCH(1024),
|
| 244 |
+
.C_WR_DEPTH_WRCH(16),
|
| 245 |
+
.C_WR_FREQ(1),
|
| 246 |
+
.C_WR_PNTR_WIDTH(7),
|
| 247 |
+
.C_WR_PNTR_WIDTH_AXIS(10),
|
| 248 |
+
.C_WR_PNTR_WIDTH_RACH(4),
|
| 249 |
+
.C_WR_PNTR_WIDTH_RDCH(10),
|
| 250 |
+
.C_WR_PNTR_WIDTH_WACH(4),
|
| 251 |
+
.C_WR_PNTR_WIDTH_WDCH(10),
|
| 252 |
+
.C_WR_PNTR_WIDTH_WRCH(4),
|
| 253 |
+
.C_WR_RESPONSE_LATENCY(1),
|
| 254 |
+
.C_WRCH_TYPE(0)
|
| 255 |
+
)
|
| 256 |
+
inst (
|
| 257 |
+
.RST(rst),
|
| 258 |
+
.WR_CLK(wr_clk),
|
| 259 |
+
.RD_CLK(rd_clk),
|
| 260 |
+
.DIN(din),
|
| 261 |
+
.WR_EN(wr_en),
|
| 262 |
+
.RD_EN(rd_en),
|
| 263 |
+
.DOUT(dout),
|
| 264 |
+
.FULL(full),
|
| 265 |
+
.EMPTY(empty),
|
| 266 |
+
.PROG_FULL(prog_full),
|
| 267 |
+
.BACKUP(),
|
| 268 |
+
.BACKUP_MARKER(),
|
| 269 |
+
.CLK(),
|
| 270 |
+
.SRST(),
|
| 271 |
+
.WR_RST(),
|
| 272 |
+
.RD_RST(),
|
| 273 |
+
.PROG_EMPTY_THRESH(),
|
| 274 |
+
.PROG_EMPTY_THRESH_ASSERT(),
|
| 275 |
+
.PROG_EMPTY_THRESH_NEGATE(),
|
| 276 |
+
.PROG_FULL_THRESH(),
|
| 277 |
+
.PROG_FULL_THRESH_ASSERT(),
|
| 278 |
+
.PROG_FULL_THRESH_NEGATE(),
|
| 279 |
+
.INT_CLK(),
|
| 280 |
+
.INJECTDBITERR(),
|
| 281 |
+
.INJECTSBITERR(),
|
| 282 |
+
.ALMOST_FULL(),
|
| 283 |
+
.WR_ACK(),
|
| 284 |
+
.OVERFLOW(),
|
| 285 |
+
.ALMOST_EMPTY(),
|
| 286 |
+
.VALID(),
|
| 287 |
+
.UNDERFLOW(),
|
| 288 |
+
.DATA_COUNT(),
|
| 289 |
+
.RD_DATA_COUNT(),
|
| 290 |
+
.WR_DATA_COUNT(),
|
| 291 |
+
.PROG_EMPTY(),
|
| 292 |
+
.SBITERR(),
|
| 293 |
+
.DBITERR(),
|
| 294 |
+
.M_ACLK(),
|
| 295 |
+
.S_ACLK(),
|
| 296 |
+
.S_ARESETN(),
|
| 297 |
+
.M_ACLK_EN(),
|
| 298 |
+
.S_ACLK_EN(),
|
| 299 |
+
.S_AXI_AWID(),
|
| 300 |
+
.S_AXI_AWADDR(),
|
| 301 |
+
.S_AXI_AWLEN(),
|
| 302 |
+
.S_AXI_AWSIZE(),
|
| 303 |
+
.S_AXI_AWBURST(),
|
| 304 |
+
.S_AXI_AWLOCK(),
|
| 305 |
+
.S_AXI_AWCACHE(),
|
| 306 |
+
.S_AXI_AWPROT(),
|
| 307 |
+
.S_AXI_AWQOS(),
|
| 308 |
+
.S_AXI_AWREGION(),
|
| 309 |
+
.S_AXI_AWUSER(),
|
| 310 |
+
.S_AXI_AWVALID(),
|
| 311 |
+
.S_AXI_AWREADY(),
|
| 312 |
+
.S_AXI_WID(),
|
| 313 |
+
.S_AXI_WDATA(),
|
| 314 |
+
.S_AXI_WSTRB(),
|
| 315 |
+
.S_AXI_WLAST(),
|
| 316 |
+
.S_AXI_WUSER(),
|
| 317 |
+
.S_AXI_WVALID(),
|
| 318 |
+
.S_AXI_WREADY(),
|
| 319 |
+
.S_AXI_BID(),
|
| 320 |
+
.S_AXI_BRESP(),
|
| 321 |
+
.S_AXI_BUSER(),
|
| 322 |
+
.S_AXI_BVALID(),
|
| 323 |
+
.S_AXI_BREADY(),
|
| 324 |
+
.M_AXI_AWID(),
|
| 325 |
+
.M_AXI_AWADDR(),
|
| 326 |
+
.M_AXI_AWLEN(),
|
| 327 |
+
.M_AXI_AWSIZE(),
|
| 328 |
+
.M_AXI_AWBURST(),
|
| 329 |
+
.M_AXI_AWLOCK(),
|
| 330 |
+
.M_AXI_AWCACHE(),
|
| 331 |
+
.M_AXI_AWPROT(),
|
| 332 |
+
.M_AXI_AWQOS(),
|
| 333 |
+
.M_AXI_AWREGION(),
|
| 334 |
+
.M_AXI_AWUSER(),
|
| 335 |
+
.M_AXI_AWVALID(),
|
| 336 |
+
.M_AXI_AWREADY(),
|
| 337 |
+
.M_AXI_WID(),
|
| 338 |
+
.M_AXI_WDATA(),
|
| 339 |
+
.M_AXI_WSTRB(),
|
| 340 |
+
.M_AXI_WLAST(),
|
| 341 |
+
.M_AXI_WUSER(),
|
| 342 |
+
.M_AXI_WVALID(),
|
| 343 |
+
.M_AXI_WREADY(),
|
| 344 |
+
.M_AXI_BID(),
|
| 345 |
+
.M_AXI_BRESP(),
|
| 346 |
+
.M_AXI_BUSER(),
|
| 347 |
+
.M_AXI_BVALID(),
|
| 348 |
+
.M_AXI_BREADY(),
|
| 349 |
+
.S_AXI_ARID(),
|
| 350 |
+
.S_AXI_ARADDR(),
|
| 351 |
+
.S_AXI_ARLEN(),
|
| 352 |
+
.S_AXI_ARSIZE(),
|
| 353 |
+
.S_AXI_ARBURST(),
|
| 354 |
+
.S_AXI_ARLOCK(),
|
| 355 |
+
.S_AXI_ARCACHE(),
|
| 356 |
+
.S_AXI_ARPROT(),
|
| 357 |
+
.S_AXI_ARQOS(),
|
| 358 |
+
.S_AXI_ARREGION(),
|
| 359 |
+
.S_AXI_ARUSER(),
|
| 360 |
+
.S_AXI_ARVALID(),
|
| 361 |
+
.S_AXI_ARREADY(),
|
| 362 |
+
.S_AXI_RID(),
|
| 363 |
+
.S_AXI_RDATA(),
|
| 364 |
+
.S_AXI_RRESP(),
|
| 365 |
+
.S_AXI_RLAST(),
|
| 366 |
+
.S_AXI_RUSER(),
|
| 367 |
+
.S_AXI_RVALID(),
|
| 368 |
+
.S_AXI_RREADY(),
|
| 369 |
+
.M_AXI_ARID(),
|
| 370 |
+
.M_AXI_ARADDR(),
|
| 371 |
+
.M_AXI_ARLEN(),
|
| 372 |
+
.M_AXI_ARSIZE(),
|
| 373 |
+
.M_AXI_ARBURST(),
|
| 374 |
+
.M_AXI_ARLOCK(),
|
| 375 |
+
.M_AXI_ARCACHE(),
|
| 376 |
+
.M_AXI_ARPROT(),
|
| 377 |
+
.M_AXI_ARQOS(),
|
| 378 |
+
.M_AXI_ARREGION(),
|
| 379 |
+
.M_AXI_ARUSER(),
|
| 380 |
+
.M_AXI_ARVALID(),
|
| 381 |
+
.M_AXI_ARREADY(),
|
| 382 |
+
.M_AXI_RID(),
|
| 383 |
+
.M_AXI_RDATA(),
|
| 384 |
+
.M_AXI_RRESP(),
|
| 385 |
+
.M_AXI_RLAST(),
|
| 386 |
+
.M_AXI_RUSER(),
|
| 387 |
+
.M_AXI_RVALID(),
|
| 388 |
+
.M_AXI_RREADY(),
|
| 389 |
+
.S_AXIS_TVALID(),
|
| 390 |
+
.S_AXIS_TREADY(),
|
| 391 |
+
.S_AXIS_TDATA(),
|
| 392 |
+
.S_AXIS_TSTRB(),
|
| 393 |
+
.S_AXIS_TKEEP(),
|
| 394 |
+
.S_AXIS_TLAST(),
|
| 395 |
+
.S_AXIS_TID(),
|
| 396 |
+
.S_AXIS_TDEST(),
|
| 397 |
+
.S_AXIS_TUSER(),
|
| 398 |
+
.M_AXIS_TVALID(),
|
| 399 |
+
.M_AXIS_TREADY(),
|
| 400 |
+
.M_AXIS_TDATA(),
|
| 401 |
+
.M_AXIS_TSTRB(),
|
| 402 |
+
.M_AXIS_TKEEP(),
|
| 403 |
+
.M_AXIS_TLAST(),
|
| 404 |
+
.M_AXIS_TID(),
|
| 405 |
+
.M_AXIS_TDEST(),
|
| 406 |
+
.M_AXIS_TUSER(),
|
| 407 |
+
.AXI_AW_INJECTSBITERR(),
|
| 408 |
+
.AXI_AW_INJECTDBITERR(),
|
| 409 |
+
.AXI_AW_PROG_FULL_THRESH(),
|
| 410 |
+
.AXI_AW_PROG_EMPTY_THRESH(),
|
| 411 |
+
.AXI_AW_DATA_COUNT(),
|
| 412 |
+
.AXI_AW_WR_DATA_COUNT(),
|
| 413 |
+
.AXI_AW_RD_DATA_COUNT(),
|
| 414 |
+
.AXI_AW_SBITERR(),
|
| 415 |
+
.AXI_AW_DBITERR(),
|
| 416 |
+
.AXI_AW_OVERFLOW(),
|
| 417 |
+
.AXI_AW_UNDERFLOW(),
|
| 418 |
+
.AXI_AW_PROG_FULL(),
|
| 419 |
+
.AXI_AW_PROG_EMPTY(),
|
| 420 |
+
.AXI_W_INJECTSBITERR(),
|
| 421 |
+
.AXI_W_INJECTDBITERR(),
|
| 422 |
+
.AXI_W_PROG_FULL_THRESH(),
|
| 423 |
+
.AXI_W_PROG_EMPTY_THRESH(),
|
| 424 |
+
.AXI_W_DATA_COUNT(),
|
| 425 |
+
.AXI_W_WR_DATA_COUNT(),
|
| 426 |
+
.AXI_W_RD_DATA_COUNT(),
|
| 427 |
+
.AXI_W_SBITERR(),
|
| 428 |
+
.AXI_W_DBITERR(),
|
| 429 |
+
.AXI_W_OVERFLOW(),
|
| 430 |
+
.AXI_W_UNDERFLOW(),
|
| 431 |
+
.AXI_B_INJECTSBITERR(),
|
| 432 |
+
.AXI_W_PROG_FULL(),
|
| 433 |
+
.AXI_W_PROG_EMPTY(),
|
| 434 |
+
.AXI_B_INJECTDBITERR(),
|
| 435 |
+
.AXI_B_PROG_FULL_THRESH(),
|
| 436 |
+
.AXI_B_PROG_EMPTY_THRESH(),
|
| 437 |
+
.AXI_B_DATA_COUNT(),
|
| 438 |
+
.AXI_B_WR_DATA_COUNT(),
|
| 439 |
+
.AXI_B_RD_DATA_COUNT(),
|
| 440 |
+
.AXI_B_SBITERR(),
|
| 441 |
+
.AXI_B_DBITERR(),
|
| 442 |
+
.AXI_B_OVERFLOW(),
|
| 443 |
+
.AXI_B_UNDERFLOW(),
|
| 444 |
+
.AXI_AR_INJECTSBITERR(),
|
| 445 |
+
.AXI_B_PROG_FULL(),
|
| 446 |
+
.AXI_B_PROG_EMPTY(),
|
| 447 |
+
.AXI_AR_INJECTDBITERR(),
|
| 448 |
+
.AXI_AR_PROG_FULL_THRESH(),
|
| 449 |
+
.AXI_AR_PROG_EMPTY_THRESH(),
|
| 450 |
+
.AXI_AR_DATA_COUNT(),
|
| 451 |
+
.AXI_AR_WR_DATA_COUNT(),
|
| 452 |
+
.AXI_AR_RD_DATA_COUNT(),
|
| 453 |
+
.AXI_AR_SBITERR(),
|
| 454 |
+
.AXI_AR_DBITERR(),
|
| 455 |
+
.AXI_AR_OVERFLOW(),
|
| 456 |
+
.AXI_AR_UNDERFLOW(),
|
| 457 |
+
.AXI_AR_PROG_FULL(),
|
| 458 |
+
.AXI_AR_PROG_EMPTY(),
|
| 459 |
+
.AXI_R_INJECTSBITERR(),
|
| 460 |
+
.AXI_R_INJECTDBITERR(),
|
| 461 |
+
.AXI_R_PROG_FULL_THRESH(),
|
| 462 |
+
.AXI_R_PROG_EMPTY_THRESH(),
|
| 463 |
+
.AXI_R_DATA_COUNT(),
|
| 464 |
+
.AXI_R_WR_DATA_COUNT(),
|
| 465 |
+
.AXI_R_RD_DATA_COUNT(),
|
| 466 |
+
.AXI_R_SBITERR(),
|
| 467 |
+
.AXI_R_DBITERR(),
|
| 468 |
+
.AXI_R_OVERFLOW(),
|
| 469 |
+
.AXI_R_UNDERFLOW(),
|
| 470 |
+
.AXIS_INJECTSBITERR(),
|
| 471 |
+
.AXI_R_PROG_FULL(),
|
| 472 |
+
.AXI_R_PROG_EMPTY(),
|
| 473 |
+
.AXIS_INJECTDBITERR(),
|
| 474 |
+
.AXIS_PROG_FULL_THRESH(),
|
| 475 |
+
.AXIS_PROG_EMPTY_THRESH(),
|
| 476 |
+
.AXIS_DATA_COUNT(),
|
| 477 |
+
.AXIS_WR_DATA_COUNT(),
|
| 478 |
+
.AXIS_RD_DATA_COUNT(),
|
| 479 |
+
.AXIS_SBITERR(),
|
| 480 |
+
.AXIS_DBITERR(),
|
| 481 |
+
.AXIS_OVERFLOW(),
|
| 482 |
+
.AXIS_UNDERFLOW(),
|
| 483 |
+
.AXIS_PROG_FULL(),
|
| 484 |
+
.AXIS_PROG_EMPTY()
|
| 485 |
+
);
|
| 486 |
+
|
| 487 |
+
// synthesis translate_on
|
| 488 |
+
|
| 489 |
+
endmodule
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/doc/fifo_generator_v9_3_readme.txt
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
CHANGE LOG for LogiCORE FIFO Generator V9.3 Rev 1
|
| 2 |
+
|
| 3 |
+
Release Date: December 18, 2012
|
| 4 |
+
--------------------------------------------------------------------------------
|
| 5 |
+
|
| 6 |
+
Table of Contents
|
| 7 |
+
|
| 8 |
+
1. INTRODUCTION
|
| 9 |
+
2. DEVICE SUPPORT
|
| 10 |
+
3. NEW FEATURE HISTORY
|
| 11 |
+
4. RESOLVED ISSUES
|
| 12 |
+
5. KNOWN ISSUES & LIMITATIONS
|
| 13 |
+
6. TECHNICAL SUPPORT & FEEDBACK
|
| 14 |
+
7. CORE RELEASE HISTORY
|
| 15 |
+
8. LEGAL DISCLAIMER
|
| 16 |
+
|
| 17 |
+
--------------------------------------------------------------------------------
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
1. INTRODUCTION
|
| 21 |
+
|
| 22 |
+
For installation instructions for this release, please go to:
|
| 23 |
+
|
| 24 |
+
http://www.xilinx.com/ipcenter/coregen/ip_update_install_instructions.htm
|
| 25 |
+
|
| 26 |
+
For system requirements:
|
| 27 |
+
|
| 28 |
+
http://www.xilinx.com/ipcenter/coregen/ip_update_system_requirements.htm
|
| 29 |
+
|
| 30 |
+
This file contains release notes for the Xilinx LogiCORE IP FIFO Generator v9.3 Rev 1
|
| 31 |
+
solution. For the latest core updates, see the product page at:
|
| 32 |
+
|
| 33 |
+
http://www.xilinx.com/products/ipcenter/FIFO_Generator.htm
|
| 34 |
+
|
| 35 |
+
................................................................................
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
2. DEVICE SUPPORT
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
2.1 ISE
|
| 42 |
+
|
| 43 |
+
The following device families are supported by the core for this release.
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
All 7 Series devices
|
| 47 |
+
Zynq-7000 devices
|
| 48 |
+
All Virtex-6 devices
|
| 49 |
+
All Spartan-6 devices
|
| 50 |
+
All Virtex-5 devices
|
| 51 |
+
All Spartan-3 devices
|
| 52 |
+
All Virtex-4 devices
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
2.2 Vivado
|
| 56 |
+
|
| 57 |
+
All 7 Series devices
|
| 58 |
+
Zynq-7000 devices
|
| 59 |
+
|
| 60 |
+
................................................................................
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
3. NEW FEATURE HISTORY
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
3.1 ISE
|
| 67 |
+
|
| 68 |
+
- ISE 14.4 software support
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
3.2 Vivado
|
| 72 |
+
|
| 73 |
+
- 2012.4 software support
|
| 74 |
+
- IP level constraint for Built-in FIFO reset synchronizer
|
| 75 |
+
|
| 76 |
+
................................................................................
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
4. RESOLVED ISSUES
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
4.1 ISE
|
| 83 |
+
|
| 84 |
+
- N/A
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
4.2 Vivado
|
| 88 |
+
|
| 89 |
+
- N/A
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
................................................................................
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
5. KNOWN ISSUES & LIMITATIONS
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
5.1 ISE
|
| 99 |
+
|
| 100 |
+
The following are known issues for v9.3 Rev 1 of this core at time of release:
|
| 101 |
+
|
| 102 |
+
1. Importing an XCO file alters the XCO configurations
|
| 103 |
+
|
| 104 |
+
Description: In the FIFO Generator GUI, after importing an XCO file (Independent clock, distributed memory configuration)
|
| 105 |
+
into a Virtex-4 CORE Generator project, if the FIFO type is changed to "Independent Clocks, Built-in FIFO" in page 1,
|
| 106 |
+
page 2 does not correctly offer the Read Clock Frequency and Write Clock Frequency options as it should.
|
| 107 |
+
|
| 108 |
+
CR 467240
|
| 109 |
+
AR 31379
|
| 110 |
+
|
| 111 |
+
2. Status flags after the first write to Common Clock Built-in FIFO not guaranteed
|
| 112 |
+
|
| 113 |
+
Description: When using Common Clock Built-in FIFO configuration with asynchronous reset for Virtex-6 FPGA,
|
| 114 |
+
correct behavior of the FIFO status flags cannot be guaranteed after the first write.
|
| 115 |
+
|
| 116 |
+
Workaround: To work around this issue, synchronize the negative edge of reset to RDCLK/WRCLK.
|
| 117 |
+
For more information and additional workaround see Answer Record 41099.
|
| 118 |
+
|
| 119 |
+
5.2 Vivado
|
| 120 |
+
|
| 121 |
+
The following are known issues for v9.3 Rev 1 of this core at time of release:
|
| 122 |
+
|
| 123 |
+
1. Description: When Trying to upgrade to latest version of FIFO Generator from older verions, following error message is seen
|
| 124 |
+
ERROR: [Common 17-69] Command failed: invalid command name "puts" and Auto Upgradation does not work.
|
| 125 |
+
|
| 126 |
+
CR 665836
|
| 127 |
+
|
| 128 |
+
The most recent information, including known issues, workarounds, and
|
| 129 |
+
resolutions for this version is provided in the IP Release Notes User Guide
|
| 130 |
+
located at
|
| 131 |
+
|
| 132 |
+
www.xilinx.com/support/documentation/user_guides/xtp025.pdf
|
| 133 |
+
|
| 134 |
+
................................................................................
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
6. TECHNICAL SUPPORT & FEEDBACK
|
| 138 |
+
|
| 139 |
+
To obtain technical support, create a WebCase at www.xilinx.com/support.
|
| 140 |
+
Questions are routed to a team with expertise using this product.
|
| 141 |
+
|
| 142 |
+
Xilinx provides technical support for use of this product when used
|
| 143 |
+
according to the guidelines described in the core documentation, and
|
| 144 |
+
cannot guarantee timing, functionality, or support of this product for
|
| 145 |
+
designs that do not follow specified guidelines.
|
| 146 |
+
|
| 147 |
+
................................................................................
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
7. CORE RELEASE HISTORY
|
| 151 |
+
|
| 152 |
+
Date By Version Description
|
| 153 |
+
================================================================================
|
| 154 |
+
12/18/2012 Xilinx, Inc. 9.3 Rev 1 ISE 14.4 and Vivado 2012.4 support; IP level constraint for Built-in FIFO reset synchronizer
|
| 155 |
+
10/16/2012 Xilinx, Inc. 9.3 ISE 14.3 and Vivado 2012.3 support; Clock Enable support for AXI4 Stream FIFO
|
| 156 |
+
07/25/2012 Xilinx, Inc. 9.2 ISE 14.2 and Vivado 2012.2 support; Accurate data count support for AXI4 Stream Packet FIFO
|
| 157 |
+
04/24/2012 Xilinx, Inc. 9.1 ISE 14.1 and Vivado 2012.1 support; Defense Grade 7 Series and Zynq devices, and Automotive Zynq device support
|
| 158 |
+
AXI FIFO data width support up to 4096; Programmable Full/Empty as sideband signals for AXI FIFO
|
| 159 |
+
01/18/2012 Xilinx, Inc. 8.4 ISE 13.4 support and Packet FIFO feature addition; Artix-7 Lower Power and Automotive Artix-7 device support
|
| 160 |
+
10/19/2011 Xilinx, Inc. 8.3 ISE 13.3 support and QVirtex-6L device support
|
| 161 |
+
06/22/2011 Xilinx, Inc. 8.2 ISE 13.2 support and Kintex-7L, Virtex-7L, Artix-7 and Zynq-7000 device support
|
| 162 |
+
03/01/2011 Xilinx, Inc. 8.1 ISE 13.1 support and Virtex-7 and Kintex-7 device support; Wiring Logic and Register Slice Support
|
| 163 |
+
10/29/2010 Xilinx, Inc. 7.3 ISE 13.0.2 support
|
| 164 |
+
09/21/2010 Xilinx, Inc. 7.2 ISE 12.3 support; AXI4 Support
|
| 165 |
+
07/30/2010 Xilinx, Inc. 7.1 ISE 13.0.1 support
|
| 166 |
+
06/18/2010 Xilinx, Inc. 6.2 ISE 12.2 support
|
| 167 |
+
04/19/2010 Xilinx, Inc. 6.1 ISE 12.1 support
|
| 168 |
+
12/02/2009 Xilinx, Inc. 5.3 rev 1 ISE 11.4 support; Spartan-6 Low Power and Automotive Spartan-6 Device support
|
| 169 |
+
09/16/2009 Xilinx, Inc. 5.3 Update to add 11.3; Virtex-6 Low Power and Virtex-6 HXT Device support
|
| 170 |
+
06/24/2009 Xilinx, Inc. 5.2 Update to add 11.2 and Virtex-6 CXT device support
|
| 171 |
+
04/24/2009 Xilinx, Inc. 5.1 Update to add 11.1 and Virtex-6 and Spartan-6 device support
|
| 172 |
+
09/19/2008 Xilinx, Inc. 4.4 Update to add 10.1 SP3 and Virtex-5 TXT device support and miscellaneous bug fixes
|
| 173 |
+
03/24/2008 Xilinx, Inc. 4.3 Update to add 10.1 support and miscellaneous bug fixes
|
| 174 |
+
10/03/2007 Xilinx, Inc. 4.2 Support for FWFT for Block RAM and Distributed RAM Common Clock FIFOs
|
| 175 |
+
08/08/2007 Xilinx, Inc. 4.1 Update to add 9.2i support; Revised to v4.1; ECC support for block RAM FIFO
|
| 176 |
+
04/02/2007 Xilinx, Inc. 3.3 Update to add 9.1i support; Revised to v3.3; Spartan-3A and Spartan-3A DSP support; ECC support
|
| 177 |
+
09/21/2006 Xilinx, Inc. 3.2 Revised to v3.2; Spartan-3 and Virtex-4 automotive device support
|
| 178 |
+
07/13/2006 Xilinx, Inc. 3.1 Update to add 8.2i support; Revised to v3.1; Virtex-5 support
|
| 179 |
+
01/11/2006 Xilinx, Inc. 2.3 Update to add 8.1i support; Revised to v2.3
|
| 180 |
+
08/31/2005 Xilinx, Inc. 2.2 Update to add 7.1i SP4 support; Revised to v2.2
|
| 181 |
+
04/28/2005 Xilinx, Inc. 2.1 Update to add 7.1i SP1 support; Revised to v2.1
|
| 182 |
+
11/04/2004 Xilinx, Inc. 2.0 Update to add 6.3i support; Revised to v2.0
|
| 183 |
+
05/21/2004 Xilinx, Inc. 1.1 Revised to v1.1; Virtex-4 support
|
| 184 |
+
04/23/2004 Xilinx, Inc. 1.0 Update to add 6.2i support; First release
|
| 185 |
+
================================================================================
|
| 186 |
+
|
| 187 |
+
................................................................................
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
8. LEGAL DISCLAIMER
|
| 191 |
+
|
| 192 |
+
(c) Copyright 2002 - 2012 Xilinx, Inc. All rights reserved.
|
| 193 |
+
|
| 194 |
+
This file contains confidential and proprietary information
|
| 195 |
+
of Xilinx, Inc. and is protected under U.S. and
|
| 196 |
+
international copyright and other intellectual property
|
| 197 |
+
laws.
|
| 198 |
+
|
| 199 |
+
DISCLAIMER
|
| 200 |
+
This disclaimer is not a license and does not grant any
|
| 201 |
+
rights to the materials distributed herewith. Except as
|
| 202 |
+
otherwise provided in a valid license issued to you by
|
| 203 |
+
Xilinx, and to the maximum extent permitted by applicable
|
| 204 |
+
law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 205 |
+
WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 206 |
+
AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 207 |
+
BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 208 |
+
INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 209 |
+
(2) Xilinx shall not be liable (whether in contract or tort,
|
| 210 |
+
including negligence, or under any other theory of
|
| 211 |
+
liability) for any loss or damage of any kind or nature
|
| 212 |
+
related to, arising under or in connection with these
|
| 213 |
+
materials, including for any direct, or any indirect,
|
| 214 |
+
special, incidental, or consequential loss or damage
|
| 215 |
+
(including loss of data, profits, goodwill, or any type of
|
| 216 |
+
loss or damage suffered as a result of any action brought
|
| 217 |
+
by a third party) even if such damage or loss was
|
| 218 |
+
reasonably foreseeable or Xilinx had been advised of the
|
| 219 |
+
possibility of the same.
|
| 220 |
+
|
| 221 |
+
CRITICAL APPLICATIONS
|
| 222 |
+
Xilinx products are not designed or intended to be fail-
|
| 223 |
+
safe, or for use in any application requiring fail-safe
|
| 224 |
+
performance, such as life-support or safety devices or
|
| 225 |
+
systems, Class III medical devices, nuclear facilities,
|
| 226 |
+
applications related to the deployment of airbags, or any
|
| 227 |
+
other applications that could lead to death, personal
|
| 228 |
+
injury, or severe property or environmental damage
|
| 229 |
+
(individually and collectively, "Critical
|
| 230 |
+
Applications"). Customer assumes the sole risk and
|
| 231 |
+
liability of any use of Xilinx products in Critical
|
| 232 |
+
Applications, subject only to applicable laws and
|
| 233 |
+
regulations governing limitations on product liability.
|
| 234 |
+
|
| 235 |
+
THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 236 |
+
PART OF THIS FILE AT ALL TIMES.
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/example_design/pixel_fifo_exdes.vhd
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--------------------------------------------------------------------------------
|
| 2 |
+
--
|
| 3 |
+
-- FIFO Generator Core - core top file for implementation
|
| 4 |
+
--
|
| 5 |
+
--------------------------------------------------------------------------------
|
| 6 |
+
--
|
| 7 |
+
-- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
|
| 8 |
+
--
|
| 9 |
+
-- This file contains confidential and proprietary information
|
| 10 |
+
-- of Xilinx, Inc. and is protected under U.S. and
|
| 11 |
+
-- international copyright and other intellectual property
|
| 12 |
+
-- laws.
|
| 13 |
+
--
|
| 14 |
+
-- DISCLAIMER
|
| 15 |
+
-- This disclaimer is not a license and does not grant any
|
| 16 |
+
-- rights to the materials distributed herewith. Except as
|
| 17 |
+
-- otherwise provided in a valid license issued to you by
|
| 18 |
+
-- Xilinx, and to the maximum extent permitted by applicable
|
| 19 |
+
-- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 20 |
+
-- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 21 |
+
-- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 22 |
+
-- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 23 |
+
-- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 24 |
+
-- (2) Xilinx shall not be liable (whether in contract or tort,
|
| 25 |
+
-- including negligence, or under any other theory of
|
| 26 |
+
-- liability) for any loss or damage of any kind or nature
|
| 27 |
+
-- related to, arising under or in connection with these
|
| 28 |
+
-- materials, including for any direct, or any indirect,
|
| 29 |
+
-- special, incidental, or consequential loss or damage
|
| 30 |
+
-- (including loss of data, profits, goodwill, or any type of
|
| 31 |
+
-- loss or damage suffered as a result of any action brought
|
| 32 |
+
-- by a third party) even if such damage or loss was
|
| 33 |
+
-- reasonably foreseeable or Xilinx had been advised of the
|
| 34 |
+
-- possibility of the same.
|
| 35 |
+
--
|
| 36 |
+
-- CRITICAL APPLICATIONS
|
| 37 |
+
-- Xilinx products are not designed or intended to be fail-
|
| 38 |
+
-- safe, or for use in any application requiring fail-safe
|
| 39 |
+
-- performance, such as life-support or safety devices or
|
| 40 |
+
-- systems, Class III medical devices, nuclear facilities,
|
| 41 |
+
-- applications related to the deployment of airbags, or any
|
| 42 |
+
-- other applications that could lead to death, personal
|
| 43 |
+
-- injury, or severe property or environmental damage
|
| 44 |
+
-- (individually and collectively, "Critical
|
| 45 |
+
-- Applications"). Customer assumes the sole risk and
|
| 46 |
+
-- liability of any use of Xilinx products in Critical
|
| 47 |
+
-- Applications, subject only to applicable laws and
|
| 48 |
+
-- regulations governing limitations on product liability.
|
| 49 |
+
--
|
| 50 |
+
-- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 51 |
+
-- PART OF THIS FILE AT ALL TIMES.
|
| 52 |
+
--------------------------------------------------------------------------------
|
| 53 |
+
--
|
| 54 |
+
-- Filename: pixel_fifo_exdes.vhd
|
| 55 |
+
--
|
| 56 |
+
-- Description:
|
| 57 |
+
-- This is the FIFO core wrapper with BUFG instances for clock connections.
|
| 58 |
+
--
|
| 59 |
+
--------------------------------------------------------------------------------
|
| 60 |
+
-- Library Declarations
|
| 61 |
+
--------------------------------------------------------------------------------
|
| 62 |
+
|
| 63 |
+
library ieee;
|
| 64 |
+
use ieee.std_logic_1164.all;
|
| 65 |
+
use ieee.std_logic_arith.all;
|
| 66 |
+
use ieee.std_logic_unsigned.all;
|
| 67 |
+
|
| 68 |
+
library unisim;
|
| 69 |
+
use unisim.vcomponents.all;
|
| 70 |
+
|
| 71 |
+
--------------------------------------------------------------------------------
|
| 72 |
+
-- Entity Declaration
|
| 73 |
+
--------------------------------------------------------------------------------
|
| 74 |
+
entity pixel_fifo_exdes is
|
| 75 |
+
PORT (
|
| 76 |
+
WR_CLK : IN std_logic;
|
| 77 |
+
RD_CLK : IN std_logic;
|
| 78 |
+
RST : IN std_logic;
|
| 79 |
+
PROG_FULL : OUT std_logic;
|
| 80 |
+
WR_EN : IN std_logic;
|
| 81 |
+
RD_EN : IN std_logic;
|
| 82 |
+
DIN : IN std_logic_vector(64-1 DOWNTO 0);
|
| 83 |
+
DOUT : OUT std_logic_vector(64-1 DOWNTO 0);
|
| 84 |
+
FULL : OUT std_logic;
|
| 85 |
+
EMPTY : OUT std_logic);
|
| 86 |
+
|
| 87 |
+
end pixel_fifo_exdes;
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
architecture xilinx of pixel_fifo_exdes is
|
| 92 |
+
|
| 93 |
+
signal wr_clk_i : std_logic;
|
| 94 |
+
signal rd_clk_i : std_logic;
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
component pixel_fifo is
|
| 99 |
+
PORT (
|
| 100 |
+
WR_CLK : IN std_logic;
|
| 101 |
+
RD_CLK : IN std_logic;
|
| 102 |
+
RST : IN std_logic;
|
| 103 |
+
PROG_FULL : OUT std_logic;
|
| 104 |
+
WR_EN : IN std_logic;
|
| 105 |
+
RD_EN : IN std_logic;
|
| 106 |
+
DIN : IN std_logic_vector(64-1 DOWNTO 0);
|
| 107 |
+
DOUT : OUT std_logic_vector(64-1 DOWNTO 0);
|
| 108 |
+
FULL : OUT std_logic;
|
| 109 |
+
EMPTY : OUT std_logic);
|
| 110 |
+
|
| 111 |
+
end component;
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
begin
|
| 115 |
+
|
| 116 |
+
wr_clk_buf: bufg
|
| 117 |
+
PORT map(
|
| 118 |
+
i => WR_CLK,
|
| 119 |
+
o => wr_clk_i
|
| 120 |
+
);
|
| 121 |
+
|
| 122 |
+
rd_clk_buf: bufg
|
| 123 |
+
PORT map(
|
| 124 |
+
i => RD_CLK,
|
| 125 |
+
o => rd_clk_i
|
| 126 |
+
);
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
exdes_inst : pixel_fifo
|
| 130 |
+
PORT MAP (
|
| 131 |
+
WR_CLK => wr_clk_i,
|
| 132 |
+
RD_CLK => rd_clk_i,
|
| 133 |
+
RST => rst,
|
| 134 |
+
PROG_FULL => prog_full,
|
| 135 |
+
WR_EN => wr_en,
|
| 136 |
+
RD_EN => rd_en,
|
| 137 |
+
DIN => din,
|
| 138 |
+
DOUT => dout,
|
| 139 |
+
FULL => full,
|
| 140 |
+
EMPTY => empty);
|
| 141 |
+
|
| 142 |
+
end xilinx;
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/fifo_generator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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
CHANGE LOG for LogiCORE FIFO Generator V9.3 Rev 1
|
| 2 |
+
|
| 3 |
+
Release Date: December 18, 2012
|
| 4 |
+
--------------------------------------------------------------------------------
|
| 5 |
+
|
| 6 |
+
Table of Contents
|
| 7 |
+
|
| 8 |
+
1. INTRODUCTION
|
| 9 |
+
2. DEVICE SUPPORT
|
| 10 |
+
3. NEW FEATURE HISTORY
|
| 11 |
+
4. RESOLVED ISSUES
|
| 12 |
+
5. KNOWN ISSUES & LIMITATIONS
|
| 13 |
+
6. TECHNICAL SUPPORT & FEEDBACK
|
| 14 |
+
7. CORE RELEASE HISTORY
|
| 15 |
+
8. LEGAL DISCLAIMER
|
| 16 |
+
|
| 17 |
+
--------------------------------------------------------------------------------
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
1. INTRODUCTION
|
| 21 |
+
|
| 22 |
+
For installation instructions for this release, please go to:
|
| 23 |
+
|
| 24 |
+
http://www.xilinx.com/ipcenter/coregen/ip_update_install_instructions.htm
|
| 25 |
+
|
| 26 |
+
For system requirements:
|
| 27 |
+
|
| 28 |
+
http://www.xilinx.com/ipcenter/coregen/ip_update_system_requirements.htm
|
| 29 |
+
|
| 30 |
+
This file contains release notes for the Xilinx LogiCORE IP FIFO Generator v9.3 Rev 1
|
| 31 |
+
solution. For the latest core updates, see the product page at:
|
| 32 |
+
|
| 33 |
+
http://www.xilinx.com/products/ipcenter/FIFO_Generator.htm
|
| 34 |
+
|
| 35 |
+
................................................................................
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
2. DEVICE SUPPORT
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
2.1 ISE
|
| 42 |
+
|
| 43 |
+
The following device families are supported by the core for this release.
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
All 7 Series devices
|
| 47 |
+
Zynq-7000 devices
|
| 48 |
+
All Virtex-6 devices
|
| 49 |
+
All Spartan-6 devices
|
| 50 |
+
All Virtex-5 devices
|
| 51 |
+
All Spartan-3 devices
|
| 52 |
+
All Virtex-4 devices
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
2.2 Vivado
|
| 56 |
+
|
| 57 |
+
All 7 Series devices
|
| 58 |
+
Zynq-7000 devices
|
| 59 |
+
|
| 60 |
+
................................................................................
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
3. NEW FEATURE HISTORY
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
3.1 ISE
|
| 67 |
+
|
| 68 |
+
- ISE 14.4 software support
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
3.2 Vivado
|
| 72 |
+
|
| 73 |
+
- 2012.4 software support
|
| 74 |
+
- IP level constraint for Built-in FIFO reset synchronizer
|
| 75 |
+
|
| 76 |
+
................................................................................
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
4. RESOLVED ISSUES
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
4.1 ISE
|
| 83 |
+
|
| 84 |
+
- N/A
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
4.2 Vivado
|
| 88 |
+
|
| 89 |
+
- N/A
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
................................................................................
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
5. KNOWN ISSUES & LIMITATIONS
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
5.1 ISE
|
| 99 |
+
|
| 100 |
+
The following are known issues for v9.3 Rev 1 of this core at time of release:
|
| 101 |
+
|
| 102 |
+
1. Importing an XCO file alters the XCO configurations
|
| 103 |
+
|
| 104 |
+
Description: In the FIFO Generator GUI, after importing an XCO file (Independent clock, distributed memory configuration)
|
| 105 |
+
into a Virtex-4 CORE Generator project, if the FIFO type is changed to "Independent Clocks, Built-in FIFO" in page 1,
|
| 106 |
+
page 2 does not correctly offer the Read Clock Frequency and Write Clock Frequency options as it should.
|
| 107 |
+
|
| 108 |
+
CR 467240
|
| 109 |
+
AR 31379
|
| 110 |
+
|
| 111 |
+
2. Status flags after the first write to Common Clock Built-in FIFO not guaranteed
|
| 112 |
+
|
| 113 |
+
Description: When using Common Clock Built-in FIFO configuration with asynchronous reset for Virtex-6 FPGA,
|
| 114 |
+
correct behavior of the FIFO status flags cannot be guaranteed after the first write.
|
| 115 |
+
|
| 116 |
+
Workaround: To work around this issue, synchronize the negative edge of reset to RDCLK/WRCLK.
|
| 117 |
+
For more information and additional workaround see Answer Record 41099.
|
| 118 |
+
|
| 119 |
+
5.2 Vivado
|
| 120 |
+
|
| 121 |
+
The following are known issues for v9.3 Rev 1 of this core at time of release:
|
| 122 |
+
|
| 123 |
+
1. Description: When Trying to upgrade to latest version of FIFO Generator from older verions, following error message is seen
|
| 124 |
+
ERROR: [Common 17-69] Command failed: invalid command name "puts" and Auto Upgradation does not work.
|
| 125 |
+
|
| 126 |
+
CR 665836
|
| 127 |
+
|
| 128 |
+
The most recent information, including known issues, workarounds, and
|
| 129 |
+
resolutions for this version is provided in the IP Release Notes User Guide
|
| 130 |
+
located at
|
| 131 |
+
|
| 132 |
+
www.xilinx.com/support/documentation/user_guides/xtp025.pdf
|
| 133 |
+
|
| 134 |
+
................................................................................
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
6. TECHNICAL SUPPORT & FEEDBACK
|
| 138 |
+
|
| 139 |
+
To obtain technical support, create a WebCase at www.xilinx.com/support.
|
| 140 |
+
Questions are routed to a team with expertise using this product.
|
| 141 |
+
|
| 142 |
+
Xilinx provides technical support for use of this product when used
|
| 143 |
+
according to the guidelines described in the core documentation, and
|
| 144 |
+
cannot guarantee timing, functionality, or support of this product for
|
| 145 |
+
designs that do not follow specified guidelines.
|
| 146 |
+
|
| 147 |
+
................................................................................
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
7. CORE RELEASE HISTORY
|
| 151 |
+
|
| 152 |
+
Date By Version Description
|
| 153 |
+
================================================================================
|
| 154 |
+
12/18/2012 Xilinx, Inc. 9.3 Rev 1 ISE 14.4 and Vivado 2012.4 support; IP level constraint for Built-in FIFO reset synchronizer
|
| 155 |
+
10/16/2012 Xilinx, Inc. 9.3 ISE 14.3 and Vivado 2012.3 support; Clock Enable support for AXI4 Stream FIFO
|
| 156 |
+
07/25/2012 Xilinx, Inc. 9.2 ISE 14.2 and Vivado 2012.2 support; Accurate data count support for AXI4 Stream Packet FIFO
|
| 157 |
+
04/24/2012 Xilinx, Inc. 9.1 ISE 14.1 and Vivado 2012.1 support; Defense Grade 7 Series and Zynq devices, and Automotive Zynq device support
|
| 158 |
+
AXI FIFO data width support up to 4096; Programmable Full/Empty as sideband signals for AXI FIFO
|
| 159 |
+
01/18/2012 Xilinx, Inc. 8.4 ISE 13.4 support and Packet FIFO feature addition; Artix-7 Lower Power and Automotive Artix-7 device support
|
| 160 |
+
10/19/2011 Xilinx, Inc. 8.3 ISE 13.3 support and QVirtex-6L device support
|
| 161 |
+
06/22/2011 Xilinx, Inc. 8.2 ISE 13.2 support and Kintex-7L, Virtex-7L, Artix-7 and Zynq-7000 device support
|
| 162 |
+
03/01/2011 Xilinx, Inc. 8.1 ISE 13.1 support and Virtex-7 and Kintex-7 device support; Wiring Logic and Register Slice Support
|
| 163 |
+
10/29/2010 Xilinx, Inc. 7.3 ISE 13.0.2 support
|
| 164 |
+
09/21/2010 Xilinx, Inc. 7.2 ISE 12.3 support; AXI4 Support
|
| 165 |
+
07/30/2010 Xilinx, Inc. 7.1 ISE 13.0.1 support
|
| 166 |
+
06/18/2010 Xilinx, Inc. 6.2 ISE 12.2 support
|
| 167 |
+
04/19/2010 Xilinx, Inc. 6.1 ISE 12.1 support
|
| 168 |
+
12/02/2009 Xilinx, Inc. 5.3 rev 1 ISE 11.4 support; Spartan-6 Low Power and Automotive Spartan-6 Device support
|
| 169 |
+
09/16/2009 Xilinx, Inc. 5.3 Update to add 11.3; Virtex-6 Low Power and Virtex-6 HXT Device support
|
| 170 |
+
06/24/2009 Xilinx, Inc. 5.2 Update to add 11.2 and Virtex-6 CXT device support
|
| 171 |
+
04/24/2009 Xilinx, Inc. 5.1 Update to add 11.1 and Virtex-6 and Spartan-6 device support
|
| 172 |
+
09/19/2008 Xilinx, Inc. 4.4 Update to add 10.1 SP3 and Virtex-5 TXT device support and miscellaneous bug fixes
|
| 173 |
+
03/24/2008 Xilinx, Inc. 4.3 Update to add 10.1 support and miscellaneous bug fixes
|
| 174 |
+
10/03/2007 Xilinx, Inc. 4.2 Support for FWFT for Block RAM and Distributed RAM Common Clock FIFOs
|
| 175 |
+
08/08/2007 Xilinx, Inc. 4.1 Update to add 9.2i support; Revised to v4.1; ECC support for block RAM FIFO
|
| 176 |
+
04/02/2007 Xilinx, Inc. 3.3 Update to add 9.1i support; Revised to v3.3; Spartan-3A and Spartan-3A DSP support; ECC support
|
| 177 |
+
09/21/2006 Xilinx, Inc. 3.2 Revised to v3.2; Spartan-3 and Virtex-4 automotive device support
|
| 178 |
+
07/13/2006 Xilinx, Inc. 3.1 Update to add 8.2i support; Revised to v3.1; Virtex-5 support
|
| 179 |
+
01/11/2006 Xilinx, Inc. 2.3 Update to add 8.1i support; Revised to v2.3
|
| 180 |
+
08/31/2005 Xilinx, Inc. 2.2 Update to add 7.1i SP4 support; Revised to v2.2
|
| 181 |
+
04/28/2005 Xilinx, Inc. 2.1 Update to add 7.1i SP1 support; Revised to v2.1
|
| 182 |
+
11/04/2004 Xilinx, Inc. 2.0 Update to add 6.3i support; Revised to v2.0
|
| 183 |
+
05/21/2004 Xilinx, Inc. 1.1 Revised to v1.1; Virtex-4 support
|
| 184 |
+
04/23/2004 Xilinx, Inc. 1.0 Update to add 6.2i support; First release
|
| 185 |
+
================================================================================
|
| 186 |
+
|
| 187 |
+
................................................................................
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
8. LEGAL DISCLAIMER
|
| 191 |
+
|
| 192 |
+
(c) Copyright 2002 - 2012 Xilinx, Inc. All rights reserved.
|
| 193 |
+
|
| 194 |
+
This file contains confidential and proprietary information
|
| 195 |
+
of Xilinx, Inc. and is protected under U.S. and
|
| 196 |
+
international copyright and other intellectual property
|
| 197 |
+
laws.
|
| 198 |
+
|
| 199 |
+
DISCLAIMER
|
| 200 |
+
This disclaimer is not a license and does not grant any
|
| 201 |
+
rights to the materials distributed herewith. Except as
|
| 202 |
+
otherwise provided in a valid license issued to you by
|
| 203 |
+
Xilinx, and to the maximum extent permitted by applicable
|
| 204 |
+
law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 205 |
+
WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 206 |
+
AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 207 |
+
BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 208 |
+
INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 209 |
+
(2) Xilinx shall not be liable (whether in contract or tort,
|
| 210 |
+
including negligence, or under any other theory of
|
| 211 |
+
liability) for any loss or damage of any kind or nature
|
| 212 |
+
related to, arising under or in connection with these
|
| 213 |
+
materials, including for any direct, or any indirect,
|
| 214 |
+
special, incidental, or consequential loss or damage
|
| 215 |
+
(including loss of data, profits, goodwill, or any type of
|
| 216 |
+
loss or damage suffered as a result of any action brought
|
| 217 |
+
by a third party) even if such damage or loss was
|
| 218 |
+
reasonably foreseeable or Xilinx had been advised of the
|
| 219 |
+
possibility of the same.
|
| 220 |
+
|
| 221 |
+
CRITICAL APPLICATIONS
|
| 222 |
+
Xilinx products are not designed or intended to be fail-
|
| 223 |
+
safe, or for use in any application requiring fail-safe
|
| 224 |
+
performance, such as life-support or safety devices or
|
| 225 |
+
systems, Class III medical devices, nuclear facilities,
|
| 226 |
+
applications related to the deployment of airbags, or any
|
| 227 |
+
other applications that could lead to death, personal
|
| 228 |
+
injury, or severe property or environmental damage
|
| 229 |
+
(individually and collectively, "Critical
|
| 230 |
+
Applications"). Customer assumes the sole risk and
|
| 231 |
+
liability of any use of Xilinx products in Critical
|
| 232 |
+
Applications, subject only to applicable laws and
|
| 233 |
+
regulations governing limitations on product liability.
|
| 234 |
+
|
| 235 |
+
THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 236 |
+
PART OF THIS FILE AT ALL TIMES.
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/implement/planAhead_ise.tcl
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
|
| 2 |
+
#
|
| 3 |
+
# This file contains confidential and proprietary information
|
| 4 |
+
# of Xilinx, Inc. and is protected under U.S. and
|
| 5 |
+
# international copyright and other intellectual property
|
| 6 |
+
# laws.
|
| 7 |
+
#
|
| 8 |
+
# DISCLAIMER
|
| 9 |
+
# This disclaimer is not a license and does not grant any
|
| 10 |
+
# rights to the materials distributed herewith. Except as
|
| 11 |
+
# otherwise provided in a valid license issued to you by
|
| 12 |
+
# Xilinx, and to the maximum extent permitted by applicable
|
| 13 |
+
# law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 14 |
+
# WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 15 |
+
# AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 16 |
+
# BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 17 |
+
# INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 18 |
+
# (2) Xilinx shall not be liable (whether in contract or tort,
|
| 19 |
+
# including negligence, or under any other theory of
|
| 20 |
+
# liability) for any loss or damage of any kind or nature
|
| 21 |
+
# related to, arising under or in connection with these
|
| 22 |
+
# materials, including for any direct, or any indirect,
|
| 23 |
+
# special, incidental, or consequential loss or damage
|
| 24 |
+
# (including loss of data, profits, goodwill, or any type of
|
| 25 |
+
# loss or damage suffered as a result of any action brought
|
| 26 |
+
# by a third party) even if such damage or loss was
|
| 27 |
+
# reasonably foreseeable or Xilinx had been advised of the
|
| 28 |
+
# possibility of the same.
|
| 29 |
+
#
|
| 30 |
+
# CRITICAL APPLICATIONS
|
| 31 |
+
# Xilinx products are not designed or intended to be fail-
|
| 32 |
+
# safe, or for use in any application requiring fail-safe
|
| 33 |
+
# performance, such as life-support or safety devices or
|
| 34 |
+
# systems, Class III medical devices, nuclear facilities,
|
| 35 |
+
# applications related to the deployment of airbags, or any
|
| 36 |
+
# other applications that could lead to death, personal
|
| 37 |
+
# injury, or severe property or environmental damage
|
| 38 |
+
# (individually and collectively, "Critical
|
| 39 |
+
# Applications"). Customer assumes the sole risk and
|
| 40 |
+
# liability of any use of Xilinx products in Critical
|
| 41 |
+
# Applications, subject only to applicable laws and
|
| 42 |
+
# regulations governing limitations on product liability.
|
| 43 |
+
#
|
| 44 |
+
# THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 45 |
+
# PART OF THIS FILE AT ALL TIMES.
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
set device xc6slx45csg324-2
|
| 49 |
+
set projName pixel_fifo
|
| 50 |
+
set design pixel_fifo
|
| 51 |
+
set projDir [file dirname [info script]]
|
| 52 |
+
create_project $projName $projDir/results/$projName -part $device -force
|
| 53 |
+
set_property design_mode RTL [current_fileset -srcset]
|
| 54 |
+
set top_module pixel_fifo_exdes
|
| 55 |
+
add_files -norecurse {../../example_design/pixel_fifo_exdes.vhd}
|
| 56 |
+
add_files -norecurse {./pixel_fifo.ngc}
|
| 57 |
+
import_files -fileset [get_filesets constrs_1] -force -norecurse {../../example_design/pixel_fifo_exdes.xdc}
|
| 58 |
+
set_property top pixel_fifo_exdes [get_property srcset [current_run]]
|
| 59 |
+
synth_design
|
| 60 |
+
opt_design
|
| 61 |
+
place_design
|
| 62 |
+
route_design
|
| 63 |
+
write_sdf -rename_top_module pixel_fifo_exdes -file routed.sdf
|
| 64 |
+
write_verilog -nolib -mode timesim -sdf_anno false -rename_top_module pixel_fifo_exdes routed.v
|
| 65 |
+
report_timing -nworst 30 -path_type full -file routed.twr
|
| 66 |
+
report_drc -file report.drc
|
| 67 |
+
write_bitstream -bitgen_options {-g UnconstrainedPins:Allow}
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/simulation/functional/vcs_session.tcl
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#--------------------------------------------------------------------------------
|
| 2 |
+
#--
|
| 3 |
+
#-- FIFO Generator Core Demo Testbench
|
| 4 |
+
#--
|
| 5 |
+
#--------------------------------------------------------------------------------
|
| 6 |
+
# (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
|
| 7 |
+
#
|
| 8 |
+
# This file contains confidential and proprietary information
|
| 9 |
+
# of Xilinx, Inc. and is protected under U.S. and
|
| 10 |
+
# international copyright and other intellectual property
|
| 11 |
+
# laws.
|
| 12 |
+
#
|
| 13 |
+
# DISCLAIMER
|
| 14 |
+
# This disclaimer is not a license and does not grant any
|
| 15 |
+
# rights to the materials distributed herewith. Except as
|
| 16 |
+
# otherwise provided in a valid license issued to you by
|
| 17 |
+
# Xilinx, and to the maximum extent permitted by applicable
|
| 18 |
+
# law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 19 |
+
# WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 20 |
+
# AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 21 |
+
# BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 22 |
+
# INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 23 |
+
# (2) Xilinx shall not be liable (whether in contract or tort,
|
| 24 |
+
# including negligence, or under any other theory of
|
| 25 |
+
# liability) for any loss or damage of any kind or nature
|
| 26 |
+
# related to, arising under or in connection with these
|
| 27 |
+
# materials, including for any direct, or any indirect,
|
| 28 |
+
# special, incidental, or consequential loss or damage
|
| 29 |
+
# (including loss of data, profits, goodwill, or any type of
|
| 30 |
+
# loss or damage suffered as a result of any action brought
|
| 31 |
+
# by a third party) even if such damage or loss was
|
| 32 |
+
# reasonably foreseeable or Xilinx had been advised of the
|
| 33 |
+
# possibility of the same.
|
| 34 |
+
#
|
| 35 |
+
# CRITICAL APPLICATIONS
|
| 36 |
+
# Xilinx products are not designed or intended to be fail-
|
| 37 |
+
# safe, or for use in any application requiring fail-safe
|
| 38 |
+
# performance, such as life-support or safety devices or
|
| 39 |
+
# systems, Class III medical devices, nuclear facilities,
|
| 40 |
+
# applications related to the deployment of airbags, or any
|
| 41 |
+
# other applications that could lead to death, personal
|
| 42 |
+
# injury, or severe property or environmental damage
|
| 43 |
+
# (individually and collectively, "Critical
|
| 44 |
+
# Applications"). Customer assumes the sole risk and
|
| 45 |
+
# liability of any use of Xilinx products in Critical
|
| 46 |
+
# Applications, subject only to applicable laws and
|
| 47 |
+
# regulations governing limitations on product liability.
|
| 48 |
+
#
|
| 49 |
+
# THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 50 |
+
# PART OF THIS FILE AT ALL TIMES.
|
| 51 |
+
# Filename: vcs_session.tcl
|
| 52 |
+
#
|
| 53 |
+
# Description:
|
| 54 |
+
# This is the VCS wave form file.
|
| 55 |
+
#
|
| 56 |
+
#--------------------------------------------------------------------------------
|
| 57 |
+
if { ![gui_is_db_opened -db {pixel_fifo.vpd}] } {
|
| 58 |
+
gui_open_db -design V1 -file pixel_fifo.vpd -nosource
|
| 59 |
+
}
|
| 60 |
+
gui_set_precision 1ps
|
| 61 |
+
gui_set_time_units 1ps
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
gui_open_window Wave
|
| 65 |
+
gui_sg_create pixel_fifo_Group
|
| 66 |
+
gui_list_add_group -id Wave.1 {pixel_fifo_Group}
|
| 67 |
+
|
| 68 |
+
gui_sg_addsignal -group pixel_fifo_Group /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/RST
|
| 69 |
+
gui_sg_addsignal -group pixel_fifo_Group WRITE -divider
|
| 70 |
+
gui_sg_addsignal -group pixel_fifo_Group /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/WR_CLK
|
| 71 |
+
gui_sg_addsignal -group pixel_fifo_Group /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/WR_EN
|
| 72 |
+
gui_sg_addsignal -group pixel_fifo_Group /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/FULL
|
| 73 |
+
gui_sg_addsignal -group pixel_fifo_Group READ -divider
|
| 74 |
+
gui_sg_addsignal -group pixel_fifo_Group /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/RD_CLK
|
| 75 |
+
gui_sg_addsignal -group pixel_fifo_Group /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/RD_EN
|
| 76 |
+
gui_sg_addsignal -group pixel_fifo_Group /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/EMPTY
|
| 77 |
+
gui_zoom -window Wave.1 -full
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/simulation/functional/wave_isim.tcl
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#--------------------------------------------------------------------------------
|
| 2 |
+
#--
|
| 3 |
+
#-- FIFO Generator Core Demo Testbench
|
| 4 |
+
#--
|
| 5 |
+
#--------------------------------------------------------------------------------
|
| 6 |
+
# (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
|
| 7 |
+
#
|
| 8 |
+
# This file contains confidential and proprietary information
|
| 9 |
+
# of Xilinx, Inc. and is protected under U.S. and
|
| 10 |
+
# international copyright and other intellectual property
|
| 11 |
+
# laws.
|
| 12 |
+
#
|
| 13 |
+
# DISCLAIMER
|
| 14 |
+
# This disclaimer is not a license and does not grant any
|
| 15 |
+
# rights to the materials distributed herewith. Except as
|
| 16 |
+
# otherwise provided in a valid license issued to you by
|
| 17 |
+
# Xilinx, and to the maximum extent permitted by applicable
|
| 18 |
+
# law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 19 |
+
# WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 20 |
+
# AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 21 |
+
# BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 22 |
+
# INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 23 |
+
# (2) Xilinx shall not be liable (whether in contract or tort,
|
| 24 |
+
# including negligence, or under any other theory of
|
| 25 |
+
# liability) for any loss or damage of any kind or nature
|
| 26 |
+
# related to, arising under or in connection with these
|
| 27 |
+
# materials, including for any direct, or any indirect,
|
| 28 |
+
# special, incidental, or consequential loss or damage
|
| 29 |
+
# (including loss of data, profits, goodwill, or any type of
|
| 30 |
+
# loss or damage suffered as a result of any action brought
|
| 31 |
+
# by a third party) even if such damage or loss was
|
| 32 |
+
# reasonably foreseeable or Xilinx had been advised of the
|
| 33 |
+
# possibility of the same.
|
| 34 |
+
#
|
| 35 |
+
# CRITICAL APPLICATIONS
|
| 36 |
+
# Xilinx products are not designed or intended to be fail-
|
| 37 |
+
# safe, or for use in any application requiring fail-safe
|
| 38 |
+
# performance, such as life-support or safety devices or
|
| 39 |
+
# systems, Class III medical devices, nuclear facilities,
|
| 40 |
+
# applications related to the deployment of airbags, or any
|
| 41 |
+
# other applications that could lead to death, personal
|
| 42 |
+
# injury, or severe property or environmental damage
|
| 43 |
+
# (individually and collectively, "Critical
|
| 44 |
+
# Applications"). Customer assumes the sole risk and
|
| 45 |
+
# liability of any use of Xilinx products in Critical
|
| 46 |
+
# Applications, subject only to applicable laws and
|
| 47 |
+
# regulations governing limitations on product liability.
|
| 48 |
+
#
|
| 49 |
+
# THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 50 |
+
# PART OF THIS FILE AT ALL TIMES.
|
| 51 |
+
# Filename: wave_isim.tcl
|
| 52 |
+
#
|
| 53 |
+
# Description:
|
| 54 |
+
# This is the ISIM wave form file.
|
| 55 |
+
#
|
| 56 |
+
#--------------------------------------------------------------------------------
|
| 57 |
+
wcfg new
|
| 58 |
+
isim set radix hex
|
| 59 |
+
wave add /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/RST
|
| 60 |
+
wave add /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/WR_CLK
|
| 61 |
+
wave add /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/WR_EN
|
| 62 |
+
wave add /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/FULL
|
| 63 |
+
wave add /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/RD_CLK
|
| 64 |
+
wave add /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/RD_EN
|
| 65 |
+
wave add /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/EMPTY
|
| 66 |
+
run all
|
| 67 |
+
quit
|
| 68 |
+
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/simulation/functional/wave_ncsim.sv
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#--------------------------------------------------------------------------------
|
| 2 |
+
#--
|
| 3 |
+
#-- FIFO Generator Core Demo Testbench
|
| 4 |
+
#--
|
| 5 |
+
#--------------------------------------------------------------------------------
|
| 6 |
+
# (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
|
| 7 |
+
#
|
| 8 |
+
# This file contains confidential and proprietary information
|
| 9 |
+
# of Xilinx, Inc. and is protected under U.S. and
|
| 10 |
+
# international copyright and other intellectual property
|
| 11 |
+
# laws.
|
| 12 |
+
#
|
| 13 |
+
# DISCLAIMER
|
| 14 |
+
# This disclaimer is not a license and does not grant any
|
| 15 |
+
# rights to the materials distributed herewith. Except as
|
| 16 |
+
# otherwise provided in a valid license issued to you by
|
| 17 |
+
# Xilinx, and to the maximum extent permitted by applicable
|
| 18 |
+
# law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 19 |
+
# WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 20 |
+
# AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 21 |
+
# BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 22 |
+
# INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 23 |
+
# (2) Xilinx shall not be liable (whether in contract or tort,
|
| 24 |
+
# including negligence, or under any other theory of
|
| 25 |
+
# liability) for any loss or damage of any kind or nature
|
| 26 |
+
# related to, arising under or in connection with these
|
| 27 |
+
# materials, including for any direct, or any indirect,
|
| 28 |
+
# special, incidental, or consequential loss or damage
|
| 29 |
+
# (including loss of data, profits, goodwill, or any type of
|
| 30 |
+
# loss or damage suffered as a result of any action brought
|
| 31 |
+
# by a third party) even if such damage or loss was
|
| 32 |
+
# reasonably foreseeable or Xilinx had been advised of the
|
| 33 |
+
# possibility of the same.
|
| 34 |
+
#
|
| 35 |
+
# CRITICAL APPLICATIONS
|
| 36 |
+
# Xilinx products are not designed or intended to be fail-
|
| 37 |
+
# safe, or for use in any application requiring fail-safe
|
| 38 |
+
# performance, such as life-support or safety devices or
|
| 39 |
+
# systems, Class III medical devices, nuclear facilities,
|
| 40 |
+
# applications related to the deployment of airbags, or any
|
| 41 |
+
# other applications that could lead to death, personal
|
| 42 |
+
# injury, or severe property or environmental damage
|
| 43 |
+
# (individually and collectively, "Critical
|
| 44 |
+
# Applications"). Customer assumes the sole risk and
|
| 45 |
+
# liability of any use of Xilinx products in Critical
|
| 46 |
+
# Applications, subject only to applicable laws and
|
| 47 |
+
# regulations governing limitations on product liability.
|
| 48 |
+
#
|
| 49 |
+
# THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 50 |
+
# PART OF THIS FILE AT ALL TIMES.
|
| 51 |
+
# Filename: wave_ncsim.sv
|
| 52 |
+
#
|
| 53 |
+
# Description:
|
| 54 |
+
# This is the IUS wave form file.
|
| 55 |
+
#
|
| 56 |
+
#--------------------------------------------------------------------------------
|
| 57 |
+
|
| 58 |
+
window new WaveWindow -name "Waves for FIFO Generator Example Design"
|
| 59 |
+
waveform using "Waves for FIFO Generator Example Design"
|
| 60 |
+
|
| 61 |
+
waveform add -signals /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/RST
|
| 62 |
+
waveform add -label WRITE
|
| 63 |
+
waveform add -signals /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/WR_CLK
|
| 64 |
+
waveform add -signals /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/WR_EN
|
| 65 |
+
waveform add -signals /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/FULL
|
| 66 |
+
waveform add -label READ
|
| 67 |
+
waveform add -signals /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/RD_CLK
|
| 68 |
+
waveform add -signals /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/RD_EN
|
| 69 |
+
waveform add -signals /pixel_fifo_tb/pixel_fifo_synth_inst/pixel_fifo_inst/EMPTY
|
| 70 |
+
console submit -using simulator -wait no "run"
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/simulation/pixel_fifo_dgen.vhd
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--------------------------------------------------------------------------------
|
| 2 |
+
--
|
| 3 |
+
-- FIFO Generator Core Demo Testbench
|
| 4 |
+
--
|
| 5 |
+
--------------------------------------------------------------------------------
|
| 6 |
+
--
|
| 7 |
+
-- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
|
| 8 |
+
--
|
| 9 |
+
-- This file contains confidential and proprietary information
|
| 10 |
+
-- of Xilinx, Inc. and is protected under U.S. and
|
| 11 |
+
-- international copyright and other intellectual property
|
| 12 |
+
-- laws.
|
| 13 |
+
--
|
| 14 |
+
-- DISCLAIMER
|
| 15 |
+
-- This disclaimer is not a license and does not grant any
|
| 16 |
+
-- rights to the materials distributed herewith. Except as
|
| 17 |
+
-- otherwise provided in a valid license issued to you by
|
| 18 |
+
-- Xilinx, and to the maximum extent permitted by applicable
|
| 19 |
+
-- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 20 |
+
-- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 21 |
+
-- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 22 |
+
-- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 23 |
+
-- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 24 |
+
-- (2) Xilinx shall not be liable (whether in contract or tort,
|
| 25 |
+
-- including negligence, or under any other theory of
|
| 26 |
+
-- liability) for any loss or damage of any kind or nature
|
| 27 |
+
-- related to, arising under or in connection with these
|
| 28 |
+
-- materials, including for any direct, or any indirect,
|
| 29 |
+
-- special, incidental, or consequential loss or damage
|
| 30 |
+
-- (including loss of data, profits, goodwill, or any type of
|
| 31 |
+
-- loss or damage suffered as a result of any action brought
|
| 32 |
+
-- by a third party) even if such damage or loss was
|
| 33 |
+
-- reasonably foreseeable or Xilinx had been advised of the
|
| 34 |
+
-- possibility of the same.
|
| 35 |
+
--
|
| 36 |
+
-- CRITICAL APPLICATIONS
|
| 37 |
+
-- Xilinx products are not designed or intended to be fail-
|
| 38 |
+
-- safe, or for use in any application requiring fail-safe
|
| 39 |
+
-- performance, such as life-support or safety devices or
|
| 40 |
+
-- systems, Class III medical devices, nuclear facilities,
|
| 41 |
+
-- applications related to the deployment of airbags, or any
|
| 42 |
+
-- other applications that could lead to death, personal
|
| 43 |
+
-- injury, or severe property or environmental damage
|
| 44 |
+
-- (individually and collectively, "Critical
|
| 45 |
+
-- Applications"). Customer assumes the sole risk and
|
| 46 |
+
-- liability of any use of Xilinx products in Critical
|
| 47 |
+
-- Applications, subject only to applicable laws and
|
| 48 |
+
-- regulations governing limitations on product liability.
|
| 49 |
+
--
|
| 50 |
+
-- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 51 |
+
-- PART OF THIS FILE AT ALL TIMES.
|
| 52 |
+
--------------------------------------------------------------------------------
|
| 53 |
+
--
|
| 54 |
+
-- Filename: pixel_fifo_dgen.vhd
|
| 55 |
+
--
|
| 56 |
+
-- Description:
|
| 57 |
+
-- Used for write interface stimulus generation
|
| 58 |
+
--
|
| 59 |
+
--------------------------------------------------------------------------------
|
| 60 |
+
-- Library Declarations
|
| 61 |
+
--------------------------------------------------------------------------------
|
| 62 |
+
LIBRARY ieee;
|
| 63 |
+
USE ieee.std_logic_1164.ALL;
|
| 64 |
+
USE ieee.std_logic_unsigned.all;
|
| 65 |
+
USE IEEE.std_logic_arith.all;
|
| 66 |
+
USE IEEE.std_logic_misc.all;
|
| 67 |
+
|
| 68 |
+
LIBRARY work;
|
| 69 |
+
USE work.pixel_fifo_pkg.ALL;
|
| 70 |
+
|
| 71 |
+
ENTITY pixel_fifo_dgen IS
|
| 72 |
+
GENERIC (
|
| 73 |
+
C_DIN_WIDTH : INTEGER := 32;
|
| 74 |
+
C_DOUT_WIDTH : INTEGER := 32;
|
| 75 |
+
C_CH_TYPE : INTEGER := 0;
|
| 76 |
+
TB_SEED : INTEGER := 2
|
| 77 |
+
);
|
| 78 |
+
PORT (
|
| 79 |
+
RESET : IN STD_LOGIC;
|
| 80 |
+
WR_CLK : IN STD_LOGIC;
|
| 81 |
+
PRC_WR_EN : IN STD_LOGIC;
|
| 82 |
+
FULL : IN STD_LOGIC;
|
| 83 |
+
WR_EN : OUT STD_LOGIC;
|
| 84 |
+
WR_DATA : OUT STD_LOGIC_VECTOR(C_DIN_WIDTH-1 DOWNTO 0)
|
| 85 |
+
);
|
| 86 |
+
END ENTITY;
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
ARCHITECTURE fg_dg_arch OF pixel_fifo_dgen IS
|
| 90 |
+
|
| 91 |
+
CONSTANT C_DATA_WIDTH : INTEGER := if_then_else(C_DIN_WIDTH > C_DOUT_WIDTH,C_DIN_WIDTH,C_DOUT_WIDTH);
|
| 92 |
+
CONSTANT LOOP_COUNT : INTEGER := divroundup(C_DATA_WIDTH,8);
|
| 93 |
+
|
| 94 |
+
SIGNAL pr_w_en : STD_LOGIC := '0';
|
| 95 |
+
SIGNAL rand_num : STD_LOGIC_VECTOR(8*LOOP_COUNT-1 DOWNTO 0);
|
| 96 |
+
SIGNAL wr_data_i : STD_LOGIC_VECTOR(C_DIN_WIDTH-1 DOWNTO 0);
|
| 97 |
+
BEGIN
|
| 98 |
+
|
| 99 |
+
WR_EN <= PRC_WR_EN ;
|
| 100 |
+
WR_DATA <= wr_data_i AFTER 50 ns;
|
| 101 |
+
|
| 102 |
+
----------------------------------------------
|
| 103 |
+
-- Generation of DATA
|
| 104 |
+
----------------------------------------------
|
| 105 |
+
gen_stim:FOR N IN LOOP_COUNT-1 DOWNTO 0 GENERATE
|
| 106 |
+
rd_gen_inst1:pixel_fifo_rng
|
| 107 |
+
GENERIC MAP(
|
| 108 |
+
WIDTH => 8,
|
| 109 |
+
SEED => TB_SEED+N
|
| 110 |
+
)
|
| 111 |
+
PORT MAP(
|
| 112 |
+
CLK => WR_CLK,
|
| 113 |
+
RESET => RESET,
|
| 114 |
+
RANDOM_NUM => rand_num(8*(N+1)-1 downto 8*N),
|
| 115 |
+
ENABLE => pr_w_en
|
| 116 |
+
);
|
| 117 |
+
END GENERATE;
|
| 118 |
+
|
| 119 |
+
pr_w_en <= PRC_WR_EN AND NOT FULL;
|
| 120 |
+
wr_data_i <= rand_num(C_DIN_WIDTH-1 DOWNTO 0);
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
END ARCHITECTURE;
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/sim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------------
|
| 2 |
+
--
|
| 3 |
+
-- FIFO Generator Core Demo Testbench
|
| 4 |
+
--
|
| 5 |
+
--------------------------------------------------------------------------------
|
| 6 |
+
--
|
| 7 |
+
-- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
|
| 8 |
+
--
|
| 9 |
+
-- This file contains confidential and proprietary information
|
| 10 |
+
-- of Xilinx, Inc. and is protected under U.S. and
|
| 11 |
+
-- international copyright and other intellectual property
|
| 12 |
+
-- laws.
|
| 13 |
+
--
|
| 14 |
+
-- DISCLAIMER
|
| 15 |
+
-- This disclaimer is not a license and does not grant any
|
| 16 |
+
-- rights to the materials distributed herewith. Except as
|
| 17 |
+
-- otherwise provided in a valid license issued to you by
|
| 18 |
+
-- Xilinx, and to the maximum extent permitted by applicable
|
| 19 |
+
-- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 20 |
+
-- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 21 |
+
-- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 22 |
+
-- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 23 |
+
-- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 24 |
+
-- (2) Xilinx shall not be liable (whether in contract or tort,
|
| 25 |
+
-- including negligence, or under any other theory of
|
| 26 |
+
-- liability) for any loss or damage of any kind or nature
|
| 27 |
+
-- related to, arising under or in connection with these
|
| 28 |
+
-- materials, including for any direct, or any indirect,
|
| 29 |
+
-- special, incidental, or consequential loss or damage
|
| 30 |
+
-- (including loss of data, profits, goodwill, or any type of
|
| 31 |
+
-- loss or damage suffered as a result of any action brought
|
| 32 |
+
-- by a third party) even if such damage or loss was
|
| 33 |
+
-- reasonably foreseeable or Xilinx had been advised of the
|
| 34 |
+
-- possibility of the same.
|
| 35 |
+
--
|
| 36 |
+
-- CRITICAL APPLICATIONS
|
| 37 |
+
-- Xilinx products are not designed or intended to be fail-
|
| 38 |
+
-- safe, or for use in any application requiring fail-safe
|
| 39 |
+
-- performance, such as life-support or safety devices or
|
| 40 |
+
-- systems, Class III medical devices, nuclear facilities,
|
| 41 |
+
-- applications related to the deployment of airbags, or any
|
| 42 |
+
-- other applications that could lead to death, personal
|
| 43 |
+
-- injury, or severe property or environmental damage
|
| 44 |
+
-- (individually and collectively, "Critical
|
| 45 |
+
-- Applications"). Customer assumes the sole risk and
|
| 46 |
+
-- liability of any use of Xilinx products in Critical
|
| 47 |
+
-- Applications, subject only to applicable laws and
|
| 48 |
+
-- regulations governing limitations on product liability.
|
| 49 |
+
--
|
| 50 |
+
-- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 51 |
+
-- PART OF THIS FILE AT ALL TIMES.
|
| 52 |
+
--------------------------------------------------------------------------------
|
| 53 |
+
--
|
| 54 |
+
-- Filename: pixel_fifo_dverif.vhd
|
| 55 |
+
--
|
| 56 |
+
-- Description:
|
| 57 |
+
-- Used for FIFO read interface stimulus generation and data checking
|
| 58 |
+
--
|
| 59 |
+
--------------------------------------------------------------------------------
|
| 60 |
+
-- Library Declarations
|
| 61 |
+
--------------------------------------------------------------------------------
|
| 62 |
+
LIBRARY ieee;
|
| 63 |
+
USE ieee.std_logic_1164.ALL;
|
| 64 |
+
USE ieee.std_logic_unsigned.all;
|
| 65 |
+
USE IEEE.std_logic_arith.all;
|
| 66 |
+
USE IEEE.std_logic_misc.all;
|
| 67 |
+
|
| 68 |
+
LIBRARY work;
|
| 69 |
+
USE work.pixel_fifo_pkg.ALL;
|
| 70 |
+
|
| 71 |
+
ENTITY pixel_fifo_dverif IS
|
| 72 |
+
GENERIC(
|
| 73 |
+
C_DIN_WIDTH : INTEGER := 0;
|
| 74 |
+
C_DOUT_WIDTH : INTEGER := 0;
|
| 75 |
+
C_USE_EMBEDDED_REG : INTEGER := 0;
|
| 76 |
+
C_CH_TYPE : INTEGER := 0;
|
| 77 |
+
TB_SEED : INTEGER := 2
|
| 78 |
+
);
|
| 79 |
+
PORT(
|
| 80 |
+
RESET : IN STD_LOGIC;
|
| 81 |
+
RD_CLK : IN STD_LOGIC;
|
| 82 |
+
PRC_RD_EN : IN STD_LOGIC;
|
| 83 |
+
EMPTY : IN STD_LOGIC;
|
| 84 |
+
DATA_OUT : IN STD_LOGIC_VECTOR(C_DOUT_WIDTH-1 DOWNTO 0);
|
| 85 |
+
RD_EN : OUT STD_LOGIC;
|
| 86 |
+
DOUT_CHK : OUT STD_LOGIC
|
| 87 |
+
);
|
| 88 |
+
END ENTITY;
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
ARCHITECTURE fg_dv_arch OF pixel_fifo_dverif IS
|
| 92 |
+
|
| 93 |
+
CONSTANT C_DATA_WIDTH : INTEGER := if_then_else(C_DIN_WIDTH > C_DOUT_WIDTH,C_DIN_WIDTH,C_DOUT_WIDTH);
|
| 94 |
+
CONSTANT EXTRA_WIDTH : INTEGER := if_then_else(C_CH_TYPE = 2,1,0);
|
| 95 |
+
CONSTANT LOOP_COUNT : INTEGER := divroundup(C_DATA_WIDTH+EXTRA_WIDTH,8);
|
| 96 |
+
|
| 97 |
+
SIGNAL expected_dout : STD_LOGIC_VECTOR(C_DOUT_WIDTH-1 DOWNTO 0) := (OTHERS => '0');
|
| 98 |
+
SIGNAL data_chk : STD_LOGIC := '1';
|
| 99 |
+
SIGNAL rand_num : STD_LOGIC_VECTOR(8*LOOP_COUNT-1 downto 0);
|
| 100 |
+
SIGNAL rd_en_i : STD_LOGIC := '0';
|
| 101 |
+
SIGNAL pr_r_en : STD_LOGIC := '0';
|
| 102 |
+
SIGNAL rd_en_d1 : STD_LOGIC := '0';
|
| 103 |
+
BEGIN
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
DOUT_CHK <= data_chk;
|
| 107 |
+
RD_EN <= rd_en_i;
|
| 108 |
+
rd_en_i <= PRC_RD_EN;
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
data_fifo_chk:IF(C_CH_TYPE /=2) GENERATE
|
| 112 |
+
-------------------------------------------------------
|
| 113 |
+
-- Expected data generation and checking for data_fifo
|
| 114 |
+
-------------------------------------------------------
|
| 115 |
+
PROCESS (RD_CLK,RESET)
|
| 116 |
+
BEGIN
|
| 117 |
+
IF (RESET = '1') THEN
|
| 118 |
+
rd_en_d1 <= '0';
|
| 119 |
+
ELSIF (RD_CLK'event AND RD_CLK='1') THEN
|
| 120 |
+
IF(EMPTY = '0' AND rd_en_i='1' AND rd_en_d1 = '0') THEN
|
| 121 |
+
rd_en_d1 <= '1';
|
| 122 |
+
END IF;
|
| 123 |
+
END IF;
|
| 124 |
+
END PROCESS;
|
| 125 |
+
|
| 126 |
+
pr_r_en <= rd_en_i AND NOT EMPTY AND rd_en_d1;
|
| 127 |
+
expected_dout <= rand_num(C_DOUT_WIDTH-1 DOWNTO 0);
|
| 128 |
+
|
| 129 |
+
gen_num:FOR N IN LOOP_COUNT-1 DOWNTO 0 GENERATE
|
| 130 |
+
rd_gen_inst2:pixel_fifo_rng
|
| 131 |
+
GENERIC MAP(
|
| 132 |
+
WIDTH => 8,
|
| 133 |
+
SEED => TB_SEED+N
|
| 134 |
+
)
|
| 135 |
+
PORT MAP(
|
| 136 |
+
CLK => RD_CLK,
|
| 137 |
+
RESET => RESET,
|
| 138 |
+
RANDOM_NUM => rand_num(8*(N+1)-1 downto 8*N),
|
| 139 |
+
ENABLE => pr_r_en
|
| 140 |
+
);
|
| 141 |
+
END GENERATE;
|
| 142 |
+
|
| 143 |
+
PROCESS (RD_CLK,RESET)
|
| 144 |
+
BEGIN
|
| 145 |
+
IF(RESET = '1') THEN
|
| 146 |
+
data_chk <= '0';
|
| 147 |
+
ELSIF (RD_CLK'event AND RD_CLK='1') THEN
|
| 148 |
+
IF((EMPTY = '0') AND (rd_en_i = '1' AND rd_en_d1 = '1')) THEN
|
| 149 |
+
IF(DATA_OUT = expected_dout) THEN
|
| 150 |
+
data_chk <= '0';
|
| 151 |
+
ELSE
|
| 152 |
+
data_chk <= '1';
|
| 153 |
+
END IF;
|
| 154 |
+
END IF;
|
| 155 |
+
END IF;
|
| 156 |
+
END PROCESS;
|
| 157 |
+
END GENERATE data_fifo_chk;
|
| 158 |
+
|
| 159 |
+
END ARCHITECTURE;
|
Frogwells_fpga_design/基于FPGA、DDR3和USB2.0的图像采集系统/debug/ov5640-vga-usb-normal/ipcore_dir/pixel_fifo/simulation/pixel_fifo_pctrl.vhd
ADDED
|
@@ -0,0 +1,541 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
--------------------------------------------------------------------------------
|
| 3 |
+
--
|
| 4 |
+
-- FIFO Generator Core Demo Testbench
|
| 5 |
+
--
|
| 6 |
+
--------------------------------------------------------------------------------
|
| 7 |
+
--
|
| 8 |
+
-- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
|
| 9 |
+
--
|
| 10 |
+
-- This file contains confidential and proprietary information
|
| 11 |
+
-- of Xilinx, Inc. and is protected under U.S. and
|
| 12 |
+
-- international copyright and other intellectual property
|
| 13 |
+
-- laws.
|
| 14 |
+
--
|
| 15 |
+
-- DISCLAIMER
|
| 16 |
+
-- This disclaimer is not a license and does not grant any
|
| 17 |
+
-- rights to the materials distributed herewith. Except as
|
| 18 |
+
-- otherwise provided in a valid license issued to you by
|
| 19 |
+
-- Xilinx, and to the maximum extent permitted by applicable
|
| 20 |
+
-- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
| 21 |
+
-- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
| 22 |
+
-- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
| 23 |
+
-- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
| 24 |
+
-- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
| 25 |
+
-- (2) Xilinx shall not be liable (whether in contract or tort,
|
| 26 |
+
-- including negligence, or under any other theory of
|
| 27 |
+
-- liability) for any loss or damage of any kind or nature
|
| 28 |
+
-- related to, arising under or in connection with these
|
| 29 |
+
-- materials, including for any direct, or any indirect,
|
| 30 |
+
-- special, incidental, or consequential loss or damage
|
| 31 |
+
-- (including loss of data, profits, goodwill, or any type of
|
| 32 |
+
-- loss or damage suffered as a result of any action brought
|
| 33 |
+
-- by a third party) even if such damage or loss was
|
| 34 |
+
-- reasonably foreseeable or Xilinx had been advised of the
|
| 35 |
+
-- possibility of the same.
|
| 36 |
+
--
|
| 37 |
+
-- CRITICAL APPLICATIONS
|
| 38 |
+
-- Xilinx products are not designed or intended to be fail-
|
| 39 |
+
-- safe, or for use in any application requiring fail-safe
|
| 40 |
+
-- performance, such as life-support or safety devices or
|
| 41 |
+
-- systems, Class III medical devices, nuclear facilities,
|
| 42 |
+
-- applications related to the deployment of airbags, or any
|
| 43 |
+
-- other applications that could lead to death, personal
|
| 44 |
+
-- injury, or severe property or environmental damage
|
| 45 |
+
-- (individually and collectively, "Critical
|
| 46 |
+
-- Applications"). Customer assumes the sole risk and
|
| 47 |
+
-- liability of any use of Xilinx products in Critical
|
| 48 |
+
-- Applications, subject only to applicable laws and
|
| 49 |
+
-- regulations governing limitations on product liability.
|
| 50 |
+
--
|
| 51 |
+
-- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
| 52 |
+
-- PART OF THIS FILE AT ALL TIMES.
|
| 53 |
+
--------------------------------------------------------------------------------
|
| 54 |
+
--
|
| 55 |
+
-- Filename: pixel_fifo_pctrl.vhd
|
| 56 |
+
--
|
| 57 |
+
-- Description:
|
| 58 |
+
-- Used for protocol control on write and read interface stimulus and status generation
|
| 59 |
+
--
|
| 60 |
+
--------------------------------------------------------------------------------
|
| 61 |
+
-- Library Declarations
|
| 62 |
+
--------------------------------------------------------------------------------
|
| 63 |
+
LIBRARY ieee;
|
| 64 |
+
USE ieee.std_logic_1164.ALL;
|
| 65 |
+
USE ieee.std_logic_unsigned.all;
|
| 66 |
+
USE IEEE.std_logic_arith.all;
|
| 67 |
+
USE IEEE.std_logic_misc.all;
|
| 68 |
+
|
| 69 |
+
LIBRARY work;
|
| 70 |
+
USE work.pixel_fifo_pkg.ALL;
|
| 71 |
+
|
| 72 |
+
ENTITY pixel_fifo_pctrl IS
|
| 73 |
+
GENERIC(
|
| 74 |
+
AXI_CHANNEL : STRING :="NONE";
|
| 75 |
+
C_APPLICATION_TYPE : INTEGER := 0;
|
| 76 |
+
C_DIN_WIDTH : INTEGER := 0;
|
| 77 |
+
C_DOUT_WIDTH : INTEGER := 0;
|
| 78 |
+
C_WR_PNTR_WIDTH : INTEGER := 0;
|
| 79 |
+
C_RD_PNTR_WIDTH : INTEGER := 0;
|
| 80 |
+
C_CH_TYPE : INTEGER := 0;
|
| 81 |
+
FREEZEON_ERROR : INTEGER := 0;
|
| 82 |
+
TB_STOP_CNT : INTEGER := 2;
|
| 83 |
+
TB_SEED : INTEGER := 2
|
| 84 |
+
);
|
| 85 |
+
PORT(
|
| 86 |
+
RESET_WR : IN STD_LOGIC;
|
| 87 |
+
RESET_RD : IN STD_LOGIC;
|
| 88 |
+
WR_CLK : IN STD_LOGIC;
|
| 89 |
+
RD_CLK : IN STD_LOGIC;
|
| 90 |
+
FULL : IN STD_LOGIC;
|
| 91 |
+
EMPTY : IN STD_LOGIC;
|
| 92 |
+
ALMOST_FULL : IN STD_LOGIC;
|
| 93 |
+
ALMOST_EMPTY : IN STD_LOGIC;
|
| 94 |
+
DATA_IN : IN STD_LOGIC_VECTOR(C_DIN_WIDTH-1 DOWNTO 0);
|
| 95 |
+
DATA_OUT : IN STD_LOGIC_VECTOR(C_DOUT_WIDTH-1 DOWNTO 0);
|
| 96 |
+
DOUT_CHK : IN STD_LOGIC;
|
| 97 |
+
PRC_WR_EN : OUT STD_LOGIC;
|
| 98 |
+
PRC_RD_EN : OUT STD_LOGIC;
|
| 99 |
+
RESET_EN : OUT STD_LOGIC;
|
| 100 |
+
SIM_DONE : OUT STD_LOGIC;
|
| 101 |
+
STATUS : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
|
| 102 |
+
);
|
| 103 |
+
END ENTITY;
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
ARCHITECTURE fg_pc_arch OF pixel_fifo_pctrl IS
|
| 107 |
+
|
| 108 |
+
CONSTANT C_DATA_WIDTH : INTEGER := if_then_else(C_DIN_WIDTH > C_DOUT_WIDTH,C_DIN_WIDTH,C_DOUT_WIDTH);
|
| 109 |
+
CONSTANT LOOP_COUNT : INTEGER := divroundup(C_DATA_WIDTH,8);
|
| 110 |
+
CONSTANT D_WIDTH_DIFF : INTEGER := log2roundup(C_DOUT_WIDTH/C_DIN_WIDTH);
|
| 111 |
+
|
| 112 |
+
SIGNAL data_chk_i : STD_LOGIC := if_then_else(C_CH_TYPE /= 2,'1','0');
|
| 113 |
+
SIGNAL full_chk_i : STD_LOGIC := if_then_else(C_CH_TYPE /= 2,'1','0');
|
| 114 |
+
SIGNAL empty_chk_i : STD_LOGIC := if_then_else(C_CH_TYPE /= 2,'1','0');
|
| 115 |
+
SIGNAL status_i : STD_LOGIC_VECTOR(4 DOWNTO 0):= (OTHERS => '0');
|
| 116 |
+
SIGNAL status_d1_i : STD_LOGIC_VECTOR(4 DOWNTO 0):= (OTHERS => '0');
|
| 117 |
+
SIGNAL wr_en_gen : STD_LOGIC_VECTOR(7 DOWNTO 0):= (OTHERS => '0');
|
| 118 |
+
SIGNAL rd_en_gen : STD_LOGIC_VECTOR(7 DOWNTO 0):= (OTHERS => '0');
|
| 119 |
+
SIGNAL wr_cntr : STD_LOGIC_VECTOR(C_WR_PNTR_WIDTH-2 DOWNTO 0) := (OTHERS => '0');
|
| 120 |
+
SIGNAL full_as_timeout : STD_LOGIC_VECTOR(C_WR_PNTR_WIDTH DOWNTO 0) := (OTHERS => '0');
|
| 121 |
+
SIGNAL full_ds_timeout : STD_LOGIC_VECTOR(C_WR_PNTR_WIDTH DOWNTO 0) := (OTHERS => '0');
|
| 122 |
+
SIGNAL rd_cntr : STD_LOGIC_VECTOR(C_RD_PNTR_WIDTH-2 DOWNTO 0) := (OTHERS => '0');
|
| 123 |
+
SIGNAL empty_as_timeout : STD_LOGIC_VECTOR(C_RD_PNTR_WIDTH DOWNTO 0) := (OTHERS => '0');
|
| 124 |
+
SIGNAL empty_ds_timeout : STD_LOGIC_VECTOR(C_RD_PNTR_WIDTH DOWNTO 0):= (OTHERS => '0');
|
| 125 |
+
SIGNAL wr_en_i : STD_LOGIC := '0';
|
| 126 |
+
SIGNAL rd_en_i : STD_LOGIC := '0';
|
| 127 |
+
SIGNAL state : STD_LOGIC := '0';
|
| 128 |
+
SIGNAL wr_control : STD_LOGIC := '0';
|
| 129 |
+
SIGNAL rd_control : STD_LOGIC := '0';
|
| 130 |
+
SIGNAL stop_on_err : STD_LOGIC := '0';
|
| 131 |
+
SIGNAL sim_stop_cntr : STD_LOGIC_VECTOR(7 DOWNTO 0):= conv_std_logic_vector(if_then_else(C_CH_TYPE=2,64,TB_STOP_CNT),8);
|
| 132 |
+
SIGNAL sim_done_i : STD_LOGIC := '0';
|
| 133 |
+
SIGNAL rdw_gt_wrw : STD_LOGIC_VECTOR(D_WIDTH_DIFF-1 DOWNTO 0) := (OTHERS => '1');
|
| 134 |
+
SIGNAL wrw_gt_rdw : STD_LOGIC_VECTOR(D_WIDTH_DIFF-1 DOWNTO 0) := (OTHERS => '1');
|
| 135 |
+
SIGNAL rd_activ_cont : STD_LOGIC_VECTOR(25 downto 0):= (OTHERS => '0');
|
| 136 |
+
SIGNAL prc_we_i : STD_LOGIC := '0';
|
| 137 |
+
SIGNAL prc_re_i : STD_LOGIC := '0';
|
| 138 |
+
SIGNAL reset_en_i : STD_LOGIC := '0';
|
| 139 |
+
SIGNAL sim_done_d1 : STD_LOGIC := '0';
|
| 140 |
+
SIGNAL sim_done_wr1 : STD_LOGIC := '0';
|
| 141 |
+
SIGNAL sim_done_wr2 : STD_LOGIC := '0';
|
| 142 |
+
SIGNAL empty_d1 : STD_LOGIC := '0';
|
| 143 |
+
SIGNAL empty_wr_dom1 : STD_LOGIC := '0';
|
| 144 |
+
SIGNAL state_d1 : STD_LOGIC := '0';
|
| 145 |
+
SIGNAL state_rd_dom1 : STD_LOGIC := '0';
|
| 146 |
+
SIGNAL rd_en_d1 : STD_LOGIC := '0';
|
| 147 |
+
SIGNAL rd_en_wr1 : STD_LOGIC := '0';
|
| 148 |
+
SIGNAL wr_en_d1 : STD_LOGIC := '0';
|
| 149 |
+
SIGNAL wr_en_rd1 : STD_LOGIC := '0';
|
| 150 |
+
SIGNAL full_chk_d1 : STD_LOGIC := '0';
|
| 151 |
+
SIGNAL full_chk_rd1 : STD_LOGIC := '0';
|
| 152 |
+
SIGNAL empty_wr_dom2 : STD_LOGIC := '0';
|
| 153 |
+
|
| 154 |
+
SIGNAL state_rd_dom2 : STD_LOGIC := '0';
|
| 155 |
+
SIGNAL state_rd_dom3 : STD_LOGIC := '0';
|
| 156 |
+
SIGNAL rd_en_wr2 : STD_LOGIC := '0';
|
| 157 |
+
SIGNAL wr_en_rd2 : STD_LOGIC := '0';
|
| 158 |
+
SIGNAL full_chk_rd2 : STD_LOGIC := '0';
|
| 159 |
+
SIGNAL reset_en_d1 : STD_LOGIC := '0';
|
| 160 |
+
SIGNAL reset_en_rd1 : STD_LOGIC := '0';
|
| 161 |
+
SIGNAL reset_en_rd2 : STD_LOGIC := '0';
|
| 162 |
+
|
| 163 |
+
SIGNAL data_chk_wr_d1 : STD_LOGIC := '0';
|
| 164 |
+
SIGNAL data_chk_rd1 : STD_LOGIC := '0';
|
| 165 |
+
SIGNAL data_chk_rd2 : STD_LOGIC := '0';
|
| 166 |
+
SIGNAL post_rst_dly_wr : STD_LOGIC_VECTOR(4 DOWNTO 0) := (OTHERS => '1');
|
| 167 |
+
SIGNAL post_rst_dly_rd : STD_LOGIC_VECTOR(4 DOWNTO 0) := (OTHERS => '1');
|
| 168 |
+
BEGIN
|
| 169 |
+
status_i <= data_chk_i & full_chk_rd2 & empty_chk_i & '0' & '0';
|
| 170 |
+
STATUS <= status_d1_i & '0' & '0' & rd_activ_cont(rd_activ_cont'high);
|
| 171 |
+
|
| 172 |
+
prc_we_i <= wr_en_i WHEN sim_done_wr2 = '0' ELSE '0';
|
| 173 |
+
prc_re_i <= rd_en_i WHEN sim_done_i = '0' ELSE '0';
|
| 174 |
+
|
| 175 |
+
SIM_DONE <= sim_done_i;
|
| 176 |
+
rdw_gt_wrw <= (OTHERS => '1');
|
| 177 |
+
wrw_gt_rdw <= (OTHERS => '1');
|
| 178 |
+
|
| 179 |
+
PROCESS(RD_CLK)
|
| 180 |
+
BEGIN
|
| 181 |
+
IF (RD_CLK'event AND RD_CLK='1') THEN
|
| 182 |
+
IF(prc_re_i = '1') THEN
|
| 183 |
+
rd_activ_cont <= rd_activ_cont + "1";
|
| 184 |
+
END IF;
|
| 185 |
+
END IF;
|
| 186 |
+
END PROCESS;
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
PROCESS(sim_done_i)
|
| 190 |
+
BEGIN
|
| 191 |
+
assert sim_done_i = '0'
|
| 192 |
+
report "Simulation Complete for:" & AXI_CHANNEL
|
| 193 |
+
severity note;
|
| 194 |
+
END PROCESS;
|
| 195 |
+
|
| 196 |
+
-----------------------------------------------------
|
| 197 |
+
-- SIM_DONE SIGNAL GENERATION
|
| 198 |
+
-----------------------------------------------------
|
| 199 |
+
PROCESS (RD_CLK,RESET_RD)
|
| 200 |
+
BEGIN
|
| 201 |
+
IF(RESET_RD = '1') THEN
|
| 202 |
+
--sim_done_i <= '0';
|
| 203 |
+
ELSIF(RD_CLK'event AND RD_CLK='1') THEN
|
| 204 |
+
IF((OR_REDUCE(sim_stop_cntr) = '0' AND TB_STOP_CNT /= 0) OR stop_on_err = '1') THEN
|
| 205 |
+
sim_done_i <= '1';
|
| 206 |
+
END IF;
|
| 207 |
+
END IF;
|
| 208 |
+
END PROCESS;
|
| 209 |
+
|
| 210 |
+
-- TB Timeout/Stop
|
| 211 |
+
fifo_tb_stop_run:IF(TB_STOP_CNT /= 0) GENERATE
|
| 212 |
+
PROCESS (RD_CLK)
|
| 213 |
+
BEGIN
|
| 214 |
+
IF (RD_CLK'event AND RD_CLK='1') THEN
|
| 215 |
+
IF(state_rd_dom2 = '0' AND state_rd_dom3 = '1') THEN
|
| 216 |
+
sim_stop_cntr <= sim_stop_cntr - "1";
|
| 217 |
+
END IF;
|
| 218 |
+
END IF;
|
| 219 |
+
END PROCESS;
|
| 220 |
+
END GENERATE fifo_tb_stop_run;
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
-- Stop when error found
|
| 224 |
+
PROCESS (RD_CLK)
|
| 225 |
+
BEGIN
|
| 226 |
+
IF (RD_CLK'event AND RD_CLK='1') THEN
|
| 227 |
+
IF(sim_done_i = '0') THEN
|
| 228 |
+
status_d1_i <= status_i OR status_d1_i;
|
| 229 |
+
END IF;
|
| 230 |
+
IF(FREEZEON_ERROR = 1 AND status_i /= "0") THEN
|
| 231 |
+
stop_on_err <= '1';
|
| 232 |
+
END IF;
|
| 233 |
+
END IF;
|
| 234 |
+
END PROCESS;
|
| 235 |
+
-----------------------------------------------------
|
| 236 |
+
|
| 237 |
+
-----------------------------------------------------
|
| 238 |
+
-- CHECKS FOR FIFO
|
| 239 |
+
-----------------------------------------------------
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
PROCESS(RD_CLK,RESET_RD)
|
| 243 |
+
BEGIN
|
| 244 |
+
IF(RESET_RD = '1') THEN
|
| 245 |
+
post_rst_dly_rd <= (OTHERS => '1');
|
| 246 |
+
ELSIF (RD_CLK'event AND RD_CLK='1') THEN
|
| 247 |
+
post_rst_dly_rd <= post_rst_dly_rd-post_rst_dly_rd(4);
|
| 248 |
+
END IF;
|
| 249 |
+
END PROCESS;
|
| 250 |
+
|
| 251 |
+
PROCESS(WR_CLK,RESET_WR)
|
| 252 |
+
BEGIN
|
| 253 |
+
IF(RESET_WR = '1') THEN
|
| 254 |
+
post_rst_dly_wr <= (OTHERS => '1');
|
| 255 |
+
ELSIF (WR_CLK'event AND WR_CLK='1') THEN
|
| 256 |
+
post_rst_dly_wr <= post_rst_dly_wr-post_rst_dly_wr(4);
|
| 257 |
+
END IF;
|
| 258 |
+
END PROCESS;
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
-- FULL de-assert Counter
|
| 262 |
+
PROCESS(WR_CLK,RESET_WR)
|
| 263 |
+
BEGIN
|
| 264 |
+
IF(RESET_WR = '1') THEN
|
| 265 |
+
full_ds_timeout <= (OTHERS => '0');
|
| 266 |
+
ELSIF(WR_CLK'event AND WR_CLK='1') THEN
|
| 267 |
+
IF(state = '1') THEN
|
| 268 |
+
IF(rd_en_wr2 = '1' AND wr_en_i = '0' AND FULL = '1' AND AND_REDUCE(wrw_gt_rdw) = '1') THEN
|
| 269 |
+
full_ds_timeout <= full_ds_timeout + '1';
|
| 270 |
+
END IF;
|
| 271 |
+
ELSE
|
| 272 |
+
full_ds_timeout <= (OTHERS => '0');
|
| 273 |
+
END IF;
|
| 274 |
+
END IF;
|
| 275 |
+
END PROCESS;
|
| 276 |
+
|
| 277 |
+
|
| 278 |
+
-- EMPTY deassert counter
|
| 279 |
+
PROCESS(RD_CLK,RESET_RD)
|
| 280 |
+
BEGIN
|
| 281 |
+
IF(RESET_RD = '1') THEN
|
| 282 |
+
empty_ds_timeout <= (OTHERS => '0');
|
| 283 |
+
ELSIF(RD_CLK'event AND RD_CLK='1') THEN
|
| 284 |
+
IF(state = '0') THEN
|
| 285 |
+
IF(wr_en_rd2 = '1' AND rd_en_i = '0' AND EMPTY = '1' AND AND_REDUCE(rdw_gt_wrw) = '1') THEN
|
| 286 |
+
empty_ds_timeout <= empty_ds_timeout + '1';
|
| 287 |
+
END IF;
|
| 288 |
+
ELSE
|
| 289 |
+
empty_ds_timeout <= (OTHERS => '0');
|
| 290 |
+
END IF;
|
| 291 |
+
END IF;
|
| 292 |
+
END PROCESS;
|
| 293 |
+
|
| 294 |
+
-- Full check signal generation
|
| 295 |
+
PROCESS(WR_CLK,RESET_WR)
|
| 296 |
+
BEGIN
|
| 297 |
+
IF(RESET_WR = '1') THEN
|
| 298 |
+
full_chk_i <= '0';
|
| 299 |
+
ELSIF(WR_CLK'event AND WR_CLK='1') THEN
|
| 300 |
+
IF(C_APPLICATION_TYPE = 1 AND (AXI_CHANNEL = "WACH" OR AXI_CHANNEL = "RACH" OR AXI_CHANNEL = "AXI4_Stream")) THEN
|
| 301 |
+
full_chk_i <= '0';
|
| 302 |
+
ELSE
|
| 303 |
+
full_chk_i <= AND_REDUCE(full_as_timeout) OR
|
| 304 |
+
AND_REDUCE(full_ds_timeout);
|
| 305 |
+
END IF;
|
| 306 |
+
END IF;
|
| 307 |
+
END PROCESS;
|
| 308 |
+
|
| 309 |
+
-- Empty checks
|
| 310 |
+
PROCESS(RD_CLK,RESET_RD)
|
| 311 |
+
BEGIN
|
| 312 |
+
IF(RESET_RD = '1') THEN
|
| 313 |
+
empty_chk_i <= '0';
|
| 314 |
+
ELSIF(RD_CLK'event AND RD_CLK='1') THEN
|
| 315 |
+
IF(C_APPLICATION_TYPE = 1 AND (AXI_CHANNEL = "WACH" OR AXI_CHANNEL = "RACH" OR AXI_CHANNEL = "AXI4_Stream")) THEN
|
| 316 |
+
empty_chk_i <= '0';
|
| 317 |
+
ELSE
|
| 318 |
+
empty_chk_i <= AND_REDUCE(empty_as_timeout) OR
|
| 319 |
+
AND_REDUCE(empty_ds_timeout);
|
| 320 |
+
END IF;
|
| 321 |
+
END IF;
|
| 322 |
+
END PROCESS;
|
| 323 |
+
|
| 324 |
+
fifo_d_chk:IF(C_CH_TYPE /= 2) GENERATE
|
| 325 |
+
PRC_WR_EN <= prc_we_i AFTER 50 ns;
|
| 326 |
+
PRC_RD_EN <= prc_re_i AFTER 100 ns;
|
| 327 |
+
data_chk_i <= dout_chk;
|
| 328 |
+
END GENERATE fifo_d_chk;
|
| 329 |
+
-----------------------------------------------------
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
-----------------------------------------------------
|
| 333 |
+
-- SYNCHRONIZERS B/W WRITE AND READ DOMAINS
|
| 334 |
+
-----------------------------------------------------
|
| 335 |
+
PROCESS(WR_CLK,RESET_WR)
|
| 336 |
+
BEGIN
|
| 337 |
+
IF(RESET_WR = '1') THEN
|
| 338 |
+
empty_wr_dom1 <= '1';
|
| 339 |
+
empty_wr_dom2 <= '1';
|
| 340 |
+
state_d1 <= '0';
|
| 341 |
+
wr_en_d1 <= '0';
|
| 342 |
+
rd_en_wr1 <= '0';
|
| 343 |
+
rd_en_wr2 <= '0';
|
| 344 |
+
full_chk_d1 <= '0';
|
| 345 |
+
reset_en_d1 <= '0';
|
| 346 |
+
sim_done_wr1 <= '0';
|
| 347 |
+
sim_done_wr2 <= '0';
|
| 348 |
+
ELSIF (WR_CLK'event AND WR_CLK='1') THEN
|
| 349 |
+
sim_done_wr1 <= sim_done_d1;
|
| 350 |
+
sim_done_wr2 <= sim_done_wr1;
|
| 351 |
+
reset_en_d1 <= reset_en_i;
|
| 352 |
+
state_d1 <= state;
|
| 353 |
+
empty_wr_dom1 <= empty_d1;
|
| 354 |
+
empty_wr_dom2 <= empty_wr_dom1;
|
| 355 |
+
wr_en_d1 <= wr_en_i;
|
| 356 |
+
rd_en_wr1 <= rd_en_d1;
|
| 357 |
+
rd_en_wr2 <= rd_en_wr1;
|
| 358 |
+
full_chk_d1 <= full_chk_i;
|
| 359 |
+
END IF;
|
| 360 |
+
END PROCESS;
|
| 361 |
+
|
| 362 |
+
PROCESS(RD_CLK,RESET_RD)
|
| 363 |
+
BEGIN
|
| 364 |
+
IF(RESET_RD = '1') THEN
|
| 365 |
+
empty_d1 <= '1';
|
| 366 |
+
state_rd_dom1 <= '0';
|
| 367 |
+
state_rd_dom2 <= '0';
|
| 368 |
+
state_rd_dom3 <= '0';
|
| 369 |
+
wr_en_rd1 <= '0';
|
| 370 |
+
wr_en_rd2 <= '0';
|
| 371 |
+
rd_en_d1 <= '0';
|
| 372 |
+
full_chk_rd1 <= '0';
|
| 373 |
+
full_chk_rd2 <= '0';
|
| 374 |
+
reset_en_rd1 <= '0';
|
| 375 |
+
reset_en_rd2 <= '0';
|
| 376 |
+
sim_done_d1 <= '0';
|
| 377 |
+
ELSIF (RD_CLK'event AND RD_CLK='1') THEN
|
| 378 |
+
sim_done_d1 <= sim_done_i;
|
| 379 |
+
reset_en_rd1 <= reset_en_d1;
|
| 380 |
+
reset_en_rd2 <= reset_en_rd1;
|
| 381 |
+
empty_d1 <= EMPTY;
|
| 382 |
+
rd_en_d1 <= rd_en_i;
|
| 383 |
+
state_rd_dom1 <= state_d1;
|
| 384 |
+
state_rd_dom2 <= state_rd_dom1;
|
| 385 |
+
state_rd_dom3 <= state_rd_dom2;
|
| 386 |
+
wr_en_rd1 <= wr_en_d1;
|
| 387 |
+
wr_en_rd2 <= wr_en_rd1;
|
| 388 |
+
full_chk_rd1 <= full_chk_d1;
|
| 389 |
+
full_chk_rd2 <= full_chk_rd1;
|
| 390 |
+
END IF;
|
| 391 |
+
END PROCESS;
|
| 392 |
+
|
| 393 |
+
RESET_EN <= reset_en_rd2;
|
| 394 |
+
|
| 395 |
+
|
| 396 |
+
data_fifo_en:IF(C_CH_TYPE /= 2) GENERATE
|
| 397 |
+
-----------------------------------------------------
|
| 398 |
+
-- WR_EN GENERATION
|
| 399 |
+
-----------------------------------------------------
|
| 400 |
+
gen_rand_wr_en:pixel_fifo_rng
|
| 401 |
+
GENERIC MAP(
|
| 402 |
+
WIDTH => 8,
|
| 403 |
+
SEED => TB_SEED+1
|
| 404 |
+
)
|
| 405 |
+
PORT MAP(
|
| 406 |
+
CLK => WR_CLK,
|
| 407 |
+
RESET => RESET_WR,
|
| 408 |
+
RANDOM_NUM => wr_en_gen,
|
| 409 |
+
ENABLE => '1'
|
| 410 |
+
);
|
| 411 |
+
|
| 412 |
+
PROCESS(WR_CLK,RESET_WR)
|
| 413 |
+
BEGIN
|
| 414 |
+
IF(RESET_WR = '1') THEN
|
| 415 |
+
wr_en_i <= '0';
|
| 416 |
+
ELSIF(WR_CLK'event AND WR_CLK='1') THEN
|
| 417 |
+
IF(state = '1') THEN
|
| 418 |
+
wr_en_i <= wr_en_gen(0) AND wr_en_gen(7) AND wr_en_gen(2) AND wr_control;
|
| 419 |
+
ELSE
|
| 420 |
+
wr_en_i <= (wr_en_gen(3) OR wr_en_gen(4) OR wr_en_gen(2)) AND (NOT post_rst_dly_wr(4));
|
| 421 |
+
END IF;
|
| 422 |
+
END IF;
|
| 423 |
+
END PROCESS;
|
| 424 |
+
|
| 425 |
+
-----------------------------------------------------
|
| 426 |
+
-- WR_EN CONTROL
|
| 427 |
+
-----------------------------------------------------
|
| 428 |
+
PROCESS(WR_CLK,RESET_WR)
|
| 429 |
+
BEGIN
|
| 430 |
+
IF(RESET_WR = '1') THEN
|
| 431 |
+
wr_cntr <= (OTHERS => '0');
|
| 432 |
+
wr_control <= '1';
|
| 433 |
+
full_as_timeout <= (OTHERS => '0');
|
| 434 |
+
ELSIF(WR_CLK'event AND WR_CLK='1') THEN
|
| 435 |
+
IF(state = '1') THEN
|
| 436 |
+
IF(wr_en_i = '1') THEN
|
| 437 |
+
wr_cntr <= wr_cntr + "1";
|
| 438 |
+
END IF;
|
| 439 |
+
full_as_timeout <= (OTHERS => '0');
|
| 440 |
+
ELSE
|
| 441 |
+
wr_cntr <= (OTHERS => '0');
|
| 442 |
+
IF(rd_en_wr2 = '0') THEN
|
| 443 |
+
IF(wr_en_i = '1') THEN
|
| 444 |
+
full_as_timeout <= full_as_timeout + "1";
|
| 445 |
+
END IF;
|
| 446 |
+
ELSE
|
| 447 |
+
full_as_timeout <= (OTHERS => '0');
|
| 448 |
+
END IF;
|
| 449 |
+
END IF;
|
| 450 |
+
|
| 451 |
+
wr_control <= NOT wr_cntr(wr_cntr'high);
|
| 452 |
+
|
| 453 |
+
END IF;
|
| 454 |
+
END PROCESS;
|
| 455 |
+
|
| 456 |
+
-----------------------------------------------------
|
| 457 |
+
-- RD_EN GENERATION
|
| 458 |
+
-----------------------------------------------------
|
| 459 |
+
gen_rand_rd_en:pixel_fifo_rng
|
| 460 |
+
GENERIC MAP(
|
| 461 |
+
WIDTH => 8,
|
| 462 |
+
SEED => TB_SEED
|
| 463 |
+
)
|
| 464 |
+
PORT MAP(
|
| 465 |
+
CLK => RD_CLK,
|
| 466 |
+
RESET => RESET_RD,
|
| 467 |
+
RANDOM_NUM => rd_en_gen,
|
| 468 |
+
ENABLE => '1'
|
| 469 |
+
);
|
| 470 |
+
|
| 471 |
+
PROCESS(RD_CLK,RESET_RD)
|
| 472 |
+
BEGIN
|
| 473 |
+
IF(RESET_RD = '1') THEN
|
| 474 |
+
rd_en_i <= '0';
|
| 475 |
+
ELSIF(RD_CLK'event AND RD_CLK='1') THEN
|
| 476 |
+
IF(state_rd_dom2 = '0') THEN
|
| 477 |
+
rd_en_i <= rd_en_gen(1) AND rd_en_gen(5) AND rd_en_gen(3) AND rd_control AND (NOT post_rst_dly_rd(4));
|
| 478 |
+
ELSE
|
| 479 |
+
rd_en_i <= rd_en_gen(0) OR rd_en_gen(6);
|
| 480 |
+
END IF;
|
| 481 |
+
END IF;
|
| 482 |
+
END PROCESS;
|
| 483 |
+
|
| 484 |
+
-----------------------------------------------------
|
| 485 |
+
-- RD_EN CONTROL
|
| 486 |
+
-----------------------------------------------------
|
| 487 |
+
PROCESS(RD_CLK,RESET_RD)
|
| 488 |
+
BEGIN
|
| 489 |
+
IF(RESET_RD = '1') THEN
|
| 490 |
+
rd_cntr <= (OTHERS => '0');
|
| 491 |
+
rd_control <= '1';
|
| 492 |
+
empty_as_timeout <= (OTHERS => '0');
|
| 493 |
+
ELSIF(RD_CLK'event AND RD_CLK='1') THEN
|
| 494 |
+
IF(state_rd_dom2 = '0') THEN
|
| 495 |
+
IF(rd_en_i = '1') THEN
|
| 496 |
+
rd_cntr <= rd_cntr + "1";
|
| 497 |
+
END IF;
|
| 498 |
+
empty_as_timeout <= (OTHERS => '0');
|
| 499 |
+
ELSE
|
| 500 |
+
rd_cntr <= (OTHERS => '0');
|
| 501 |
+
IF(wr_en_rd2 = '0') THEN
|
| 502 |
+
IF(rd_en_i = '1') THEN
|
| 503 |
+
empty_as_timeout <= empty_as_timeout + "1";
|
| 504 |
+
END IF;
|
| 505 |
+
ELSE
|
| 506 |
+
empty_as_timeout <= (OTHERS => '0');
|
| 507 |
+
END IF;
|
| 508 |
+
END IF;
|
| 509 |
+
|
| 510 |
+
rd_control <= NOT rd_cntr(rd_cntr'high);
|
| 511 |
+
|
| 512 |
+
END IF;
|
| 513 |
+
END PROCESS;
|
| 514 |
+
|
| 515 |
+
-----------------------------------------------------
|
| 516 |
+
-- STIMULUS CONTROL
|
| 517 |
+
-----------------------------------------------------
|
| 518 |
+
PROCESS(WR_CLK,RESET_WR)
|
| 519 |
+
BEGIN
|
| 520 |
+
IF(RESET_WR = '1') THEN
|
| 521 |
+
state <= '0';
|
| 522 |
+
reset_en_i <= '0';
|
| 523 |
+
ELSIF(WR_CLK'event AND WR_CLK='1') THEN
|
| 524 |
+
CASE state IS
|
| 525 |
+
WHEN '0' =>
|
| 526 |
+
IF(FULL = '1' AND empty_wr_dom2 = '0') THEN
|
| 527 |
+
state <= '1';
|
| 528 |
+
reset_en_i <= '0';
|
| 529 |
+
END IF;
|
| 530 |
+
WHEN '1' =>
|
| 531 |
+
IF(empty_wr_dom2 = '1' AND FULL = '0') THEN
|
| 532 |
+
state <= '0';
|
| 533 |
+
reset_en_i <= '1';
|
| 534 |
+
END IF;
|
| 535 |
+
WHEN OTHERS => state <= state;
|
| 536 |
+
END CASE;
|
| 537 |
+
END IF;
|
| 538 |
+
END PROCESS;
|
| 539 |
+
END GENERATE data_fifo_en;
|
| 540 |
+
|
| 541 |
+
END ARCHITECTURE;
|