test_512.v 11.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
//**************************************************************************************************
//  K9F1208U0M, 512Mbit(x8) 1st Generation NAND FLASH TIMING VECTOR FOR PROGRAM  MODE  TEST      
//  Programmed By NAND Flash Memory Product Planning Team, Samsung Semiconductor Co. LTD.
//  NOTICE:
//  - This test vector file provides simultaneous PROGRAM/ERASE capability up Max.four PAGES/BLOCKS.
//  - And provides also COPY-BACK / PRELOAD functions. 
//  Rev. 1.1 
//**************************************************************************************************

`timescale 1ns/1ps

`define PWRUP   	5000 	 // Wait Time
`define TPROGRAM   	200100   // Program Time
`define TERASE   	2000100  // Erase Time
`define TREAD      	12100    // Data Transfer form Cell to Register
`define TDBSY		1500	 // Dummy Busy Time for Multi Plane Program

module nand_driver();
reg     [7:0]   io;
wire    [7:0]   i_o=io;
reg     		ceb, cle, ale, web, reb, wpb;

integer i;

km29u512  flash(.ceb(ceb), .cle(cle), .ale(ale), 
		.web(web), .reb(reb), .io(i_o), 
		.wpb(wpb), .rbb(rbb));

initial
begin
	$dumpvars();
	$dumpfile("test.dump");
end

initial
begin
	ceb = 1; 
	cle = 0;        
	ale = 0; 
	web = 1; 
	reb = 1;
	io  = 8'hzz; 
	wpb = 1;
end  

// timing for command latch 
task	cmd_latch;
	input [7:0] cmd;

	begin
	    #20
		ceb = 0;
		web = 1;
		cle = 0;
		ale = 0;
	    #10
		cle = 1;
	    #1
		web = 0;
		io  = cmd;
	    #26
		web = 1;
    #11
		io  = 8'hzz;
	    #6
		cle = 0;
            #10
               ceb = 1;
	end
endtask


// timing for address latch
task	add_latch;
	input [7:0] add;

	begin
           ceb = 0;
	   #20
		cle = 0;
		ale = 1;
		#1
		web = 0;
	    #5
		io  = add;
  		#22
		web = 1;
		#11
		io  = 8'hzz;
	    #6
		ale = 0;
		ceb = 0;
	end
endtask


// timing for data latch
task	data_latch;
	input [10:0] cnt;
	input [7:0] data;

	begin
		for (i=0; i < cnt; i=i+1)
		begin
	    	   #20
			ceb = 0;
	    	   #1
			web = 0;
	    	   #5
			io  = data + i;
	    	   #22
			web = 1;
		   #11
			io  = 8'hzz;
		end
	end
endtask


// timing for serial read
task	serial_read;
	input  [16:0]	cnt;

	begin
		cle = 0;
		ale = 0;
		web = 1;
	    	for ( i=0; i < cnt; i = i+1) 
		begin
		   #16
			reb = 0;
	    	   #36
			reb = 1;
		end
	end
endtask

// timing for serial read (/CE don't care)
task    serial_read1;
        input  [16:0]   cnt1;

        begin
                cle = 0;
                ale = 0;
                web = 1;
                for ( i=0; i < cnt1; i = i+1)
                begin
                   #26
			ceb = 0;
                        reb = 0;
                   #56
                        reb = 1;
			ceb = 1;
                end
        end
endtask


//******************************
// User Test Vector Here
//******************************

initial
begin
	#`PWRUP

// This function is PRELOAD function and you can read external data(2blocks size=528Byte*32pages*2blocks=33792Bytes) from External_File.txt.
// If you don't want to use this operating, you have to remove this function.
        cmd_latch(8'h00);
    add_latch(8'h00);
    add_latch(8'h00);
    add_latch(8'h00);
    add_latch(8'h00);	
        #`TREAD
    serial_read(16'h210); // Sequential read from the 1st block's 1st page.	
	 #`TREAD
    serial_read(16'h210);
	 #`TREAD
    serial_read(16'h210);
	#`TREAD
    serial_read(16'h210);
         #`TREAD        
    serial_read(16'h210);       
         #`TREAD        
    serial_read(16'h210);       
	#`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
	#`TREAD
    serial_read(16'h210);
         #`TREAD        
    serial_read(16'h210);       
         #`TREAD        
    serial_read(16'h210);       
        #`TREAD 
    serial_read(16'h210);       
         #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
        #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
	#`TREAD
    serial_read(16'h210);
         #`TREAD        
    serial_read(16'h210);       
         #`TREAD        
    serial_read(16'h210);       
        #`TREAD 
    serial_read(16'h210);       
         #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
        #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
	#`TREAD
    serial_read(16'h210);
         #`TREAD        
    serial_read(16'h210);       
         #`TREAD        
    serial_read(16'h210);       
        #`TREAD 
    serial_read(16'h210);       
         #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
        #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
        ceb = 1'b1;
	#1000

	cmd_latch(8'h00);
    add_latch(8'h00);
    add_latch(8'h20);
    add_latch(8'h00);
    add_latch(8'h00);	
        #`TREAD
    serial_read(16'h210); // Sequential read from the 2nd block's 1st page.
         #`TREAD        
    serial_read(16'h210);       
         #`TREAD        
    serial_read(16'h210);       
        #`TREAD 
    serial_read(16'h210);       
         #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
        #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
        #`TREAD
    serial_read(16'h210);
         #`TREAD        
    serial_read(16'h210);       
         #`TREAD        
    serial_read(16'h210);       
        #`TREAD 
    serial_read(16'h210);       
         #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
        #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
        #`TREAD
    serial_read(16'h210);
         #`TREAD        
    serial_read(16'h210);       
         #`TREAD        
    serial_read(16'h210);       
        #`TREAD 
    serial_read(16'h210);       
         #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
        #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
        #`TREAD
    serial_read(16'h210);
         #`TREAD        
    serial_read(16'h210);       
         #`TREAD        
    serial_read(16'h210);       
        #`TREAD 
    serial_read(16'h210);       
         #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
        #`TREAD                
    serial_read(16'h210);               
         #`TREAD                
    serial_read(16'h210);               
        ceb = 1'b1;
	
        #10000

// ID Read
        cmd_latch(8'h90);
    add_latch(8'h00);
        #100
    serial_read(16'h4);
        #20000

// 1Block Erase 
	cmd_latch(8'h60);
    add_latch(8'h40);
    add_latch(8'h00);
    add_latch(8'h00);	
	cmd_latch(8'hD0);
	#`TERASE
    cmd_latch(8'h70);    // Status Check Command 
        ceb = 1'b0;
	#18
    serial_read(16'h1);
        ceb = 1'b1;
        #1000 


// Multi_Plane Block(4Blocks) Erase
// NOTICE :
//   You can simultaneously erase only one block from each plane, up to four blocks. 
  
	cmd_latch(8'h60);
    add_latch(8'h80);
    add_latch(8'h00);
    add_latch(8'h00);
	#230
	cmd_latch(8'h60);
    add_latch(8'ha0);
    add_latch(8'h00);
    add_latch(8'h00);
        #230
	cmd_latch(8'h60);
    add_latch(8'hc0);
    add_latch(8'h00);
    add_latch(8'h00);
        #230
	cmd_latch(8'h60);
    add_latch(8'he0);
    add_latch(8'h00);
    add_latch(8'h00);
        cmd_latch(8'hD0);
	#`TERASE
    cmd_latch(8'h71);   // Multi_Status Check Command
	ceb = 1'b0;
	#18
    serial_read(16'h1);
   	ceb = 1'b1;
	#1000 

// Multi_Plane Page(4pages) Program
// NOTICE :
//   While any block in each plane may be addressable for Multi_Plane Page Program, the four least 
//   significant address(A9-A13) for the selected pages at one operation must be the same.
 
	cmd_latch(8'h80);
    add_latch(8'h00);
    add_latch(8'hc1);
    add_latch(8'h00);
    add_latch(8'h00);
	data_latch(10'h210,8'h00);
    cmd_latch(8'h11);
	#`TDBSY
        cmd_latch(8'h80);
    add_latch(8'h00);
    add_latch(8'ha1);
    add_latch(8'h00);
    add_latch(8'h00);
        data_latch(10'h210,8'h10); 
    cmd_latch(8'h11);
	#`TDBSY 
       cmd_latch(8'h80);
    add_latch(8'h00);
    add_latch(8'he1);
    add_latch(8'h00);
    add_latch(8'h00); 
        data_latch(10'h210,8'h20); 
    cmd_latch(8'h11);
	#`TDBSY 
        cmd_latch(8'h80);
    add_latch(8'h00);
    add_latch(8'h81);
    add_latch(8'h00);
    add_latch(8'h00); 
        data_latch(10'h210,8'h30); 
    cmd_latch(8'h10);
	#`TPROGRAM 
    cmd_latch(8'h71);    // Multi_Status Check Command
        ceb = 1'b0;
	#18 
    serial_read(16'h1);
	ceb = 1'b1;
        #1000

// Copy_Back #1 ( Moving programmed 528-Byte to lower-address from current address )
// NOTICE: Whenever you use this function, you have to check that address 14 ,the plane address, of source and destination
//         page address must be same.
        cmd_latch(8'h00);
    add_latch(8'h00);
    add_latch(8'ha1); //source page address
    add_latch(8'h00);
    add_latch(8'h00);	
        #`TREAD

        cmd_latch(8'h8a);
    add_latch(8'h00);
    add_latch(8'h41); //destination page address
    add_latch(8'h00);
    add_latch(8'h00);
        #`TPROGRAM

    cmd_latch(8'h70); // Status Check Command
        ceb = 1'b0;
    serial_read(16'h1);
        ceb = 1'b1;
        #1000

// Copy_Back #2  ( Moving programmed 528-Byte to higher-address from current address )
// NOTICE: Whenever you use this function, you have to check that address 14 ,the plane address, of source and destination
//         page address must be same.
        cmd_latch(8'h00);
    add_latch(8'h00);
    add_latch(8'hc1); //source page address
    add_latch(8'h00);
    add_latch(8'h00);
        #`TREAD

        cmd_latch(8'h8a);
    add_latch(8'h00);
    add_latch(8'he2); //destination page address
    add_latch(8'h00);
    add_latch(8'h00);
        #`TPROGRAM

    cmd_latch(8'h70);
        ceb = 1'b0;
    serial_read(16'h1);
        ceb = 1'b1;
        #1000

// Sequential Read
        cmd_latch(8'h00);
    add_latch(8'h00);
    add_latch(8'h41);	
    add_latch(8'h00);
    add_latch(8'h00);
	#`TREAD
    serial_read(16'h210);
	ceb = 1'b1;	
	#1000

	cmd_latch(8'h00);
    add_latch(8'h00);
    add_latch(8'h81);
    add_latch(8'h00);
    add_latch(8'h00);
	#`TREAD
    serial_read(16'h210);
	ceb = 1'b1;
	#1000

	cmd_latch(8'h00);
    add_latch(8'h00);
    add_latch(8'he1);
    add_latch(8'h00);
    add_latch(8'h00);
        #`TREAD
    serial_read(16'h210);
	ceb = 1'b1;
        #1000

	cmd_latch(8'h00);
    add_latch(8'h00);
    add_latch(8'he2);
    add_latch(8'h00);
    add_latch(8'h00);
        #`TREAD
    serial_read1(16'h210);
	ceb = 1'b1; 
        #1000
       
  	$finish;
end
endmodule