Creating Counters Using ABEL
// Up Counter
// Down Counter
// Bidirectional Counter
upcount := (upcount.q + 1) & up & !reset
# upcount.q & !up & !reset; ``Hold clear if reset is high.
upcount.clk = clock;
dncount := (dncount.q - 1) & dn & !reset
# dncount.q & !dn & !reset; ``Hold Clear if reset is high.
dncount.clk = clock;
bicount := (bicount.q + 1) & up & !reset
# (bicount.q - 1) & dn & !reset ``Count down.
# bicount.q & !up & !dn & !reset;
``Hold Clear if reset is high.
bicount.clk = clock;