MODULE wuerfel "Autor: Lunetikk "Zweck: elektronischer Würfel TITLE 'wuerfel' Declarations DFF2,DFF1,DFF0 node istype 'buffer,reg'; run node; "Ausgänge für die 7 Segmentanzeige a,b,c,d,e,f,g pin 4,3,6,7,8,9,10 istype 'buffer,com'; S pin 19 istype 'buffer,com'; takt pin 11; Equations "Takt an alle FFs DFF0.clk = takt; DFF1.clk = takt; DFF2.clk = takt; Truth_Table "BDC-Zähler Tabelle mit Stop-Schalter ([DFF2, DFF1, DFF0, S] :> [DFF2, DFF1, DFF0]) [0,0,0,0]:>[0,0,1]; "Zustand 0 [0,0,0,1]:>[0,0,0]; [0,0,1,0]:>[0,1,0]; "Zustand 1 [0,0,1,1]:>[0,0,1]; [0,1,0,0]:>[0,1,1]; "Zustand 2 [0,1,0,1]:>[0,1,0]; [0,1,1,0]:>[1,0,0]; "Zustand 3 [0,1,1,1]:>[0,1,1]; [1,0,0,0]:>[1,0,1]; "Zustand 4 [1,0,0,1]:>[1,0,0]; [1,0,1,0]:>[1,1,0]; "Zustand 5 [1,0,1,1]:>[1,0,1]; [1,1,0,0]:>[0,0,1]; "Zustand 6 [1,1,0,1]:>[1,1,0]; [1,1,1,0]:>[0,0,1]; "Zustand 7 [1,1,1,1]:>[1,1,1]; Truth_Table "Codeumsetzer 7-Segment Anzeige ([DFF2.q, DFF1.q, DFF0.q] -> [a,b,c,d,e,f,g]) [0,0,0] -> [1,1,1,1,1,1,0]; //0 [0,0,1] -> [0,1,1,0,0,0,0]; //1 [0,1,0] -> [1,1,0,1,1,0,1]; //2 [0,1,1] -> [1,1,1,1,0,0,1]; //3 [1,0,0] -> [0,1,1,0,0,1,1]; //4 [1,0,1] -> [1,0,1,1,0,1,1]; //5 [1,1,0] -> [1,0,1,1,1,1,1]; //6 [1,1,1] -> [1,1,1,0,0,0,0]; //7 END