% 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.

function [ c ] = add8_025( a, b )
% Approximate function add8_025
%  Library = EvoApprox8b
%  Circuit = add8_025
%  Area   (180) = 984
%  Delay  (180) = 0.780
%  Power  (180) = 269.10
%  Area   (45) = 66
%  Delay  (45) = 0.330
%  Power  (45) = 22.02
%  Nodes = 20
%  HD = 190592
%  MAE = 4.62500
%  MSE = 32.50000
%  MRE = 2.49 %
%  WCE = 15
%  WCRE = 900 %
%  EP = 93.8 %
  a = uint16(a);
  b = uint16(b);
  c = 0;
  n6 = bitand(bitshift(a, -3), 1, 'uint16');
  n8 = bitand(bitshift(a, -4), 1, 'uint16');
  n10 = bitand(bitshift(a, -5), 1, 'uint16');
  n12 = bitand(bitshift(a, -6), 1, 'uint16');
  n14 = bitand(bitshift(a, -7), 1, 'uint16');
  n22 = bitand(bitshift(b, -3), 1, 'uint16');
  n24 = bitand(bitshift(b, -4), 1, 'uint16');
  n26 = bitand(bitshift(b, -5), 1, 'uint16');
  n28 = bitand(bitshift(b, -6), 1, 'uint16');
  n30 = bitand(bitshift(b, -7), 1, 'uint16');
  n37 = bitcmp(bitxor(n30, n30));
  n44 = bitor(n28, n12);
  n45 = bitor(n28, n12);
  n64 = n45;
  n68 = bitxor(n8, n24);
  n69 = bitand(n8, n24);
  n70 = n69;
  n71 = n69;
  n78 = bitxor(n10, n26);
  n79 = bitand(n10, n26);
  n86 = bitxor(n12, n28);
  n87 = bitand(n12, n28);
  n96 = bitxor(n14, n30);
  n97 = bitand(n14, n30);
  n130 = bitand(n10, n26);
  n134 = bitor(n26, n10);
  n162 = bitand(n44, n130);
  n181 = bitor(n87, n162);
  n226 = bitand(n134, n70);
  n227 = bitand(n134, n70);
  n245 = bitor(n79, n227);
  n255 = bitand(n64, n226);
  n273 = bitor(n181, n255);
  n394 = bitxor(n78, n71);
  n404 = bitxor(n86, n245);
  n412 = bitxor(n96, n273);
  n413 = bitand(n96, n273);
  n422 = bitor(n97, n413);
  c = bitor(c, bitshift(bitand(n37, 1), 0));
  c = bitor(c, bitshift(bitand(n22, 1), 1));
  c = bitor(c, bitshift(bitand(n6, 1), 2));
  c = bitor(c, bitshift(bitand(n37, 1), 3));
  c = bitor(c, bitshift(bitand(n68, 1), 4));
  c = bitor(c, bitshift(bitand(n394, 1), 5));
  c = bitor(c, bitshift(bitand(n404, 1), 6));
  c = bitor(c, bitshift(bitand(n412, 1), 7));
  c = bitor(c, bitshift(bitand(n422, 1), 8));
end