Sample file for the 7C331 Use with the SMS PLDASM version 3.0e or later this implements an asynchronous counter, with additional outputs to test inversion and combinatorial logic Device 7c331 pin1 = 1 pin2 = 2 pin3 = 3 pin4 = 4 pin5 = 5 pin6 = 6 pin7 = 7 pin9 = 9 pin10 = 10 pin11 = 11 pin12 = 12 pin13 = 13 pin14 = 14 /pin15 = 15 /pin16 = 16 /pin17 = 17 /pin18 = 18 /pin19 = 19 /pin20 = 20 /pin23 = 23 /pin24 = 24 /pin25 = 25 /pin26 = 26 /pin27 = 27 /pin28 = 28 iff15 = 29 ' represents the Q of input flip flops pins 15..28 iff16 = 30 iff17 = 31 iff18 = 32 iff19 = 33 iff20 = 34 iff23 = 35 iff24 = 36 iff25 = 37 iff26 = 38 iff27 = 39 iff28 = 40 start ' store the set and reset lines on the neg clock of pin 5 iff15 := ; ' preset, pin 15 as input clocked by pin 1 iff15.iclk = pin1; iff16 := ; ' reset iff16.iclk = pin1; '/pin15 /= pin7; ' if both these lines are included, /pin16 /= pin9; ' then there will be an error reported, ' the 7C331 shared mux allows 3 / 4 feedbacks ' three bit synchronous counter with pin4 as async preset and pin 2 as ' sync reset. Pin 1 is the sync clock. /pin28 /:= /pin2 * pin28 ' hold + pin2 * /pin28; ' count /pin28.clk = pin1; /pin28.set = /iff15; /pin28.rst = /iff16; /pin27 /:= pin2 * pin28 ' count ^ pin27; ' one method to use XOR /pin27.clk = pin1 ; /pin27.set = /iff15; /pin27.rst = /iff16; /pin26 /:= pin2 * pin27 * pin28; /pin26.xor = pin26; ' another method to use XOR /pin26.clk = pin1 ; /pin26.set = /iff15; /pin26.rst = /iff16; /pin20 /= pin28* pin27* pin26; 'carry output ' three bit async ripple counter. Pin 3 is the clock. Pin 2 is async ' reset, pin 4 is async preset. Output enable is pin 6. /pin25 /:= /pin25; ' D == Q /pin25.clk = pin3 ; /pin25.rst = /pin2 ; /pin25.set = /pin4 ; /pin25.ena = /pin14; /pin24 /:= /pin24; /pin24.clk = /pin25; /pin24.rst = /pin2 ; /pin24.set = /pin4 ; /pin24.ena = /pin14; /pin23 /:= /pin23; /pin23.clk = /pin24; /pin23.rst = /pin2 ; /pin23.set = /pin4 ; /pin23.ena = /pin14; /pin19 /= pin23 *pin24 *pin25; end;