-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathSecondPriceAuction-compiled.sfdl.Opt.circuit
162 lines (162 loc) · 12.3 KB
/
SecondPriceAuction-compiled.sfdl.Opt.circuit
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
// /**
// * Performs a 2nd price auction between 4 bidders.
// * At the end only the winning bidder and the seller know the identity of the winner
// * Everyone knows the 2nd highest price,
// * Nothing else is known to anyone.
// **/
// program SecondPriceAuction{
// const nBidders = 4;
// type Bid = Int<4>; // enough bits to represent a small bid.
// type WinningBidder = Int<3>; // enough bits to represent a winner (nBitters bits).
//
// type SellerOutput = struct{WinningBidder winner, Bid winningPrice};
// type Seller = struct{SellerOutput output}; // Seller has no input
//
// type BidderOutput = struct{Boolean win, Bid winningPrice};
// type Bidder = struct{Bid input, BidderOutput output};
//
// function void main(Seller seller, Bidder[nBidders] bidder){
// var Bid high;
// var Bid second;
// var WinningBidder winner;
// winner = 0; high = bidder[0].input; second = 0;
//
// // Making the auction.
// for(i=1 to nBidders-1){
// if(bidder[i].input > high){
// winner = i;
// second = high;
// high = bidder[i].input;
// }
// else {
// if(bidder[i].input > second)
// second = bidder[i].input;
// }
// }
//
// // Setting the result.
// seller.output.winner = winner;
// seller.output.winningPrice = second;
// for(i=0 to nBidders-1){
// bidder[i].output.win = (winner == i);
// bidder[i].output.winningPrice = second;
// }
// }
// }
0 gate arity 0 table [ 0 ] inputs [ ] //CONST 0 , winner.$2(4) , seller.output.winner.$2(0) []
1 gate arity 0 table [ 1 ] inputs [ ] //CONST 1 []
// --------------- EOF ------------------
// ---------------- BEFORE: (v0.bitSize+v1.bitSize)
// ---------------- After: (v0.bitSize+v1.bitSize) Pins: [ 0 ]
// ---------------- BEFORE: (v0.bitSize+v1.bitSize)
// ---------------- After: (v0.bitSize+v1.bitSize) Pins: [ 0 ]
// SFDL file for Program: SecondPriceAuction
2 input //bidder[0].input.$0(0) , high.$0(0) , second.$0(1) , bidder[0].input.$0(1) [35, 23, 31]
3 input //bidder[0].input.$1(0) , high.$1(0) , second.$1(1) , bidder[0].input.$1(1) [32, 36, 24]
4 input //bidder[0].input.$2(0) , high.$2(0) , second.$2(1) , bidder[0].input.$2(1) [33, 37, 25]
5 input //bidder[0].input.$3(0) , high.$3(0) , second.$3(1) , bidder[0].input.$3(1) [34, 38, 26]
6 input //bidder[1].input.$0(0) , bidder[i].input.$0(0) , high.$0(1) , second.$0(2) , bidder[1].input.$0(1) [35, 19, 18, 23, 27]
7 input //bidder[1].input.$1(0) , bidder[i].input.$1(0) , high.$1(1) , second.$1(2) , bidder[1].input.$1(1) [19, 18, 36, 28]
8 input //bidder[1].input.$2(0) , bidder[i].input.$2(0) , high.$2(1) , second.$2(2) , bidder[1].input.$2(1) [21, 20, 37, 29]
9 input //bidder[1].input.$3(0) , bidder[i].input.$3(0) , high.$3(1) , second.$3(2) , bidder[1].input.$3(1) [38, 22, 30]
10 input //bidder[2].input.$0(0) , bidder[i].input.$0(0) , high.$0(2) , second.$0(4) , bidder[2].input.$0(1) [48, 39, 52, 40, 44, 60]
11 input //bidder[2].input.$1(0) , bidder[i].input.$1(0) , high.$1(2) , second.$1(4) , bidder[2].input.$1(1) [39, 53, 40, 61]
12 input //bidder[2].input.$2(0) , bidder[i].input.$2(0) , high.$2(2) , second.$2(4) , bidder[2].input.$2(1) [54, 42, 41, 62]
13 input //bidder[2].input.$3(0) , bidder[i].input.$3(0) , high.$3(2) , second.$3(4) , bidder[2].input.$3(1) [55, 43, 63]
14 input //bidder[3].input.$0(0) , bidder[i].input.$0(0) , high.$0(3) , second.$0(6) , bidder[3].input.$0(1) [70, 65, 66, 78, 74]
15 input //bidder[3].input.$1(0) , bidder[i].input.$1(0) , high.$1(3) , second.$1(6) , bidder[3].input.$1(1) [65, 66, 79]
16 input //bidder[3].input.$2(0) , bidder[i].input.$2(0) , high.$2(3) , second.$2(6) , bidder[3].input.$2(1) [68, 80, 67]
17 input //bidder[3].input.$3(0) , bidder[i].input.$3(0) , high.$3(3) , second.$3(6) , bidder[3].input.$3(1) [69, 81]
// ---------------- Assign: winner = 0
// ---------------- Assign: high = bidder[0].input
// ---------------- Assign: second = 0
// ---------------- BEFORE: (nBidders+(-1))
// ---------------- After: (nBidders+(-1)) Pins: [ 1 1 0 ]
// ---------------- BEFORE: (high+(-bidder[i].input))
18 gate arity 2 table [ 0 1 1 0 ] inputs [ 7 6 ] // [24]
19 gate arity 2 table [ 0 1 1 1 ] inputs [ 7 6 ] // [21, 20]
20 gate arity 2 table [ 0 1 1 0 ] inputs [ 8 19 ] // [25]
21 gate arity 2 table [ 0 1 1 1 ] inputs [ 8 19 ] // [22]
22 gate arity 2 table [ 0 1 1 0 ] inputs [ 9 21 ] // [27, 26, 29, 28, 30]
23 gate arity 2 table [ 0 0 0 1 ] inputs [ 6 2 ] // [24]
24 gate arity 3 table [ 0 0 0 1 0 1 1 1 ] inputs [ 23 18 3 ] // [25]
25 gate arity 3 table [ 0 0 0 1 0 1 1 1 ] inputs [ 24 20 4 ] // [26]
26 gate arity 3 table [ 0 1 1 0 1 0 0 1 ] inputs [ 25 22 5 ] // [34, 35, 32, 33, 38, 64, 36, 37, 31]
27 gate arity 2 table [ 0 0 0 1 ] inputs [ 6 22 ] // [31]
28 gate arity 2 table [ 0 0 0 1 ] inputs [ 7 22 ] // [32]
29 gate arity 2 table [ 0 0 0 1 ] inputs [ 8 22 ] // [33]
30 gate arity 2 table [ 0 0 0 1 ] inputs [ 9 22 ] // [34]
31 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 27 2 26 ] //second.$0(4) [48, 52]
32 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 28 3 26 ] //second.$1(4) [49, 53]
33 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 29 4 26 ] //second.$2(4) [50, 54]
// ---------------- After: (high+(-bidder[i].input)) Pins: [ 26 28 30 32 ]
// ---------------- Assign: winner = i
// ---------------- Assign: second = high
// ---------------- Assign: high = bidder[i].input
// ---------------- BEFORE: (second+(-bidder[i].input))
34 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 30 5 26 ] //second.$3(4) [51, 55]
35 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 2 6 26 ] //high.$0(2) , second.$0(3) [56, 44, 60]
36 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 3 7 26 ] //high.$1(2) , second.$1(3) [57, 61, 45]
37 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 4 8 26 ] //high.$2(2) , second.$2(3) [58, 46, 62]
38 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 5 9 26 ] //high.$3(2) , second.$3(3) [59, 63, 47]
39 gate arity 2 table [ 0 1 1 0 ] inputs [ 11 10 ] // [49, 45]
40 gate arity 2 table [ 0 1 1 1 ] inputs [ 11 10 ] // [42, 41]
41 gate arity 2 table [ 0 1 1 0 ] inputs [ 12 40 ] // [50, 46]
42 gate arity 2 table [ 0 1 1 1 ] inputs [ 12 40 ] // [43]
43 gate arity 2 table [ 0 1 1 0 ] inputs [ 13 42 ] // [51, 47]
44 gate arity 2 table [ 0 0 0 1 ] inputs [ 10 35 ] // [45]
45 gate arity 3 table [ 0 0 0 1 0 1 1 1 ] inputs [ 44 39 36 ] // [46]
46 gate arity 3 table [ 0 0 0 1 0 1 1 1 ] inputs [ 45 41 37 ] // [47]
47 gate arity 3 table [ 0 1 1 0 1 0 0 1 ] inputs [ 46 43 38 ] // [87, 64, 59, 58, 57, 56, 63, 62, 61, 60]
48 gate arity 2 table [ 0 0 0 1 ] inputs [ 10 31 ] // [49]
49 gate arity 3 table [ 0 0 0 1 0 1 1 1 ] inputs [ 48 39 32 ] // [50]
// ---------------- After: (second+(-bidder[i].input)) Pins: [ 42 44 46 48 ]
// ---------------- Assign: second = bidder[i].input
50 gate arity 3 table [ 0 0 0 1 0 1 1 1 ] inputs [ 49 41 33 ] // [51]
51 gate arity 3 table [ 0 1 1 0 1 0 0 1 ] inputs [ 50 43 34 ] // [55, 54, 53, 52]
52 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 31 10 51 ] // [56]
53 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 32 11 51 ] // [57]
54 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 33 12 51 ] // [58]
55 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 34 13 51 ] // [59]
56 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 52 35 47 ] //second.$0(6) [78, 74]
57 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 53 36 47 ] //second.$1(6) [79, 75]
58 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 54 37 47 ] //second.$2(6) [80, 76]
59 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 55 38 47 ] //second.$3(6) [81, 77]
60 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 35 10 47 ] //high.$0(3) , second.$0(5) [70, 82]
61 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 36 11 47 ] //high.$1(3) , second.$1(5) [71, 83]
62 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 37 12 47 ] //high.$2(3) , second.$2(5) [84, 72]
// ---------------- BEFORE: (high+(-bidder[i].input))
63 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 38 13 47 ] //high.$3(3) , second.$3(5) [85, 73]
64 gate arity 2 table [ 0 1 0 0 ] inputs [ 26 47 ] // [86]
65 gate arity 2 table [ 0 1 1 0 ] inputs [ 15 14 ] // [71, 75]
66 gate arity 2 table [ 0 1 1 1 ] inputs [ 15 14 ] // [68, 67]
67 gate arity 2 table [ 0 1 1 0 ] inputs [ 16 66 ] // [76, 72]
68 gate arity 2 table [ 0 1 1 1 ] inputs [ 16 66 ] // [69]
69 gate arity 2 table [ 0 1 1 0 ] inputs [ 17 68 ] // [77, 73]
70 gate arity 2 table [ 0 0 0 1 ] inputs [ 14 60 ] // [71]
71 gate arity 3 table [ 0 0 0 1 0 1 1 1 ] inputs [ 70 65 61 ] // [72]
72 gate arity 3 table [ 0 0 0 1 0 1 1 1 ] inputs [ 71 67 62 ] // [73]
73 gate arity 3 table [ 0 1 1 0 1 0 0 1 ] inputs [ 72 69 63 ] // [85, 84, 87, 86, 83, 82]
74 gate arity 2 table [ 0 0 0 1 ] inputs [ 14 56 ] // [75]
75 gate arity 3 table [ 0 0 0 1 0 1 1 1 ] inputs [ 74 65 57 ] // [76]
76 gate arity 3 table [ 0 0 0 1 0 1 1 1 ] inputs [ 75 67 58 ] // [77]
77 gate arity 3 table [ 0 1 1 0 1 0 0 1 ] inputs [ 76 69 59 ] // [81, 80, 78, 79]
78 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 56 14 77 ] // [82]
// ---------------- After: (high+(-bidder[i].input)) Pins: [ 71 73 75 77 ]
// ---------------- Assign: winner = i
// ---------------- Assign: second = high
// ---------------- Assign: high = bidder[i].input
// ---------------- BEFORE: (second+(-bidder[i].input))
79 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 57 15 77 ] // [83]
80 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 58 16 77 ] // [84]
81 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 59 17 77 ] // [85]
82 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 78 60 73 ] //second.$0(7) , seller.output.winningPrice.$0(1) , bidder[0].output.winningPrice.$0(1) , bidder[1].output.winningPrice.$0(3) , bidder[0].output.winningPrice.$0(4) , bidder[1].output.winningPrice.$0(4) , bidder[0].output.winningPrice.$0(5) , bidder[1].output.winningPrice.$0(5) , bidder[2].output.winningPrice.$0(5) , bidder[0].output.winningPrice.$0(6) , bidder[1].output.winningPrice.$0(6) , bidder[2].output.winningPrice.$0(6) , bidder[0].output.winningPrice.$0(7) , bidder[1].output.winningPrice.$0(7) , bidder[2].output.winningPrice.$0(7) , bidder[3].output.winningPrice.$0(7) []
83 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 79 61 73 ] //second.$1(7) , seller.output.winningPrice.$1(1) , bidder[0].output.winningPrice.$1(1) , bidder[1].output.winningPrice.$1(3) , bidder[0].output.winningPrice.$1(4) , bidder[1].output.winningPrice.$1(4) , bidder[0].output.winningPrice.$1(5) , bidder[1].output.winningPrice.$1(5) , bidder[2].output.winningPrice.$1(5) , bidder[0].output.winningPrice.$1(6) , bidder[1].output.winningPrice.$1(6) , bidder[2].output.winningPrice.$1(6) , bidder[0].output.winningPrice.$1(7) , bidder[1].output.winningPrice.$1(7) , bidder[2].output.winningPrice.$1(7) , bidder[3].output.winningPrice.$1(7) []
84 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 80 62 73 ] //second.$2(7) , seller.output.winningPrice.$2(1) , bidder[0].output.winningPrice.$2(1) , bidder[1].output.winningPrice.$2(3) , bidder[0].output.winningPrice.$2(4) , bidder[1].output.winningPrice.$2(4) , bidder[0].output.winningPrice.$2(5) , bidder[1].output.winningPrice.$2(5) , bidder[2].output.winningPrice.$2(5) , bidder[0].output.winningPrice.$2(6) , bidder[1].output.winningPrice.$2(6) , bidder[2].output.winningPrice.$2(6) , bidder[0].output.winningPrice.$2(7) , bidder[1].output.winningPrice.$2(7) , bidder[2].output.winningPrice.$2(7) , bidder[3].output.winningPrice.$2(7) []
85 gate arity 3 table [ 0 1 0 1 0 0 1 1 ] inputs [ 81 63 73 ] //second.$3(7) , seller.output.winningPrice.$3(1) , bidder[0].output.winningPrice.$3(1) , bidder[1].output.winningPrice.$3(3) , bidder[0].output.winningPrice.$3(4) , bidder[1].output.winningPrice.$3(4) , bidder[0].output.winningPrice.$3(5) , bidder[1].output.winningPrice.$3(5) , bidder[2].output.winningPrice.$3(5) , bidder[0].output.winningPrice.$3(6) , bidder[1].output.winningPrice.$3(6) , bidder[2].output.winningPrice.$3(6) , bidder[0].output.winningPrice.$3(7) , bidder[1].output.winningPrice.$3(7) , bidder[2].output.winningPrice.$3(7) , bidder[3].output.winningPrice.$3(7) []
86 gate arity 2 table [ 0 1 1 1 ] inputs [ 73 64 ] // [89, 88, 91, 90]
87 gate arity 2 table [ 0 1 1 1 ] inputs [ 47 73 ] // [89, 88, 91, 90]
88 gate arity 2 table [ 1 0 0 0 ] inputs [ 87 86 ] // []
89 gate arity 2 table [ 0 0 1 0 ] inputs [ 87 86 ] // []
90 gate arity 2 table [ 0 1 0 0 ] inputs [ 87 86 ] // []
91 gate arity 2 table [ 0 0 0 1 ] inputs [ 87 86 ] // []