-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSerial.v
97 lines (77 loc) · 1.55 KB
/
Serial.v
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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 09:50:27 06/16/2021
// Design Name:
// Module Name: Serial
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module test_Serial();
reg [7:0] data;
reg write = 0;
wire serial_line;
wire [7:0] data_output;
wire no_data;
reg read = 1;
reg clk = 0;
always #5 clk = !clk;
SerialTransmitter s_t(
data,
write,
serial_line,
clk
);
SerialReceiver s_r(
data_output,
no_data,
read,
serial_line,
clk
);
always #10
begin
if(!no_data)
$display("output: %s", data_output);
end
initial begin
#5;
data <= "h";
write <= 1;
#20;
data <= "e";
#20;
data <= "l";
#20;
#20
data <= "o";
#20;
data <= " ";
#20;
write <= 0;
#10010;
write <= 1;
data <= "w";
#20;
data <= "o";
#20;
data <= "r";
#20;
data <= "l";
#20;
data <= "d";
#20;
write <= 0;
end
endmodule