r4200b.v
4.99 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
module r4200b(clock, reset_l, p_valid_l, e_valid_l, e_ok_l, int_l,
sys_ad, sys_cmd, nmi_l);
`include "rcp.vh"
`include "rdram.vh"
`include "define.vh"
input clock;
input reset_l;
input e_valid_l;
input e_ok_l;
input int_l;
input nmi_l;
output p_valid_l;
inout [SYS_AD_SIZE-1:0] sys_ad;
inout [SYS_CMD_SIZE-1:0] sys_cmd;
reg e_valid;
reg e_ok;
reg int;
reg p_valid;
reg [SYS_AD_SIZE-1:0] sys_ad_in, sys_ad_out;
reg [SYS_CMD_SIZE-1:0] sys_cmd_in, sys_cmd_out;
reg sys_ad_enable;
reg [31:0] data [0:7];
reg test_selected;
reg rdram_ready;
assign sys_ad = sys_ad_enable ? sys_ad_out : 'bz;
assign sys_cmd = sys_ad_enable ? sys_cmd_out : 'bz;
assign p_valid_l = ~p_valid;
reg monitor;
initial monitor = $test$plusargs("r4200_mon");
always @(posedge clock) begin
e_valid <= ~e_valid_l;
e_ok <= ~e_ok_l;
int <= ~int_l;
sys_ad_in <= sys_ad;
sys_cmd_in <= sys_cmd;
end
// asynchronous reset_l
always @(reset_l) begin
if (!reset_l) begin
assign p_valid = LOW;
assign sys_ad_enable = HIGH;
end
else begin
deassign p_valid;
deassign sys_ad_enable;
end
end
// nmi detector
always @(posedge clock) begin
if (nmi_l == 0)
$display (" NMI detected");
end
initial begin
test_selected <= LOW;
rdram_ready <= LOW;
wait(`SYSTEM_READY);
@(posedge clock);
if ($test$plusargs("test_4200_mi_version")) mi_version;
if ($test$plusargs("test_4200_dp_counters")) dp_counters;
if ($test$plusargs("test_4200_pbus_reg")) pbus_reg;
if ($test$plusargs("test_4200_pbus_io")) pbus_io;
if ($test$plusargs("test_4200_pbus_dma")) pbus_dma;
if ($test$plusargs("test_4200_pif_boot")) pif_boot;
if ($test$plusargs("test_4200_dmem")) sp_dmem;
if ($test$plusargs("test_4200_imem")) sp_imem;
if ($test$plusargs("test_4200_rsp_dma")) rsp_dma;
if ($test$plusargs("test_4200_sp_reg")) sp_reg;
if ($test$plusargs("test_4200_sp_dma_copy")) sp_dma_copy;
if ($test$plusargs("test_4200_sp_dual")) sp_dual;
if ($test$plusargs("test_4200_cbuf_dma")) cbuf_dma;
if ($test$plusargs("test_4200_cbuf_dmem")) cbuf_dmem;
if ($test$plusargs("test_4200_subblock")) test_subblock;
if ($test$plusargs("test_4200_byte_write")) test_byte_write;
if ($test$plusargs("test_4200_external")) external;
if ($test$plusargs("test_4200_data_file")) data_file;
if ($test$plusargs("test_4200_pif_test")) pif_test;
if ($test$plusargs("test_4200_nmi_test")) nmi_test;
if ($test$plusargs("test_4200_pif_interrupt")) pif_interrupt;
if ($test$plusargs("test_4200_pif_rd_lap1")) pif_rd_lap1;
if ($test$plusargs("test_4200_pif_rd_lap2")) pif_rd_lap2;
if ($test$plusargs("test_4200_pif_rd_lap3")) pif_rd_lap3;
if ($test$plusargs("test_4200_vi_test")) vi_test;
if ($test$plusargs("test_4200_ai_test")) ai_test;
if ($test$plusargs("test_4200_pif_rd4Bcpu")) pif_rd4Bcpu;
if ($test$plusargs("test_4200_pif_io_read_conflict")) pif_io_read_conflict;
if ($test$plusargs("test_4200_pif_wr4B")) pif_wr4B;
if ($test$plusargs("test_4200_pif_rd64B")) pif_rd64B;
if ($test$plusargs("test_4200_pif_wr64B")) pif_wr64B;
if ($test$plusargs("test_4200_pif_wr_rd")) pif_wr_rd;
if ($test$plusargs("test_4200_span_buf_test")) span_buf_test;
end
initial begin
if ($test$plusargs("help")) begin
$display("R4200 test arguments include:");
$display(" +test_4200_mi_version");
$display(" +test_4200_dp_counters");
$display(" +test_4200_pbus_reg");
$display(" +test_4200_pbus_io");
$display(" +test_4200_pbus_dma");
$display(" +test_4200_pif_boot");
$display(" +test_4200_dmem");
$display(" +test_4200_imem");
$display(" +test_4200_rsp_dma");
$display(" +test_4200_sp_reg");
$display(" +test_4200_sp_dma_copy");
$display(" +test_4200_sp_dual");
$display(" +test_4200_cbuf_dma");
$display(" +test_4200_cbuf_dmem");
$display(" +test_4200_subblock");
$display(" +test_4200_byte_write");
$display(" +test_4200_external");
$display(" +test_4200_data_file");
$display(" +test_4200_pif_test");
$display(" +test_4200_nmi_test");
$display(" +test_4200_pif_interrupt");
$display(" +test_4200_pif_rd_lap1");
$display(" +test_4200_pif_rd_lap2");
$display(" +test_4200_pif_rd_lap3");
$display(" +test_4200_vi_test");
$display(" +test_4200_ai_test");
$display(" +test_4200_pif_wr4B");
$display(" +test_4200_pif_rd4Bcpu");
$display(" +test_4200_pif_io_read_conflict");
$display(" +test_4200_pif_rd64B");
$display(" +test_4200_pif_wr64B");
$display(" +test_4200_pif_wr_rd");
$display(" +test_4200_span_buf_test");
$display("");
#1 $finish;
end
end
`include "io_tasks.v"
`include "pif_tasks.v"
`include "audio_tasks.v"
`include "video_tasks.v"
`include "rspdma_tasks.v"
`include "rdp_tasks.v"
`include "support_tasks.v"
`ifdef IPC_PRESENT
`include "ipc_tasks.v"
`endif
endmodule