User`s manual
67 flash_ddata <= 0;
68 flash_wdata <= wdata;
69 lop <= op;
70 if (op != ‘FLASHOP_IDLE)
71 begin
72 busy <= 1;
73 state <= state+1;
74 end
75 else
76 busy <= 0;
77 end
78 else if ((state==0) && flash_sts)
79 busy <= 0;
80 else if (state == 1)
81 // The first stage of a flash operation. The address bus is already set,
82 // so, if this is a read, we assert OE. For a write, we start driving
83 // the user’s data onto the flash databus (the value was latched in the
84 // previous state.
85 begin
86 if (lop == ‘FLASHOP_WRITE)
87 flash_ddata <= 1;
88 else if (lop == ‘FLASHOP_READ)
89 flash_oe_b <= 0;
90 state <= state+1;
91 end
92 else if (state == 2)
93 // The second stage of a flash operation. Nothing to do for a read. For
94 // a write, we assert WE.
95 begin
96 if (lop == ‘FLASHOP_WRITE)
97 flash_we_b <= 0;
98 state <= state+1;
99 end
100 else if (state == access_cycles+1)
101 // The third stage of a flash operation. For a read, we latch the data
102 // from the flash chip. For a write, we deassert WE.
103 begin
104 if (lop == ‘FLASHOP_WRITE)
105 flash_we_b <= 1;
106 if (lop == ‘FLASHOP_READ)
107 rdata <= flash_data;
108 state <= 0;
109 end
110 else
111 begin
112 if (!flash_sts)
69