module jcounter Title 'Johnson Shift Counter' Declarations clk pin 43; // GCK1 on XC9536 CPLD !q0 pin 22 istype 'reg'; // LED !q1 pin 21 istype 'reg'; // LED !q2 pin 20 istype 'reg'; // LED !q3 pin 19 istype 'reg'; // LED !q4 pin 18 istype 'reg'; // LED !q5 pin 16 istype 'reg'; // LED !q6 pin 14 istype 'reg'; // LED !q7 pin 13 istype 'reg'; // LED q = [q7..q0]; // LED Bus Declaration Equations //Johnson Shift Counter description q.clk = clk; q0 := !q7; q1 := q0; q2 := q1; q3 := q2; q4 := q3; q5 := q4; q6 := q5; q7 := q6; // Test Vectors can be used to functionaly verify equations in-system. test_vectors([ clk ] -> [ q0, q1, q2, q3, q4, q5, q6, q7]); [ .C. ] -> [ 0, 1, 1, 1, 1, 1, 1, 1 ]; [ .C. ] -> [ 0, 0, 1, 1, 1, 1, 1, 1 ]; [ .C. ] -> [ 0, 0, 0, 1, 1, 1, 1, 1 ]; [ .C. ] -> [ 0, 0, 0, 0, 1, 1, 1, 1 ]; [ .C. ] -> [ 0, 0, 0, 0, 0, 1, 1, 1 ]; [ .C. ] -> [ 0, 0, 0, 0, 0, 0, 1, 1 ]; [ .C. ] -> [ 0, 0, 0, 0, 0, 0, 0, 1 ]; [ .C. ] -> [ 0, 0, 0, 0, 0, 0, 0, 0 ]; [ .C. ] -> [ 1, 0, 0, 0, 0, 0, 0, 0 ]; [ .C. ] -> [ 1, 1, 0, 0, 0, 0, 0, 0 ]; [ .C. ] -> [ 1, 1, 1, 0, 0, 0, 0, 0 ]; [ .C. ] -> [ 1, 1, 1, 1, 0, 0, 0, 0 ]; [ .C. ] -> [ 1, 1, 1, 1, 1, 0, 0, 0 ]; [ .C. ] -> [ 1, 1, 1, 1, 1, 1, 0, 0 ]; [ .C. ] -> [ 1, 1, 1, 1, 1, 1, 1, 0 ]; [ .C. ] -> [ 1, 1, 1, 1, 1, 1, 1, 1 ]; end jcounter