test009.v
1.89 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
//
// test009 Test subblock ordered DMA reads
//
task test009;
fork
test009_cmddata;
test009_check;
join
endtask
task test009_check;
integer i;
begin
for (i = 0; i < 4; i = i + 1)
begin
while (!dma_start)
@(posedge clock);
if (!dma_last)
begin
$write("test009: dma_last expected: %d was %d at time %d\n",
1'b1, dma_last, $time);
errors = errors + 1;
end
@(posedge clock);
end
check_subblock("test009");
end
endtask
task test009_cmddata;
reg [CBUS_DATA_SIZE-1:0] address;
reg [DBUS_DATA_SIZE-1:0] actual_d_data;
reg [EBUS_DATA_SIZE-1:0] actual_e_data;
reg [3:0] nibble;
integer i, j;
begin
// Put known patterns in first four doublewords of memory
address = 0;
for (i = 0; i < 4; i = i + 1)
begin
cbus_dma_write(`DMA_UNMASKED, `DMA_UP, address, BUS_DEVICE_MI, -2, 8);
nibble = i;
dbus_put_data({16{nibble}}, {2{nibble}}, -2);
address = address + 8;
end
// Read two doublewords of memory with both beginning address offsets
for (i = 0; i < 2; i = i + 1)
begin
address = i*8;
cbus_dma_read(`DMA_SUBBLOCK, `DMA_UP, address, BUS_DEVICE_MI, 3, 2*8);
while (!dma_start)
@(posedge clock);
for (j = 0; j < 2; j = j + 1)
begin
nibble = i ^ j;
check_data("test009", {16{nibble}}, dbus_data_reg,
{ 2{nibble}}, ebus_data_reg);
@(posedge clock);
end
end
// Read four doublewords of memory with all beginning address offsets
for (i = 0; i < 4; i = i + 1)
begin
address = i*8;
cbus_dma_read(`DMA_SUBBLOCK, `DMA_UP, address, BUS_DEVICE_MI, 3, 4*8);
while (!dma_start)
@(posedge clock);
for (j = 0; j < 4; j = j + 1)
begin
nibble = i ^ j;
check_data("test009", {16{nibble}}, dbus_data_reg,
{ 2{nibble}}, ebus_data_reg);
@(posedge clock);
end
end
end
endtask