rsp_mon_gate.v
5.61 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
module rsp_mon_gate(clk,reset_l);
input clk,reset_l;
`define SUpath reality.rcp_0.rsp_0_su
reg rsp_display_on;
reg [11:0] pc,su_rd_pc_debug;
reg [31:0] inst_0, inst_1;
reg halt,set_broke,dma_busy;
reg SR_Wen;
reg [31:0] SR_d;
reg [4:0] SR_w_addr;
reg imem_web;
reg [63:0] imem_din;
reg show_imem_on_r1;
reg dmem_we;
reg [15:0] dmem_web;
reg [11:0] dmemh_adr;
reg [11:0] dmeml_adr;
reg [63:0] dmemh_din;
reg [63:0] dmeml_din;
integer i;
initial
begin
pc = 0;
su_rd_pc_debug = 0;
inst_0 = 0;
inst_1 = 0;
halt = 0;
set_broke = 0;
dma_busy = 0;
SR_Wen = 0;
SR_w_addr = 0;
SR_d = 0;
imem_web = 1;
imem_din = 0;
dmem_we = 1;
dmem_web = 16'hFFFF;
dmemh_din = 0;
dmeml_din = 0;
show_imem_on_r1 = 0;
rsp_display_on = 0;
if ($test$plusargs("rsp_mon"))
rsp_display_on = 1;
if ($test$plusargs("show_imem_on_r1"))
show_imem_on_r1 = 1;
end
reg [15:0] tmp_web;
always @(posedge clk)
if (rsp_display_on)
begin
pc <= {reality.rcp_0.rsp_0_imem.a,3'b000};
inst_0 <= reality.rcp_0.rsp_0_imem.dout[63:32];
inst_1 <= reality.rcp_0.rsp_0_imem.dout[31:0];
imem_web <= reality.rcp_0.rsp_0_imem.web;
if (reality.rcp_0.rsp_0_imem.web===1'b0)
imem_din <= reality.rcp_0.rsp_0_imem.di;
tmp_web = {reality.rcp_0.rsp_0_dmemx2_dmemLow.web, reality.rcp_0.rsp_0_dmemx2_dmemHigh.web};
dmem_web <= tmp_web;
dmem_we <= (tmp_web !==16'hffff);
if (tmp_web!==16'hFFFF) begin
dmemh_din <= reality.rcp_0.rsp_0_dmemx2_dmemHigh.di;
dmeml_din <= reality.rcp_0.rsp_0_dmemx2_dmemLow.di;
dmemh_adr <= {reality.rcp_0.rsp_0_dmemx2_dmemHigh.a,4'b0 };
dmeml_adr <= {reality.rcp_0.rsp_0_dmemx2_dmemLow.a,4'b0 };
end
halt <= reality.rcp_0.rsp_0_io_logic.halt;
set_broke <= reality.rcp_0.rsp_0_io_logic.set_broke;
dma_busy <= reality.rcp_0.rsp_0_io_logic.io_mem_dma_dma_busy;
SR_Wen <= reality.rcp_0.rsp_0_su_surf_wen;
if (reality.rcp_0.rsp_0_su_surf_wen)
begin
SR_w_addr <= reality.rcp_0.rsp_0_su_sudp.surf_w;
SR_d[31] <= reality.rcp_0.rsp_0_su_sudp.wb_data_31_ ;
SR_d[30] <= reality.rcp_0.rsp_0_su_sudp.wb_data_30_ ;
SR_d[29] <= reality.rcp_0.rsp_0_su_sudp.wb_data_29_ ;
SR_d[28] <= reality.rcp_0.rsp_0_su_sudp.wb_data_28_ ;
SR_d[27] <= reality.rcp_0.rsp_0_su_sudp.wb_data_27_ ;
SR_d[26] <= reality.rcp_0.rsp_0_su_sudp.wb_data_26_ ;
SR_d[25] <= reality.rcp_0.rsp_0_su_sudp.wb_data_25_ ;
SR_d[24] <= reality.rcp_0.rsp_0_su_sudp.wb_data_24_ ;
SR_d[23] <= reality.rcp_0.rsp_0_su_sudp.wb_data_23_ ;
SR_d[22] <= reality.rcp_0.rsp_0_su_sudp.wb_data_22_ ;
SR_d[21] <= reality.rcp_0.rsp_0_su_sudp.wb_data_21_ ;
SR_d[20] <= reality.rcp_0.rsp_0_su_sudp.wb_data_20_ ;
SR_d[19] <= reality.rcp_0.rsp_0_su_sudp.wb_data_19_ ;
SR_d[18] <= reality.rcp_0.rsp_0_su_sudp.wb_data_18_ ;
SR_d[17] <= reality.rcp_0.rsp_0_su_sudp.wb_data_17_ ;
SR_d[16] <= reality.rcp_0.rsp_0_su_sudp.wb_data_16_ ;
SR_d[15] <= reality.rcp_0.rsp_0_su_sudp.wb_data_15_ ;
SR_d[14] <= reality.rcp_0.rsp_0_su_sudp.wb_data_14_ ;
SR_d[13] <= reality.rcp_0.rsp_0_su_sudp.wb_data_13_ ;
SR_d[12] <= reality.rcp_0.rsp_0_su_sudp.wb_data_12_ ;
SR_d[11] <= reality.rcp_0.rsp_0_su_sudp.wb_data_11_ ;
SR_d[10] <= reality.rcp_0.rsp_0_su_sudp.wb_data_10_ ;
SR_d[9] <= reality.rcp_0.rsp_0_su_sudp.wb_data_9_ ;
SR_d[8] <= reality.rcp_0.rsp_0_su_sudp.wb_data_8_ ;
SR_d[7] <= reality.rcp_0.rsp_0_su_sudp.wb_data_7_ ;
SR_d[6] <= reality.rcp_0.rsp_0_su_sudp.wb_data_6_ ;
SR_d[5] <= reality.rcp_0.rsp_0_su_sudp.wb_data_5_ ;
SR_d[4] <= reality.rcp_0.rsp_0_su_sudp.wb_data_4_ ;
SR_d[3] <= reality.rcp_0.rsp_0_su_sudp.wb_data_3_ ;
SR_d[2] <= reality.rcp_0.rsp_0_su_sudp.wb_data_2_ ;
SR_d[1] <= reality.rcp_0.rsp_0_su_sudp.wb_data_1_ ;
SR_d[0] <= reality.rcp_0.rsp_0_su_sudp.wb_data_0_ ;
end
su_rd_pc_debug <= {reality.rcp_0.rsp_0_su_suctl.pc,2'b00};
end
always @(negedge clk)
begin
SR_Wen <= 0;
imem_web <= 1;
dmem_we <= 0;
end
always @(
pc or
inst_0 or
inst_1 or
su_rd_pc_debug or
halt or
set_broke or
dma_busy or
posedge SR_Wen or
negedge imem_web or
posedge dmem_we
)
if (rsp_display_on)
begin
$display($time, " : RSP: H=%b B=%b D=%b im=%h (H=%h L=%h) npc=%h",
halt, set_broke, dma_busy, pc, inst_0, inst_1, su_rd_pc_debug);
if (imem_web===1'b0)
$display($time, " : RSP: imem dma write : imem_din= %8h_%8h",
imem_din[63:32],imem_din[31:0]);
if (dmem_web!==16'hFFFF)
$display(" dmem write: %2h @%8h %8h_%8h %2h @%8h %8h_%8h",
dmem_web[15:8],
dmemh_adr, dmemh_din[63:32], dmemh_din[31:0],
dmem_web[ 7:0],
dmeml_adr, dmeml_din[63:32], dmeml_din[31:0]);
if (SR_Wen)
begin
$display($time, " : RSP: SU Reg: R%0d = %h", SR_w_addr, SR_d);
if (show_imem_on_r1 && SR_w_addr===5'h1) dump_imem;
end
end
task dump_imem;
reg [9:0] i;
reg [31:0] dh0,dl0,dh1,dl1;
begin
$display("+++++++++++++++++ IMEM DUMP ++++++++++++++++++++++");
for (i=0; i<512; i=i+2)
begin
{ dh0,dl0 } = reality.rcp_0.rsp_0_imem.ram_prim[i ];
{ dh1,dl1 } = reality.rcp_0.rsp_0_imem.ram_prim[i+1];
$display(" IMEM[0x%3h]=%4h_%4h (hex) IMEM[0x%3h]=%4h_%4h (hex)",
i,dh0,dl0,i+'h1,dh1,dl1);
end
end
endtask
endmodule