C1: RX PORT MAP (CLOCK_50,UART_RXD,RX_DATA,RX_BUSY,DATA_RCVD);
R1: reg PORT MAP (Input1,CLOCK_50,L_D1,Output1);
R2: reg PORT MAP (Input2,CLOCK_50,L_D2,Output2);
FORFlag:DFF PORT MAP (Inp,resett,CLOCK_50,Outp);
process(DATA_RCVD)
begin
if DATA_RCVD = '1' then
Inp <= '1';
else
Inp <= '0';
end if;
end process;
Process(CLOCK_50,Reset)
begin
if Reset = '1' then
NState <= 0;
elsif rising_edge(CLOCK_50) then
case PState is
when 0 => --idle
if Outp = '1' then
NState <= 1;
end if;
when 1 => --communication state
D <= RX_DATA;
if flag = 0 then
Input1 <= D;
L_D1 <= '1';
flag <= 1;
elsif flag = 1 then
Input2 <= D;
L_D2 <= '1';
end if;
resett <= '1';
NState <= 0;
end case;
PState <= NState;
end if;
LED <= Output1 or Output2;
end process;