Changeset 22 in XOpenSparcT1 for trunk/sim/tb_top.v
- Timestamp:
- 03/31/11 12:31:26 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sim/tb_top.v
r17 r22 14 14 localparam real TCYC_200 = 5.0; 15 15 parameter RST_ACT_LOW = 1; // =1 for active low reset, =0 for active high 16 localparam real TPROP_DQS = 0.01; // Delay for DQS signal during Write Operation 17 localparam real TPROP_DQS_RD = 0.01; // Delay for DQS signal during Read Operation 18 localparam real TPROP_PCB_CTRL = 0.01; // Delay for Address and Ctrl signals 19 localparam real TPROP_PCB_DATA = 0.01; // Delay for data signal during Write operation 20 localparam real TPROP_PCB_DATA_RD = 0.01; // Delay for data signal during Read operation 16 21 17 22 … … 32 37 wire [DQS_WIDTH-1:0] ddr2_dqs_n_sdram; 33 38 wire [7:0] ddr2_dm_sdram; 34 wire ddr2_clk_sdram; 35 wire ddr2_clk_n_sdram; 36 wire [12:0] ddr2_address_sdram; 37 wire [1:0] ddr2_ba_sdram; 38 wire ddr2_ras_n_sdram; 39 wire ddr2_cas_n_sdram; 40 wire ddr2_we_n_sdram; 41 wire [CS_WIDTH-1:0] ddr2_cs_n_sdram; 42 wire ddr2_cke_sdram; 43 wire [ODT_WIDTH-1:0] ddr2_odt_sdram; 39 reg [7:0] ddr2_dm_sdram_tmp; 40 reg ddr2_clk_sdram; 41 reg ddr2_clk_n_sdram; 42 reg [12:0] ddr2_address_sdram; 43 reg [1:0] ddr2_ba_sdram; 44 reg ddr2_ras_n_sdram; 45 reg ddr2_cas_n_sdram; 46 reg ddr2_we_n_sdram; 47 reg [CS_WIDTH-1:0] ddr2_cs_n_sdram; 48 reg ddr2_cke_sdram; 49 reg [ODT_WIDTH-1:0] ddr2_odt_sdram; 50 51 wire [DQ_WIDTH-1:0] ddr2_dq_fpga; 52 wire [DQS_WIDTH-1:0] ddr2_dqs_fpga; 53 wire [DQS_WIDTH-1:0] ddr2_dqs_n_fpga; 54 wire [7:0] ddr2_dm_fpga; 55 wire ddr2_clk_fpga; 56 wire ddr2_clk_n_fpga; 57 wire [12:0] ddr2_address_fpga; 58 wire [1:0] ddr2_ba_fpga; 59 wire ddr2_ras_n_fpga; 60 wire ddr2_cas_n_fpga; 61 wire ddr2_we_n_fpga; 62 wire [CS_WIDTH-1:0] ddr2_cs_n_fpga; 63 wire ddr2_cke_fpga; 64 wire [ODT_WIDTH-1:0] ddr2_odt_fpga; 65 44 66 45 67 wire stx; … … 57 79 58 80 // Create VCD trace file 59 $dumpfile("trace.vcd");60 $dumpvars();81 // $dumpfile("trace.vcd"); 82 // $dumpvars(); 61 83 62 84 // Run the simulation … … 65 87 // #1000 66 88 // sys_reset <= 1'b0; 67 # 10000089 #700_000 68 90 $display("INFO: TBENCH: Completed simulation!"); 69 91 $finish; … … 109 131 110 132 // ddr3 memory interface 111 .ddr3_dq (ddr2_dq_ sdram),112 .ddr3_dqs (ddr2_dqs_ n_sdram),113 .ddr3_dqs_n (ddr2_dqs_n_ sdram),114 .ddr3_ck (ddr2_clk_ sdram),115 .ddr3_ck_n (ddr2_clk_n_ sdram),116 .ddr3_a (ddr2_address_ sdram),117 .ddr3_ba (ddr2_ba_ sdram), //FIXME118 .ddr3_ras_n (ddr2_ras_n_ sdram),119 .ddr3_cas_n (ddr2_cas_n_ sdram),120 .ddr3_we_n (ddr2_we_n_ sdram),121 .ddr3_cs_n (ddr2_cs_n_ sdram),122 .ddr3_odt (ddr2_odt_ sdram),123 .ddr3_ce (ddr2_cke_ sdram),124 .ddr3_dm (ddr2_dm_ sdram),133 .ddr3_dq (ddr2_dq_fpga), 134 .ddr3_dqs (ddr2_dqs_fpga), 135 .ddr3_dqs_n (ddr2_dqs_n_fpga), 136 .ddr3_ck (ddr2_clk_fpga), 137 .ddr3_ck_n (ddr2_clk_n_fpga), 138 .ddr3_a (ddr2_address_fpga), 139 .ddr3_ba (ddr2_ba_fpga), //FIXME 140 .ddr3_ras_n (ddr2_ras_n_fpga), 141 .ddr3_cas_n (ddr2_cas_n_fpga), 142 .ddr3_we_n (ddr2_we_n_fpga), 143 .ddr3_cs_n (ddr2_cs_n_fpga), 144 .ddr3_odt (ddr2_odt_fpga), 145 .ddr3_ce (ddr2_cke_fpga), 146 .ddr3_dm (ddr2_dm_fpga), 125 147 126 148 // Console interface … … 156 178 .flash_rst(flash_rst) 157 179 ); 180 181 //DDR2 model 182 // 183 184 always @( * ) begin 185 ddr2_clk_sdram <= #(TPROP_PCB_CTRL) ddr2_clk_fpga; 186 ddr2_clk_n_sdram <= #(TPROP_PCB_CTRL) ddr2_clk_n_fpga; 187 ddr2_address_sdram <= #(TPROP_PCB_CTRL) ddr2_address_fpga; 188 ddr2_ba_sdram <= #(TPROP_PCB_CTRL) ddr2_ba_fpga; 189 ddr2_ras_n_sdram <= #(TPROP_PCB_CTRL) ddr2_ras_n_fpga; 190 ddr2_cas_n_sdram <= #(TPROP_PCB_CTRL) ddr2_cas_n_fpga; 191 ddr2_we_n_sdram <= #(TPROP_PCB_CTRL) ddr2_we_n_fpga; 192 ddr2_cs_n_sdram <= #(TPROP_PCB_CTRL) ddr2_cs_n_fpga; 193 ddr2_cke_sdram <= #(TPROP_PCB_CTRL) ddr2_cke_fpga; 194 ddr2_odt_sdram <= #(TPROP_PCB_CTRL) ddr2_odt_fpga; 195 ddr2_dm_sdram_tmp <= #(TPROP_PCB_DATA) ddr2_dm_fpga;//DM signal generation 196 end 197 198 assign ddr2_dm_sdram = ddr2_dm_sdram_tmp; 199 200 genvar dqwd; 201 generate 202 for (dqwd = 0;dqwd < DQ_WIDTH;dqwd = dqwd+1) begin : dq_delay 203 WireDelay # 204 ( 205 .Delay_g (TPROP_PCB_DATA), 206 .Delay_rd (TPROP_PCB_DATA_RD) 207 ) 208 u_delay_dq 209 ( 210 .A (ddr2_dq_fpga[dqwd]), 211 .B (ddr2_dq_sdram[dqwd]), 212 .reset (sys_rst_n) 213 ); 214 end 215 endgenerate 216 217 218 genvar dqswd; 219 generate 220 for (dqswd = 0;dqswd < DQS_WIDTH;dqswd = dqswd+1) begin : dqs_delay 221 WireDelay # 222 ( 223 .Delay_g (TPROP_DQS), 224 .Delay_rd (TPROP_DQS_RD) 225 ) 226 u_delay_dqs 227 ( 228 .A (ddr2_dqs_fpga[dqswd]), 229 .B (ddr2_dqs_sdram[dqswd]), 230 .reset (sys_rst_n) 231 ); 232 233 WireDelay # 234 ( 235 .Delay_g (TPROP_DQS), 236 .Delay_rd (TPROP_DQS_RD) 237 ) 238 u_delay_dqs_n 239 ( 240 .A (ddr2_dqs_n_fpga[dqswd]), 241 .B (ddr2_dqs_n_sdram[dqswd]), 242 .reset (sys_rst_n) 243 ); 244 end 245 endgenerate 246 158 247 // if the data width is multiple of 16 159 248 //for(j = 0; j < CS_NUM; j = j+1) begin : gen_cs
Note: See TracChangeset
for help on using the changeset viewer.