⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rx_async.vhd

📁 Actel Fusion System Management Development Kit UART Example. Contains Libero design using CoreABC. P
💻 VHD
字号:
-- Copyright 2007 Actel Corporation.  All rights reserved.
-- ANY USE OR REDISTRIBUTION IN PART OR IN WHOLE MUST BE HANDLED IN 
-- ACCORDANCE WITH THE ACTEL LICENSE AGREEMENT AND MUST BE APPROVED 
-- IN ADVANCE IN WRITING.  
-- Rev: 3.0  21FEB07  HJ  : v3.0 CoreConsole Release  
library ieEe;
use ieee.std_LOGIC_1164.all;
use iEEe.STd_logic_ARIth.all;
use ieeE.std_LOGic_unSIGNEd.all;
entity RX_Async is
generic (rx_FIFo: INTEger := 0); port (clk: in STD_logiC;
baud_Clock: in std_LOGIC;
REset_n: in std_lOGIC;
bit8: in std_LOGIc;
paRITY_en: in stD_LOgic;
Odd_n_EVEN: in Std_loGIC;
Read_rx_BYTe: in stD_LOgic;
CLEar_paRITY: in STd_logiC;
rx: in std_LOGic;
ovERFLOw: out Std_loGIC;
PARITy_err: out sTD_logic;
CLEAR_pariTY_En: out sTD_Logic;
REceive_FULl: out sTD_Logic;
rX_BYTe: out STD_logic_VECtor(7 downto 0);
fifO_WRite: out std_LOGIc);
end entity rx_aSYNC;

architecture tRanslaTED of rX_Async is

type CUARTi11 is (CUARToOOl,CUARTlOOL,CUARTiool);

signal CUARTOLOL: CUARTi11;

signal CUARTllol: Std_logiC_VECTor(3 downto 0);

signal CUARTilol: std_loGIC;

signal CUARTOIOL: std_LOGIC_vector(8 downto 0);

signal CUARTLIol: STD_logic;

signal CUARTIiol: Std_logiC_VECTor(3 downto 0);

signal CUARTO0OL: std_LOGIC;

signal CUARTL0OL: STD_LOgic_vecTOR(2 downto 0);

signal CUARTi0ol: Std_logiC;

signal CUARTo1ol: STD_logic_vECTOR(1 downto 0);

signal CUARTL1Ol: STD_logic_vECTOR(1 downto 0);

signal CUARTi1oL: STd_logic_VECTOR(3 downto 0);

signal CUARTLO0: std_LOGIC_vector(3 downto 0);

signal CUARTooll: STd_logic_VECTOr(3 downto 0);

signal CUARTloll: STD_Logic_veCTOR(3 downto 0);

signal CUARTIOLL: STD_logic;

signal CUARToLLL: STD_LOGic;

signal CUARTlLLL: std_lOGIC;

signal CUARTilLL: STd_logic;

signal CUARToiLL: STD_logic_VECTOR(7 downto 0);

signal CUARTlill: STD_Logic;

begin
OVERflow <= CUARTIOll;
PARITY_err <= CUARTOLLl;
clear_PARITy_en <= CUARTllll;
receIVE_full <= CUARTIlll;
rx_bytE <= CUARToill;
fifo_wRITE <= CUARTLIll;
CUARTiill:
process (clk,reset_N)
begin
if (RESET_n = '0') then
CUARTL0ol <= "000";
elsif (clK'EVENT and CLK = '1') then
if (bAUD_CLock = '1') then
CUARTl0ol(1 downto 0) <= CUARTl0OL(2 downto 1);
CUARTl0OL(2) <= rX;
end if;
end if;
end process CUARTiilL;
process (CUARTl0ol)
begin
case CUARTl0OL is
when "000" =>
CUARTiLOL <= '0';
when "001" =>
CUARTilol <= '0';
when "010" =>
CUARTiloL <= '0';
when "011" =>
CUARTiloL <= '1';
when "100" =>
CUARTilol <= '0';
when "101" =>
CUARTilol <= '1';
when "110" =>
CUARTILol <= '1';
when others =>
CUARTILOL <= '1';
end case;
end process;
CUARTO0Ll:
process (clK,rESET_N)
begin
if (ReseT_N = '0') then
CUARTLLOL <= "0000";
elsif (CLK'event and clk = '1') then
if (BAUD_clock = '1') then
if (CUARTolol = CUARToool and (CUARTilol = '1' or CUARTlLOL = "1000")) then
CUARTLLol <= "0000";
else
CUARTLLOl <= CUARTllol+"0001";
end if;
end if;
end if;
end process CUARTO0ll;
CUARTL0LL:
process (clk,reseT_N)
begin
if (RESET_n = '0') then
CUARTiolL <= '0';
elsif (CLK'event and CLk = '1') then
if (bauD_Clock = '1') then
if (CUARTi0oL = '1') then
CUARTioll <= '1';
end if;
end if;
if (rEAD_RX_byte = '1') then
CUARTioll <= '0';
end if;
end if;
end process CUARTl0LL;
CUARTLO0 <= "1000" when (BIT8 = '1' and pARITY_en = '0') else
"1001";
CUARTOOLL <= "1000" when (BIT8 = '0' and PARITY_en = '1') else
CUARTLO0;
CUARTLoll <= "0111" when (Bit8 = '0' and paRITY_En = '0') else
CUARTOOLl;
CUARTI1OL <= CUARTloll;
CUARTi0ll:
process (clk,reset_N)
begin
if (resET_N = '0') then
CUARTOLOL <= CUARTOOOL;
CUARToill <= "00000000";
CUARTI0ol <= '0';
elsif (CLK'EVENt and clk = '1') then
if (Baud_clocK = '1') then
CUARTI0OL <= '0';
case CUARTolol is
when CUARTOOOL =>
if (CUARTLLol = "1000") then
CUARTOLOl <= CUARTloOL;
else
CUARToloL <= CUARToooL;
end if;
when CUARTLool =>
if (CUARTIiol = CUARTI1ol) then
CUARTolol <= CUARTiool;
CUARTi0ol <= CUARTO0OL;
if (CUARTo0ol = '0') then
CUARTOill <= (biT8 and CUARTOIOL(7))&CUARToiOL(6 downto 0);
end if;
else
CUARTolOL <= CUARTloOL;
end if;
when CUARTiool =>
if (CUARTllol = "1111") then
CUARTolOL <= CUARToOOL;
else
CUARTOLOl <= CUARTIOOL;
end if;
when others =>
CUARToloL <= CUARTOOOL;
end case;
end if;
end if;
end process CUARTI0Ll;
CUARTo1OL <= bit8&paRITY_en;
CUARTO1LL:
process (Clk,reset_N)
begin
if (RESEt_n = '0') then
CUARToioL(8 downto 0) <= "000000000";
CUARTiiol <= "0000";
elsif (Clk'evenT and cLK = '1') then
if (BAUD_clock = '1') then
if (CUARToloL = CUARToool) then
CUARTOIol(8 downto 0) <= "000000000";
CUARTiIOL <= "0000";
else
if (CUARTllol = "1111") then
CUARTiiol <= CUARTIIOL+"0001";
case CUARTo1OL is
when "00" =>
CUARTOIOL(5 downto 0) <= CUARTOIol(6 downto 1);
CUARToiol(6) <= CUARTIlol;
when "11" =>
CUARToIOL(7 downto 0) <= CUARTOiol(8 downto 1);
CUARTOIOL(8) <= CUARTILOL;
when others =>
CUARTOIOL(6 downto 0) <= CUARToiol(7 downto 1);
CUARToioL(7) <= CUARTILOL;
end case;
end if;
end if;
end if;
end if;
end process CUARTO1Ll;
CUARTL1LL:
process (CLK,RESET_n)
begin
if (Reset_n = '0') then
CUARTliOL <= '0';
elsif (clk'event and CLK = '1') then
if (baUD_clock = '1') then
if (CUARTLLOL = "1111" and pARITY_en = '1') then
CUARTliol <= CUARTliol xor CUARTILol;
end if;
if (CUARTOlol = CUARTIOOL) then
CUARTLIOl <= '0';
end if;
end if;
end if;
end process CUARTL1LL;
CUARTL1Ol <= bit8&ODD_n_eveN;
CUARTI1ll:
process (CLk,resET_n)
begin
if (reSET_n = '0') then
CUARTOLLl <= '0';
elsif (CLk'eVENT and cLK = '1') then
if ((Baud_Clock = '1' and Parity_EN = '1') and CUARTLLol = "1111") then
case CUARTl1ol is
when "00" =>
if (CUARTiIol = "0111") then
CUARTOLll <= CUARTLIOL xor CUARTilol;
end if;
when "01" =>
if (CUARTiiol = "0111") then
CUARTOLLl <= not (CUARTlIol xor CUARTILol);
end if;
when "10" =>
if (CUARTiiOL = "1000") then
CUARTolll <= CUARTLIOL xor CUARTilol;
end if;
when "11" =>
if (CUARTiIOL = "1000") then
CUARTolll <= not (CUARTlioL xor CUARTiLOL);
end if;
when others =>
CUARTolll <= '0';
end case;
end if;
if (clear_paRITY = '1') then
CUARTolll <= '0';
end if;
end if;
end process CUARTI1ll;
CUARTooIL:
process (clk,RESET_n)
begin
if (reset_N = '0') then
CUARTo0OL <= '0';
CUARTLILL <= '1';
CUARTLlll <= '0';
elsif (clk'event and CLk = '1') then
CUARTliLL <= '1';
CUARTlllL <= '0';
if (baud_cLOCK = '1') then
if (bIT8 = '1') then
if (Parity_EN = '1') then
if (CUARTiIOL = "1001" and CUARTolol = CUARTlooL) then
CUARTlill <= '0';
CUARTLLLL <= '1';
if (rX_FIFo = 2#0#) then
CUARTo0ol <= '1';
end if;
end if;
else
if (CUARTiiol = "1000" and CUARTOLOL = CUARTLOOL) then
CUARTlilL <= '0';
CUARTllLL <= '1';
if (RX_fifo = 2#0#) then
CUARTo0ol <= '1';
end if;
end if;
end if;
else
if (PARity_en = '1') then
if (CUARTIIOL = "1000" and CUARToloL = CUARTLool) then
CUARTliLL <= '0';
CUARTLLLl <= '1';
if (rX_FIFo = 2#0#) then
CUARTo0ol <= '1';
end if;
end if;
else
if (CUARTiiol = "0111" and CUARToLOL = CUARTLOOL) then
CUARTlilL <= '0';
CUARTllll <= '1';
if (rX_FIFO = 2#0#) then
CUARTo0ol <= '1';
end if;
end if;
end if;
end if;
end if;
if (read_rx_BYTe = '1') then
CUARTo0ol <= '0';
end if;
end if;
end process CUARTOOIL;
CUARTilll <= CUARTo0oL;
end architecture tranSLATED;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -