forked from umangs30/fpga-team-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
find.v
76 lines (46 loc) · 1.17 KB
/
find.v
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
include "storage.v"
include "initialize.v"
module main (
input [7:0] a1 [9:0],
input [7:0] b1 [9:0],input [7:0] a2[7:0][0:2], input value
);
initialize oot(.a(a1), .b(b1));
storage uut(.a(a2));
integer i;
input i1;
input i2;
initial begin
for ( i=0 ;i<8 ;i++ ) begin
if (a2[i][2]==value) begin
i1<=a2[i][0];
i2<=a2[i][1];
i=8;
end
end
integer count=0;;
while ((a1[i1]!=0 && count%2==0) || (b1[i2]!=0 && count%2!=0)) begin
if (count>=20) begin
break;
end
if (count%2==0) begin
reg temp=value;
value=a1[i1];
a1[i1]=temp;
count++;
end
if (count%2!=0) begin
reg temp=value;
value=b1[i2];
b1[i2]=temp;
count++;
end
for ( i=0 ;i<8 ;i++ ) begin
if (a2[i][2]==value) begin
i1<=a2[i][0];
i2<=a2[i][1];
i=8;
end
end
end
end
endmodule