'ptgnlfsr' is a program that generates PLD (Programmable Logic Device) programming tables & LFSR/BIBLO (Linear Feedback Shift Register/Built In Logic Block Observer) signature for a function given by the user.

News: version 2.5 is released. Support for BILBO generator is now added. Read the file 'CHANGELOG' for more details.

Getting the software:

This program is distributed under the GNU General Public License, read the file COPYING file for details.

You can get 'ptgnlfsr' from the following sites : site

To download the latest portable release of 'ptgnlfsr' click here. It is primarily for DOS/Win users, you won't need it unless your C library doesn't provide the 'vsprintf' function. Note for *NIX users, to unpack this file use the command : unzip -a


1. Optional: edit the files 'config.h' & 'Makefile' to suit your needs.
2. If you are running on one of UNIX flavours, run 'make'. Otherwise compile the package using whatever C compiler you have.
3. Optionally, run 'make clean' (if you use one of UNIX flavours).
4. You may also run 'make install' to install the package in the directory set in the 'Makefile'.

Also you may run 'make all', in which case, you'll be left with 2 executables: 'ptgnlfsr' & 'test/test'.
'test' is a program that counts from '0' to '2 ^ x', where 'x' is a number supplied by the user in the command line, for example : ./test/test 7 You can also use 'test' to test wether the source code could be compiled using your C compiler.

The output of each of those programs will be to 'stdout'. If you wish to save the output to some file, you may redirect it to that file, for example :
./test/test 7 > outputfilename


Read the file 'inputfile', that is part of the documentation of this package, to learn the syntax in which you can enter the functions to the program.

Run 'ptgnlfsr', then first key in the number of inputs & outputs (& feedback lines) as shown in the file 'inputfile'. Then you may optionally key in a user-defined name for each input & output pin. Then key in the functions for which you wish to generate the observer signature or programming table. Key in the appropriate command(s), when you are finished you can end the program by keyying in the '.eof' command, or on UNIX like operating systems you can simply press 'CTRL + C', or, 'CTRL + D'.
Also you could write the enter your functions, commands,... in some input file in some file and let the program read it by redirecting, for example:
./ptgnlfsr < inputfilename
./ptgnlfsr < inputfilename > outputfilename

Notes: 1. This was compiled without errors using GNU C Compiler v2.95.1. But it won't compile on old versions of Borland & Turbo C compilers.

2. There are some additional files with this package:
inputfile: describes the commands and how to implement your functions.
controller: an input file implementing a function that was a mini-project required by BSc Helwan univ. students on year 2000.
ip: another input file, have a look at it to get an idea of other methods of entering the equations & commands, this file implements the same functions implemented in the file 'controller'.
mid-term-exam: an input file implementing a function that BSc Helwan univ. students had on a mid-term exam on year 2000.
fpgat & fpgat2: a couple of input files to test the FPGA programming table module.
alu.c : an old version of epromtg that generates the programming table for an ALU.

To do:

1. To be able to generate programming table generators for other CPLDs (ie: Complex PLDs, such as LCA & MAX devices).

2. 'ptgnlfsr' uses the function 'vsprintf', which is not supported in all C libraries. I need to write a 'vsprintf' equivalent to the GNU C Library's 'vsprintf', anyone knows a trick so that I can 'fprintf' to a string [(ie: (char *)] ?

3. Make a hardware to program PLDs via this software.

4. Currently the program can only interpret an equation if it were in the expanded form, for example :
d2 = q2 & !c2 | q2 & !c1 | q2 & c2 & !c0 | q2 & c2 & !q1 | q2 & c2 & !q0 | q1 & q0 & !c2 & c1 & c0;
I need to make this program interpret functions in a form like :
d2 = (q2 & ((!c2) | (!c1) | (c2 & ((!c0) | (!q1) | (!q0))))) | (q1 & q0 & (!c2) & c1 & c0);
Also I need to make the program interpret other operations as: XOR


Ahmed El-Mahmoudy <>

The code for this program has been written using lpe

Get ptgnlfsr at Fast, secure and Free Open Source software downloads