Line 16... |
Line 16... |
DAT_O : out std_logic_vector ((nBitsLarge-1) downto 0); -- Data output (Wishbone)
|
DAT_O : out std_logic_vector ((nBitsLarge-1) downto 0); -- Data output (Wishbone)
|
baud_wait : out std_logic_vector ((nBitsLarge-1) downto 0); -- Signal to control the baud rate frequency
|
baud_wait : out std_logic_vector ((nBitsLarge-1) downto 0); -- Signal to control the baud rate frequency
|
data_byte_tx : out std_logic_vector((nBits-1) downto 0); -- 1 Byte to be send to serial_transmitter
|
data_byte_tx : out std_logic_vector((nBits-1) downto 0); -- 1 Byte to be send to serial_transmitter
|
data_byte_rx : in std_logic_vector((nBits-1) downto 0); -- 1 Byte to be received by serial_receiver
|
data_byte_rx : in std_logic_vector((nBits-1) downto 0); -- 1 Byte to be received by serial_receiver
|
tx_data_sent : in std_logic; -- Signal comming from serial_transmitter
|
tx_data_sent : in std_logic; -- Signal comming from serial_transmitter
|
|
tx_start : out std_logic; -- Signal to start sending serial data...
|
rst_comm_blocks : out std_logic; -- Reset Communication blocks
|
rst_comm_blocks : out std_logic; -- Reset Communication blocks
|
rx_data_ready : in std_logic); -- Signal comming from serial_receiver
|
rx_data_ready : in std_logic); -- Signal comming from serial_receiver
|
end uart_control;
|
end uart_control;
|
|
|
architecture Behavioral of uart_control is
|
architecture Behavioral of uart_control is
|
Line 118... |
Line 119... |
clk_configured := '0';
|
clk_configured := '0';
|
div_result_baud_wait := (others => '0');
|
div_result_baud_wait := (others => '0');
|
done <= '0';
|
done <= '0';
|
sigDivRst <= '1';
|
sigDivRst <= '1';
|
rst_comm_blocks <= '1';
|
rst_comm_blocks <= '1';
|
|
tx_start <= '0';
|
elsif rising_edge(clk) then
|
elsif rising_edge(clk) then
|
case controlStates is
|
case controlStates is
|
when idle =>
|
when idle =>
|
done <= '0';
|
done <= '0';
|
-- Go to config state
|
-- Go to config state
|
Line 177... |
Line 179... |
done <= '1';
|
done <= '1';
|
|
|
-- Control the serial_receiver or serial_transmitter block
|
-- Control the serial_receiver or serial_transmitter block
|
when rx_tx_state =>
|
when rx_tx_state =>
|
rst_comm_blocks <= '0';
|
rst_comm_blocks <= '0';
|
|
tx_start <= '0';
|
controlStates <= rx_tx_state;
|
controlStates <= rx_tx_state;
|
if (WE = '1') and (start = '1') then
|
if (WE = '1') and (start = '1') then
|
if reg_addr = "10" then
|
if reg_addr = "10" then
|
controlStates <= tx_state_wait;
|
controlStates <= tx_state_wait;
|
done <= '0';
|
done <= '0';
|
Line 195... |
Line 198... |
end if;
|
end if;
|
|
|
|
|
-- Send data and wait to transmit
|
-- Send data and wait to transmit
|
when tx_state_wait =>
|
when tx_state_wait =>
|
|
tx_start <= '1';
|
data_byte_tx <= byte_to_transmitt;
|
data_byte_tx <= byte_to_transmitt;
|
if tx_data_sent = '0' then
|
if tx_data_sent = '0' then
|
controlStates <= tx_state_wait;
|
controlStates <= tx_state_wait;
|
else
|
else
|
controlStates <= rx_tx_state;
|
controlStates <= rx_tx_state;
|