converter state (sequence) table to EPROM content

Version 0.3


epr_prg -h -> print this help

epr_prg -i -> exports into Intel Hex format

epr_prg -b -> exports into a binary format


cat test.csv|perl epr_prg -i > test.ihex

cat test.csv|perl epr_prg -b > test.bin


This script converts a truth-table in CSV-Format into a binary-File or Intel-Hex based file to program EPROMs

The output will be sent to STDOUT, the input will be read from STDIN.

This script is runnable under all variations of perl 5.xx (also the windowsversion)

Format of inputfiles

CSV (comma separated value) based File:





First column means outputwire (0..7) as an Integer second to n-th means adresswire as an Boolean (0,1,x)

if a table has not all combination-rows, we use missing combinations as zero output

all rows must be the same length

in example above, we mean:

output o0 is high, if A0 high and A5 is low.

output o0 is high, if A0-A7 are high and A8 is low

output o1 is high, if A0-A4 are high, A5 low, A6 high, A7 low and A8 is high.

output o2 is high, if A0-A2 are high, A3 is low, and A4-A8 are high

or in short o0=(A0 & ~A5) | (A0 & A1 & A2 & A3 & A4 & A5 & A6 & A7 & ~A8)


The adress-size is automagic calculated with counts of columns, it means if you have 13 columns (remember, first one is output, 13 columns means 12 adresswire) then you have selected a 2732-EPROM or 4096x8 EPROM, else you have 16 columns then you have selected a 27256-EPROM. If you do not need higher adresswires, but you must use a 27256, then use 'x' or '0' in unused columns.

Format of outputfile can handle with two outputformats: binary and Intel-Hex. If you have small EPROMs or you have a EPROMmer which does not support Intel-Hex, you can use the binary format. If you can, use Intel-Hex, because it generates mostly smaller outputfiles, but only if you have to program less than half of all possible adresses.

Format of outputfile: binary

means the byte 1 in file is equal the byte in EPROM at address h0000, the byte 2 in file is equal the byte in EPROM at address h0001, and so on.

Format of outputfile: Intel-Hex Format

- every line beginning with ``:'' closed by CR and LF is a record

- there are two types of records: datarecord, endrecord

- all values are HEX-digits

           datarecord: ":llaaaattdddddd...dddddcc"
             - ll -> length of databytes (ddd...ddd), 2 Hex-digits
             - aaaa -> startadress of EPROM where databytes of this record will be programmed
             - tt -> type of record: data is 00
             - ddd...ddd -> ll-sized sequence of bytes programmed at adress aaaa
             - cc -> checksum plus llaaaattddd...ddd must be zero.
           endrecord: ":00000001FF"


- Verify EPROM-programfile in Intel-HEX (not done yet, BIN works)

- verify ERRORs like different columns in CSV, contrary bitcombinations

- and so on.


No known BUGs there.

If you find them, please do not hesitate to contact me.


(c) 2001 Andreas Romeyke (mailto:


Distributed under the terms of the GNU General Public License. Please check for license.