SUBDESIGN pwm_mode
(
MODE0, MODE1, CWCCW, PWM, CLK : INPUT;
PWM_P1, PWM_P2, PWM_N1, PWM_N2 : OUTPUT;
)
VARIABLE
PWM_P10, PWM_P20, PWM_N10, PWM_N20 : NODE;
PWM1 : NODE;
PWM_P, PWM_N : NODE;
BEGIN
PWM1 = DFF(PWM, CLK, VCC, VCC);
PWM_P = PWM & PWM1;
PWM_N = PWM # PWM1;
IF !(MODE0 # MODE1) THEN
PWM_P10 = GND;
PWM_P20 = GND;
PWM_N10 = GND;
PWM_N20 = GND;
ELSIF (MODE0 & !MODE1 & CWCCW) THEN
PWM_P10 = PWM;
PWM_P20 = GND;
PWM_N10 = GND;
PWM_N20 = PWM;
ELSIF (MODE0 & !MODE1 & !CWCCW) THEN
PWM_P10 = GND;
PWM_P20 = PWM;
PWM_N10 = PWM;
PWM_N20 = GND;
ELSIF (!MODE0 & MODE1) THEN
PWM_P10 = PWM_P;
PWM_P20 = !PWM_N;
PWM_N10 = !PWM_N;
PWM_N20 = PWM_P;
ELSIF (MODE0 & MODE1) THEN
PWM_P10 = GND;
PWM_P20 = GND;
PWM_N10 = VCC;
PWM_N20 = VCC;
END IF;
PWM_P1 = DFF(PWM_P10, CLK, VCC, VCC);
PWM_P2 = DFF(PWM_P20, CLK, VCC, VCC);
PWM_N1 = DFF(PWM_N10, CLK, VCC, VCC);
PWM_N2 = DFF(PWM_N20, CLK, VCC, VCC);
END;