ram_bist_check.v
3.59 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
`timescale 1ns / 10ps
module rcp_misc_test;
reg imem_bist_done;
reg tmem_bist_done;
reg [6:0] imem_bist_status;
reg [10:0] tmem_bist_status;
`define IMEM_BIST_ADDR 'h0408_0004
`define TMEM_BIST_ADDR 'h0420_0000
`define CLK reality.rcp_0.clock
//initial $dumpvars;
initial
begin
#16
reality.r4200b_0.test_selected = 1;
wait(`SYSTEM_READY);
repeat (4) @(posedge `CLK);
/******************************************************
* clear bist
******************************************************/
reality.r4200b_0.write_word(`IMEM_BIST_ADDR, 3, 'h4);
reality.r4200b_0.write_word(`TMEM_BIST_ADDR, 3, 'h4);
/******************************************************
* bist check
******************************************************/
reality.r4200b_0.write_word(`IMEM_BIST_ADDR, 3, 'h1);
reality.r4200b_0.write_word(`TMEM_BIST_ADDR, 3, 'h1);
reality.r4200b_0.data[0] = 'h0;
imem_bist_done = 0;
tmem_bist_done = 0;
while (imem_bist_done === 1'b0 || tmem_bist_done === 1'b0)
begin
repeat (1000) @(posedge `CLK);
reality.r4200b_0.read_word(`IMEM_BIST_ADDR, 3);
imem_bist_done = reality.r4200b_0.data[0] >> 2;
imem_bist_status = reality.r4200b_0.data[0];
reality.r4200b_0.read_word(`TMEM_BIST_ADDR, 3);
tmem_bist_done = reality.r4200b_0.data[0] >> 2;
tmem_bist_status = reality.r4200b_0.data[0];
$display ($time, " IMEM BIST status = %h", imem_bist_status);
$display ($time, " TMEM BIST status = %h", tmem_bist_status);
end
if (imem_bist_status !== 'h7d)
begin
$display($time," ERROR: imem bist status is wrong");
$finish;
end
if (tmem_bist_status !== 'h7fd)
begin
$display($time," ERROR: tmem bist status is wrong");
$finish;
end
/******************************************************
* clear bist
******************************************************/
$display ($time, "\n\nClearing MEM BIST ");
reality.r4200b_0.write_word(`IMEM_BIST_ADDR, 3, 'h4);
reality.r4200b_0.write_word(`TMEM_BIST_ADDR, 3, 'h4);
reality.r4200b_0.data[0] = 'h0;
imem_bist_done = 0;
tmem_bist_done = 0;
while (imem_bist_done === 1'b0 || tmem_bist_done === 1'b0)
begin
repeat (2000) @(posedge `CLK);
reality.r4200b_0.read_word(`IMEM_BIST_ADDR, 3);
imem_bist_done = reality.r4200b_0.data[0] >> 2;
imem_bist_status = reality.r4200b_0.data[0];
reality.r4200b_0.read_word(`TMEM_BIST_ADDR, 3);
tmem_bist_done = reality.r4200b_0.data[0] >> 2;
tmem_bist_status = reality.r4200b_0.data[0];
$display ($time, " IMEM BIST status = %h", imem_bist_status);
$display ($time, " TMEM BIST status = %h", tmem_bist_status);
end
if (imem_bist_status !== 'h7c)
begin
$display($time," ERROR: imem bist status is wrong");
$finish;
end
if (tmem_bist_status !== 'h7fc)
begin
$display($time," ERROR: tmem bist status is wrong");
$finish;
end
/******************************************************
* clear bist
******************************************************/
$display ($time, "\n\nClearing MEM BIST ");
reality.r4200b_0.write_word(`IMEM_BIST_ADDR, 3, 'h4);
reality.r4200b_0.write_word(`TMEM_BIST_ADDR, 3, 'h4);
reality.r4200b_0.read_word(`IMEM_BIST_ADDR, 3);
imem_bist_status = reality.r4200b_0.data[0];
reality.r4200b_0.read_word(`TMEM_BIST_ADDR, 3);
tmem_bist_status = reality.r4200b_0.data[0];
$display ($time, " IMEM BIST status = %h", imem_bist_status);
$display ($time, " TMEM BIST status = %h", tmem_bist_status);
if (imem_bist_status !== 'h0)
begin
$display($time," ERROR: imem bist status is wrong");
$finish;
end
if (tmem_bist_status !== 'h0)
begin
$display($time," ERROR: tmem bist status is wrong");
$finish;
end
$finish;
end
endmodule