SH-1/SH-2/SH-DSP Programming Manual
Total Page:16
File Type:pdf, Size:1020Kb
Hitachi SuperH™ RISC Engine SH-1/SH-2/SH-DSP Programming Manual ADE-602-063C Rev. 4.0 5/13/99 Hitachi ,Ltd Cautions 1. Hitachi neither warrants nor grants licenses of any rights of Hitachi’s or any third party’s patent, copyright, trademark, or other intellectual property rights for information contained in this document. Hitachi bears no responsibility for problems that may arise with third party’s rights, including intellectual property rights, in connection with use of the information contained in this document. 2. Products and product specifications may be subject to change without notice. Confirm that you have received the latest product standards or specifications before final design, purchase or use. 3. Hitachi makes every attempt to ensure that its products are of high quality and reliability. However, contact Hitachi’s sales office before using the product in an application that demands especially high quality and reliability or where its failure or malfunction may directly threaten human life or cause risk of bodily injury, such as aerospace, aeronautics, nuclear power, combustion control, transportation, traffic, safety equipment or medical equipment for life support. 4. Design your application so that the product is used within the ranges guaranteed by Hitachi particularly for maximum rating, operating supply voltage range, heat radiation characteristics, installation conditions and other characteristics. Hitachi bears no responsibility for failure or damage when used beyond the guaranteed ranges. Even within the guaranteed ranges, consider normally foreseeable failure rates or failure modes in semiconductor devices and employ systemic measures such as fail-safes, so that the equipment incorporating Hitachi product does not cause bodily injury, fire or other consequential damage due to operation of the Hitachi product. 5. This product is not designed to be radiation resistant. 6. No one is permitted to reproduce or duplicate, in any form, the whole or part of this document without written approval from Hitachi. 7. Contact Hitachi’s sales office for any questions regarding this document or Hitachi semiconductor products. Introduction The SH-1 and SH-2 incorporates a RISC (Reduced Instruction Set Computer) type CPU. A basic instruction can be executed in one clock cycle, realizing high performance operation. A built-in multiplier can execute multiplication and addition as quickly as DSP. The SH-DSP is a 32 bit microcontroller based on Hitachi’s SuperTM RISC engine that realizes the same signal processing capability as a general usage DSP (Digital Signal Processor). The SH-DSP offers an improvement on the DSP functions of multiplication and multiply and accumulate in SuperH microprocessors by using a DSP style data path function. It maintains upward compatibility at the object code level with the SH-1 and SH-2 microprocessors and has the many functions, low power usage, and low price of other SuperH microprocessors. The SH-DSP achieves high performance in processing operations by using a RISC CPU core and a DSP unit with DSP functions. This new type of single chip RISC-DSP simultaneously integrates the peripheral functions needed to build systems into the SH-DSP and provides the lower-power consumption vital to microprocessor applications. This Programming Manual describes in detail the basic architecture and instructions for the SH-1, SH2, and SH-DSP and is intended as a reference on instruction operation and architecture. It also covers the operation of pipelines, which are a feature of the SuperH microprocessor. For software development environment system, contact your Hitachi sales office. Note: SuperHTM is a trademark of Hitachi, Ltd. Contents Section 1 Features............................................................................................................. 1 1.1 SH-1 and SH-2 Features ................................................................................................... 1 1.2 SH-DSP Features ..............................................................................................................2 Section 2 Register Configuration ................................................................................. 5 2.1 General Registers.............................................................................................................. 5 2.2 Control Registers .............................................................................................................. 8 2.3 System Registers............................................................................................................... 11 2.4 DSP Registers ................................................................................................................... 12 2.5 Precautions for Handling of Guard Bit and Overflow ...................................................... 14 2.6 Initial Values of Registers................................................................................................. 14 Section 3 Data Formats ................................................................................................... 15 3.1 Data Format in Registers .................................................................................................. 15 3.2 Data Format in Memory ................................................................................................... 15 3.3 Immediate Data Format .................................................................................................... 16 3.4 DSP Type Data Formats ................................................................................................... 16 3.5 DSP Instructions and Data Formats.................................................................................. 18 3.5.1 DSP Data Processing ........................................................................................... 18 3.5.2 X and Y Data Transfers ....................................................................................... 18 3.5.3 Single Data Transfers .......................................................................................... 18 Section 4 Instruction Features ....................................................................................... 23 4.1 RISC-Type Instruction Set................................................................................................ 23 4.2 Addressing Modes ............................................................................................................ 26 4.3 Instruction Format ............................................................................................................ 29 4.4 DSP................................................................................................................................... 32 4.5 DSP Data Addressing ....................................................................................................... 33 4.5.1 X and Y Data Addressing.................................................................................... 33 4.5.2 Single Data Addressing ....................................................................................... 35 4.5.3 Modulo Addressing ............................................................................................. 36 4.5.4 DSP Addressing Operation.................................................................................. 37 4.6 Instruction Formats for DSP Instructions ......................................................................... 39 4.6.1 Double and Single Data Transfer Instructions..................................................... 39 4.6.2 Parallel Processing Instructions........................................................................... 42 4.7 ALU Fixed Decimal Point Operations.............................................................................. 46 4.7.1 Function............................................................................................................... 46 4.7.2 Instructions and Operands ................................................................................... 47 4.7.3 DC Bit.................................................................................................................. 48 i 4.7.4 Condition Bits...................................................................................................... 51 4.7.5 Overflow Prevention Function (Saturation Operation)........................................ 51 4.8 ALU Integer Operations ................................................................................................... 51 4.9 ALU Logical Operations .................................................................................................. 53 4.9.1 Function............................................................................................................... 53 4.9.2 Instructions and Operands ................................................................................... 54 4.9.3 DC Bit.................................................................................................................. 55 4.9.4 Condition Bits...................................................................................................... 55 4.10 Fixed Decimal Point Multiplication.................................................................................. 55 4.11 Shift Operations................................................................................................................ 57 4.11.1 Arithmetic Shift Operations................................................................................