aboutsummaryrefslogtreecommitdiffstats
path: root/icestick/uart/hdl/uart_rx.vhd
diff options
context:
space:
mode:
authoreine <6628437+eine@users.noreply.github.com>2020-01-19 03:25:43 +0000
committertgingold <tgingold@users.noreply.github.com>2020-01-19 04:25:43 +0100
commit910073d647e55d133494429d8c3a4bacffc32428 (patch)
tree6b1e616a1f670d44b03c1239ab5cba8aff15b909 /icestick/uart/hdl/uart_rx.vhd
parent175123cda990ee2b5cfac461bd8ec44956da302a (diff)
downloadghdl-yosys-plugin-910073d647e55d133494429d8c3a4bacffc32428.tar.gz
ghdl-yosys-plugin-910073d647e55d133494429d8c3a4bacffc32428.tar.bz2
ghdl-yosys-plugin-910073d647e55d133494429d8c3a4bacffc32428.zip
migrate from Travis to GHA and rework examples (#78)
* migrate from Travis to GHA * rework examples
Diffstat (limited to 'icestick/uart/hdl/uart_rx.vhd')
-rwxr-xr-xicestick/uart/hdl/uart_rx.vhd66
1 files changed, 0 insertions, 66 deletions
diff --git a/icestick/uart/hdl/uart_rx.vhd b/icestick/uart/hdl/uart_rx.vhd
deleted file mode 100755
index 5f488cc..0000000
--- a/icestick/uart/hdl/uart_rx.vhd
+++ /dev/null
@@ -1,66 +0,0 @@
-library ieee;
- use ieee.std_logic_1164.all;
-
-entity uart_rx is
- generic (
- C_BITS : integer := 8;
- C_CYCLES_PER_BIT : integer := 104
- );
- port (
- isl_clk : in std_logic;
- isl_data_n : in std_logic;
- oslv_data : out std_logic_vector(C_BITS-1 downto 0);
- osl_valid : out std_logic
- );
-end entity uart_rx;
-
-architecture rtl of uart_rx is
- signal int_cycle_cnt : integer range 0 to C_CYCLES_PER_BIT-1 := 0;
- signal int_bit_cnt : integer range 0 to C_BITS+1 := 0;
-
- signal slv_data : std_logic_vector(C_BITS-1 downto 0) := (others => '0');
- signal sl_valid : std_logic := '0';
-
- type t_state is (IDLE, INIT, RECEIVE);
- signal state : t_state;
-
-begin
- process(isl_clk)
- begin
- if rising_edge(isl_clk) then
- case state is
- when IDLE =>
- sl_valid <= '0';
- if isl_data_n = '0' then
- -- wait for the start bit
- state <= INIT;
- end if;
-
- when INIT =>
- int_cycle_cnt <= C_CYCLES_PER_BIT / 2;
- int_bit_cnt <= 0;
- state <= RECEIVE;
-
- when RECEIVE =>
- if int_bit_cnt < C_BITS+1 then
- if int_cycle_cnt < C_CYCLES_PER_BIT-1 then
- int_cycle_cnt <= int_cycle_cnt+1;
- else
- -- receive data bits
- int_cycle_cnt <= 0;
- int_bit_cnt <= int_bit_cnt+1;
- slv_data <= not isl_data_n & slv_data(slv_data'LEFT downto 1); -- low active
- end if;
- elsif isl_data_n = '1' then
- -- wait for the stop bit
- sl_valid <= '1';
- state <= IDLE;
- end if;
-
- end case;
- end if;
- end process;
-
- oslv_data <= slv_data;
- osl_valid <= sl_valid;
-end architecture rtl;