4.4.6 LPM_ROM

 

Copyright © 1998 University of Manchester

Read only memory

Ports
Port Name
Type
Usage
DescriptionComments
Address
I
Required
Address of memory location Vector, LPM_WidthAd wide
Q
O
Required
Output of memory Vector, LPM_Width wide
InClock
I
Note 1
Synchronous Address
OutClock
I
Note 2
Synchronous Q outputs from memory.
MemEnab
I
Optional
Memory enable control. Low: Q output is Hi-Z

High: Q is Memory[Address]

Note 1: The Address is synchronous(registered) when the InClock port is connected. and asynchronous(registered) when it is not connected

Note 2: The addressed memory content to Q response is synchronous when the OutClock port is connected. and asynchronous when it is not connected.

Properties
Property
Usage
ValueComments
LPM_Width
Required
LPM Value > 0Width of input and output vectors.
LPM_WidthAd
Required
LPM Value > 0Width of Address Port. Note 1.
LPM_NumWords
Optional
LPM Value > 0Number of words stored in Memory. Note 2.
LPM_Address_Control
Optional
REGISTERED | UNREGISTERED Indicates if Addres port is registered. Default is REGISTERED
LPM_OutData
Optional
REGISTERED | UNREGISTEREDIndicates if Q and Eq ports are registered. Default is REGISTERED
LPM_File
Required
File NameFile for ROM initialization.

Note 1: The LPM_WidthAd should be (but is not required to be) equal to: log2(LPM_NumWords). If LPM_WidthAd is too small, some memory locations will not be addressable. If is too big, then the addresses that are too high will return UNDEFINED.

Note 2: If LPM_NumWords is not used, then it defaults to 2LPM_WidthAd. In general, this value should be (but is not required to be): 2LPM_WidthAd-1 < LPM_NumWords < = 2LPM_WidthAd.

Functions

Read Only Memory. This module can represent asynchronous memory or memory with synchronous outputs.

Synchronous Memory Operations

Synchronous memory
OutClock
MemEnab
Output
X
L
Q output is Hi-Z
not rising edge
H
No Change in output
rising edge
H
The output register is loaded with the contents of the memory location pointed to by Address. Q outputs the contents of the output register.

Asynchronous Memory Operations

Totally asynchronous memory operations occur when none of InClock nor OutClock is connected.
MemEnab
Memory Contents
L
Q output is Hi-Z
H
The memory location pointed to by Address is read.

The output Q is asynchronous and reflects the data in the memory to which Address points.

ROM Contents

The format for the file containing the ROM contents is contained in section 9.4, HEX OBJECT FILE SPECIFICATION of LPM 2 0 1 specification. A summary and examples is included here for reference only.

Glossary
Hex-byte: an 8-bit byte represented by a pair of hex-digits.
Hex-digit: a symbol representing values from 0 to 15 (4-bits) using the digits 0-9 and the letters A-F (or a-f).
Byte Count: A pair of hex-digits indicating the number of data or address hex-bytes in the current record. The following fields are not included in the Byte-count: address record, data indicator record or checksum.
Address Bytes: A pair of hex-bytes representing the address offset (with respect to the current Extended Address) of the first word in the data portion of the record. The value of the address bytes is added to the current Extended Address to form the real address of the first data word. An Extended Address is defined as zero until it is redefined by an Extended Address record.
Extended Address: The concatenation of the Data in an Extended Address Record with a hex '0'. See the example below.
Sum_Check: A hex-byte representing the sum of the bytes in the record, exclusive of the Sum_Check. The bytes are taken one hex-byte (two hex-digits) at a time and summed as unsigned integers. White space characters are ignored for the Sum_Check calculation. The two's complement of the sum is computed and the low-order hex-byte is retained. The hex-bytes that are included in the sum are: Byte_Count, Address, Record_Type ('00' or '02'), and the Data. The Sum_Check is not included in the calculation. (The term Sum_Check is used to avoid conflict with the EDIF definition Check_Sum.)
For example, if the record is : 07 0000 02 00 01 02 03 03 03 01 EA the bytes sum as 07+00+00+02+00+01+02+03+03+03+01=16. The 32-bit two's complement of 00000016 is FFFFFFEA. The least-significant byte has the hex value EA.

Interpretation of the data values in the Hex Object File depends on the value of the Width property. The data values correspond to the words in the LPM_ROM, with the word at address zero appearing first in the data list. The word at address one follows the word at address zero, etc. Each word in the Hex Object File is padded on the left by zero bits so that the word consumes an even multiple of 8 bits (a hex-byte). If the 'Width' is an even multiple of 8 bits, then no padding is needed. For example, suppose an LPM_ROM is 3-bits wide. To represent the data values 0 through 7 in such an LPM_ROM you would use the hex-bytes: 00 01 02 03 04 05 06 07.

The goal is readability: the number "1" would be represented as a hex-byte "01" and padding bits will be ignored so that subsequent words will also be readable. In a 10-bit wide LPM_ROM, two hex-byte pairs are used to represent each word. The first hex-byte value contains the two most-significant bits (bits 10 and 9). The second hex-byte value contains the eight least-significant bits (bits 7, 6, 5, 4, 3, 2, 1, and 0).

Example 1:
WidthValuehex-byte
6000
6707
65032
10700 07
102700 1B
1027301 11
1072502 D5
10102303 FF

Example 2:

Hex file for an LPM_ROM (Width = 10, Numwords = 32)
line #Contents
1:02 0000 02 00 01 FB
2:08 0000 00 00 07 00 1B 01 11 02 D5 ED
3:04 0008 00 03 FF 00 01 F1
4:00000001FF

Interpretation:

Line 4 contains ":00000001FF" which is the "End of File" indicator.

The first field of each of lines 1, 2, and 3 is the byte count (this excludes the first three fields and the last field, that is: byte count = # fields - 4).

The second field is an address offset from the current Extended Address. If none is specified, then the current Extended Address is used.

The third field indicates whether the following hex-bytes are a new Extended Address (02) or data (00).
The fields between the third and last fields contain either an address or data.
If the fields contain an address, then it is multiplied by 16 to form a new Extended Address. Note that the second field is required to be '0000' when an address is specified.
If the fields contain data, then hex-bytes are taken in groups to form the data words. If the 'Width' is between 1 and 8 then one hex-byte is read. If the 'Width is between 9 and 16, then two hex-bytes are taken. Between 17 and 24, three hex-bytes are taken, etc.

The last field is a checksum computed by summing all of the bytes (including the first three fields), truncating the result to the least significant hex-byte and taking the two's complement.

Corresponding contents of LPM_ROM:
Address (Hex)+0 +1+2+3 +4+5+6 +7
000 000 000
800 000 000
16 (10)71B 1112D50 000
24 (18)3FF1 000 000

Example 3:

An LPM_ROM with Width=2 and Numwords=7 (7 words of 2-bits each)

:07000000 000102 03030301 EA
:00000001 FF

Corresponding contents of LPM_ROM:

Address (Hex)+0+1 +2+3+4 +5+6+7
001 2333 1

Additional comments on Hex File Format
There is optional white space between the all of the fields. The white space does not affect the checksum.