-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtb_baud_rate_gen.v
More file actions
74 lines (54 loc) · 1006 Bytes
/
tb_baud_rate_gen.v
File metadata and controls
74 lines (54 loc) · 1006 Bytes
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
`timescale 1ns / 1ps
//
// Engineer: Utkarsha
// Project Name: Baudrate Generator
//
module tb_baud_rate_gen;
reg clk;
reg reset;
reg [2:0] baud_sel;
wire baud_tick;
// Instantiate DUT (Device Under Test)
//baud_rate_gen DUT (
// .clk(clk),
// .reset(reset),
// .baud_sel(baud_sel),
// .baud_tick(baud_tick)
//);
baud_rate_gen_oversampling DUT (
.clk(clk),
.reset(reset),
.baud_sel(baud_sel),
.oversample_tick(baud_tick)
);
// Clock Generation (100 MHz)
// Period = 10 ns
initial begin
clk = 0;
end
always #5 clk = ~clk;
// Test sequence
initial begin
// Initialize
reset = 1;
baud_sel = 3'b000;
#50;
reset = 0;
// Test 9600 baud
baud_sel = 3'b000;
#200000;
// Test 19200 baud
baud_sel = 3'b001;
#200000;
// Test 38400 baud
baud_sel = 3'b010;
#200000;
// Test 57600 baud
baud_sel = 3'b011;
#200000;
// Test 115200 baud
baud_sel = 3'b100;
#200000;
$finish;
end
endmodule