This repository was archived by the owner on Oct 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathadd8_434.c
More file actions
97 lines (92 loc) · 2.78 KB
/
add8_434.c
File metadata and controls
97 lines (92 loc) · 2.78 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
/***
* This code is a part of EvoApproxLib library (ehw.fit.vutbr.cz/approxlib) distributed under The MIT License.
* When used, please cite the following article(s): V. Mrazek, R. Hrbacek, Z. Vasicek and L. Sekanina, "EvoApprox8b: Library of approximate adders and multipliers for circuit design and benchmarking of approximation methods". Design, Automation & Test in Europe Conference & Exhibition (DATE), 2017, Lausanne, 2017, pp. 258-261. doi: 10.23919/DATE.2017.7926993
* This file contains a circuit from evoapprox8b dataset. Note that a new version of library was already published.
***/
#include <stdint.h>
#include <stdlib.h>
/// Approximate function add8_434
/// Library = EvoApprox8b
/// Circuit = add8_434
/// Area (180) = 968
/// Delay (180) = 1.920
/// Power (180) = 263.20
/// Area (45) = 70
/// Delay (45) = 0.700
/// Power (45) = 25.93
/// Nodes = 13
/// HD = 89480
/// MAE = 0.74609
/// MSE = 1.48438
/// MRE = 0.39 %
/// WCE = 3
/// WCRE = 50 %
/// EP = 43.8 %
uint16_t add8_434(uint8_t a, uint8_t b)
{
uint16_t c = 0;
uint8_t n0 = (a >> 0) & 0x1;
uint8_t n2 = (a >> 1) & 0x1;
uint8_t n4 = (a >> 2) & 0x1;
uint8_t n6 = (a >> 3) & 0x1;
uint8_t n8 = (a >> 4) & 0x1;
uint8_t n10 = (a >> 5) & 0x1;
uint8_t n12 = (a >> 6) & 0x1;
uint8_t n14 = (a >> 7) & 0x1;
uint8_t n16 = (b >> 0) & 0x1;
uint8_t n18 = (b >> 1) & 0x1;
uint8_t n20 = (b >> 2) & 0x1;
uint8_t n22 = (b >> 3) & 0x1;
uint8_t n24 = (b >> 4) & 0x1;
uint8_t n26 = (b >> 5) & 0x1;
uint8_t n28 = (b >> 6) & 0x1;
uint8_t n30 = (b >> 7) & 0x1;
uint8_t n33;
uint8_t n38;
uint8_t n52;
uint8_t n58;
uint8_t n76;
uint8_t n80;
uint8_t n83;
uint8_t n132;
uint8_t n133;
uint8_t n182;
uint8_t n183;
uint8_t n232;
uint8_t n233;
uint8_t n282;
uint8_t n283;
uint8_t n332;
uint8_t n333;
uint8_t n382;
uint8_t n383;
n33 = n0 | n16;
n38 = ~(n14 | n28 | n30);
n52 = ~(n38 & n18 & n16);
n58 = ~(n52 | n12);
n76 = ~(n58 & n0 & n2);
n80 = ~(n26 | n76);
n83 = n2 | n18;
n132 = (n4 ^ n20) ^ n80;
n133 = (n4 & n20) | (n20 & n80) | (n4 & n80);
n182 = (n6 ^ n22) ^ n133;
n183 = (n6 & n22) | (n22 & n133) | (n6 & n133);
n232 = (n8 ^ n24) ^ n183;
n233 = (n8 & n24) | (n24 & n183) | (n8 & n183);
n282 = (n10 ^ n26) ^ n233;
n283 = (n10 & n26) | (n26 & n233) | (n10 & n233);
n332 = (n12 ^ n28) ^ n283;
n333 = (n12 & n28) | (n28 & n283) | (n12 & n283);
n382 = (n14 ^ n30) ^ n333;
n383 = (n14 & n30) | (n30 & n333) | (n14 & n333);
c |= (n33 & 0x1) << 0;
c |= (n83 & 0x1) << 1;
c |= (n132 & 0x1) << 2;
c |= (n182 & 0x1) << 3;
c |= (n232 & 0x1) << 4;
c |= (n282 & 0x1) << 5;
c |= (n332 & 0x1) << 6;
c |= (n382 & 0x1) << 7;
c |= (n383 & 0x1) << 8;
return c;
}