OpenCores
URL https://opencores.org/ocsvn/uart_fifo_cpu_if_sv_testbench/uart_fifo_cpu_if_sv_testbench/trunk

Subversion Repositories uart_fifo_cpu_if_sv_testbench

[/] [uart_fifo_cpu_if_sv_testbench/] [trunk/] [rtl/] [uart.vhd] - Diff between revs 2 and 3

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 3
Line 7... Line 7...
----                                                              ----
----                                                              ----
----  Description                                                 ----
----  Description                                                 ----
--             Serial UART with byte wide register interface for control/status, data, and baud rate.
--             Serial UART with byte wide register interface for control/status, data, and baud rate.
--             Transmit(Tx) and Receive(Rx) data is FIFO buffered. Tx and Rx FIFO size configurable independently.
--             Transmit(Tx) and Receive(Rx) data is FIFO buffered. Tx and Rx FIFO size configurable independently.
--             Currently only supports no parity, 8 data bits, 1 stop bit (N81).
--             Currently only supports no parity, 8 data bits, 1 stop bit (N81).
--             Data is sent most significant bit first.
--             Data is sent least significant bit first.
--             Baud rate divisor set via 16 bit register, allowing a wide range of baud rates and system clocks.
--             Baud rate divisor set via 16 bit register, allowing a wide range of baud rates and system clocks.
--
--
--             Future:
--             Future:
--              - insertion and checking of parity bit
--              - insertion and checking of parity bit
--              - data bit order configurable
--              - data bit order configurable
Line 257... Line 257...
          --output 1 start bit
          --output 1 start bit
          when START =>
          when START =>
            if tx_bit_enable then
            if tx_bit_enable then
              txd           := '0';
              txd           := '0';
              tx_state      := DATA;
              tx_state      := DATA;
              tx_data_count := 7;
              tx_data_count := 0;
            end if;
            end if;
          --output 8 data bits
          --output 8 data bits, least significant bit first.
          when DATA =>
          when DATA =>
            if tx_bit_enable then
            if tx_bit_enable then
              txd := tx_fifo_read_data(tx_data_count);
              txd := tx_fifo_read_data(tx_data_count);
              if tx_data_count = 0 then
              if tx_data_count = 7 then
                tx_state := STOP;
                tx_state := STOP;
              else
              else
                tx_data_count := tx_data_count - 1;
                tx_data_count := tx_data_count + 1;
              end if;
              end if;
            end if;
            end if;
          --output 1 stop bit
          --output 1 stop bit
          when STOP =>
          when STOP =>
            if tx_bit_enable then
            if tx_bit_enable then
Line 304... Line 304...
            if rxd /= '0' then
            if rxd /= '0' then
              --start bit has not stayed low for longer than 1/2 a bit period.
              --start bit has not stayed low for longer than 1/2 a bit period.
              rx_state := IDLE;
              rx_state := IDLE;
            elsif rx_bit_enable then
            elsif rx_bit_enable then
              rx_state      := DATA;
              rx_state      := DATA;
              rx_data_count := 7;
              rx_data_count := 0;
            end if;
            end if;
          --read in 8 data bits.
          --read in 8 data bits.
          when DATA =>
          when DATA =>
            if rx_bit_enable then
            if rx_bit_enable then
              rx_fifo_write_data(rx_data_count) <= rxd;
              rx_fifo_write_data(rx_data_count) <= rxd;
              if rx_data_count = 0 then
              if rx_data_count = 7 then
                rx_state := STOP;
                rx_state := STOP;
              else
              else
                rx_data_count := rx_data_count - 1;
                rx_data_count := rx_data_count + 1;
              end if;
              end if;
            end if;
            end if;
          --check stop bit is '1'. If not, set the rx error flag.
          --check stop bit is '1'. If not, set the rx error flag.
          when STOP =>
          when STOP =>
            if rx_bit_enable then
            if rx_bit_enable then

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.