National Instruments HPC467064, HPC167064 manual Code Efficiency, Development Support

Models: HPC167064 HPC467064

1 34
Download 34 pages 21.41 Kb
Page 30
Image 30

Code Efficiency

One of the most important criteria of a single chip microcon- troller is code efficiency. The more efficient the code, the more features that can be put on a chip. The memory size on a chip is fixed so if code is not efficient, features may have to be sacrificed or the programmer may have to buy a larger, more expensive version of the chip.

The HPC family has been designed to be extremely code- efficient. The HPC looks very good in all the standard cod- ing benchmarks; however, it is not realistic to rely only on benchmarks. Many large jobs have been programmed onto the HPC, and the code savings over other popular micro- controllers has been considerable.

Reasons for this saving of code include the following:

SINGLE BYTE INSTRUCTIONS

The majority of instructions on the HPC167064 are single- byte. There are two especially code-saving instructions: JP is a 1-byte jump. True, it can only jump within a range of plus or minus 32, but many loops and decisions are often within a small range of program memory. Most other micros need 2-byte instructions for any short jumps.

JSRP is a 1-byte subroutine call. The user makes a table of the 16 most frequently called subroutines and these calls will only take one byte. Most other micros require two and even three bytes to call a subroutine. The user does not have to decide which subroutine addresses to put into the table; the assembler can give this information.

EFFICIENT SUBROUTINE CALLS

The 2-byte JSR instructions can call any subroutine within plus or minus 1k of program memory.

MULTIFUNCTION INSTRUCTIONS FOR DATA MOVE- MENT AND PROGRAM LOOPING

The HPC167064 has single-byte instructions that perform multiple tasks. For example, the XS instruction will do the following:

1.Exchange A and memory pointed to by the B register

2.Increment or decrement the B register

3.Compare the B register to the K register

4.Generate a conditional skip if B has passed K

The value of this multipurpose instruction becomes evident when looping through sequential areas of memory and exit- ing when the loop is finished.

BIT MANIPULATION INSTRUCTIONS

Any bit of memory, I/O or registers can be set, reset or tested by the single byte bit instructions. The bits can be addressed directly or indirectly. Since all registers and I/O are mapped into the memory, it is very easy to manipulate specific bits to do efficient control.

DECIMAL ADD AND SUBTRACT

This instruction is needed to interface with the decimal user world.

It can handle both 16-bit words and 8-bit bytes.

The 16-bit capability saves code since many variables can be stored as one piece of data and the programmer does not have to break his data into two bytes. Many applications store most data in 4-digit variables. The HPC167064 sup- plies 8-bit byte capability for 2-digit variables and literal vari- ables.

MULTIPLY AND DIVIDE INSTRUCTIONS

The HPC167064 has 16-bit multiply, 16-bit by 16-bit divide, and 32-bit by 16-bit divide instructions. This saves both code and time. Multiply and divide can use immediate data or data from memory. The ability to multiply and divide by immediate data saves code since this function is often needed for scaling, base conversion, computing indexes of arrays, etc.

Development Support

The HPC167064 acts as a stand alone emulator for either the HPC16083 or the HPC16064. No separate development tool is thus provided to support this emulator device. The user will use either the HPC16083 or the HPC16064 (de- pending on which device is in use) development tools to develop and debug the application hardware and software in their target as normally done for the non-emulator HPC devices. The application software can then be programmed in the on-chip EPROM and the HPC167064 can then be plugged in the target system to run the application like a regular masked ROM device. The HPC167064 can be pro- grammed using a DATA I/O UNISITE with pinsite module.

To support the security feature of the HPC167064, a soft- ware switch is provided with the linker (under PROMHPC) which will generate an encrypted hex file for the user. The purpose is to be able to compare this software generated encrypted data with the encrypted data produced by the actual chip to provide a way to verify on-chip EPROM code after security has been enabled. For details of how to gener- ate encrypted data and all other HPC167064 features, refer to the Appendix K of the HPC Family User’s Manual.

30

Page 30
Image 30
National Instruments HPC467064, HPC167064 manual Code Efficiency, Development Support