1
0
mirror of synced 2026-01-28 13:09:09 +00:00

cellaigs: add $priority

This commit is contained in:
Emil J. Tywoniak
2026-01-21 20:55:32 +01:00
parent 3a5c492e32
commit 5a613fc457
10 changed files with 130 additions and 64 deletions

View File

@@ -501,6 +501,27 @@ Aig::Aig(Cell *cell)
goto optimize;
}
if (cell->type == ID($priority))
{
int width = GetSize(cell->getPort(ID::Y));
RTLIL::Const polarity = cell->getParam(ID::POLARITY);
vector<int> A = mk.inport_vec(ID::A, width);
vector<int> Y;
int any_previous_active;
if (width) {
any_previous_active = polarity[0] ? A[0] : mk.not_gate(A[0]);
Y.push_back(A[0]);
}
for (int i = 1; i < width; i++) {
int inactive_val = mk.bool_node(!polarity[i]);
Y.push_back(mk.mux_gate(A[i], inactive_val, any_previous_active));
int is_active = mk.xnor_gate(inactive_val, A[i]);
any_previous_active = mk.or_gate(any_previous_active, is_active);
}
mk.outport_vec(Y, ID::Y);
goto optimize;
}
name.clear();
return;

View File

@@ -0,0 +1,5 @@
aag 1 1 0 1 0
2
2
c
Generated by Yosys

View File

@@ -1,7 +1,12 @@
aag 1 1 0 3 0
2
aag 5 3 0 4 2
2
4
6
10
0
0
0
8 4 2
10 8 6
c
Generated by Yosys

View File

@@ -1,13 +1,9 @@
aag 7 4 0 3 3
aag 5 3 0 1 2
2
4
6
8
15
0
0
10 5 3
12 10 7
14 12 9
11
8 5 3
10 8 7
c
Generated by Yosys

View File

@@ -1,7 +1,10 @@
aag 3 2 0 1 1
aag 1 1 0 6 0
2
4
7
6 5 3
2
0
0
0
0
0
c
Generated by Yosys

View File

@@ -1,30 +1,10 @@
aag 25 6 0 2 19
aag 5 2 0 2 3
2
4
6
8
10
12
51
11
0
14 4 2
16 5 3
18 17 15
20 18 6
22 17 15
24 23 7
26 25 21
28 26 8
30 25 21
32 31 9
34 33 29
36 34 10
38 33 29
40 39 11
42 41 37
44 42 12
46 41 37
48 47 13
50 49 45
6 4 2
8 5 3
10 9 7
c
Generated by Yosys

View File

@@ -1,9 +1,7 @@
aag 5 2 0 1 3
aag 1 1 0 3 0
2
4
10
6 4 2
8 5 3
10 9 7
2
0
0
c
Generated by Yosys

View File

@@ -1,20 +1,35 @@
aag 16 13 0 1 3
aag 29 6 0 3 23
2
4
6
8
10
12
14
16
18
20
22
24
26
33
28 17 2
30 16 3
32 31 29
19
38
58
14 7 2
16 6 3
18 17 15
20 6 3
22 20 15
24 9 4
26 8 5
28 27 25
30 28 23
32 27 25
34 20 15
36 34 33
38 37 31
40 27 23
42 41 25
44 11 4
46 10 5
48 47 45
50 48 43
52 47 45
54 41 25
56 54 53
58 57 51
c
Generated by Yosys

View File

@@ -1,12 +1,16 @@
aag 10 4 0 4 6
aag 10 4 0 8 6
2
4
6
8
15
21
21
21
1
1
1
1
1
1
10 6 2
12 7 3
14 13 11

View File

@@ -1,12 +1,51 @@
aag 8 5 0 1 3
aag 40 16 0 8 24
2
4
6
8
10
12
14
16
12 8 2
14 9 3
16 15 13
18
20
22
24
26
28
30
32
38
44
50
56
62
68
74
80
34 18 2
36 19 3
38 37 35
40 20 4
42 21 5
44 43 41
46 22 6
48 23 7
50 49 47
52 24 8
54 25 9
56 55 53
58 26 10
60 27 11
62 61 59
64 28 12
66 29 13
68 67 65
70 30 14
72 31 15
74 73 71
76 32 16
78 33 17
80 79 77
c
Generated by Yosys