-
Notifications
You must be signed in to change notification settings - Fork 0
/
6lut.c
47 lines (39 loc) · 970 Bytes
/
6lut.c
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
#include <stdio.h>
#include <assert.h>
#include "tests.h"
#include "struct.h"
#include "utils.h"
int getQ(unsigned char C);
int main(int argc, char *argv[])
{
/* input pins to LUT KEY
1 = 0 100000
2 = 1 010000
4 = 2 001000
8 = 3 000100
16 = 4 000010
32 = 5 000001
Lookup table 0-127 (128 symbols) outputs LSB Q and !Q (via assert)
*/
// just for setup:
//outputter();
// debug ^^
Lut lut6;
const unsigned char MAXLUTIN = 252; // 000000** - 111111** inclusive.
const unsigned char MAXLUTOUT = 2; // ******00 - ******10 (so 01 and 10)
unsigned char i = 0;
for (i=0;i<=(MAXLUTIN+MAXLUTOUT);i++) {
if (get_bit_from_char(i, 0) != get_bit_from_char(i,1)) {
lut6.lut=i;
printf("%d\tQ=%d\tQ_PRIME=%d\t",lut6.lut,getQ(lut6.lut),!getQ(lut6.lut));
printf("BINARY: ");
outputter(i);
}
}
return 0;
}
int getQ(unsigned char C)
{
assert(get_bit_from_char(C, 0) != get_bit_from_char(C,1));
return(get_bit_from_char(C, 1));
}