Programming PROMs in LogicWorks
This document describes procedures to program PROMs (Programmable Read
Only Memory). The PROMs are programmed using data in a .HEX
file (more precisely, a file in the Intel Hex format). The file can
be
loaded into a PROM in LogicWorks (for simulation) or a real EPROM
(Erasable Programmable ROM), such as the 2732. The procedure for
programming a PROM in LogicWorks will be described below.
Remember that the HEX file must have lines that begin with colons
(":"). If you create a HEX file using the Truth Table program, it
will look
like this:
INPUT a2 0 0 0
INPUT a1 0 0 0
INPUT a0 0 0 0
OUTPUT d2 0 0 0 0 0
OUTPUT d1 0 0 0 0 0
OUTPUT d0 0 0 0 0 0
HEX
:10000000f8faf9fdfefef9faffffffffffffffff21
:10001000fffffffffffffffffffffffffffffffff0
:10002000ffffffffffffffffffffffffffffffffe0
:10003000ffffffffffffffffffffffffffffffffd0
:10004000ffffffffffffffffffffffffffffffffc0
:10005000ffffffffffffffffffffffffffffffffb0
:10006000ffffffffffffffffffffffffffffffffa0
:10007000ffffffffffffffffffffffffffffffff90
:10008000ffffffffffffffffffffffffffffffff80
:10009000ffffffffffffffffffffffffffffffff70
:1000a000ffffffffffffffffffffffffffffffff60
Delete the first few lines to get the following:
:10000000f8faf9fdfefef9faffffffffffffffff21
:10001000fffffffffffffffffffffffffffffffff0
:10002000ffffffffffffffffffffffffffffffffe0
:10003000ffffffffffffffffffffffffffffffffd0
:10004000ffffffffffffffffffffffffffffffffc0
:10005000ffffffffffffffffffffffffffffffffb0
:10006000ffffffffffffffffffffffffffffffffa0
:10007000ffffffffffffffffffffffffffffffff90
:10008000ffffffffffffffffffffffffffffffff80
:10009000ffffffffffffffffffffffffffffffff70
:1000a000ffffffffffffffffffffffffffffffff60
Using the ".HEX" File to
Program a PROM in LogicWorks
The next three steps are for Logicworks on PCs (it is similar for
Mac).
Assume that the .HEX file is in wiliki.
Step 1. Transfer the ".HEX" file from wiliki to the PC
The SSH Secure File Transfer program, available in the EE 260 Lab
(Holmes 451) and
the EE Computer Lab (Holmes 387), transfers files between a local and
a
remote computer. The local computer is the one you're
using,
and the remote is somewhere else. For our purposes, the remote
computer
will be wiliki, where the .HEX file is located. A file transfer
can
be a download, which goes from remote to local, or an upload,
which goes from local to remote.
Start the SSH Secure File Transfer, which will open a window.
Under the File menu, select Connect. When the program
prompts you for a machine,
enter
wiliki.eng.hawaii.edu
Now logon. The window will show your files on the local and
remote computers. You can navigate around by pointing and
clicking. You
can also create folders/directories.
Navigate on wiliki until you find your HEX file. Navigate on
your local computer until you find a folder to download the file.
Select your HEX file on wiliki. Under the Operation menu,
select Download. The file should transfer, and you're done.
You can close the connection
by simply exiting or closing the application.
Step 2. Programming a PROM for LogicWorks 5 using the ".HEX" file:
- Start LogicWorks 5. In Holmes 387, LogicWorks 5 can be
found in folder "EE Basic Design" or on the drive K "eepcserver", under
Logicworks 5 (click the logicworks exe file).
- Make sure your own parts "library" is loaded, so that you can
store your new PROM part in it (click here to
get
a refresher on how to start a new library):
- Under the Simulation menu, select the "PLA/PROM/RAM Construction
Wizard." This will take you through a series of queries:
- Select Type of Device to Build: Select PROM.
- Device Specifications:
- Address Lines: Enter number of inputs*.
- Bits Per Word: Enter number of outputs**.
- Data Entry Method: Select Intel Format Hex File
- Navigate until you find the HEX file, then select.
- Select a name for the PROM, e.g., "Lab 20 Circuit"
- Select your library to store the PROM.
* Logicworks only allows the number to be powers of
2.
So you may end up having slightly more inputs than you need.
The
extra inputs are the ones corresponding to the most significant bits.
When
using the circuit, tie these to Ground (0). For example, suppose
you
need 5 inputs but must select 8. This leaves you with a PROM with
inputs
In7, In6,... In0. When you use the PROM, connect In7, In6, and
In5
to Ground.
** Logicworks only allows the numbers to be powers of 2. You may
end
up having slightly more outputs than you need. The extra outputs
are
the ones corresponding to the most significant bits. You can
ignore these. For example, suppose you need 3 outputs but must
select 4. This leaves you with a PROM with inputs Out3, Out2,
Out1, Out0. When you
use the PROM, ignore Out3.
Step 3. Delete your files from the PC if it's not your own.
Don't
forget your thumb drive or disks.
Appendix B:
Intel Hex File Format
We will be using the Intel
Hex File format to program Programmable Read Only Memory (PROMs)
such as the 2732. The format specifies the memory location of the
data, and the data values itself. In addition, it has information
to check for bit errors.
The file is a text file but representing hexadecimal numbers. A
hexadecimal number is a number that has base 16. So each digit
can have one of 16 values, {0, 1, 2, ..., 14, 15}. The digit is a
single symbol. For the values 10, 11, ..., 15, the symbols are
"A" = 10, "B" = 11, "C" = 12, ..., "E" = 14, and "F" = 15. The
letters may be upper or lower case. As an example, the
hexadecimal number FA is equal to 15x16 + 10. Hexadecimal numbers
are useful to represent binary values because it is easy to convert a
hexadecimal number to binary and vice versa. Each hexadecimal
digit represents 4 bits. For example the hexadecimal number "FA"
is equal to the binary number "1111 1010". To convert a
hexadecimal number to binary, just convert each hexadecimal digit to
its equivalent 4-bit binary number. To convert a binary number to
hexadecimal, just partition the binary number into 4-bit chunks
starting from the right. Then convert the 4-bit values into
hexadecimal. For example,101101100010101 = 101 1011
0001 0101 = 5 B 1 5. Note that a byte (8
bits) is represented by two hexadecimal digits. Also, hexadecimal
numbers are often prefixed by "0x" to indicate it is a hexadecimal
number, e.g., 0x5B15
The Intel Hex File Format is list of "lines", where each line either (i) specifies data values at a
particular memory location or (ii)
its a line indicating that its the end of the file. Each line has
six parts to it, where each part is also referred as a
"field".
- The first character in the line is always a colon ":". It
is the first field, and is referred to as the start code.
- The second field is the byte
count, and is the number of bytes in the data field, which will
be described below. This value is typically either 16 or
32. It is represented as two hexadecimal digits. So it is
either "0x10" or "0x20". For our case, this value will typically
be 16.
- The third field is a 16-bit address
which is represented by 4
hexadecimal digits. The address is where the data will be
stored in the PROM. For our case, the address will typically be
0x0000, 0x0010, 0x0020, ....., which corresponds to the address values
0, 16, 32, etc.
- The fourth field is record type
which indicates whether the line has data or is an end of file.
00 = record type, and 01 = end of file.
- The fifth field is the data,
and the number of bytes is specified by the byte count.
Typically, the byte count is 16, so the data will be represented by 32
hexadecimal digits, where 2 hex digits = 1 byte.
- The fifth field is the checksum,
which is a value used to check whether any data is in error. The
check sum is a fancy way to data together to produce a "sum" This
checksum is stored. To check if the data is still good, the sum
is calculated, and if it is different than the sum that is stored, then
we know there is an error. If the calculated and stored sums have
the same values then it is assumed that there are no errors. For
now, you don't need to know how this sum is calculated. But the
checksum is a byte = 2 hex digits.
For example, the first line below has the start code ":" then a byte count of 0x10 = 16, an address of 0x0000, a record of 00 = data, and a checksum of 21.
The second line also has data but starting at address 0x0010, and with a checksum of 0xf0. The
final line has a record 01 =
end of file, byte count =
0x00 = 0, address of 0x0000
(since there are no data bytes), and checksum of 0xff.
:10000000f8faf9fdfefef9faffffffffffffffff21
:10001000fffffffffffffffffffffffffffffffff0
:00000001ff
This specifies that the data to be stored is
Address (hex) Data (hex)
0000
f8
0001
fa
0002
f9
0003
fd
0004
fe
0005
fe
0006
f9
0007
fa
0008
ff
0009
ff
etc