What is the output? digital or analog, 12 bits or 16 bits? Probably the easiest way is to simply keep an unsigned - 16 bit counter in memory, incrementing it by 4 bits (16) each time increment and putting out the upper 12 bits. The output will increase by 1 bit each time period, and you'll get the saw-tooth edge when it rolls over.