| 1 | 3 | dinesha | // Author: Mehdi SEBBANE
 | 
      
         | 2 |  |  | // May 2002
 | 
      
         | 3 |  |  | // Verilog model
 | 
      
         | 4 |  |  | // project: M25P20 25 MHz,
 | 
      
         | 5 |  |  | // release: 1.4.1
 | 
      
         | 6 |  |  |  
 | 
      
         | 7 |  |  |  
 | 
      
         | 8 |  |  |  
 | 
      
         | 9 |  |  | // These Verilog HDL models are provided "as is" without warranty
 | 
      
         | 10 |  |  | // of any kind, included but not limited to, implied warranty
 | 
      
         | 11 |  |  | // of merchantability and fitness for a particular purpose.
 | 
      
         | 12 |  |  |  
 | 
      
         | 13 |  |  |  
 | 
      
         | 14 |  |  |  
 | 
      
         | 15 |  |  |  
 | 
      
         | 16 |  |  |  
 | 
      
         | 17 |  |  | `timescale  1ns/1ns
 | 
      
         | 18 |  |  |  
 | 
      
         | 19 |  |  | `define SIZE               2097152     // 2Mbit
 | 
      
         | 20 |  |  | `define PLENGTH            256         // page length
 | 
      
         | 21 |  |  | `define SSIZE              524288      // Sector size
 | 
      
         | 22 |  |  | `define NB_BPI             2           // number of BPi bits
 | 
      
         | 23 |  |  | `define SIGNATURE          8'b00010001 // electronic signature
 | 
      
         | 24 |  |  | `define BIT_TO_CODE_MEM    18          // number of bit to code a 2Mbits memory
 | 
      
         | 25 |  |  | `define LSB_TO_CODE_PAGE   8           // number of bit to code a PLENGTH page
 | 
      
         | 26 |  |  |  
 | 
      
         | 27 |  |  | `define NB_BIT_ADD_MEM              24
 | 
      
         | 28 |  |  | `define NB_BIT_ADD                  8
 | 
      
         | 29 |  |  | `define NB_BIT_DATA                 8
 | 
      
         | 30 |  |  | `define TOP_MEM                     (`SIZE/`NB_BIT_DATA)-1
 | 
      
         | 31 |  |  |  
 | 
      
         | 32 |  |  | `define MASK_SECTOR        24'hFF0000   // anded with address to find first sector adress to erase
 | 
      
         | 33 |  |  |  
 | 
      
         | 34 |  |  | `define   TRUE    1'b1
 | 
      
         | 35 |  |  | `define   FALSE   1'b0
 | 
      
         | 36 |  |  |  
 | 
      
         | 37 |  |  |  
 | 
      
         | 38 |  |  | `define TC     40          // Minimum Clock period
 | 
      
         | 39 |  |  | `define TR     50          // Minimum Clock period for read instruction
 | 
      
         | 40 |  |  | `define TSLCH  10          // notS active setup time (relative to C)
 | 
      
         | 41 |  |  | `define TCHSL  10          // notS not active hold time
 | 
      
         | 42 |  |  | `define TCH    18          // Clock high time
 | 
      
         | 43 |  |  | `define TCL    18          // Clock low time
 | 
      
         | 44 |  |  | `define TDVCH  5           // Data in Setup Time
 | 
      
         | 45 |  |  | `define TCHDX  5           // Data in Hold Time
 | 
      
         | 46 |  |  | `define TCHSH  10          // notS active hold time (relative to C)
 | 
      
         | 47 |  |  | `define TSHCH  10          // notS not active setup  time (relative to C)
 | 
      
         | 48 |  |  | `define TSHSL  100            // /S deselect time
 | 
      
         | 49 |  |  | `define TSHQZ  15          // Output disable Time
 | 
      
         | 50 |  |  | `define TCLQV  15          // clock low to output valid
 | 
      
         | 51 |  |  | `define THLCH  10          // NotHold active setup time
 | 
      
         | 52 |  |  | `define TCHHH  10          // NotHold not active hold time
 | 
      
         | 53 |  |  | `define THHCH  10          // NotHold not active setup time
 | 
      
         | 54 |  |  | `define TCHHL  10          // NotHold active hold time
 | 
      
         | 55 |  |  | `define THHQX  15          // NotHold high to Output Low-Z
 | 
      
         | 56 |  |  | `define THLQZ  20          // NotHold low to Output High-Z
 | 
      
         | 57 |  |  | `define TDP    3000        // notS high to deep power down mode
 | 
      
         | 58 |  |  | `define TRES1  3000        // notS high to Stand-By power mode w-o ID Read
 | 
      
         | 59 |  |  | `define TRES2  1800        // notS high to Stand-By power mode with ID Read
 | 
      
         | 60 |  |  | `define TW     15000000    // write status register cycle time (15ms)
 | 
      
         | 61 |  |  | `define TPP    5000000         // page program cycle time (5ms)
 | 
      
         | 62 |  |  | `define TSE    3000000000      // sector erase cycle time (3s)
 | 
      
         | 63 |  |  | `define TBE    6000000000      // bulk erase cycle time (6s)
 |