 |
|
 |
MESC TOOL NEWS:
MESCT-NC308WA_2-000716D
Please take note of the following problem and modifications of manuals
in using C compiler (with assembler and integrated development environment)
NC308WA for the M16C/80 series of MCUs:
- On flipping bit fields of more than 1 bit wide
- On corrections of and additions to user's manuals for assembler macros
-
Problem on Flipping Bit Fields of More Than 1 Bit Wide
Flipping a bit field of more than 1 bit wide and storing
the flipped value in the original bit field may result in incorrect code being generated.
- 1.1 Versions Concerned
- NC308WA V.1.00 Release 1-V.3.00 Release 1
Note: V.3.00 Release 1 is due to be released in September 2000.
- 1.2 Conditions
- This problem occurs if the following three conditions are satisfied:
- (1)A bit field on memory containing a member of more than 1 bit wide is involved in an operation.
- (2)The one's complement operator "~"(tilde) is applied to the bit field involved.
- (3)The result produced in (2) is stored in the original bit field.
- 1.3 Example
--------------------------------------------------------------------------
struct {
unsigned int bbb : 3;
} b;
void func(void)
{
b.bbb = ~ b.bbb; /* Only the lowermost one bit flipped */
}
--------------------------------------------------------------------------
- 1.4 Workaround
- Temporarily store the result of the one's complement operation
into a TMP variable; then assign it to the original bit field.
----------------------------------------------------------------------
struct {
unsigned int bbb : 3;
} b;
void func(void)
{
unsigned int tmp; /* A TMP variable */
tmp = ~ b.bbb; /* Store the result in TMP */
b.bbb = tmp;
}
----------------------------------------------------------------------
- 1.5 Schedule of Fixing Problem
- We plan to fix this problem in our future release.
NC308WA Precaution MESCT-NC308WA_2-000716D
-
Corrections of and Additions to User's Manuals for Assembler Macros
- 2.1 Manuals Concerned
- NC308WA V.2.00 User's Manual (Document No.: MSD-NC308-UE-991216)
- 2.2 Additions
- On page 60 in Appendix B of NC308WA V.2.00 User's Manual
DIV
[Function] Returns the quotient of a signed division
of dividend val2 by divisor val1.
[Format] signed char div_b(signed char val1, signed int val2);
/* In 8-bit operation */
signed int div_w(signed int val1, signed long val2);
/* In 16-bit operation */
DIVU
[Function] Returns the quotient of an unsigned division
of dividend val2 by divisor val1.
[Format] unsigned char divu_b(unsigned char val1, unsigned int val2);
/* In 8-bit operation */
unsigned int divu_w(unsigned int val1, unsigned long val2);
/* In 16-bit operation */
ABS
[Function] Returns the absolute value of val
[Format] signed char abs_b(signed char); /* In 8-bit operation */
signed int abs_w(signed int); /* In 16-bit operation */
MOVDir
[Function] Returns the result of a 4-bit transfer from val1 to val2
[Format] unsigned char movll(unsigned char val1, unsigned char val2);
/* Transfer between two lower 4 bits */
unsigned char movlh(unsigned char val1, unsigned char val2);
/* Transfer from lower 4 bits
to upper 4 bits */
unsigned char movhl(unsigned char val1, unsigned char val2);
/* Transfer from upper 4 bits
to lower 4 bits */
unsigned char movhh(unsigned char val1, unsigned char val2);
/* Transfer between two upper 4 bits */
|
 |