aboutsummaryrefslogtreecommitdiff
path: root/src/uart_rx_shift.vhd
blob: 30a84037d218f2c8bdfc00142b8d828a77040bc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
library ieee;
use ieee.std_logic_1164.all;

entity uart_rx_shift is
  port (
    clk     : in std_ulogic;
    rst_n   : in std_ulogic;
    shift_i : in std_ulogic;
    ser_i   : in std_ulogic;
    d_o     : out std_ulogic_vector(7 downto 0));
end entity;

architecture rtl of uart_rx_shift is
  signal sr, nsr : std_ulogic_vector(7 downto 0);
begin
  sr <= "00000000" when rst_n = '0' else nsr when rising_edge(clk);
  nsr <= ser_i & sr(7 downto 1) when shift_i = '1' else sr;
  d_o <= sr;
end architecture rtl;