Als erstes muss ich ein Übungsprogramm schreiben, mit dem ich gut unär codierte Automaten üben kann
Was ich bisher bei den Automaten gemacht habe, waren auch nicht unbedingt binär Codierte Automaten. Man kann das sicher so machen. Vor allem mit EPROM bequem. Trotzdem, man kann vor ein binär Codiertes Register. einen Encoder schalten. Danach ein Dekoder
Das übliche ist aber ein unär codierter Automat.
Und zwar wie folgt
Zustände werden von 0 beginnend, konsekutiv nummeriert, unär codiert gespeichert
Ich habe das ausprobiert. Das erspart wesentlich Elemente beim Schaltnetz. Beim Übergangsschaltnetz
Ich werde das von nun an auf so machen
Ich möchte noch an einen Satz erinnern
Eine Ampel steht normalerweise auf rot. Drückt man den Knopf geht/wechselt sie auf grün, verbleibt dort für 3s und wechselt wieder auf rot.
Die entsprechungen Funktionsgleichungen sehen wie folgt aus
[code]
z0+ = z0 AND NOT Knopf OR z2
z1+ = z0 AND Knopf
z2+ = z1
Farbe = z0 AND Knopf OR z1 OR z2
[/code]
Wie kommt es dazu? Zunächst, was wir sehen, dieses Übergangsschaltnetz aber auch das Ausgangsschaltnetz ist minimiert worden. Ich kenne diese Formeln auswendig. Und halte auch die Regeln für die Ampel für würdig auswendig gelernt zu werden. Normalerweise wird es nicht bei drei Sekunden bleiben. Was ist zu tun, wenn wir eine Feste Taktdauer haben? Dann führen wir einen weiteren Zustand ein
[code]
z0+ = z0 AND NOT Knopf OR z3
z1+ = z0 AND Knopf
z2+ = z1
z3+ = z2
Farbe = z0 AND Knopf OR z1 OR z2
[/code]
Die Regel ist relativ schnell gelernt. Es handelt sich um einen Mealy Automaten. Zunächst müssen wir wissen, was ein Signal ist. Und wir dürfen den Takt nicht verwechseln
Ein Taktsignal ist ein Takt, während er steigende Flanke hat. Auch das ist ein Signal. Wir müssen bei der Ampel zwischen drei Signalen unterscheiden
[list=1]
[*] Der Knopf, den der Fussgänger drückt, das ist eine Eingabe [code]i[/code]
[*] Das Licht, bzw,. die Farbe [code]ro, ge, gr[/code], die der Fussgänger sieht, das ist aber eine Ausgabe [code]o[/code]
[*] Das Taktsignal mit Steigender Flanke [code]clk[/code]
[/list]
Für den Fussgänger ist beides ein Signal, nicht nur die Farbe, auf der die Ampel steht, sondern er sender ein Signal an die Ampel. Für den Automaten
[code]
i/o
:=
i
o
[/code]
Sind Eingabe und Ausgabe Signale
Wieso ist diese Formel einfach? Es handelt sich um einen Mealy Automaten. Und [code]z0+[/code] bleibt solange in [code]z0[/code] Also der Zustand [code]Z0[/code] bleibt solange [code]Z0[/code] solange nicht Knopf gedrückt ist, oder die Folge von Zustand [code]Z2[/code]. Ist Knopf gedrückt, folgt Automatisch Zustand [code]Z1[/code], darauf automatisch Zustand [code]Z2[/code]
Ich möchte jetzt einen Automatengenerator schreiben. er schreibt die Tabelle nicht in der üblichen Form auf. Das bedeutet
[code]
Zustand Eingabe Ausgabe Folgezustand Code Folgezustand
z0+ z1+ z2+
[/code]
Sondern hier muss ich schon überlegen, wie ich das mache. Wahrscheinlich so
[code]
Zustand Eingabe Ausgabe Folgezustand
[/code]
Ich habe immer eine Eingabe
[code]
x0, x1
[/code]
Weil mit einer einzigen, wird es langweilig. Und vier Zustände
[code]
Z0, Z1, Z2, Z3
[/code]
So, jeder Zustand muss ein Mal irgendwie erreicht werden. Es muss nicht jede Eingabe bedient werden. Das sind die Bedingungen für das Übungsprogramm
[code]
david@laptop-peaq:~$ ./a.out
Zustand Eingabe Ausgabe Folgezustand
0 00 0 3
0 01 0 2
0 11 0 2
1 00 1 0
1 01 1 1
1 10 0 1
1 11 1 1
2 00 0 2
2 01 0 3
2 10 0 0
2 11 0 3
3 00 1 1
david@laptop-peaq:~$
[/code]
[code]
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define EMPTY_Z -1
#define UNINIT_Z -2
int main (void) {
time_t t;
int x0line, x1line, x2line, x3line;
int nfollowed;
int z0reached, z1reached, z2reached, z3reached;
int i, j;
int z [4][4];
int k, l;
int v;
int nf;
srand ((unsigned)time (&t));
z0reached = 0;
z1reached = 0;
z2reached = 0;
z3reached = 0;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
z [i][j] = EMPTY_Z;
}
nfollowed = 0;
for (i = 0; i < 4; i++) {
x0line = rand () % 2;
x1line = rand () % 2;
x2line = rand () % 2;
x3line = rand () % 2;
nfollowed += x0line + x1line + x2line + x3line;
if (x0line == 1)
z [i][0] = UNINIT_Z;
if (x1line == 1)
z [i][1] = UNINIT_Z;
if (x2line == 1)
z [i][2] = UNINIT_Z;
if (x3line == 1)
z [i][3] = UNINIT_Z;
if ((x0line + x1line + x2line + x3line) == 0) {
z [i][0] = UNINIT_Z;
nfollowed += 1;
}
}
z0reached = 0;
z1reached = 0;
z2reached = 0;
z3reached = 0;
nf = nfollowed;
for (i = 0, k = 0, l = 0; i < nf; i++) {
v = rand () % 4;
if (v == 0)
z0reached = 1;
if (v == 1)
z1reached = 1;
if (v == 2)
z2reached = 1;
if (v == 3)
z3reached = 1;
while ((k < 4) && (l < 4) && (z [k][l] != UNINIT_Z)) {
while ((l < 4) && (z [k][l] != UNINIT_Z))
l++;
if (z [k][l] != UNINIT_Z) {
l = 0;
k++;
}
}
nfollowed--;
if (nfollowed == (z0reached + z1reached + z2reached + z3reached)) {
if (z0reached == 0) {
v = 0;
z0reached = 1;
}
else if (z1reached == 0) {
v = 1;
z1reached = 1;
}
else if (z2reached == 0) {
v = 2;
z2reached = 1;
}
else if (z3reached == 0) {
v = 3;
z3reached = 1;
}
}
z [k][l] = v;
k += (l/4);
l = (l+1) % 4;
}
printf ("Zustand\tEingabe\tAusgabe\tFolgezustand\n");
for (i = 0; i < 4; i++) {
if (z [i][0] != EMPTY_Z)
printf ("%i\t\t00\t\t%i\t\t%i\n", i, rand () % 2, z [i][0]);
if (z [i][1] != EMPTY_Z)
printf ("%i\t\t01\t\t%i\t\t%i\n", i, rand () % 2, z [i][1]);
if (z [i][2] != EMPTY_Z)
printf ("%i\t\t10\t\t%i\t\t%i\n", i, rand () % 2, z [i][2]);
if (z [i][3] != EMPTY_Z)
printf ("%i\t\t11\t\t%i\t\t%i\n", i, rand () % 2, z [i][3]);
}
return 0;
}
[/code]
So, zu dieser Übung mache ich den Automaten
[code]
Zustand Eingabe Ausgabe Folgezustand
0 10 1 3
1 10 0 2
2 10 1 1
2 11 1 0
3 00 1 1
3 01 0 1
3 11 0 1
[/code]
wie wir sehen, ist noch ein Fehler im Programm drin
[code]
Zustand Eingabe Ausgabe Folgezustand
0 00 0 0
0 01 1 0
0 10 1 0
1 00 0 0
1 01 0 0
1 11 1 1
2 00 1 2
2 11 1 3
3 11 0 1
Zustand Eingabe Ausgabe Folgezustand
0 10 1 3
1 10 0 2
2 10 1 1
2 11 1 0
3 00 1 1
3 01 0 1
3 11 0 1
Zustand Eingabe Ausgabe Folgezustand Code Folgezustand
z3+ z2+ z1+ z0+
0 10 1 3 1 0 0 0
1 10 0 2 0 1 0 0
2 10 1 1 0 0 1 0
2 11 1 0 0 0 0 1
3 00 1 1 0 0 1 0
3 01 0 1 0 0 1 0
3 11 0 1 0 0 1 0
[/code]
was ist mit den übrigen Eingaben?
Also, meine einfachste Idee, wäre ein Mal in die eine Richtung zu sortieren, mal in die andere. Reihenweise
[code]
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define EMPTY_Z -1
#define UNINIT_Z -2
int main (void) {
time_t t;
int i, j;
int z [4][4];
int v;
int k, l;
srand ((unsigned)time (&t));
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
z [i][j] = j;
}
for (i = 0; i < 4; i++) {
if ((rand () % 2) == 0) {
for (k = 0; k < 4; k++) {
for (l = k + 1; l < 4; l++) {
if (z[i][l] > z[i][k]) {
t = z [i][l];
z [i][l] = z[i][k];
z [i][k] = t;
}
}
}
}
}
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
printf ("%i ", z[i][j]);
printf ("\n");
}
return 0;
}
[/code]
Im nächsten Schritt Spaltenweise. Dann wieder Zeilweise und so weiter. So lange wie man lustig ist.
[code]
david@laptop-peaq:~$ ./a.out
3 0 0 0
0 1 2 3
0 1 2 3
3 0 0 0
david@laptop-peaq:~$ gcc automat5.c
david@laptop-peaq:~$ ./a.out
0 1 2 3
3 2 1 0
3 2 1 0
3 2 1 0
david@laptop-peaq:~$ ./a.out
3 2 1 0
3 2 1 0
0 1 2 3
3 2 1 0
david@laptop-peaq:~$ ./a.out
0 1 2 3
3 2 1 0
3 2 1 0
3 2 1 0
david@laptop-peaq:~$ ./a.out
3 2 1 0
0 1 2 3
3 2 1 0
0 1 2 3
david@laptop-peaq:~$ ./a.out
3 2 1 0
3 2 1 0
3 2 1 0
0 1 2 3
david@laptop-peaq:~$
[/code]
[code]
david@laptop-peaq:~$ gcc automat5.c
david@laptop-peaq:~$ ./a.out
0 2 2 3
3 1 2 0
0 1 2 3
0 1 1 3
david@laptop-peaq:~$ ./a.out
0 1 2 3
0 1 2 3
3 2 1 0
3 2 1 0
david@laptop-peaq:~$ ./a.out
3 2 2 3
0 1 2 3
0 1 1 0
3 2 1 0
david@laptop-peaq:~$
[/code]
[code]
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define EMPTY_Z -1
#define UNINIT_Z -2
int main (void) {
time_t t;
int i, j;
int z [4][4];
int v;
int k, l;
srand ((unsigned)time (&t));
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
z [i][j] = j;
}
for (i = 0; i < 4; i++) {
if ((rand () % 2) == 0) {
for (k = 0; k < 4; k++) {
for (l = k + 1; l < 4; l++) {
if (z[i][l] > z[i][k]) {
t = z [i][l];
z [i][l] = z[i][k];
z [i][k] = t;
}
}
}
}
}
for (j = 0; j < 4; j++) {
if ((rand () % 2) == 0) {
for (k = 0; k < 4; k++) {
for (l = k + 1; l < 4; l++) {
if (z[l][j] > z[k][j]) {
t = z [l][j];
z [l][j] = z[k][j];
z [k][j] = t;
}
}
}
}
}
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
printf ("%i ", z[i][j]);
printf ("\n");
}
return 0;
}
[/code]
Jetzt machen wir das randomized oft
Ich habe jetzt folgendes hingekriegt
[code]
david@laptop-peaq:~$ gcc automat5.c
david@laptop-peaq:~$ ./a.out
0 3 3 0
1 2 2 1
2 1 1 3
2 0 0 3
david@laptop-peaq:~$ ./a.out
0 3 3 0
1 2 2 1
2 1 1 3
2 0 0 3
david@laptop-peaq:~$ ./a.out
3 0 3 3
3 1 2 2
1 2 1 0
0 2 1 0
david@laptop-peaq:~$ ./a.out
3 1 3 3
0 1 2 3
0 1 2 2
0 2 1 0
david@laptop-peaq:~$ ./a.out
3 1 3 3
0 1 2 3
0 1 2 2
0 2 1 0
david@laptop-peaq:~$ ./a.out
0 0 0 0
2 2 1 1
3 2 1 1
3 3 2 3
david@laptop-peaq:~$ ./a.out
0 0 1 0
0 1 1 2
1 2 2 3
2 3 3 3
david@laptop-peaq:~$
[/code]
Mit dem Code
[code]
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define EMPTY_Z -1
#define UNINIT_Z -2
int main (void) {
time_t t;
int i, j;
int z [4][4];
int v;
int k, l;
int n;
srand ((unsigned)time (&t));
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
z [i][j] = j;
}
for (n = rand () % 100; n >= 0; n--) {
for (i = 0; i < 4; i++) {
if ((rand () % 2) == 0) {
for (k = 0; k < 4; k++) {
for (l = k + 1; l < 4; l++) {
if (z[i][l] > z[i][k]) {
t = z [i][l];
z [i][l] = z[i][k];
z [i][k] = t;
}
}
}
}
else {
for (k = 0; k < 4; k++) {
for (l = k + 1; l < 4; l++) {
if (z[i][l] < z[i][k]) {
t = z [i][l];
z [i][l] = z[i][k];
z [i][k] = t;
}
}
}
}
}
for (j = 0; j < 4; j++) {
if ((rand () % 2) == 0) {
for (k = 0; k < 4; k++) {
for (l = k + 1; l < 4; l++) {
if (z[l][j] > z[k][j]) {
t = z [l][j];
z [l][j] = z[k][j];
z [k][j] = t;
}
}
}
}
else {
for (k = 0; k < 4; k++) {
for (l = k + 1; l < 4; l++) {
if (z[l][j] < z[k][j]) {
t = z [l][j];
z [l][j] = z[k][j];
z [k][j] = t;
}
}
}
}
}
}
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
printf ("%i ", z[i][j]);
printf ("\n");
}
return 0;
}
[/code]
Ich habe jetzt für den Fall, dass bei der Sortierung [code]JA[/code] gesagt, beim Gegenteil, nicht etwa, die Sortierung nicht geamcht, sonst stagniert es. Dann wird es zu einer Matrix in Treppennormalform ähnlichem etwas, sehr seltsam. Mal sammeln sich die einsen Senkrecht, mal wagerecht. Aber dann wird es sortiert sein. Deswegen, ist die Möglichkeit, dass man es jenachdem ein Mal so rum sortiert ein Mal so rum
Dass jetzt in einer Zeile 0,0,0,0 stehen lasse ich mal aus Gnade zum Algorithmus, so stehen.
Also, so sieht das Programm jetzt aus, Ausgabe
[code]
david@laptop-peaq:~$ ./a.out
0 0 0 0
3 1 1 1
3 2 2 1
3 2 2 3
Zustand Eingabe Ausgabe Folgezustand
0 0 0 0
0 1 1 0
0 2 2 0
0 3 2 0
1 0 3 3
1 1 3 1
1 2 1 1
1 3 1 1
2 0 3 3
2 1 1 2
2 2 2 2
2 3 0 1
3 0 1 3
3 1 1 2
3 2 2 2
3 3 2 3
david@laptop-peaq:~$
[/code]
Ich habe mir mal erlaubt, die Ausgabe
[code]y1y0[/code]
Und die Eingabe
[code]x1x0[/code]
nicht binär zu kodieren. Hier das Programm
[code]
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define EMPTY_Z -1
#define UNINIT_Z -2
int main (void) {
time_t t;
int i, j;
int z [4][4];
int v;
int k, l;
int n;
srand ((unsigned)time (&t));
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
z [i][j] = j;
}
for (n = rand () % 100; n >= 0; n--) {
for (i = 0; i < 4; i++) {
if ((rand () % 2) == 0) {
for (k = 0; k < 4; k++) {
for (l = k + 1; l < 4; l++) {
if (z[i][l] > z[i][k]) {
t = z [i][l];
z [i][l] = z[i][k];
z [i][k] = t;
}
}
}
}
else {
for (k = 0; k < 4; k++) {
for (l = k + 1; l < 4; l++) {
if (z[i][l] < z[i][k]) {
t = z [i][l];
z [i][l] = z[i][k];
z [i][k] = t;
}
}
}
}
}
for (j = 0; j < 4; j++) {
if ((rand () % 2) == 0) {
for (k = 0; k < 4; k++) {
for (l = k + 1; l < 4; l++) {
if (z[l][j] > z[k][j]) {
t = z [l][j];
z [l][j] = z[k][j];
z [k][j] = t;
}
}
}
}
else {
for (k = 0; k < 4; k++) {
for (l = k + 1; l < 4; l++) {
if (z[l][j] < z[k][j]) {
t = z [l][j];
z [l][j] = z[k][j];
z [k][j] = t;
}
}
}
}
}
}
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
printf ("%i ", z[i][j]);
printf ("\n");
}
printf ("Zustand\tEingabe\tAusgabe\tFolgezustand\n");
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
printf ("%i\t\t%i\t\t%i\t\t%i\n", i, j, rand () % 4, z[i][j]);
}
return 0;
}
[/code]
Diese Aufgabe mache ich jetzt
[code]
2 3 0 3
2 2 1 3
0 1 2 1
0 0 3 1
Zustand Eingabe Ausgabe Folgezustand
0 0 2 2
0 1 1 3
0 2 0 0
0 3 3 3
1 0 3 2
1 1 3 2
1 2 0 1
1 3 1 3
2 0 2 0
2 1 1 1
2 2 1 2
2 3 3 1
3 0 3 0
3 1 1 0
3 2 1 3
3 3 0 1
[/code]
So, ergibt das mit den Kodierungen einen gewissen sinn
[code]
2 3 0 3
2 2 1 3
0 1 2 1
0 0 3 1
Zustand Eingabe Ausgabe Folgezustand
0 0 2 2
0 1 1 3
0 2 0 0
0 3 3 3
1 0 3 2
1 1 3 2
1 2 0 1
1 3 1 3
2 0 2 0
2 1 1 1
2 2 1 2
2 3 3 1
3 0 3 0
3 1 1 0
3 2 1 3
3 3 0 1
Zustand Eingabe Ausgabe Folgezustand Code Folgezustand Code Eingabe Code Ausgabe
z3+ z2+ z1+ z0+ x1 x0 y1 y0
0 0 2 2 0 1 0 0 0 0 1 0
0 1 1 3 1 0 0 0 0 1 0 1
0 2 0 0 0 0 0 1 1 0 0 0
0 3 3 3 1 0 0 0 1 1 1 1
1 0 3 2 0 1 0 0 0 0 1 1
1 1 3 2 0 1 0 0 0 1 1 1
1 2 0 1 0 0 1 0 1 0 0 0
1 3 1 3 1 0 0 0 1 1 0 1
2 0 2 0 0 0 0 1 0 0 1 0
2 1 1 1 0 0 1 0 0 1 0 1
2 2 1 2 0 1 0 0 1 0 0 1
2 3 3 1 0 0 1 0 1 1 1 1
3 0 3 0 0 0 0 1 0 0 1 1
3 1 1 0 0 0 0 1 0 1 0 1
3 2 1 3 1 0 0 0 1 0 0 1
3 3 0 1 0 0 0 1 1 1 0 0
[/code]
[code]
Zustand Eingabe Ausgabe Folgezustand Code Folgezustand Code Eingabe Code Ausgabe
z3+ z2+ z1+ z0+ x1 x0 y1 y0
0 0 2 2 0 1 0 0 0 0 1 0
0 1 1 3 1 0 0 0 0 1 0 1
0 2 0 0 0 0 0 1 1 0 0 0
0 3 3 3 1 0 0 0 1 1 1 1
1 0 3 2 0 1 0 0 0 0 1 1
1 1 3 2 0 1 0 0 0 1 1 1
1 2 0 1 0 0 1 0 1 0 0 0
1 3 1 3 1 0 0 0 1 1 0 1
2 0 2 0 0 0 0 1 0 0 1 0
2 1 1 1 0 0 1 0 0 1 0 1
2 2 1 2 0 1 0 0 1 0 0 1
2 3 3 1 0 0 1 0 1 1 1 1
3 0 3 0 0 0 0 1 0 0 1 1
3 1 1 0 0 0 0 1 0 1 0 1
3 2 1 3 1 0 0 0 1 0 0 1
3 3 0 1 0 0 0 1 1 1 0 0
[/code]
Jetzt mache ich dazu das Schaltwerk und das nachher auch in VHDL.
Da kann man trotz allem ein Quine Mc Cluskey draus machen, ich zeige es gleich
Nein, kann man nicht, aber was ähnliches. Es geht nicht, weil die Zustände unär kodiert sind, deswegen nicht
Aber, man kann es geschickter hinschreiben
so ist das schon besser
[code]
2 3 0 3
2 2 1 3
0 1 2 1
0 0 3 1
Zustand Eingabe Ausgabe Folgezustand
0 0 2 2
0 1 1 3
0 2 0 0
0 3 3 3
1 0 3 2
1 1 3 2
1 2 0 1
1 3 1 3
2 0 2 0
2 1 1 1
2 2 1 2
2 3 3 1
3 0 3 0
3 1 1 0
3 2 1 3
3 3 0 1
Zustand Eingabe Ausgabe Folgezustand Code Folgezustand Code Eingabe Code Ausgabe
z3+ z2+ z1+ z0+ x1 x0 y1 y0
0 0 2 2 0 1 0 0 0 0 1 0
0 1 1 3 1 0 0 0 0 1 0 1
0 2 0 0 0 0 0 1 1 0 0 0
0 3 3 3 1 0 0 0 1 1 1 1
1 0 3 2 0 1 0 0 0 0 1 1
1 1 3 2 0 1 0 0 0 1 1 1
1 2 0 1 0 0 1 0 1 0 0 0
1 3 1 3 1 0 0 0 1 1 0 1
2 0 2 0 0 0 0 1 0 0 1 0
2 1 1 1 0 0 1 0 0 1 0 1
2 2 1 2 0 1 0 0 1 0 0 1
2 3 3 1 0 0 1 0 1 1 1 1
3 0 3 0 0 0 0 1 0 0 1 1
3 1 1 0 0 0 0 1 0 1 0 1
3 2 1 3 1 0 0 0 1 0 0 1
3 3 0 1 0 0 0 1 1 1 0 0
++++++++++++++++++++++++++
Zustand z3+
Zustand Eingabe Ausgabe Folgezustand Code Folgezustand Code Eingabe Code Ausgabe
z3+ z2+ z1+ z0+ x1 x0 y1 y0
0 1 1 3 1 0 0 0 0 1 0 1
0 3 3 3 1 0 0 0 1 1 1 1
1 3 1 3 1 0 0 0 1 1 0 1
3 2 1 3 1 0 0 0 1 0 0 1
z3+ <= (z0 and not x1 and x0) or (z0 and x1 and x0) or (z1 and x1 and x0) or (z3 and x1 and not x0)
z3+ <= (z0 and x0) or (z1 and x1 and x0) or (z3 and x1 and not x0)
Zustand z2+
Zustand Eingabe Ausgabe Folgezustand Code Folgezustand Code Eingabe Code Ausgabe
z3+ z2+ z1+ z0+ x1 x0 y1 y0
0 0 2 2 0 1 0 0 0 0 1 0
1 0 3 2 0 1 0 0 0 0 1 1
1 1 3 2 0 1 0 0 0 1 1 1
2 2 1 2 0 1 0 0 1 0 0 1
z2+ <= (z0 and not x1 and not x0) or (z1 and not x1 and not x0) or (z1 and not x1 and x0) or (z2 and x1 and not x0)
z2+ <= (z0 and not x1 and not x0) or (z1 and not x1) or (z2 and x1 and not x0)
Zustand z1+
Zustand Eingabe Ausgabe Folgezustand Code Folgezustand Code Eingabe Code Ausgabe
z3+ z2+ z1+ z0+ x1 x0 y1 y0
1 2 0 1 0 0 1 0 1 0 0 0
2 1 1 1 0 0 1 0 0 1 0 1
2 3 3 1 0 0 1 0 1 1 1 1
z1+ <= (z1 and x1 and not x0) or (z2 and x0)
Zustand z0+
Zustand Eingabe Ausgabe Folgezustand Code Folgezustand Code Eingabe Code Ausgabe
z3+ z2+ z1+ z0+ x1 x0 y1 y0
0 2 0 0 0 0 0 1 1 0 0 0
2 0 2 0 0 0 0 1 0 0 1 0
3 0 3 0 0 0 0 1 0 0 1 1
3 1 1 0 0 0 0 1 0 1 0 1
3 3 0 1 0 0 0 1 1 1 0 0
z0+ <= (z0 and x1 and not x0) or (z2 and not x1 and not x0) or not (z3 and x1 and not x0)
Ausgabe y1
Zustand Eingabe Ausgabe Folgezustand Code Folgezustand Code Eingabe Code Ausgabe
z3+ z2+ z1+ z0+ x1 x0 y1 y0
0 0 2 2 0 1 0 0 0 0 1 0
0 3 3 3 1 0 0 0 1 1 1 1
1 0 3 2 0 1 0 0 0 0 1 1
1 1 3 2 0 1 0 0 0 1 1 1
2 0 2 0 0 0 0 1 0 0 1 0
2 3 3 1 0 0 1 0 1 1 1 1
3 0 3 0 0 0 0 1 0 0 1 1
y1 <= (z0 and not x1 and not x0) or (z0 and x1 and x0) or (z1 and not x1) or (z2 and not (x1 xor x0)) or (z3 and not x1 and not x0)
Ausgabe y0
Zustand Eingabe Ausgabe Folgezustand Code Folgezustand Code Eingabe Code Ausgabe
z3+ z2+ z1+ z0+ x1 x0 y1 y0
0 0 1 3 1 0 0 0 0 1 0 1
0 2 3 3 1 0 0 0 1 1 1 1
1 0 3 2 0 1 0 0 0 0 1 1
1 1 3 2 0 1 0 0 0 1 1 1
1 2 1 3 1 0 0 0 1 1 0 1
2 0 1 1 0 0 1 0 0 1 0 1
2 2 1 2 0 1 0 0 1 0 0 1
2 3 3 1 0 0 1 0 1 1 1 1
3 0 3 0 0 0 0 1 0 0 1 1
3 1 1 0 0 0 0 1 0 1 0 1
3 2 1 3 1 0 0 0 1 0 0 1
y0 <= (z0 and x0) or (z1 and not (not x0 and x1)) or (z2 and (x1 or x0)) and (z3 and (x1 nand x0))
z3+ <= (z0 and x0) or (z1 and x1 and x0) or (z3 and x1 and not x0)
z2+ <= (z0 and not x1 and not x0) or (z1 and not x1) or (z2 and x1 and not x0)
z1+ <= (z1 and x1 and not x0) or (z2 and x0)
z0+ <= (z0 and x1 and not x0) or (z2 and not x1 and not x0) or not (z3 and x1 and not x0)
y1 <= (z0 and not x1 and not x0) or (z0 and x1 and x0) or (z1 and not x1) or (z2 and not (x1 xor x0)) or (z3 and not x1 and not x0)
y0 <= (z0 and x0) or (z1 and not (not x0 and x1)) or (z2 and (x1 or x0)) and (z3 and (x1 nand x0))
[/code]
[code]
z3+ <= (z0 and x0) or (z1 and x1 and x0) or (z3 and x1 and not x0)
z2+ <= (z0 and not x1 and not x0) or (z1 and not x1) or (z2 and x1 and not x0)
z1+ <= (z1 and x1 and not x0) or (z2 and x0)
z0+ <= (z0 and x1 and not x0) or (z2 and not x1 and not x0) or not (z3 and x1 and not x0)
y1 <= (z0 and not x1 and not x0) or (z0 and x1 and x0) or (z1 and not x1) or (z2 and not (x1 xor x0)) or (z3 and not x1 and not x0)
y0 <= (z0 and x0) or (z1 and not (not x0 and x1)) or (z2 and (x1 or x0)) and (z3 and (x1 nand x0))
[/code]
Jetzt mache ich dazu gewohnheitsmässig einen VHDL Code von mir aus implementiere ich die Speicherglieder - ich mache das Schaltwerk dazu. Mit Caneda. Gezeichnet.
Nein, ich muss noch lernen. Ich mache ein normales Schaltnetz in VHDL dazu und das ist alles. Ich drücke es in VHDL aus, ohne Speicherglieder. Wir wissen ja
[code]
Q <= R NOR Q'
Q' <= S NOR Q
[/code]
Das müsste für das RS-Latch schon reichen. Jetzt Code, dann muss ich weiter lernen