forked from nguyenthienviet/16-QAM-verilog-based-transmitter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtb_S2P.v.bak
61 lines (52 loc) · 882 Bytes
/
tb_S2P.v.bak
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
`timescale 1ns / 1ns
module tb_S2P;
// Inputs
reg clk;
reg rst;
reg start;
// Outputs
wire [3:0] parallel_data;
wire serial_in;
wire data_flag;
// DUT
data_generator dat_gen(
.clk(clk),
.rst(rst),
.enable(start),
.serial_in(serial_in),
.data_flag(data_flag)
);
serial_2_parallel dut (
.clk(clk),
.rst(rst),
.start(start),
.serial_in(serial_in),
.data_flag(data_flag),
.parallel_data(parallel_data)
);
initial begin
// Initialize Inputs
clk = 0;
rst = 0;
start = 1;
// Wait 10 ns for global reset to finish
#10;
rst = 1;
end
always #5
clk <= ~clk;
initial begin
#1000
$stop;
end
/*always @(posedge clk) begin
data_flag = 0;
if(i == 7) begin
serial_in = $unsigned($random)%2;
data_flag = 1;
i = i-1;
end
else if(i == 0) i = 7;
else i = i-1;
end*/
endmodule