-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmorse_top.v
109 lines (80 loc) · 1.62 KB
/
morse_top.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
98
99
100
101
102
103
104
105
106
107
108
109
`timescale 1ns / 1ps
`define dit 2'b00
`define dah 2'b11
`define etc 2'b01
module morse_top;
reg clk;
reg [0:1] ditDah;
wire [0:1] t;
wire [0:1] p;
wire [0:5] letter;
// clock: 10 ns period
initial
begin
clk = 1'b0;
forever
begin
#5 clk = ~clk;
end
end
// // limit simulation time
// initial
// begin
// #200 $finish;
// end
// dit dah
initial
begin
#10 ditDah = `etc;
#10 ditDah = `dit; // h
#10 ditDah = `dit;
#10 ditDah = `dit;
#10 ditDah = `dit;
#10 ditDah = `etc;
#10 ditDah = `dit; // e
#10 ditDah = `etc;
#10 ditDah = `dit; // l
#10 ditDah = `dah;
#10 ditDah = `dit;
#10 ditDah = `dit;
#10 ditDah = `etc;
#10 ditDah = `dit; // l
#10 ditDah = `dah;
#10 ditDah = `dit;
#10 ditDah = `dit;
#10 ditDah = `etc;
#10 ditDah = `dah; // o
#10 ditDah = `dah;
#10 ditDah = `dah;
#10 ditDah = `etc;
#10 ditDah = `dit; // SPACE
#10 ditDah = `dit;
#10 ditDah = `dah;
#10 ditDah = `dah;
#10 ditDah = `etc;
#10 ditDah = `dit; // w
#10 ditDah = `dah;
#10 ditDah = `dah;
#10 ditDah = `etc;
#10 ditDah = `dah; // o
#10 ditDah = `dah;
#10 ditDah = `dah;
#10 ditDah = `etc;
#10 ditDah = `dit; // r
#10 ditDah = `dah;
#10 ditDah = `dit;
#10 ditDah = `etc;
#10 ditDah = `dit; // l
#10 ditDah = `dah;
#10 ditDah = `dit;
#10 ditDah = `dit;
#10 ditDah = `etc;
#10 ditDah = `dah; // d
#10 ditDah = `dit;
#10 ditDah = `dit;
#10 ditDah = `etc;
end
morse_tx m_tx_ut(clk, ditDah, t);
morse_ch m_ch_ut(clk, t, p);
morse_rx m_rx_ut(clk, p, letter);
endmodule