Line 16... |
Line 16... |
-- DISCLAIMED. IN NO EVENT SHALL JEREMY SETH HENRY BE LIABLE FOR ANY
|
-- DISCLAIMED. IN NO EVENT SHALL JEREMY SETH HENRY BE LIABLE FOR ANY
|
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
--
|
--
|
-- VHDL Units : o8_async_serial
|
-- VHDL Units : o8_async_serial
|
-- Description: Provides a single 8-bit, asynchronous transceiver. While the
|
-- Description: Provides a single 8-bit, asynchronous transceiver. While the
|
-- width is fixed at 8-bits, the bit rate and parity controls
|
-- width is fixed at 8-bits, the bit rate and parity controls
|
-- are settable via generics.
|
-- are settable via generics.
|
--
|
--
|
|
-- Register Map:
|
|
-- Offset Bitfield Description Read/Write
|
|
-- 0x00 AAAAAAAA TX Data (WR) RX Data (RD) (RW)
|
|
-- 0x01 DCBA---- FIFO Status (RO)
|
|
-- A: RX FIFO Empty
|
|
-- B: RX FIFO almost full (922/1024)
|
|
-- C: TX FIFO Empty
|
|
-- D: TX FIFO almost full (922/1024)
|
|
--
|
-- Note: The baud rate generator will produce an approximate frequency. The
|
-- Note: The baud rate generator will produce an approximate frequency. The
|
-- final bit rate should be within +/- 1% of the true bit rate to
|
-- final bit rate should be within +/- 1% of the true bit rate to
|
-- ensure the receiver can successfully receive. With a sufficiently
|
-- ensure the receiver can successfully receive. With a sufficiently
|
-- high core clock, this is generally achievable for common PC serial
|
-- high core clock, this is generally achievable for common PC serial
|
-- data rates.
|
-- data rates.
|
|
--
|
|
-- Revision History
|
|
-- Author Date Change
|
|
------------------ -------- ---------------------------------------------------
|
|
-- Seth Henry 12/20/19 Design Start
|
|
-- Seth Henry 04/10/20 Code cleanup and register documentation
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
Line 41... |
Line 56... |
library work;
|
library work;
|
use work.open8_pkg.all;
|
use work.open8_pkg.all;
|
|
|
entity o8_async_serial is
|
entity o8_async_serial is
|
generic(
|
generic(
|
|
Disable_Transmit : boolean := FALSE;
|
|
Disable_Receive : boolean := FALSE;
|
Bit_Rate : real;
|
Bit_Rate : real;
|
Enable_Parity : boolean;
|
Enable_Parity : boolean;
|
Parity_Odd_Even_n : std_logic;
|
Parity_Odd_Even_n : std_logic;
|
Sys_Freq : real;
|
Sys_Freq : real;
|
Reset_Level : std_logic;
|
Reset_Level : std_logic;
|
Line 132... |
Line 149... |
end if;
|
end if;
|
RTS_Out <= not RX_FIFO_AFull;
|
RTS_Out <= not RX_FIFO_AFull;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
|
TX_Disabled : if( Disable_Transmit )generate
|
|
|
|
TX_FIFO_Empty <= '1';
|
|
TX_FIFO_AFull <= '0';
|
|
TX_Out <= '1';
|
|
|
|
end generate;
|
|
|
|
TX_Enabled : if( not Disable_Transmit )generate
|
|
|
TX_FIFO_Wr_En <= Wr_Enable and Addr_Match and not Reg_Addr;
|
TX_FIFO_Wr_En <= Wr_Enable and Addr_Match and not Reg_Addr;
|
|
|
FIFO_Reset <= '1' when Reset = Reset_Level else '0';
|
FIFO_Reset <= '1' when Reset = Reset_Level else '0';
|
|
|
U_TX_FIFO : entity work.fifo_1k_core
|
U_TX_FIFO : entity work.fifo_1k_core
|
Line 205... |
Line 232... |
--
|
--
|
Tx_Out => TX_Out,
|
Tx_Out => TX_Out,
|
Tx_Done => Tx_Done
|
Tx_Done => Tx_Done
|
);
|
);
|
|
|
|
end generate;
|
|
|
|
RX_Disabled : if( Disable_Transmit )generate
|
|
|
|
RX_FIFO_Empty <= '1';
|
|
RX_FIFO_AFull <= '0';
|
|
RX_FIFO_Rd_Data <= x"00";
|
|
|
|
end generate;
|
|
|
|
RX_Enabled : if( not Disable_Receive )generate
|
|
|
U_RX : entity work.async_ser_rx
|
U_RX : entity work.async_ser_rx
|
generic map(
|
generic map(
|
Reset_Level => Reset_Level,
|
Reset_Level => Reset_Level,
|
Enable_Parity => Enable_Parity,
|
Enable_Parity => Enable_Parity,
|
Parity_Odd_Even_n => Parity_Odd_Even_n,
|
Parity_Odd_Even_n => Parity_Odd_Even_n,
|
Line 237... |
Line 276... |
empty => RX_FIFO_Empty,
|
empty => RX_FIFO_Empty,
|
almost_full => RX_FIFO_AFull,
|
almost_full => RX_FIFO_AFull,
|
q => RX_FIFO_Rd_Data
|
q => RX_FIFO_Rd_Data
|
);
|
);
|
|
|
|
end generate;
|
|
|
end architecture;
|
end architecture;
|
No newline at end of file
|
No newline at end of file
|