==============================================================================
Pofview by Hermit - Altera MAX V 5M40ZE64C5 (EQFP64) bitstream file examinator
==============================================================================

 During the development of a big project in 2014 I wanted to create a design 
very tightly in the cheap 1USD Altera MAX V CPLD with 40 Logic elements.
I tried editing all the constraints and the chip directly graphically in
Quartus II but it always performed modifications and optimizations to my very
carefully design which I wanted to keep at Logic-cell level. (I used logic-cell
primitives directly but after a lot of reading of the long Quartus documentation
I still couldn't turn off all the minor modifications that Quartus made.)
 I think for such little projects human brain can perform better than automatic
place-and-route processes. That's how pofview's idea born, I started to reverse
engineer the smallest 64pin MAX V to see if I could generate POF files for it
directly by a simple tool.
 I created a lot of automatic (makefile-based) scripting to create clean states
of different placements of LC elements and examined the outputs. I could find
out the exact bits for the IOE and LE properties and pofview can read them from
a POF file generated for this exact same chip-model.
 However, at that time I gave up on finding out the routing, that's much more
complicated and much harder to reverse-engineer. Maybe sometime I'll continue
where I left off, but for now pofview can only display the LE and IOE settings.
It can be used to check what Quartus actually generated at low level, as it may
be different unfortunately from what a strict designer intended and maybe it
makes it easier to correct settings in Quartus accordingly.
 If the routing gets reverse engineered too this could become a CPLD editor tool
for small CPLDs leaving out Quartus IDE from the toolchain when not necessary.
But that's just a dream for now, and it's nowhere near the completeness of the
other FPGA reverse engineering projects like IceStorm for Lattice devices. Maybe
one day with the contribution of other low-level design enthusiasts...
 During the reverse-engineering my scripts created a huge amount of files with
the help of pofview's ability to generate a .bmp file to see the change of the
bits as black dots by eyes easier. Of course human interaction is needed, the
scripting only does the automatic compilations and file-namings...
 The folders contain excerpts from the many-many files and textual contents that
fits in 1MB instead of the 1GB I have here on my machine... In the tool folder
there are some differentiator tools for exact file comparisons and some pieces
from my scripts/makefiles but I can't recall after 3 years how they were used
and not all of them are complete standalone tools, sometimes they're there just
for giving ideas to someone who tries to continue the experiment.

 Pofview's usage is simple, you can see the commandline arguments if you run
pofview without parameters. If you use the '-debug' argument beside the filename
a .bmp will be generated and also a .vo file which holds LE/IOE primitives but
not any routing yet. The most important part of pofview is of course the ASCII
lookout of the resource-usage on the chip.

 I don't play with it right now but I can return to the task anytime when my
project requires it. Feel free to experiment with it, WTF license allows to do
anything with my code and the chip info it contains.

            2017  Hermit (Mihaly Horvath)   hermit.sidrip.com
