openPCells icon indicating copy to clipboard operation
openPCells copied to clipboard

Up-Counter

Open a-kest opened this issue 2 months ago • 2 comments

Hey there,

in "cells/logic/counter.lua" I noticed this comment: "The counter is down-counting, since this can be implemented more regularly than an upcounting counter. (At least that's what I think, if you see this differently, let me know.)"

I want to let you know :D

If you replace all XNORs by XORs and all ORs by ANDs and replace the constant vss 0 by a constant vdd 1, you create an up-counter in - I believe - a similar footprint.

Merry Christmas :)

a-kest avatar Dec 19 '25 12:12 a-kest

Hi and thanks for this message! I was not aware of this. It makes sense, I guess simply for the symmetry. The comment in the cell stems from a simplification with regularity in mind from a up/down counter based on two's complement, where you would either feed 11111...1 or 00000...1 into a series of adders, calculating the next value of the counter. Since the string of 1s is regular and the 00....1 is not, I took that case and simplified the corresponding logic gates.

This property can of course be leveraged in the implementation of the counter pcell, with a parameter for up/down. However, the 'logic' library and especially the 'stdcells' are horribly out-dated and need major overhaul. That is quite low on my priority list, so I hope you were digging through stuff and not actually using this ;)

patrickschulz avatar Dec 19 '25 19:12 patrickschulz

Don't worry :D I was just digging through the pcells and found this comment.

a-kest avatar Dec 20 '25 01:12 a-kest