Created
November 8, 2012 16:38
-
-
Save antoinealb/4039949 to your computer and use it in GitHub Desktop.
Generator of logisim table for EPFL's CS-171 course's 3rd lab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void print_number(char num, int bitsize) { | |
while(bitsize--) { | |
if(num & (1 << bitsize)) | |
printf("1"); | |
else | |
printf("0"); | |
printf("\t"); | |
} | |
} | |
void main(void) { | |
char a, b; | |
printf("A3\tA2\tA1\tA0\tB3\tB2\tB1\tB0\tQ\tC3\tC2\tC1\tC0\n"); | |
for(a=0;a<16;a++) { | |
for(b=0;b<16;b++) { | |
print_number(a, 4); | |
print_number(b, 4); | |
print_number(a-b, 5); | |
printf("\n"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment