001.
library
IEEE
;
002.
use
IEEE.STD_LOGIC_1164.
all
;
003.
use
IEEE.Numeric_Std.
all
;
004.
use
work.UART_Components.
all
;
005.
use
work.UART.
all
;
006.
007.
entity
Test_Harness
is
008.
end
Test_Harness
;
009.
010.
architecture
Test_Harness_A1
of
Test_Harness
is
011.
constant
Size
:
integer
:
=
8
;
012.
signal
Reset
:
std_logic
:
=
'
1
'
;
013.
signal
Clock
:
std_logic
:
=
'
0
'
;
014.
signal
LocalCount
:
unsigned
(
10
downto
0
)
;
015.
016.
signal
Tx_A0
:
std_logic
;
017.
signal
Tx_WEn
:
std_logic
;
018.
signal
Tx_Data
:
std_logic_vector
(
8
downto
0
)
;
019.
signal
Tx_Busy
:
std_logic
;
020.
021.
signal
Serial
:
std_logic
;
022.
023.
signal
Rx_A0
:
std_logic
;
024.
signal
Rx_REn
:
std_logic
;
025.
signal
Rx_Data
:
std_logic_vector
(
8
downto
0
)
;
026.
signal
Rx_BAv
:
std_logic
;
027.
signal
Rx_DAv
:
std_logic
;
028.
029.
begin
030.
031.
Tx
:
UART_Tx
032.
port
map
(
033.
Reset
=
>
Reset
,
034.
SampCk
=
>
Clock
,
035.
A0
=
>
Tx_A0
,
036.
WEn
=
>
Tx_WEn
,
037.
Data
=
>
Tx_Data
,
038.
SOut
=
>
Serial
,
039.
Busy
=
>
Tx_Busy
040.
)
;
041.
042.
Rx
:
UART_Rx
043.
port
map
(
044.
Reset
=
>
Reset
,
045.
SampCk
=
>
Clock
,
046.
SIn
=
>
Serial
,
047.
A0
=
>
Rx_A0
,
048.
REn
=
>
Rx_REn
,
049.
Data
=
>
Rx_Data
,
050.
BAv
=
>
Rx_BAv
,
051.
DAv
=
>
Rx_DAv
052.
)
;
053.
054.
055.
process
056.
begin
057.
058.
Reset
<
=
'
1
'
;
059.
wait
for
15 ps
;
060.
061.
Reset
<
=
'
0
'
;
062.
wait
for
10 ps
;
063.
064.
Reset
<
=
'
1
'
;
065.
wait
for
100 ps
;
066.
067.
Reset
<
=
'
0
'
;
068.
wait
for
10 ps
;
069.
070.
Reset
<
=
'
1
'
;
071.
wait
until
Reset
=
'
0
'
;
072.
073.
end
process
;
074.
075.
076.
process
077.
begin
078.
079.
Clock
<
=
'
0
'
;
080.
081.
for
i
in
0
to
300
loop
082.
083.
Clock
<
=
'
1
'
;
084.
wait
for
20 ps
;
085.
086.
Clock
<
=
'
0
'
;
087.
wait
for
20 ps
;
088.
089.
end
loop
;
090.
091.
end
process
;
092.
093.
094.
095.
process
(
Reset
,
Clock
)
096.
begin
097.
098.
if
(
Reset
=
'
0
'
)
then
099.
100.
LocalCount
<
=
(
others
=
>
'
0
'
)
;
101.
102.
elsif
(
rising_edge
(
Clock
)
)
then
103.
104.
LocalCount
<
=
LocalCount
+
1
;
105.
106.
end
if
;
107.
108.
109.
end
process
;
110.
111.
112.
process
(
Reset
,
LocalCount
)
113.
begin
114.
115.
if
(
Reset
=
'
0
'
)
then
116.
117.
Tx_A0
<
=
'
0
'
;
118.
Tx_WEn
<
=
'
0
'
;
119.
Tx_Data
<
=
(
others
=
>
'
0
'
)
;
120.
121.
else
122.
123.
if
(
LocalCount
=
1
)
then
124.
125.
Tx_A0
<
=
'
1
'
;
126.
Tx_WEn
<
=
'
1
'
;
127.
Tx_Data
(
8
)
<
=
'
0
'
;
128.
Tx_Data
(
7
downto
0
)
<
=
x
"0F"
;
129.
130.
elsif
(
LocalCount
=
2
)
then
131.
132.
Tx_A0
<
=
'
0
'
;
133.
Tx_WEn
<
=
'
1
'
;
134.
Tx_Data
(
8
)
<
=
'
0
'
;
135.
Tx_Data
(
7
downto
0
)
<
=
x
"71"
;
136.
137.
elsif
(
LocalCount
=
3
)
then
138.
139.
Tx_A0
<
=
'
0
'
;
140.
Tx_WEn
<
=
'
0
'
;
141.
Tx_Data
<
=
(
others
=
>
'
0
'
)
;
142.
143.
elsif
(
LocalCount
=
164
)
then
144.
145.
Tx_A0
<
=
'
0
'
;
146.
Tx_WEn
<
=
'
1
'
;
147.
Tx_Data
(
8
)
<
=
'
0
'
;
148.
Tx_Data
(
7
downto
0
)
<
=
x
"55"
;
149.
150.
elsif
(
LocalCount
=
165
)
then
151.
152.
Tx_A0
<
=
'
0
'
;
153.
Tx_WEn
<
=
'
0
'
;
154.
Tx_Data
<
=
(
others
=
>
'
0
'
)
;
155.
156.
end
if
;
157.
158.
end
if
;
159.
160.
end
process
;
161.
162.
163.
process
(
Reset
,
LocalCount
)
164.
begin
165.
166.
if
(
Reset
=
'
0
'
)
then
167.
168.
Rx_A0
<
=
'
0
'
;
169.
Rx_REn
<
=
'
0
'
;
170.
171.
else
172.
173.
if
(
LocalCount
=
160
)
then
174.
175.
Rx_A0
<
=
'
1
'
;
176.
Rx_REn
<
=
'
1
'
;
177.
178.
elsif
(
LocalCount
=
161
)
then
179.
180.
Rx_A0
<
=
'
0
'
;
181.
Rx_REn
<
=
'
1
'
;
182.
183.
elsif
(
LocalCount
=
162
)
then
184.
185.
Rx_A0
<
=
'
0
'
;
186.
Rx_REn
<
=
'
0
'
;
187.
188.
elsif
(
LocalCount
=
322
)
then
189.
190.
Rx_A0
<
=
'
0
'
;
191.
Rx_REn
<
=
'
1
'
;
192.
193.
elsif
(
LocalCount
=
323
)
then
194.
195.
Rx_A0
<
=
'
0
'
;
196.
Rx_REn
<
=
'
0
'
;
197.
198.
end
if
;
199.
200.
end
if
;
201.
202.
end
process
;
203.
204.
205.
end
Test_Harness_A1
;