The present disclosure relates to memory configuration for a digital device, and more particularly, to a configurable memory for storage of program instructions and/or data (op-codes), with selectable storage of error detecting and correcting codes.
In digital devices having processors controlled by program instructions, typical error correcting code (ECC) or parity checking implementations store the ECC or parity data as part of an operation code (op-code) word. Such implementations require a wider word program memory, i.e., more bits per memory location, to accommodate the extra ECC or parity data. However, for applications where ECC or parity is not required, memory capacity is wasted because of the unused extra memory word bits set aside for the ECC or parity data.
Therefore there is a need for a digital device having a memory space that may be configured for an ECC or parity implementation when required, otherwise the entire memory space may be made available for program instructions and/or data (op-code) with digital devices not requiring ECC or parity checking. According to teachings of this disclosure, standard size, e.g., standard word width, memory, e.g., FLASH, electrically programmable read only memory (EEPROM), battery backed-up random access memory (RAM), etc., may be configured for ECC or non-ECC functionality, or parity or non-parity functionality, based upon a desired digital device application. The last portion of the memory may be allocated for ECC or parity data rather then op-code storage when an ECC or parity implementation is required. When an ECC or parity implementation is not required, the entire memory may be used for op-code (e.g., program instructions and/or data) storage. This allows the memory of the digital device to be used most efficiently in applications having different robustness (e.g., application code integrity) requirements.
When ECC or parity checking is implemented in a digital device, according to specific example embodiments of this disclosure, the ECC or parity data may be stored at the end of the memory and may be fetched as needed for each op-code word. This requires extra read cycles out of the memory, but will not be an issue when headroom exists for the speed of program execution. Thus digital processing for either ECC/parity or non-ECC/non-parity applications may be provided using only one type of digital device memory without incurring additional hardware costs.
A parity implementation, e.g., even or odd parity, may detect single-bit errors but cannot correct an error. However, the parity implementation has minimal overhead, e.g., only one extra bit is used per instruction and/or data word. The parity bits may be stored at the end of the memory, in groups of N for N bit op-codes (assuming an N-bit wide memory word), e.g., groups of 24 for 24 bit application codes. Thus parities for up to N words may be loaded into an N-bit wide cache with one memory read access. When loading the parity bits into cache, a very small reduction in execution speed may result, e.g., for a 24-bit word, a 4 percent speed reduction may result.
A single-bit error correction double error detection error correcting code (SECDED ECC) can detect and correct single-bit errors, and detect 2-bit errors. The SECDED ECC requires an overhead of 6-bits to detect and correct a single-bit error in a 24-bit word. For a 24-bit memory word this implies a 25 percent reduction of memory available for op-code storage. The 6-bit ECC error correcting code for each 24-bit op-code word may be stored at the end of the memory in groups of four (4×6 bits=24 bits). Thus, up to four words worth of error correcting code may be loaded into cache per memory access. For sequential program execution, one extra memory access for every four op-code word accesses will be required (cache stores four error correcting codes per each memory read access), this will reduce program execution speed by about 20 percent.
According to a specific example embodiment of this disclosure, a digital device having a configurable memory may comprise: a digital processor; a main memory in communication with the digital processor; an op-code latch for storing an operational code (op-code) word read from the main memory; and parity check logic coupled to the main memory, op-code latch and the digital processor, whereby the parity check logic determines whether the op-code word stored in the op-code latch has a parity error; wherein the main memory is configurable for storing operational code (op-code) words and parity bits, or op-code words only.
According to another specific example embodiment of this disclosure, a digital device having a configurable memory may comprise: a digital processor; a main memory in communication with the digital processor; an op-code latch for storing an operational code (op-code) word read from the main memory; and error correcting code (ECC) logic coupled to the main memory, op-code latch and the digital processor, whereby the ECC logic determines whether the op-code word stored in the op-code latch has an error and attempts to correct the error; wherein the main memory is configurable for storing op-code words and ECC data words, or op-code words only.
A more complete understanding of the present disclosure thereof may be acquired by referring to the following description taken in conjunction with the accompanying drawings wherein:
While the present disclosure is susceptible to various modifications and alternative forms, specific example embodiments thereof have been shown in the drawings and are herein described in detail. It should be understood, however, that the description herein of specific example embodiments is not intended to limit the disclosure to the particular forms disclosed herein, but on the contrary, this disclosure is to cover all modifications and equivalents as defined by the appended claims.
Referring now to the drawings, the details of specific example embodiments are schematically illustrated. Like elements in the drawings will be represented by like numbers, and similar elements will be represented by like numbers with a different lower case letter suffix.
Referring to
Referring to
Referring to
Referring to
However, if the associated parity bit or ECC data word is not stored in the parity or ECC cache 306, then the processor 102 has to fetch the associated parity bit or ECC data word from the memory portion 304b. This extra memory access will slow down the parity or ECC check, and for very fast processors, issuing a CPU stall 114 may be desired until the op-code and associated parity bit or ECC data word are available for processing in the parity or ECC logic 312. The aforementioned digital device of
An ECC cache may not be required if there is sufficient headroom with the application. Thus, the op-code 350 may be read on one memory read cycle and the parity bits or ECC data 352 on the next memory read cycle. This will require about twice the memory read access time as a non-ECC implemented solution but does not require any special new logic implementation in existing digital devices 100. For example, a typical instruction memory read operation may include (1) fetch op-code word, (2) fetch the parity or ECC data associated with the op-code just fetched, (3) apply the parity or ECC algorithm to the fetched op-code word and parity or ECC data, and (4) present checked (and corrected) op-code word for use by the digital processor 102.
For faster processors having ECC implementations, a stall function 314 may be applied to the central processing unit (CPU) of the digital processor 102 so that the ECC data may be retrieved during the instruction cycle. This requires an ECC cache 306 but ECC data for multiple program instruction and/or data words may be retrieved and stored in the ECC cache 306. E.g., a 24-bit wide memory word will supply four 6-bit ECC data words for each memory read operation. For example, (1) assert new opcode address, (2) after address stable compare with what is stored in ECC cache, if a cache miss, stall CPU, (3) fetch ECC data from memory during CPU stall, (4) ECC corrected program instruction and/or data word available to CPU, and (5) unstall CPU to decode the ECC corrected program instruction and/or data word.
While embodiments of this disclosure have been depicted, described, and are defined by reference to example embodiments of the disclosure, such references do not imply a limitation on the disclosure, and no such limitation is to be inferred. The subject matter disclosed is capable of considerable modification, alteration, and equivalents in form and function, as will occur to those ordinarily skilled in the pertinent art and having the benefit of this disclosure. The depicted and described embodiments of this disclosure are examples only, and are not exhaustive of the scope of the disclosure.