-
Notifications
You must be signed in to change notification settings - Fork 3
/
testdecoder.vhd
173 lines (159 loc) · 4.46 KB
/
testdecoder.vhd
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 10/30/2018 11:48:47 PM
-- Design Name:
-- Module Name: testdecoder - rtl
-- Project Name:
-- Target Devices:
-- Tool Versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity testdecoder is
Port (
RsTx : out STD_LOGIC;
btnC: in std_logic;
clr : in STD_LOGIC;
clk_100m : in STD_LOGIC);
end testdecoder;
architecture rtl of testdecoder is
component clk_wiz_0
PORT ( clk_6144: out std_logic;
reset : in std_logic;
locked : out std_logic;
clk_100m: in std_logic);
end component;
component clk_div
Port ( clk_in : in STD_LOGIC;
clr : in STD_LOGIC;
clk_div128 : out STD_LOGIC);
end component;
component simpuart
Port ( din : in STD_LOGIC_VECTOR (7 downto 0);
wen : in STD_LOGIC;
sout : out STD_LOGIC;
clr : in STD_LOGIC;
clk_48k : in STD_LOGIC);
end component;
component symdet
Port ( d_bin : in STD_LOGIC;
dot : out STD_LOGIC;
dash : out STD_LOGIC;
lg : out STD_LOGIC;
wg : out STD_LOGIC;
valid : out STD_LOGIC;
clr : in STD_LOGIC;
clk : in STD_LOGIC);
end component;
component mcgen is
Port (clk : in std_logic;
button : in std_logic;
data_rom: out std_logic);
end component;
component mcdecoder is
port(clk : in std_logic;
valid : in std_logic;
clr : in std_logic;
dash : in std_logic;
dot : in std_logic;
lg :in std_logic;
wg : in std_logic;
dvalid : out std_logic;
error : out std_logic;
dout : out std_logic_vector(7 downto 0));
end component;
component uart_wren
Port (
clr : in std_logic;
clk : in STD_LOGIC;
wr_valid : in STD_LOGIC;
dout : out STD_LOGIC;
data_in : in std_logic_vector(7 downto 0);
data_out : out std_logic_vector(7 downto 0));
end component;
signal clk_6144: std_logic;
signal clk_48k: std_logic;
signal clk_locked: std_logic;
signal uart_wr: std_logic;
signal sout_i:std_logic_vector(0 downto 0);
--Decorder signal
signal dot : std_logic;
signal dash : std_logic;
signal lg : std_logic;
signal wg : std_logic;
signal valid : std_logic;
signal d_bin : std_logic;
signal dvalid: std_logic;
signal error: std_logic;
signal decoder_out : std_logic_vector(7 downto 0);
--FIFO signal
signal uartFIFO_out : std_logic_vector(7 downto 0);
signal empty : std_logic;
signal empty_out : std_logic;
signal read_out : STD_logic;
begin -- architecture rtl
clk_wiz_0_inst: clk_wiz_0 PORT MAP (
clk_6144=>clk_6144,
reset=>clr,
locked=>clk_locked,
clk_100m=>clk_100m);
clk_div_inst: clk_div PORT MAP (
clk_in=>clk_6144,
clr=>clr,
clk_div128=>clk_48k);
RsTx <= sout_i(0);
simpuart_inst: simpuart PORT MAP (
din=>uartFIFO_out,
wen=>uart_wr,
sout=>sout_i(0),
clr=>clr,
clk_48k=>clk_48k);
uart_wren_inst: uart_wren PORT MAP (
clr => clr,
clk => clk_48k,
wr_valid => dvalid,
dout => uart_wr,
data_in => decoder_out,
data_out => uartFIFO_out);
symdet_inst: symdet PORT MAP (
d_bin=>d_bin,
dot=>dot,
dash=>dash,
lg=>lg,
wg=>wg,
valid=>valid,
clr=>clr,
clk=>clk_48k);
mcgen_inst: mcgen PORT MAP (
clk => clk_48k,
button => btnC,
data_rom=> d_bin);
mcdecoder_inst: mcdecoder PORT MAP (
clk => clk_48k,
valid => valid,
clr =>clr,
dash=>dash,
dot=>dot,
lg=>lg,
wg=>wg,
dvalid=>dvalid,
error=> error,
dout => decoder_out);
end rtl;