Hardware Reference
In-Depth Information
122
when deselect =>
123
SSn <= spi_clk;
124
SCK <= '0';
125
nx_state <= WRITEx;
126
when WRITEx =>
127
MOSI <= WRITE_opcode(7-i);
128
imax <= 7;
129
if i=imax then
130
nx_state <= initial_addr_wr;
131
else
132
nx_state <= WRITEx;
133
end if;
134
when initial_addr_wr =>
135
MOSI <= initial_addr_for_wr(15-i);
136
imax <= 15;
137
if i=imax then
138
nx_state <= wr_data;
139
else
140
nx_state <= initial_addr_wr;
141
end if;
142
when wr_data =>
143
MOSI <= data_out(j)(7-i);
144
imax <= 7;
145
jmax <= 7;
146
if i=imax and j=jmax then
147
nx_state <= wait_wr0;
148
else
149
nx_state <= wr_data;
150
end if;
151
when wait_wr0 =>
152
SSn <= '0';
153
SCK <= '0';
154
if wr='0' then
155
nx_state <= idle;
156
else
157
nx_state <= wait_wr0;
158
end if;
159
--Data-read sequence:
160
when READx =>
161
MOSI <= READ_opcode(7-i);
162
imax <= 7;
163
if i=imax then
164
nx_state <= initial_addr_rd;
165
else
166
nx_state <= READx;
167
end if;
168
when initial_addr_rd =>
169
MOSI <= initial_addr_for_rd(15-i);
170
imax <= 15;
171
if i=imax then
172
nx_state <= rd_data;
173
else
174
nx_state <= initial_addr_rd;
175
end if;
176
when rd_data =>
177
imax <= 7;
178
jmax <= 7;
Search WWH ::




Custom Search