Hi all,
I have posted a portion of a code. Which is a state machine. I want to know how the below code executes. In the code, when this statement is ture
Code VHDL - [expand] |
1
| if scl_falling_strobe = '1' and bit_counter = 8 then |
the code executes SEND_ACK1 state or it goes on executing sequentially (next line)??
Code VHDL - [expand] |
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
| when WRITE_CMD =>
--On each rising edge, read the data bit on the SDA line and store it
--in rx_data_buf
if scl_rising_strobe = '1' then
if bit_counter <= 7 then
rx_data_buf(7-bit_counter) <= sda_d;
bit_counter <= bit_counter + 1;
end if;
if bit_counter = 7 then
rx_data_rdy_reg <= '1';
end if;
end if;
--When the byte is done, send an ACK
if scl_falling_strobe = '1' and bit_counter = 8 then
state <= SEND_ACK_1;
bit_counter <= 0;
if data_flag = 0 then
temp <= rx_data_buf;
conversion <= unsigned(temp);
data_read <= to_integer(conversion);
data_flag <= data_flag + 1;
elsif data_flag = 1 then
r_memory(data_read) <= rx_data_buf;
data_flag <= data_flag + 1;
elsif data_flag = 2 then
data_flag <= 0;
end if; |