forked from schoeberl/chisel-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuart_top.vhdl
61 lines (48 loc) · 1.24 KB
/
uart_top.vhdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--
-- Tops level for the UART
--
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity uart_top is
port (
clock : in std_logic;
-- reset : in std_logic;
-- led : out std_logic;
rxd : in std_logic;
txd : out std_logic
);
end uart_top;
architecture rtl of uart_top is
component UartMain is
port (clock : std_logic;
reset : in std_logic;
io_rxd : in std_logic;
io_txd : out std_logic);
end component;
signal reset : std_logic;
signal int_res : std_logic;
signal res_reg1, res_reg2 : std_logic;
signal res_cnt : unsigned(2 downto 0) := "000"; -- for the simulation
attribute altera_attribute : string;
attribute altera_attribute of res_cnt : signal is "POWER_UP_LEVEL=LOW";
begin
--
-- internal reset generation
--
process(clock)
begin
if rising_edge(clock) then
if (res_cnt /= "111") then
res_cnt <= res_cnt + 1;
end if;
res_reg1 <= not res_cnt(0) or not res_cnt(1) or not res_cnt(2);
res_reg2 <= res_reg1;
int_res <= res_reg2;
end if;
end process;
reset <= int_res;
u: UartMain port map(clock, reset, rxd, txd);
-- led <= not rxd;
-- txd <= rxd;
end rtl;