How to use the model from Matlab
websave("mex_evoapprox.c","https://ehw.fit.vutbr.cz/evoapproxlib/mex_evoapprox.c");
websave("add8_078.c","https://raw.githubusercontent.com/ehw-fit/evoapprox8b/master/adders_8/source_c/add8_078.c");
mex mex_evoapprox.c add8_078.c -DEXTFUN=add8_078 -DOPTYPE=uint8_t -DRESTYPE=uint16_t -output add8_078;
add8_078(123,210)
add8_078([1,2,3,4,5],[10,20,30,40,50])
BW = 8
allcombs = [0:1:2^(BW+BW)-1];
inputs = [floor(allcombs/2^BW); mod(allcombs,2^BW)];
req = inputs(1,:)+inputs(2,:);
res = add8_078(inputs(1,:),inputs(2,:));
ED = req - res;
ep=sum(ED~=0)/length(ED)
wce=max(abs(ED))
nwce=max(abs(ED))/(2^(BW+BW))
nwce=max(abs(ED))/(2^(BW+1))
mae=mean(abs(ED))
mse=mean(ED.^2)