GAL16V8
MODULE GAL16V8QUINDNF10152026
CLK X3 X2 X1 X0 NC NC NC NC GND
/OE Y NC NC NC NC NC NC NC VCC
y = /x3 * /x2 * x1 +
/x3 * x2 * /x0 +
/x3 * x2 * /x1 * x0 +
x3 * /x2 * /x1 * x0 +
x3 * x2 * /x1 * /x0 +
x3 * x2 * x1 * x0
DESCRIPTION
This is quine again.
versuchen daraus ein C programm machen.
GAL16V8
MODULE GAL16V8QUINDNF10152026
CLK X3 X2 X1 X0 NC NC NC NC GND
/OE Y NC NC NC NC NC NC NC VCC
y = (!x3 && !x2 && x1) ||
(!x3 && x2 && !x0) ||
(!x3 && x2 && !x1 && x0) ||
(x3 && !x2 && !x1 && x0) ||
(x3 && x2 && !x1 && !x0) ||
(x3 && x2 && x1 && x0);
DESCRIPTION
This is quine again.
das koennte die erste ersetzung sein.
#include <stdio.h>
/*
GAL16V8
MODULE GAL16V8QUINDNF10152026
CLK X3 X2 X1 X0 NC NC NC NC GND
/OE Y NC NC NC NC NC NC NC VCC
*/
int main (void) {
int x3, x2, x1, x0;
y = (!x3 && !x2 && x1) ||
(!x3 && x2 && !x0) ||
(!x3 && x2 && !x1 && x0) ||
(x3 && !x2 && !x1 && x0) ||
(x3 && x2 && !x1 && !x0) ||
(x3 && x2 && x1 && x0);
// jetzt kommt eine globale funktion
// und eine funktion
// y muss da rein, ...
}
// DESCRIPTION
// This is quine again.
ok, folgendes:
#include <stdio.h>
#include <stdlib.h>
/*
GAL16V8
MODULE GAL16V8QUINDNF10152026
CLK X3 X2 X1 X0 NC NC NC NC GND
/OE Y NC NC NC NC NC NC NC VCC
*/
int main (void) {
int x3, x2, x1, x0;
srand (1023);
// was hat das hier zu suchen, weiss ich nicht?
// kann trotzdem da bleiben.
y = (!x3 && !x2 && x1) ||
(!x3 && x2 && !x0) ||
(!x3 && x2 && !x1 && x0) ||
(x3 && !x2 && !x1 && x0) ||
(x3 && x2 && !x1 && !x0) ||
(x3 && x2 && x1 && x0);
// jetzt kommt eine globale funktion
// und eine funktion
// y muss da rein, ...
// das kann trotzdem stehen bleiben, weil
// es programmiertechnisch jetzt so, keine
// auswirkungen hat.
}
// DESCRIPTION
// This is quine again.
int f (int x3, int x2, int x1, int x0) {
y = (!x3 && !x2 && x1) ||
(!x3 && x2 && !x0) ||
(!x3 && x2 && !x1 && x0) ||
(x3 && !x2 && !x1 && x0) ||
(x3 && x2 && !x1 && !x0) ||
(x3 && x2 && x1 && x0);
return y;
}
void h (void) {
// alternative: fdebug
int x3, x2, x1, x0;
x3 = 1;
while {
x2 = 1;
while {
x1 = 1;
while {
x0 = 1;
while {
y = f (x3, x2, x1, x0);
printf ("%i %i %i %i %i\n", x3, x2, x1, x0, y);
x0 = !x0;
} do (x0 != 1);
x1 = !x1;
} do (x1 != 1);
x2 = !x2;
} do (x2 != 1);
x3 = !x3;
} do (x3 != 1);
return;
}
musste verbessert werden zu:
#include <stdio.h>
#include <stdlib.h>
/*
GAL16V8
MODULE GAL16V8QUINDNF10152026
CLK X3 X2 X1 X0 NC NC NC NC GND
/OE Y NC NC NC NC NC NC NC VCC
*/
int f (int, int, int, int);
void h (void);
int main (void) {
int x3, x2, x1, x0;
int y;
srand (1023);
// was hat das hier zu suchen, weiss ich nicht?
// kann trotzdem da bleiben.
y = (!x3 && !x2 && x1) ||
(!x3 && x2 && !x0) ||
(!x3 && x2 && !x1 && x0) ||
(x3 && !x2 && !x1 && x0) ||
(x3 && x2 && !x1 && !x0) ||
(x3 && x2 && x1 && x0);
h ();
// jetzt kommt eine globale funktion
// und eine funktion
// y muss da rein, ...
// das kann trotzdem stehen bleiben, weil
// es programmiertechnisch jetzt so, keine
// auswirkungen hat.
}
// DESCRIPTION
// This is quine again.
int f (int x3, int x2, int x1, int x0) {
int y;
y = (!x3 && !x2 && x1) ||
(!x3 && x2 && !x0) ||
(!x3 && x2 && !x1 && x0) ||
(x3 && !x2 && !x1 && x0) ||
(x3 && x2 && !x1 && !x0) ||
(x3 && x2 && x1 && x0);
return y;
}
void h (void) {
// alternative: fdebug
int x3, x2, x1, x0;
int y;
x3 = 1;
do {
x2 = 1;
do {
x1 = 1;
do {
x0 = 1;
do {
y = f (x3, x2, x1, x0);
printf ("%i %i %i %i %i\n", x3, x2, x1, x0, y);
x0 = !x0;
} while (x0 != 1);
x1 = !x1;
} while (x1 != 1);
x2 = !x2;
} while (x2 != 1);
x3 = !x3;
} while (x3 != 1);
return;
}
und jetzt ein schaltwerk probieren. jetzt haben wir hier lösungen gefunden, die tun tatsächlich: das erste ist ein rs-flip flop
#include <stdio.h>
#include <stdlib.h>
/*
GAL16V8
MODULE GAL16V8QUINDNF10152026
CLK X3 X2 X1 X0 NC NC NC NC GND
/OE Y NC NC NC NC NC NC NC VCC
*/
int f (int, int, int, int);
void h (void);
int main (void) {
int x3, x2, x1, x0;
int y;
int q, qs;
int r, s;
r = 0;
s = 1;
q = !(r || qs);
qs = !(s || q);
printf ("%i %i\n", q, qs);
r = 0;
s = 0;
q = !(r || qs);
qs = !(s || q);
printf ("%i %i\n", q, qs);
r = 0;
s = 1;
q = !(r || qs);
qs = !(s || q);
printf ("%i %i\n", q, qs);
r = 0;
s = 0;
q = !(r || qs);
qs = !(s || q);
printf ("%i %i\n", q, qs);
r = 1;
s = 0;
q = !(r || qs);
qs = !(s || q);
printf ("%i %i\n", q, qs);
r = 0;
s = 0;
q = !(r || qs);
qs = !(s || q);
printf ("%i %i\n", q, qs);
srand (1023);
// was hat das hier zu suchen, weiss ich nicht?
// kann trotzdem da bleiben.
y = (!x3 && !x2 && x1) ||
(!x3 && x2 && !x0) ||
(!x3 && x2 && !x1 && x0) ||
(x3 && !x2 && !x1 && x0) ||
(x3 && x2 && !x1 && !x0) ||
(x3 && x2 && x1 && x0);
h ();
// jetzt kommt eine globale funktion
// und eine funktion
// y muss da rein, ...
// das kann trotzdem stehen bleiben, weil
// es programmiertechnisch jetzt so, keine
// auswirkungen hat.
}
// DESCRIPTION
// This is quine again.
int f (int x3, int x2, int x1, int x0) {
int y;
y = (!x3 && !x2 && x1) ||
(!x3 && x2 && !x0) ||
(!x3 && x2 && !x1 && x0) ||
(x3 && !x2 && !x1 && x0) ||
(x3 && x2 && !x1 && !x0) ||
(x3 && x2 && x1 && x0);
return y;
}
void h (void) {
// alternative: fdebug
int x3, x2, x1, x0;
int y;
x3 = 1;
do {
x2 = 1;
do {
x1 = 1;
do {
x0 = 1;
do {
y = f (x3, x2, x1, x0);
printf ("%i %i %i %i %i\n", x3, x2, x1, x0, y);
x0 = !x0;
} while (x0 != 1);
x1 = !x1;
} while (x1 != 1);
x2 = !x2;
} while (x2 != 1);
x3 = !x3;
} while (x3 != 1);
return;
}
so, jetzt kommt dff und dlatch:
#include <stdio.h>
#include <stdlib.h>
/*
GAL16V8
MODULE GAL16V8QUINDNF10152026
CLK X3 X2 X1 X0 NC NC NC NC GND
/OE Y NC NC NC NC NC NC NC VCC
*/
int f (int, int, int, int);
void h (void);
int crslatch(int r, int s, int c) {
int q, qs;
q = !((r && c) || qs);
qs = !((s && c) || q);
return q;
}
int dlatch (int c, int d) {
int q, qs;
q = !((d && c) || qs);
qs = !((!d && c) || q);
return q;
}
int dff (int c, int d) {
int q, qs;
dlatch (c, dlatch(!c, d))
return q;
}
int main (void) {
int x3, x2, x1, x0;
int y;
int q, qs;
int r, s;
int c;
r = 0;
s = 1;
c = 0;
c = 1;
q = !((r && c) || qs);
qs = !((s && c) || q);
printf ("%i %i\n", q, qs);
r = 0;
s = 0;
q = !((r && c) || qs);
qs = !((s && c) || q);
printf ("%i %i\n", q, qs);
c = 0;
r = 0;
s = 1;
q = !((r && c) || qs);
qs = !((s && c) || q);
printf ("%i %i\n", q, qs);
r = 0;
s = 0;
q = !((r && c) || qs);
qs = !((s && c) || q);
printf ("%i %i\n", q, qs);
r = 1;
s = 0;
q = !((r && c) || qs);
qs = !((s && c) || q);
printf ("%i %i\n", q, qs);
r = 0;
s = 0;
q = !((r && c) || qs);
qs = !((s && c) || q);
printf ("%i %i\n", q, qs);
srand (1023);
// was hat das hier zu suchen, weiss ich nicht?
// kann trotzdem da bleiben.
y = (!x3 && !x2 && x1) ||
(!x3 && x2 && !x0) ||
(!x3 && x2 && !x1 && x0) ||
(x3 && !x2 && !x1 && x0) ||
(x3 && x2 && !x1 && !x0) ||
(x3 && x2 && x1 && x0);
h ();
// jetzt kommt eine globale funktion
// und eine funktion
// y muss da rein, ...
// das kann trotzdem stehen bleiben, weil
// es programmiertechnisch jetzt so, keine
// auswirkungen hat.
}
// DESCRIPTION
// This is quine again.
int f (int x3, int x2, int x1, int x0) {
int y;
y = (!x3 && !x2 && x1) ||
(!x3 && x2 && !x0) ||
(!x3 && x2 && !x1 && x0) ||
(x3 && !x2 && !x1 && x0) ||
(x3 && x2 && !x1 && !x0) ||
(x3 && x2 && x1 && x0);
return y;
}
void h (void) {
// alternative: fdebug
int x3, x2, x1, x0;
int y;
x3 = 1;
do {
x2 = 1;
do {
x1 = 1;
do {
x0 = 1;
do {
y = f (x3, x2, x1, x0);
printf ("%i %i %i %i %i\n", x3, x2, x1, x0, y);
x0 = !x0;
} while (x0 != 1);
x1 = !x1;
} while (x1 != 1);
x2 = !x2;
} while (x2 != 1);
x3 = !x3;
} while (x3 != 1);
return;
}
so, also es funktioniert mit den FF und RS-Latch
\begin{verbatim}
#include <stdio.h>
#include <stdlib.h>
/*
GAL16V8
MODULE GAL16V8QUINDNF10152026
CLK X3 X2 X1 X0 NC NC NC NC GND
/OE Y NC NC NC NC NC NC NC VCC
*/
int f (int, int, int, int);
void h (void);
int crslatch(int r, int s, int c) {
int q, qs;
q = !((r && c) || qs);
qs = !((s && c) || q);
return q;
}
int dlatch (int c, int d) {
int q, qs;
q = !((d && c) || qs);
qs = !((!d && c) || q);
return q;
}
int dff (int c, int d) {
int q, qs;
dlatch (c, dlatch(!c, d))
return q;
}
int main (void) {
int x3, x2, x1, x0;
int y;
int q, qs;
int r, s;
int c;
r = 0;
s = 1;
c = 0;
c = 1;
q = !((r && c) || qs);
qs = !((s && c) || q);
printf ("%i %i\n", q, qs);
r = 0;
s = 0;
q = !((r && c) || qs);
qs = !((s && c) || q);
printf ("%i %i\n", q, qs);
c = 0;
r = 0;
s = 1;
q = !((r && c) || qs);
qs = !((s && c) || q);
printf ("%i %i\n", q, qs);
r = 0;
s = 0;
q = !((r && c) || qs);
qs = !((s && c) || q);
printf ("%i %i\n", q, qs);
r = 1;
s = 0;
q = !((r && c) || qs);
qs = !((s && c) || q);
printf ("%i %i\n", q, qs);
r = 0;
s = 0;
q = !((r && c) || qs);
qs = !((s && c) || q);
printf ("%i %i\n", q, qs);
srand (1023);
// was hat das hier zu suchen, weiss ich nicht?
// kann trotzdem da bleiben.
y = (!x3 && !x2 && x1) ||
(!x3 && x2 && !x0) ||
(!x3 && x2 && !x1 && x0) ||
(x3 && !x2 && !x1 && x0) ||
(x3 && x2 && !x1 && !x0) ||
(x3 && x2 && x1 && x0);
h ();
// jetzt kommt eine globale funktion
// und eine funktion
// y muss da rein, ...
// das kann trotzdem stehen bleiben, weil
// es programmiertechnisch jetzt so, keine
// auswirkungen hat.
}
// DESCRIPTION
// This is quine again.
int f (int x3, int x2, int x1, int x0) {
int y;
y = (!x3 && !x2 && x1) ||
(!x3 && x2 && !x0) ||
(!x3 && x2 && !x1 && x0) ||
(x3 && !x2 && !x1 && x0) ||
(x3 && x2 && !x1 && !x0) ||
(x3 && x2 && x1 && x0);
return y;
}
void h (void) {
// alternative: fdebug
int x3, x2, x1, x0;
int y;
x3 = 1;
do {
x2 = 1;
do {
x1 = 1;
do {
x0 = 1;
do {
y = f (x3, x2, x1, x0);
printf ("%i %i %i %i %i\n", x3, x2, x1, x0, y);
x0 = !x0;
} while (x0 != 1);
x1 = !x1;
} while (x1 != 1);
x2 = !x2;
} while (x2 != 1);
x3 = !x3;
} while (x3 != 1);
return;
}
funktioniert die sache, also das geht in C - mit RS Latch mit Takt, jetzt bin ich ueberfordert und lasse es. das war die grundlage fuer den automaten mit halbleiter technik im pc. und: trotzdem kann man den automat mit feldern machen und das benutzen wir fuer das unentscheidbare.