spandata_mon.v
2.44 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
module spandata_mon(clock, reset_l);
`include "rcp.vh"
`include "define.vh"
`define STATE_WAITGRANT 4'h0
`define STATE_WAITSTART 4'h1
`define STATE_WAITDATA1 4'h2
`define STATE_WAITDATA2 4'h3
`define STATE_PRINTDATA1 4'h4
`define STATE_PRINTDATA2 4'h5
`define STATE_PRINTDATA3 4'h6
`define STATE_PRINTDATA4 4'h7
input clock;
input reset_l;
reg monitor;
reg [2:0] state;
initial begin
monitor = $test$plusargs("spandata_mon");
state = `STATE_WAITGRANT;
end
always @(posedge clock) begin
if (monitor && reset_l) begin
case (state)
`STATE_WAITGRANT:
begin
if (reality.rcp_0.span_dma_grant)
state <= `STATE_WAITSTART;
end
`STATE_WAITSTART:
begin
if (reality.rcp_0.dma_start)
if (reality.rcp_0.dma_last)
state <= `STATE_WAITDATA2;
else
state <= `STATE_WAITDATA1;
end
`STATE_WAITDATA1:
begin
if (!reality.rcp_0.span_dbus_write_enable)
state <= `STATE_WAITGRANT;
else if (reality.rcp_0.dma_last)
state <= `STATE_PRINTDATA2;
else
state <= `STATE_PRINTDATA1;
end
`STATE_WAITDATA2:
begin
if (!reality.rcp_0.span_dbus_write_enable)
state <= `STATE_WAITGRANT;
else
state <= `STATE_PRINTDATA3;
end
`STATE_PRINTDATA1:
begin
$display(`CLOCK_COUNT, " : dbus data - %h, from span",
reality.rcp_0.rdp_0.ms.dbus_dout);
$display(`CLOCK_COUNT, " : ebus data - %h, from span",
reality.rcp_0.rdp_0.ms.ebus_dout);
if (reality.rcp_0.dma_last)
state <= `STATE_PRINTDATA2;
else
state <= `STATE_PRINTDATA1;
end
`STATE_PRINTDATA2:
begin
$display(`CLOCK_COUNT, " : dbus data - %h, from span",
reality.rcp_0.rdp_0.ms.dbus_dout);
$display(`CLOCK_COUNT, " : ebus data - %h, from span",
reality.rcp_0.rdp_0.ms.ebus_dout);
state <= `STATE_PRINTDATA3;
end
`STATE_PRINTDATA3:
begin
$display(`CLOCK_COUNT, " : dbus data - %h, from span",
reality.rcp_0.rdp_0.ms.dbus_dout);
$display(`CLOCK_COUNT, " : ebus data - %h, from span",
reality.rcp_0.rdp_0.ms.ebus_dout);
state <= `STATE_PRINTDATA4;
end
`STATE_PRINTDATA4:
begin
$display(`CLOCK_COUNT, " : dbus data - %h, from span",
reality.rcp_0.rdp_0.ms.dbus_dout);
$display(`CLOCK_COUNT, " : ebus data - %h, from span",
reality.rcp_0.rdp_0.ms.ebus_dout);
if (reality.rcp_0.span_dma_grant)
state <= `STATE_WAITSTART;
else
state <= `STATE_WAITGRANT;
end
endcase
end
end
endmodule