Vojta Mrazek bee2086705
Devel (#2)
* CGP format

* CGP format minor

* General MAC circuit

* Modified definition of MAC class to allow proper generation of output representations.

* auto test MAC

* test all

* Made some minor changes and updated creation of MAC circuit.

* Updated logic behind generating export representations, mainly focused around circuit and its buses and subcomponents namings.

* Made some minor changes concerning proper exportation of multiplier circuits.

Co-authored-by: honzastor <jan.klhufek@gmail.com>
2021-09-18 12:55:31 +02:00

23 lines
404 B
C

#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
uint64_t mac(uint64_t a,uint64_t b,uint64_t acc);
int main() {
int result = 0;
srand(42);
for(int i = 0; i < 10000; i++) {
uint64_t a, b, acc;
a = rand() % 256;
b = rand() % 256;
acc = rand() % 65536;
result = (a * b) + acc;
assert(result == mac(a, b, acc));
}
return 0;
}