![](http://datasheet.mmic.net.cn/290000/HMS77C2000_datasheet_16134699/HMS77C2000_54.png)
HMS77C2000/2001
Nov. 2002 Ver 1.1
51
13.4.2 Checksum Calculations
Checksum is calculated by reading the contents of the
HMS77C2000 and HMS77C2001 memory locations and
adding up the opcodes up to the maximum user address-
able location, (not including the last location which is re-
served for the oscillator calibration value).
Any carry bits exceeding 16-bits are neglected. Finally, the
configuration word (appropriately masked) is added to the
checksum. Checksum computation for the HMS77C2000
and HMS77C2001 are shown in Table 13-4 .
The checksum is calculated by summing the following:
- The contents of all program memory locations
- The configuration word, appropriately masked
- Masked ID locations (when applicable)
The least significant 16 bits of this sum is the checksum
The following table describes how to calculate the check-
sum for each device. Note that the checksum calculation
differs depending on the code protect setting.
Since the program memory locations read out differently
depending on the code protect setting, the table describes
how to manipulate the actual program memory values to
simulate the values that would be read from a protected de-
vice. When calculating a checksum by reading a device,
the entire program memory can simply be read and
summed. The configuration word and ID locations can al-
ways be read.
The oscillator calibration value location is not used in the
above checksums.
Program Memory Segment
R/W in Protected Mode
R/W in Unprotected Mode
Configuration Word (FFF
H
)
R/W Enable
R/W Enable
00
H
~ 3F
H
R/W Enable
R/W Enable
40
H
~ 3FE
H
Read Disable(555
H
), Write Disable
R/W Enable
3FF
H
Oscillator Calibration Value
R/W Enable
R/W Enable
ID Location (400
H
~ 403
H
)
R/W Enable
R/W Enable
TABLE 13-3 CODE PROTECTION(HMS77C2001)
Device
Code Protect
Checksum
HMS77C2000
OFF
ON
SUM [000
H
~ 1FE
H
] + CFGW & 03F
H
SUM [000
H
~ 03F
H
] + CFGW & 03F
H
+ SUM(IDS)
HMS77C2000
OFF
ON
SUM [000
H
~ 3FE
H
] + CFGW & 03F
H
SUM [000
H
~ 03F
H
] + CFGW & 03F
H
+ SUM(IDS)
TABLE 13-4 CHECKSUM COMPUTATION
Legend: CFGW = Configuration Word
SUM[a~b] = [ Sum of locations a through b inclusive]
SUM_ID = ID locations masked by F
H
then made into a 16 bit value with ID0 as the most significant nibble.
For example, ID0 = 12
H
, ID1 = 37
H
, ID2 = 4
H
, ID0 = 26
H
, then SUM_ID = 2746
H
.
Checksum = [Sum of all the individual expressions] MODULO [FFFF
H
]
+ = addition, & = Bitwise AND