aboutsummaryrefslogtreecommitdiffstats
path: root/doc/using/UART_srcs/capitalisation/top_capitalisation.vhd
blob: 01c8e35855966cbb982420fe27dbc0a8945dbb75 (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
-- top_capitalisation.vhd
----------------------------------------------------------------------

-- top_capitalisation
-- |
-- + capitalisation
-- + UART_8N1_RX
-- + UART_8N1_TX

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity top_capitalisation is
  generic (clk_freq : integer;
           baudrate : integer);
  port(
    board_clk     : in std_logic ;
    reset         : in std_logic ;
    rx            : in std_logic ;
    tx            : out std_logic );
end top_capitalisation;

architecture behavior of top_capitalisation is
  signal rd_en   : std_logic;
  signal rdata   : std_logic_vector (7 downto 0);
  signal rd      : std_logic; 

  signal wr_en   : std_logic;
  signal wdata   : std_logic_vector (7 downto 0);
  signal wr      : std_logic;

component capitalisation is
  port(
    clk        : in  std_logic;
    reset      : in  std_logic;
    --in
    rdata      : in  std_logic_vector(7 downto 0);
    rd_en      : in  std_logic;
    rd         : out std_logic;
    --out
    wdata      : out std_logic_vector(7 downto 0);
    wr_en      : in  std_logic;
    wr         : out std_logic
    );
end component;

component UART_8N1_RX is
  generic (clk_freq : integer;
           baudrate : integer);
  port(
    clk           : in  std_logic;
    reset         : in  std_logic;
    --8bit interface
    rdata         : out std_logic_vector(7 downto 0);
    rd            : in  std_logic;
    rd_en         : out std_logic;
    --physical wire RX
    rx            : in  std_logic
    );
end component; 

component UART_8N1_TX is
  generic(
    clk_freq   : integer;
    baudrate   : integer;
    addr_depth : integer:=5); 
  port(
    clk        : in std_logic;
    reset      : in std_logic;
    --8bit  interface
    wdata      : in  std_logic_vector(7 downto 0);
    wr         : in  std_logic;
    wr_en      : out std_logic;
    
    --physical wire
    tx         : out std_logic);
end component;


begin

UART_RX:UART_8N1_RX 
  generic map (
    clk_freq   => clk_freq,
    baudrate   =>115200)
  port map(
    clk           => board_clk,
    reset         => reset,
    rdata         => rdata,
    rd            => rd,
    rd_en         => rd_en,
    --physical wire RX
    rx            => rx
    );

trans: capitalisation 
  port map(
    clk        => board_clk,
    reset      => reset,
    --in
    rdata      => rdata,
    rd_en      => rd_en,
    rd         => rd,
    --out
    wdata      => wdata,
    wr_en      => wr_en,
    wr         => wr
    );

UART_TX: UART_8N1_TX 
  generic map(
    clk_freq   => clk_freq,
    baudrate   => 115200) 
  port map(
    clk        => board_clk,
    reset      => reset,
    --8bit  interface
    wdata      => wdata,
    wr         => wr,
    wr_en      => wr_en,
    
    --physical wire TX
    tx         => tx
    );
end;