-
Notifications
You must be signed in to change notification settings - Fork 0
/
prbs_tb.v
64 lines (51 loc) · 1.03 KB
/
prbs_tb.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
`timescale 1ns / 1ps
module SS_PRBS_X;
// Inputs
reg clock;
reg init;
reg [3:0] type;
// Outputs
wire [31:0] out;
// Instantiate the Unit Under Test (UUT)
prbs_generator uut (
.clock(clock),
.init(init),
.type(type),
.out(out)
);
always #10 clock = ~clock;
reg [31:0] p_sum;
reg [31:0] p_begin;
always @(posedge clock)begin
if (init)begin
p_sum <= 0;
p_begin <= out;
end else begin
p_sum <= p_sum +1;
if (out == p_begin && p_sum != 0)begin
$display("%d", p_sum);
$stop;
end
end
end
initial begin
// Initialize Inputs
clock = 0;
init = 1;
//type = 4'h0; //PRBS7
//type = 4'h1; //PRBS9
type = 4'h2; //PRBS10
//type = 4'h3; //PRBS11
//type = 4'h4; //PRBS15
//type = 4'h5; //PRBS20
//type = 4'h6; //PRBS23
//type = 4'h7; //PRBS29
//type = 4'h8; //PRBS31
$dumpfile("prbs_dump.vcd");
$dumpvars(0, SS_PRBS_X);
// Wait 100 ns for global reset to finish
#100;
init = 0;
// Add stimulus here
end
endmodule