-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMAC_PRBS.v
76 lines (73 loc) · 1.97 KB
/
MAC_PRBS.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
// =============================================================================
// Filename: MAC_PRBS.v
// Author: KANG, Jian
// Email: jkangac@connect.ust.hk
// Affiliation: Hong Kong University of Science and Technology
// Description:
// -----------------------------------------------------------------------------
`timescale 1 ns / 1 ps
module MAC_PRBS(
input SERIAL_CLK,//the frequency of the clock is 200Mhz
input MAC_RST,
input PHY_RST, //this is improve every the content of every frame is the same
input READ_ENABLE,
output reg DATA_OUTPUT,
output reg DATA_OUTPUT_VALID
);
//inner reg and wire
reg data_out_valid;
wire data_output;
PRBS_ANY #(
//--------------------------------------------
// Configuration parameters
//--------------------------------------------
.CHK_MODE(0),
.INV_PATTERN(0),
.POLY_LENGHT(7),
.POLY_TAP(1),
.NBITS(1)
)
PRBS_ANY_inst( //--------------------------------------------
// Input/Outputs
//--------------------------------------------
.RST(MAC_RST|PHY_RST),
.CLK(SERIAL_CLK),
.DATA_IN(1'd0),
.EN(READ_ENABLE),
.DATA_OUT(data_output)
);
//DATA_OUT_VALID generation
always @ (posedge SERIAL_CLK)
begin
if(MAC_RST|PHY_RST)
begin
data_out_valid <=1'b0;
end
else
begin
data_out_valid <= READ_ENABLE;
end
end
//Output stage register
always @ (posedge SERIAL_CLK)
begin
if(MAC_RST|PHY_RST)
begin
DATA_OUTPUT_VALID <= 1'b0;
DATA_OUTPUT <= 1'b0;
end
else
begin
if (data_out_valid)
begin
DATA_OUTPUT_VALID <= 1'b1;
DATA_OUTPUT <= data_output;
end
else
begin
DATA_OUTPUT_VALID <= 1'b0;
DATA_OUTPUT <= 1'b0;
end
end
end
endmodule