2 bit serial to parallel conversion VHDL source code

This page of VHDL source code covers 2 bit serial to parallel conversion vhdl code and provides link to 2 bit parallel to serial conversion.

VHDL Code

-- library declaration
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- entity declaration
entity SIPO_2_n is
port(
CLK : in STD_LOGIC; -- global clk
D_IN : in STD_LOGIC; -- serial data in
EN : in STD_LOGIC; -- enable
RESET : in STD_LOGIC; -- asynchronous reset
D_OUT : out STD_LOGIC_VECTOR(1 downto 0); -- parallel data out
valid_out : out std_logic -- valid out
);
end SIPO_2_n;
-- architecture declaration
architecture SIPO4_2_ARCH of SIPO_2_n is
signal dout_i : std_logic;
signal tog : std_logic;
begin
-- process to conevert serial to parallel data

process (clk, reset)
begin
if reset = '1' then
valid_out <= '0';
tog <= '0';
dout_i <= '0';
D_out <= "00";
elsif rising_edge(clk)then
if en = '1' then
tog <= not tog;
else
tog <= '0';
end if;
dout_i <= D_IN;
if tog = '1' then
D_OUT <= dout_i& D_in;
valid_out <= '1';
elsif tog = '0' then
valid_out <= '0';
end if;
end if;
end process;

end SIPO4_2_ARCH;

USEFUL LINKS to VHDL CODES

Refer following as well as links mentioned on left side panel for useful VHDL codes.
D Flipflop
T Flipflop
Read Write RAM
4X1 MUX
4 bit binary counter
Radix4 Butterfly
16QAM Modulation
2bit Parallel to serial

RF and Wireless tutorials

WLAN  802.11ac  802.11ad  wimax  Zigbee  z-wave  GSM  LTE  UMTS  Bluetooth  UWB  IoT  satellite  Antenna  RADAR