WO1992008188A1 - Semiconductor device - Google Patents

Semiconductor device Download PDF

Info

Publication number
WO1992008188A1
WO1992008188A1 PCT/JP1991/001496 JP9101496W WO9208188A1 WO 1992008188 A1 WO1992008188 A1 WO 1992008188A1 JP 9101496 W JP9101496 W JP 9101496W WO 9208188 A1 WO9208188 A1 WO 9208188A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
bit
flag
register
alu
Prior art date
Application number
PCT/JP1991/001496
Other languages
French (fr)
Japanese (ja)
Inventor
Hidenori Nagao
Original Assignee
Seiko Epson Corporation
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Seiko Epson Corporation filed Critical Seiko Epson Corporation
Publication of WO1992008188A1 publication Critical patent/WO1992008188A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/57Arithmetic logic units [ALU], i.e. arrangements or devices for performing two or more of the operations covered by groups G06F7/483 – G06F7/556 or for performing logical operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2207/00Indexing scheme relating to methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F2207/38Indexing scheme relating to groups G06F7/38 - G06F7/575
    • G06F2207/3804Details
    • G06F2207/3808Details concerning the type of numbers or the way they are handled
    • G06F2207/3812Devices capable of handling different types of numbers
    • G06F2207/3816Accepting numbers of variable word length

Definitions

  • the present invention relates to a semiconductor device, and particularly to an arithmetic and logic unit therefor.
  • ALU inputs two operation terms, respectively, and adds or subtracts, for example, 8-bit data. Then, of the 9-bit operation result, the lower 8 bits are output as the operation result output, and the upper 1 bit is output as the carry signal.
  • the arithmetic function is fixed at 8 bits, so that the power that cannot handle data in units of 4 bits (1 nib ore) can be handled.
  • a 4-bit double arithmetic was executed. After that, the 5th bit out of the 8 bits of the operation result is referred to by the program, and it must be determined by the program whether the carry has occurred. The handling was troublesome. Disclosure of the invention
  • An object of the present invention to enable calculation of data having a plurality of bit widths.
  • An object of the present invention is to arbitrarily switch an arithmetic result to a hexadecimal or a 10-base.
  • An object of the present invention is to provide a semiconductor device capable of performing the above operation.
  • Another object of the present invention is to provide an electronic device incorporating such a semiconductor device.
  • a semiconductor device includes: an input unit for receiving an input data in an unpacked state; and a flag for performing an arithmetic operation. It is possible to perform arithmetic processing on the data to be set and the data of a plurality of bit widths, and the flag is set in the register and the short bit is set. When data processing of the bit width is commanded, the arithmetic operation is performed on the data of the bit width of 1Z2 of the input data, and the carry signal of the upper bit is calculated. With ALU to set in the carry flag.
  • the ALU has an arithmetic processing function of 16-bit and 8-bit bit widths, an arithmetic processing of data of 8-bit bit width is selected, and When an unchecked flag is set, the following processing is performed to obtain a 4-bit 1Z2 bit. The arithmetic processing of the bit width is performed.
  • the input data is input in an unpacked state. Therefore, only the lower 4 bits are valid and the upper 4 bits are invalid (the upper 4 bits). The bits are set to 0.) In this state, arithmetic processing is performed on the lower 4 bits, and the carry (or borrow) of the 4th bit is keyed. By setting the carry flag, the existence of the upper 4 bits is ignored, and the next 8 bits of data (the valid part is the lower 4 bits) However, it will function as a carry (or borrow) for the.
  • the operation in this case may be any of addition, subtraction, multiplication and division.
  • an arithmetic function in units of 4 bits is added to an arithmetic function previously fixed in units of 8 bits. It is now possible to programmatically select between bit operation and 4-bit operation.
  • 4-bit operation an overflow occurs every digit, and when the present invention is incorporated in a micro computer, multiple overflow occurs.
  • Each digit of the output result of complicated numerical calculation can be easily stored in one address unit. Therefore, the data is stored in one address and one address, and the decimal point position can be easily adjusted.
  • the semiconductor device sets a decimal flag when converting hexadecimal data to decimal data. It has a resistor.
  • the ALU converts the hexadecimal operation result to 10-decimal data and outputs it.
  • the data when storing arithmetic data in a storage device, the data is packed and stored, and the data is read out from the storage device. In this case, the data is automatically read and read.
  • the above-described semiconductor device is applied to various electronic devices.
  • it is applied to arithmetic operators, in which case setting the decimal flag allows the operation result to be displayed in decimal notation.
  • FIG. 1 is a block diagram showing a configuration of a semiconductor device according to one embodiment of the present invention.
  • Fig. 2 is a block diagram showing the details of the ALU in Fig. 1.
  • c Fig. 3 is an external view of the four arithmetic unit to which the semiconductor device in Fig. 1 is applied.
  • FIG. 4 to FIG. 11 are explanatory diagrams of the decimal operation, the anchor operation, and the pack operation.
  • FIGS. 12A and 12B are flow charts showing the processing flow in the case of addition processing in the four arithmetic units of FIG. 3.
  • FIG. 13 is a flowchart of FIG. This is a flow chart showing the flow of the processing of the operation routine of FIG.
  • FIG. 14 is a diagram showing a work area of the RAM.
  • FIG. 15 is a diagram showing an example of input data.
  • FIG. 16A to FIG. 16G are diagrams showing changes in data stored in the work area.
  • Fig. 17 is an evening chart showing the operation of the step of the addition process in Fig. 13.
  • FIG. 18 is a diagram showing data when the ADD instruction is executed.
  • FIG. 19 is a diagram showing data at the time of executing a pack instruction.
  • Figure 20 shows the data at the time of execution of the amp instruction.
  • FIG. 21A, FIG. 21B, FIG. 22A, FIG. 22B, and FIG. 23 to FIG. 29 are diagrams showing specific circuits of the ALU in FIG. BEST MODE FOR CARRYING OUT THE INVENTION
  • the semiconductor device shown in FIG. 1 includes a dress bus 2 and a data bus 4.
  • the input register 6 is used to input the input data from the data bus and to the timing generator. 8 Input the timing signals of these.
  • This instruction is decoded by the instruction decoder 10, and the micro-instruction signal is used. It is sent out via line group 12.
  • Reference numeral 4 is connected to the address bus 2 and the data bus 4 and to the microinstruction signal line group 12.
  • the data register group (A, B) 16 is connected to the data bus 4 and the microinstruction signal line group 12.
  • Temporary registers 18 and 20 are also connected to data bus 4 and microinstruction signal line group 12, and their outputs are Output to ALU22.
  • the temporary carry flag 24 is used to input the condition flag 26, the other flags, and the temporary register 18 And is connected to the microstructural signal line group 12.
  • AL ⁇ 22 receives the signals from the temporary carrier flag 24 and the temporary register 18, 20, as well as Performs prescribed arithmetic processing based on the transaction.
  • Temporary register 28 receives the output of ALU 22 and receives address bus 2 and data bus based on microinstruction. Output data via 4.
  • the input port 30 inputs a key input from the keyboard 32 via the address bus 2 and the data bus 4.
  • the ROM 34 stores, for example, a system program, etc.
  • the RAM 36 stores, for example, a key input from an external keyboard 32. In addition, it functions as a working memory described later.
  • the LCD driver 38 receives the data of the temporary register 28 and drives the LCD panel 40 to display the data.
  • the portion surrounded by a dashed line is composed of a chip microprocessor 42, an input port 3 2 and a keyboard 3 2 is an LCD driver 38 and an LCD panel 40 constituting the input device 44. 6.
  • ALU 2.2 is a 16-bit padder 50, as shown in Figure 2, and a decimator resistor.
  • a logic circuit 52 including clock logic and a right shifter 54 are included.
  • the ALU 22 can perform arithmetic processing of 16-bit and 8-bit bit widths, and each microcontroller corresponds to the bit width.
  • An installation kit is provided. Here, a description will be given of a case where an arithmetic processing function of 8-bit width is selected. In other words, in this embodiment, even when the 8-bit arithmetic processing function is selected, a 4-bit arithmetic processing can be performed. Therefore, the following description focuses on this point.
  • microactions are used.
  • the outline of the microactions is as follows.
  • ⁇ U SUB Inverts the temporary register A18 and "CYIN" during SUB and SBC operations, and generates a complement value of "2". Also, operate the flag on the operation result
  • UAND Selects AND operation as the ALU22 operation mode. Also, the flag is operated on the operation result (N, Z). • UOR: Performs an OR operation. Others are the same as UAND O
  • UCAL16 Selects 16-bit mode as ALU22 status (input signal to flag).
  • UDAPK Decimal area just operation and unpack operation (4 bits) are permitted. It is enabled at 8-bit addition / subtraction (ADD, ADC, SUB, SBC).
  • ⁇ SEP The 8-bit “2” complement value is expanded to 16 bits.
  • SWAP Exchanges the upper 2 and lower 2 bits of 8-bit data.
  • ⁇ UUPCK The data on the 8-bit register is stored in 16 bits. Unpack the data on the register.
  • microinstructions marked with ⁇ in the above are particularly related to the present invention.
  • the semiconductor device described above is applied to various types of electronic equipment.Here, the operation when applied to the four arithmetic units as shown in FIG. 3 will be mainly described. You
  • FIGS. 4 and 5 show. As shown. Whether the result of addition or subtraction of the input terms is output as BCD or HEX is switched according to the decimating flag "DF" described later.
  • FIGS. 6 and 7 show examples in which a 4-bit HEX value “7” and “B” are added and subtracted, respectively.
  • the lower four bits of the carry flag C carry flag C Set to F.
  • the lower four bits of the borrow are set in the carry flag CF.
  • the amp operation 4-bit operation
  • the function expands the data on the 8-bit register into the 16-bit register in the evening as shown in Fig. 10.
  • the processing is “UN” in this embodiment.
  • PACK "instruction.
  • the pack packs (reversely expands) the 16-bit register data on the 8-bit register as shown in Figure 11 on the 8-bit register. This packing process is performed by an "UNP ACK" instruction or the like in the present embodiment.
  • the key input and the like are input to the RAM 36, and the data structure at that time is, as shown in FIG. 15, the address "0000X” is the addition term word as shown in FIG. It is a query, and the address “0 0 IX” is a work area to be added.
  • the point indicated by reference numeral 60 is the boundary of the decimal point
  • 61 is the first decimal place
  • 62 is the second decimal place
  • 63 is the decimal point.
  • the seventh is shown respectively.
  • 64 indicates the “1” digit
  • 65 indicates the 100,000 digit
  • 66 indicates the 1,000,000 digit
  • 67 indicates the key input value. This area is used to store the position of the decimal point at the time of import.
  • the initial value of 1 X is “0000E”, where “0000” D ”and the digit position is one digit lower. Increment the digit counter by one (S29). "1" is set to the significant digit flag (S30).
  • M (0000F) is set to the value of M (0000F) — 1 and M (0000F) was "4", so it is "3" here. You. As described above, the value of M (0000F) is reduced by "1", and the process is repeated until the value of M (0000F) becomes zero (S50). When the value of M (0000F) becomes zero, the state shown in Fig. 16C is reached, and the decimal point alignment is completed.
  • the above 46 and 60 are examples of machine code.
  • the internal bus is a powerful 16-bit configuration, and only the lower 8 bits (I ⁇ 07 to 00) are used in the above instruction. Use and reduce execution cycles
  • the internal structure of CPu is composed of multiple bus lines (internal bus and external bus). The execution of this instruction is processed at the timing shown in the timing chart shown in FIG.
  • each instruction of the micro-instruction group for the data path is as follows.
  • UILVEB Transfer from lower internal bus to external bus
  • UEBIL Transfer from lower external bus to lower internal bus
  • UAVIL Read from A register to lower internal bus
  • UILVA Internal bus lower power, write to A register UWITHC: Carry flag power, write to temporary carrier flag
  • the addition instruction (ADD instruction) is as shown in FIG.
  • the temporary register “A” (TA) stores “19” in the lower eight bits, and the temporary register.
  • Register B (TB) stores "58" in the lower 8 bits. Then, both of them are added to the temporary flag TC, and the 16-bit adder output CAL is output to the decimal output register. Make an input to the knock logic. Decimazorea Just Finale Amp In the clock, BCD correction and unpack correction are performed, the output DAF is as shown in the figure, and the calculation output is “0 ⁇ 0100”. "1" is set in the carry flag CF.
  • each digit of the input data is stored in one-address units in decimal notation.
  • the position of the decimal point between the addition term and the augmented term can be easily adjusted.
  • addition of each digit can be output in one-digit decimal system (BCD, 4 bits), and the addition of the one digit is an overflow. Since it can be reflected in the carry flag CF, carry processing to the upper digit can be easily performed.
  • the program is executed by executing a pack instruction (PACK instruction) to store the data. This can save space.
  • PACK instruction pack instruction
  • Temporary register A stores B, A, and force as 16-bit data. “0000H” is stored in B (TB). Then, when the two are added, a 16-bit adder output CAL is obtained. Entered in 2.
  • the output DAF is as shown in the figure, and the lower 4 bits of data, the 9th power of the output CAL, and the 12th bit of data are output. No ,. And obtained as the output of ALU22. Therefore, the lower 8 bits of the output of ALU 22 are treated as valid data and stored in RAM 36, but the upper 8 bits are treated as invalid data. .
  • an unpacking instruction (UNP ACK instruction) is executed by the program.
  • a numerical value of 65 will be explained as an example.
  • Temporary register A stores the value of ⁇ 0H '' in the upper part and the value of register A in the lower part.
  • "0000H” is stored in the evening B (TB).
  • Addition of the two results in a 16-bit Atsuta output CAL, which is a digital filter, a digital filter, and a logic filter. Input to the circuit.
  • the output DAF is as shown in the figure, and the lower 4 bits of data remain the same as the lower 4 bits of the ALU output, and the next 4 bits are output. "0H” is introduced. In the next 4 bits, the data of the upper 4 bits of the DAF output is output, and in the next 4 most significant bits, “0H” is inserted. . In this way, the unpacked data "0605" is obtained.
  • FIGS. 21A to 29 The specific circuit configuration of ALU22 is as shown in FIGS. 21A to 29.
  • FIG. FIGS. 21A and 21B are ALU wiring diagrams.
  • FIGS. 22A and 22B are 16-bit atlas circuits, and
  • FIG. 23 is a decimal adjuster. Evening ⁇ Anno.
  • FIG. 24 is a circuit diagram showing the configuration of a clock logic circuit
  • FIG. 24 is an ALU shifter
  • FIG. 25 is a circuit diagram showing each configuration of a control flag.
  • FIGS. 26 to 29 are specific circuit diagrams of the latches constituting the control flag shown in FIG.
  • FIG. 25 corresponds to the FLAG block of FIG. 21B
  • FIG. 21B corresponds to the condition flag 26 of FIG.
  • Figure 26 is a circuit diagram of the zero-flag, over-flag, and negative flag grabbers.
  • Figure 27 is a circuit diagram of the 2-bit interrupt flag latch
  • Figure 28 is a circuit diagram of the carry flag latch
  • Figure 29 is a decimal flag. This is the circuit diagram of the amp flag latch section.

Abstract

A semiconductor device capable of easily processing data different in length, and an electronic arrangement incorporating the semiconductor device. The semiconductor device comprises input means for fetching unpacked input data, a register having a flag to be set at the processing of unpacked data, and an ALU capable of processing data, different in length. When the flag is set to the above register and the current instruction indicates the processing of short-length data, the ALU processes data having half the length of the input data and sets a carry signal for high-order bits of the data to a carry flag. For example, even when the ALU has the function to process 16- and 8-bit data, it is able to process 4-bit data when the 8-bit data processing is selected and an unpacking flag is set.

Description

明 細 書 半 導 体 装 置 技 術 分 野  Document semiconductor device technology field
本発明 は半導体装置、 特に そ の算術論理演算ュニ ッ ト The present invention relates to a semiconductor device, and particularly to an arithmetic and logic unit therefor.
(以下 A L U と い う ) の演算処理 に関す る 。 背 景 技 術 (Hereinafter referred to as ALU). Background technology
従来の半導体装置 に お い て は、 A L U は、 2 つ の演算 項を そ れぞれ入力 し 、 例え ば 8 ビ ッ 卜 の デー タ を加算又 は減算す る 。 そ し て、 9 ビ ッ 卜 の演算結果中、 下位 8 ビ ッ 卜 が演算結果出力 と し て、 上位 1 ビ ッ 卜 が桁上信号 と し て それぞれ出力す る 。  In a conventional semiconductor device, ALU inputs two operation terms, respectively, and adds or subtracts, for example, 8-bit data. Then, of the 9-bit operation result, the lower 8 bits are output as the operation result output, and the upper 1 bit is output as the carry signal.
こ の よ う な A L U に お い て は、 演算機能が 8 ビ ッ ト に 固定 さ れて い た た め、 4 ビ ッ ト ( 1 ニ ブノレ) 単位での デ — 夕 が扱え な 力、 つ た。 こ の A L U をマ イ ク ロ コ ン ピ ュ ー 夕 に取 り 入れて 4 ビ ッ 卜 単位の演算処理を さ せ る 場合 に は、 4 ビ ッ ト ど う し の二 ブル演算を実行 し た後、 演算結 果の 8 ビ ッ ト 中 の 5 ビ ッ ト 目 を プ ロ グラ ムで参照 し 、 桁 上げが生 じ た か ど う かを プ ロ グ ラ ム に よ っ て判断 し な け ればな ら ず、 そ の取扱 いが面倒であ っ た。 発 明 の 開 示  In such an ALU, the arithmetic function is fixed at 8 bits, so that the power that cannot handle data in units of 4 bits (1 nib ore) can be handled. Was. To incorporate this ALU into a microcomputer evening and perform 4-bit arithmetic processing, a 4-bit double arithmetic was executed. After that, the 5th bit out of the 8 bits of the operation result is referred to by the program, and it must be determined by the program whether the carry has occurred. The handling was troublesome. Disclosure of the invention
本発明 の 目 的 は、 複数の ビ ッ ト 幅の デー タ の演算を容 易 に行 う こ と がで き る 半導体装置を提供する こ と に あ る < ま た、 本発明の 目 的は、 演算結果を 1 6 進又は 1 0 進 に任意に切 り 替え る こ と がで き る 半導体装置を提供す る こ と に あ る 。 It is an object of the present invention to enable calculation of data having a plurality of bit widths. An object of the present invention is to arbitrarily switch an arithmetic result to a hexadecimal or a 10-base. An object of the present invention is to provide a semiconductor device capable of performing the above operation.
更に、 本発明の他の 目 的 は、 こ の よ う な半導体装置を, 内蔵 し た電子機器を提供す る こ と に あ る 。  Further, another object of the present invention is to provide an electronic device incorporating such a semiconductor device.
本発明 の一つ の態様に従え ば、 半導体装置 は、 入力 デ 一 夕 をア ンパ ッ ク し た状態で取 り 込む入力手段 と 、 ア ン ク 演算処理をす る 際に フ ラ グがセ ッ 卜 さ れ る レ ジ ス 夕 と 、 複数の ビ ッ ト 幅の デー タ を演算処理す る こ と がで き 、 前記 レ ジ ス タ に フ ラ グがセ ッ 卜 さ れ、 かつ短い ビ ッ ト 幅の デー タ 処理が命令 さ れてい る 状態では、 入力 デ一 夕 の 1 Z 2 の ビ ッ ト 幅の デー タ につ いて演算 し 、 そ の上 位 ビ ッ ト の キャ リ ー信号をキ ャ リ ー フ ラ グに セ ッ 卜 す る A L U と を有す る 。 例え ば、 A L U は 1 6 ビ ッ ト 及び 8 ビ ッ 卜 の ビ ッ ト 幅の演算処理機能を有 し.、 8 ビ ッ ト の ビ ッ ト 幅の デー タ の演算処理が選択 さ れ、 かつ ア ン " ッ ク フ ラ グがセ ッ 卜 さ れてい る と き に は次の よ う な処理をす る こ と に よ り そ の 1 Z 2 ビ ッ ト で あ る 4 ビ ッ 卜 の ビ ッ ト 幅の演算処理がな さ れ る 。  According to one embodiment of the present invention, a semiconductor device includes: an input unit for receiving an input data in an unpacked state; and a flag for performing an arithmetic operation. It is possible to perform arithmetic processing on the data to be set and the data of a plurality of bit widths, and the flag is set in the register and the short bit is set. When data processing of the bit width is commanded, the arithmetic operation is performed on the data of the bit width of 1Z2 of the input data, and the carry signal of the upper bit is calculated. With ALU to set in the carry flag. For example, the ALU has an arithmetic processing function of 16-bit and 8-bit bit widths, an arithmetic processing of data of 8-bit bit width is selected, and When an unchecked flag is set, the following processing is performed to obtain a 4-bit 1Z2 bit. The arithmetic processing of the bit width is performed.
入力 デー 夕 はア ンパ ッ ク の状態で人力 さ れてお り 、 従 つ て、 下位 4 ビ ッ ト の みが有効であ り 、 上位 4 ビ ッ ト は 無効 と な っ てい る (上位 4 ビ ッ ト に は 0 がセ ッ ト さ れて い る 。 ) 。 こ の状態で下位 4 ビ ッ ト に つ い て の演算処理 を行い、 こ の 4 ビ ッ ト 目 の キ ャ リ ー (又はボ ロ ー) をキ ャ リ ー フ ラ グに セ ッ ト す る こ と に よ り 、 上位 4 ビ ッ 卜 の 存在が無視 さ れ、 次の 8 ビ ッ ト の デ一 夕 (有効な部分は 下位 4 ビ ッ ト であ る が) に対す る キ ャ リ ー (又 は ボ ロ ー ) と し て機能す る こ と に な る 。 こ の 場合 の演算 は加算、 減 算、 乗算及び除算の いずれであ っ て も よ い。 The input data is input in an unpacked state. Therefore, only the lower 4 bits are valid and the upper 4 bits are invalid (the upper 4 bits). The bits are set to 0.) In this state, arithmetic processing is performed on the lower 4 bits, and the carry (or borrow) of the 4th bit is keyed. By setting the carry flag, the existence of the upper 4 bits is ignored, and the next 8 bits of data (the valid part is the lower 4 bits) However, it will function as a carry (or borrow) for the. The operation in this case may be any of addition, subtraction, multiplication and division.
こ の よ う に本発明 に お い て は、 従来 8 ビ ッ ト 単位に 固 定 さ れて い た演算機能 に対 し て 4 ビ ッ ト 単位での演算機 能を付加 し 、 更に、 8 ビ ッ ト 演算或い は 4 ビ ッ ト 演算か を プ ロ グラ マ ブルに選択で き る よ う に し た。 そ し て、 4 ビ ッ ト 演算で はオ ー バ ー フ ロ ー が各桁 ご と に発生 し 、 本 発明 をマ イ ク ロ コ ン ピ ュ ー タ に取 り 入れた場合 に は、 複 雑な数値計算の 出力結果の各 1 桁を 1 ァ ド レ ス単位 に容 易 に格納で き る 。 従 っ て、 1 デー タ 力 1 ア ド レ ス に格納 さ れ る こ と に な り 、 そ の小数点位置を合わせ る のが容易 に な る 。  As described above, according to the present invention, an arithmetic function in units of 4 bits is added to an arithmetic function previously fixed in units of 8 bits. It is now possible to programmatically select between bit operation and 4-bit operation. In addition, in the 4-bit operation, an overflow occurs every digit, and when the present invention is incorporated in a micro computer, multiple overflow occurs. Each digit of the output result of complicated numerical calculation can be easily stored in one address unit. Therefore, the data is stored in one address and one address, and the decimal point position can be easily adjusted.
ま た、 1 ア ド レ ス に 1 桁が格納 さ れて.い る た め、 それ を実行す る た めの プ ロ グ ラ ム の作成が容易 と な る 。 更 に 、 8 ビ ッ 卜 と 4 ビ ッ 卜 の演算機能がプ ロ グラ マ ブル に 切 り 換えで き る た め、 演算命令を複数種類用意す る 必要がな る 。  Also, since one digit is stored in one address, it is easy to create a program to execute it. Furthermore, since the 8-bit and 4-bit arithmetic functions can be switched programmably, it is necessary to prepare multiple types of arithmetic instructions.
ま た 、 本発明 の他の態様に従え ば、 半導体装置 は、 1 6 進デー タ を 1 0 進デー タ に変換す る 際 に はデ シ マ ル フ ラ グ力 セ ッ ト さ れ る レ ジ ス タ を有す る 。 A L U は、 こ の デ シ マ ノレフ ラ グ力 セ ッ ト さ れて い る と き に は、 1 6 進 の 演算結果を 1 0 進デー タ に変換 し て 出力す る 。 ま た、 本発明 の他の態様に おいて は、 演算デー タ を記 憶装置 に格納す る 際に はデー タ をパ ッ ク し て格納 し 、 記 憶装置力、 ら デー タ を読み 出す際に は 自動的に ァ ンパ ッ ク し て読み出す。 こ の よ う に し て、 パ ッ ク 機能及びア ン ッ ク 機能を持たせ る こ と に よ り 、 上述の演算デー タ の処 理 と 整合性を も たせ る こ と がで き る 。 Further, according to another aspect of the present invention, the semiconductor device sets a decimal flag when converting hexadecimal data to decimal data. It has a resistor. When the ALU is set, the ALU converts the hexadecimal operation result to 10-decimal data and outputs it. Further, in another aspect of the present invention, when storing arithmetic data in a storage device, the data is packed and stored, and the data is read out from the storage device. In this case, the data is automatically read and read. By providing the packing function and the anchoring function in this way, it is possible to achieve consistency with the processing of the above-described operation data.
更に、 本発明の他の の態様に従え ば、 上述の半導体装 置 は、 各種の電子機器 に適用 さ れ る 。 .例えば四則演算器 に適用 さ れ、 そ の場合 に デ シマ ルフ ラ グをセ ッ ト す る こ と に よ り 、 演算結果を 1 0 進法に よ り 表示す る こ と がで き る o 図面の簡単な説明  Further, according to another aspect of the present invention, the above-described semiconductor device is applied to various electronic devices. For example, it is applied to arithmetic operators, in which case setting the decimal flag allows the operation result to be displayed in decimal notation. o Brief description of drawings
図 1 は本発明 の一実施例の半導体装置の構成を示すブ 口 ッ ク 図であ る 。  FIG. 1 is a block diagram showing a configuration of a semiconductor device according to one embodiment of the present invention.
図 2 は図 1 の A L U の詳細を示 し た ブ.ロ ッ ク 図であ る c 図 3 は図 1 の半導体装置が適用 さ れた四則演算器の外 観図であ る 。 Fig. 2 is a block diagram showing the details of the ALU in Fig. 1. c Fig. 3 is an external view of the four arithmetic unit to which the semiconductor device in Fig. 1 is applied.
図 4 〜図 1 1 はデ シ マ ノレア ジ ャ ス ト 演算、 ア ン ッ ク 演算及びパ ッ ク 演算の説明図であ る 。  FIG. 4 to FIG. 11 are explanatory diagrams of the decimal operation, the anchor operation, and the pack operation.
図 1 2 A及び図 1 2 B は図 3 の 四則演算器 に お け る 加 算処理の場合の処理の流れを示すフ ロ ー チ ヤ 一 ト であ る , 図 1 3 は図 1 2 A の演算ル ー チ ン の処理の流れを示す フ ロ ー チ ヤ 一 卜 で あ る 。  FIGS. 12A and 12B are flow charts showing the processing flow in the case of addition processing in the four arithmetic units of FIG. 3. FIG. 13 is a flowchart of FIG. This is a flow chart showing the flow of the processing of the operation routine of FIG.
図 1 4 は R A M の ワ ー ク エ リ ア を示す図であ る 。 図 1 5 は入力 デー タ の例を示す図であ る 。 FIG. 14 is a diagram showing a work area of the RAM. FIG. 15 is a diagram showing an example of input data.
図 1 6 A 〜図 1 6 G は ワ ー ク エ リ ア に格納 さ れ る デ一 夕 の変遷を.示す図であ る 。  FIG. 16A to FIG. 16G are diagrams showing changes in data stored in the work area.
図 1 7 は図 1 3 の加算処理の ス テ ッ プ の動作を示す 夕 イ ミ ン グチ ャ ー ト であ る 。  Fig. 17 is an evening chart showing the operation of the step of the addition process in Fig. 13.
図 1 8 は A D D 命令の実行時の デー タ を示す図であ る 。 図 1 9 はパ ッ ク 命令の実行時の デー タ を示す図であ る 。 図 2 0 は ァ ンパ ッ ク 命令の実行時の デー タ を示す図で あ る o  FIG. 18 is a diagram showing data when the ADD instruction is executed. FIG. 19 is a diagram showing data at the time of executing a pack instruction. Figure 20 shows the data at the time of execution of the amp instruction.
図 2 1 A 、 図 2 1 B 、 図 2 2 A 、 図 2 2 B 、 図 2 3 〜 図 2 9 は図 1 の A L U の具体的な 回路を示 し.た 図であ る 。 発明 を実施す る た め の最良の形態  FIG. 21A, FIG. 21B, FIG. 22A, FIG. 22B, and FIG. 23 to FIG. 29 are diagrams showing specific circuits of the ALU in FIG. BEST MODE FOR CARRYING OUT THE INVENTION
図 1 に示 さ れ る 半導体装置 は、 テ ド レ ス バ ス 2 及びデ 一 夕 バス 4 を備え て い る 。 イ ン ス ト ラ ク シ ョ ン レ ジ ス タ 6 は ィ ン ス ト ラ ク シ ョ ン をデー タ バス 4.力、 ら入力す る と 共に、 タ イ ミ ン グ ジ ェ ネ レ ー タ 8 力、 ら の タ イ ミ ン グ信号 を入力す る 。 こ の イ ン ス ト ラ ク シ ョ ン は イ ン ス ト ラ ク シ ョ ン デ コ ー ダ 1 0 に てデ コ ー ダ さ れ、 マ イ ク ロ イ ン ス ト ラ ク シ ョ ン 信号線群 1 2 を介 し て送 り 出 さ れ る 。  The semiconductor device shown in FIG. 1 includes a dress bus 2 and a data bus 4. The input register 6 is used to input the input data from the data bus and to the timing generator. 8 Input the timing signals of these. This instruction is decoded by the instruction decoder 10, and the micro-instruction signal is used. It is sent out via line group 12.
ア ド レ ス レ ジ ス タ 群 ( I X , I Y , H L , B R等) 1 Address register group (IX, IY, HL, BR, etc.) 1
4 は ア ド レ ス バ ス 2 及びデー タ バ ス 4 並びに マ イ ク ロ イ ン ス ト ラ ク シ ヨ ン信号線群 1 2 と 接続 さ れてい る 。 デー 夕 レ ジ ス タ 群 ( A , B ) 1 6 はデー タ バス 4 及びマ イ ク ロ イ ン ス ト ラ ク シ ョ ン信号線群 1 2 に接続 さ れて い る 。 テ ン ポ ラ リ レ ジ ス タ 1 8 , 2 0 も デー タ バス 4 及びマ イ ク ロ イ ン ス ト ラ ク シ ョ ン信号線群 1 2 と接続 さ れてお り 、 そ の 出力 は A L U 2 2 に 出力す る 。 テ ン ポ ラ リ キ ヤ リ フ ラ グ 2 4 は、 コ ン デ シ ョ ン フ ラ グ 2 6 力、 ら の フ ラ グを入 力す る と共に テ ン ポ ラ リ レ ジ ス タ 1 8 の 出力を入力 し、 かつ マ イ ク ロ イ ン ス ト ラ ク シ ョ ン信号線群 1 2 と 接続 さ れ て い る 。 Reference numeral 4 is connected to the address bus 2 and the data bus 4 and to the microinstruction signal line group 12. The data register group (A, B) 16 is connected to the data bus 4 and the microinstruction signal line group 12. Temporary registers 18 and 20 are also connected to data bus 4 and microinstruction signal line group 12, and their outputs are Output to ALU22. The temporary carry flag 24 is used to input the condition flag 26, the other flags, and the temporary register 18 And is connected to the microstructural signal line group 12.
A L ϋ 2 2 は、 テ ン ポ ラ リ キ ヤ リ フ ラ グ 2 4 及びテ ン ポ ラ リ レ ジ ス タ 1 8 , 2 0 か ら の信号を入力す る と共に マ イ ク ロ イ ン ス ト ラ ク シ ョ ン に基づいて所定の演算処理 をす る 。 テ ン ポ ラ リ レ ジ ス タ 2 8 は A L U 2 2 の 出力を 入力 し マ イ ク ロ イ ン ス ト ラ ク シ ョ ン に 基づ い て ア ド レ ス バ ス 2 及デー タ バ ス 4 を介 し て デー タ を出力す る 。  AL ϋ 22 receives the signals from the temporary carrier flag 24 and the temporary register 18, 20, as well as Performs prescribed arithmetic processing based on the transaction. Temporary register 28 receives the output of ALU 22 and receives address bus 2 and data bus based on microinstruction. Output data via 4.
入力 ポ ー ト 3 0 はキー ボー ド 3 2 か ら の キー入力をァ ド レ スバス 2 及デー タ バス 4 を介 し て入力する。 R O M 3 4 に は例えば シ ス テ ム プ ロ グラ ム等が.格納 さ れてお り . R A M 3 6 に は例え ば外付けの キー ボー ド 3 2 か ら のキ 一入力をが格納 さ れた り 、 後述す る ワ ー キ ン グメ モ リ と し て の機能を果たす。 L C D ド ラ イ バ 3 8 は例え ばテ ン ポ ラ リ レ ジ ス 夕 2 8 の デー タ を入力 し、 L C D パネ ノレ 4 0 を駆動 し て表示 さ せ る 。  The input port 30 inputs a key input from the keyboard 32 via the address bus 2 and the data bus 4. The ROM 34 stores, for example, a system program, etc. The RAM 36 stores, for example, a key input from an external keyboard 32. In addition, it functions as a working memory described later. For example, the LCD driver 38 receives the data of the temporary register 28 and drives the LCD panel 40 to display the data.
図 1 に おいて一点鎖線で囲 ま れた部分は 1. チ ッ プマ イ ク ロ プ ロ セ ッ サ 4 2 に よ り 構成 さ れてお り 、 入力 ポ ー ト 3 2 及びキー ボー ド 3 2 は入力装置 4 4 を構成 し てい る L C D ド ラ イ バ 3 8 及び L C D パネ ノレ 4 0 は出力装置 4 6 を構成 し て い る 。 In FIG. 1, the portion surrounded by a dashed line is composed of a chip microprocessor 42, an input port 3 2 and a keyboard 3 2 is an LCD driver 38 and an LCD panel 40 constituting the input device 44. 6.
A L U 2 .2 は、 図 2 に示 さ れ る よ う に、 1 6 ビ ッ ト ァ ッ ダ ー 5 0 、 デ シ マ ノレ ア ジ ャ ス ト フ イ ノレ タ ♦ ア ン ノヽ。 ッ ク ロ ジ ッ ク を含む論理回路 5 2 及び右方向 シ フ タ 一 5 4 を 含んで い る 。 そ し て、 こ の A L U 2 2 は 1 6 ビ ッ ト 及び 8 ビ ッ 卜 の ビ ッ ト 幅の演算処理が可能であ り 、 それぞれ そ の ビ ッ ト 幅 に対応 し た マ イ ク ロ イ ン ス ト ラ ク シ ョ ン カ 用意 さ れて い る 。 こ こ で は 8 ビ ッ ト 幅の演算処理機能力 選択 さ れて い る 場合 につ い て説明す る 。 つ ま り 、 こ の実 施例 に お い て は、 8 ビ ッ ト 幅の演算処理機能が選択 さ れ て い る 状況下に お い て 4 ビ ッ ト 幅の演算処理を も 可能に し て い る 点に特徴があ り 、 従 っ て、 以下そ の点を中心に 説明す る 。  ALU 2.2 is a 16-bit padder 50, as shown in Figure 2, and a decimator resistor. A logic circuit 52 including clock logic and a right shifter 54 are included. The ALU 22 can perform arithmetic processing of 16-bit and 8-bit bit widths, and each microcontroller corresponds to the bit width. An installation kit is provided. Here, a description will be given of a case where an arithmetic processing function of 8-bit width is selected. In other words, in this embodiment, even when the 8-bit arithmetic processing function is selected, a 4-bit arithmetic processing can be performed. Therefore, the following description focuses on this point.
こ の実施例 に お い て は各種の マ イ ク ロ イ ン ス ト ラ ク シ ョ ン を使用す る が、 そ の概要 は次の と お り で あ る 。  In this embodiment, various microactions are used. The outline of the microactions is as follows.
★ U A D D : A D D , A D C 演算結果に.対す る フ ラ グの 操作をす る ( N , V , C , Z ) 。 ( A L U に対す る 操作 は特に な い。 )  ★ U ADD: Operates flags for ADD, ADC operation results (N, V, C, Z). (There is no particular operation on ALU.)
★ U S U B : S U B , S B C 演算時 に テ ン ポ ラ リ レ ジ ス タ A 1 8 及び " C Y I N "を反転 し 、 「 2 」 の補数値を 発生す る 。 ま た 、 演算結果 に対す る フ ラ グ の操作を行 う ★ U SUB: Inverts the temporary register A18 and "CYIN" during SUB and SBC operations, and generates a complement value of "2". Also, operate the flag on the operation result
( N , V , C , Z ) o (N, V, C, Z) o
★ U A N D : A N D 演算を A L U 2 2 の演算モ ー ド と し て選択す る 。 ま た、 演算結果 に対す る フ ラ グ の操作を行 う ( N , Z ) 。 • U O R : O R演算を行 う 。 そ の他は U A N D と 同様で あ る O ★ UAND: Selects AND operation as the ALU22 operation mode. Also, the flag is operated on the operation result (N, Z). • UOR: Performs an OR operation. Others are the same as UAND O
• U X O R : X O R演算を行 う 。 そ の他は U A N D と 同^で' ¾> O o  • U XOR: XOR operation is performed. Others are the same as U A N D ^ 'O> O o
★ U W I T H C : " C Y I N " の 入力 と し て " C F " を 選択す る 。  ★ UWITHC: Select "CF" as the input for "CYIN".
• U W I T H 7 : " C Y I N " の入力 と し て テ ン ポ ラ リ レ ジ ス 夕 A 1 8 の 2 ' ビ ッ ト を選択す る 。  • UWITH7: Select the 2 'bit of the temporary register A18 as the input for "CYIN".
• U C A L 1 6 : A L U 2 2 の ス テ ー タ ス ( フ ラ グへの 入力信号) と し て 1 6 ビ ッ ト モ ー ドを選択する 。  • UCAL16: Selects 16-bit mode as ALU22 status (input signal to flag).
★ U D A P K : デ シ マ ノレア ジ ャ ス ト 演算 · ア ン パ ッ ク 演 算 ( 4 ビ ッ ト ) を許可す る 。 8 ビ ッ ト 加減算 ( A D D , A D C , S U B , S B C ) 時に イ ネ一ブル と な る 。  ★ UDAPK: Decimal area just operation and unpack operation (4 bits) are permitted. It is enabled at 8-bit addition / subtraction (ADD, ADC, SUB, SBC).
♦ U N C H G C : N F , V F , C F への書込みを禁止す  ♦ U N C H G C: Writing to NF, VF, CF is prohibited
• U R R , U R R C , U S R A , U S R.L : 右 シ フ ト 、 ロ ー テ一 ト 機能を A L U 2 2 の動作 と し て選択す る 。• URR, URC, USR, and USR.L: Select the right shift and rotate functions as ALU22 operations.
• U S L L : V F への書込みを禁止す る 。 • U SLL: Write to VF is prohibited.
♦ S E P : 8 ビ ッ ト の 「 2 」 の補数値を 1 6 ビ ッ ト に拡 張す る 。  ♦ SEP: The 8-bit “2” complement value is expanded to 16 bits.
• S W A P : 8 ビ ッ ト デー タ の上位二 ブル と下位二ブル を入替 る 。  • SWAP: Exchanges the upper 2 and lower 2 bits of 8-bit data.
* U P A C : 1 6 ビ ッ ト レ ジ ス タ 上に ア ン パ ッ ク 展開 さ れて い る デー タ を 8 ビ ッ ト レ ジ ス タ 上にノ、。 ッ ク す る 。 * UPAC: Data that has been unpacked on a 16-bit register is stored on an 8-bit register. Click here.
★ U U P C K : 8 ビ ッ ト レ ジ ス タ 上の デー タ を 1 6 ビ ッ ト レ ジ ス タ 上に ア ン パ ッ ク 展開す る 。 ★ UUPCK: The data on the 8-bit register is stored in 16 bits. Unpack the data on the register.
な お、 上記の 内★印の マ イ ク ロ イ ン ス ト ラ ク シ ョ ン は 特 に本発明 に関係す る も のであ る 。  The microinstructions marked with ★ in the above are particularly related to the present invention.
上述の半導体装置 は各種の電子機器 に適用 さ れ る が、 こ こ で は図 3 に示 さ れ る よ う な 四則演算器に適用 し た場 合 につ い て の動作を.中心に説明す る 。  The semiconductor device described above is applied to various types of electronic equipment.Here, the operation when applied to the four arithmetic units as shown in FIG. 3 will be mainly described. You
こ の 四則演算器 は 8桁の 7 セ ン グメ ン ト L C D力、 ら な る L C Dノ、。ネ ノレ 4 0 を備え て い る も の と す る 。 こ こ では そ の演算処理の詳細を説明す る の に先立 っ て、 デ シ マ ル ア ジ ヤ ス ト 演算及びア ンパ ッ ク 演算の概念を説明す る 。 ( A ) デ シ マ ノレ ア ジ ャ ス ト 演算 :  These four arithmetic units are eight-digit seven-segment LCDs, and LCDs. It shall have a knoll 40. Here, prior to describing the details of the arithmetic processing, the concepts of the digital adjustment arithmetic and the unpacked arithmetic will be described. (A) Decimal just operation:
B C D と し て入力す る 2項の 1 0 進数を加算又 は減算 し 、 B C D ( 1 0 進数) で解を出力す る 。 こ こ で 、 例 と し て 8 ビ ッ ト ( 2桁) の B C D値 " 5 8 " と " 7 9 " と を加算及び減算す る 場合 につ い て見 る と 、 図 4 及び図 5 に示す よ う に な る 。 入力項の加算又 は減.算結果を B C D で出力す る か或い は H E Xで出力す る か は後述す る デ シ マ ノレフ ラ グ " D F " に よ っ て切 り 換え る 。  Adds or subtracts the two terms of decimal notation input as BCD and outputs the solution in BCD (decimal notation). Here, as an example, when adding and subtracting an 8-bit (two-digit) BCD value “58” and “79”, FIGS. 4 and 5 show. As shown. Whether the result of addition or subtraction of the input terms is output as BCD or HEX is switched according to the decimating flag "DF" described later.
( B ) ア ン パ ッ ク 演算  (B) Unpack operation
8 ビ ッ ト 演算処理を 4 ビ ッ 卜 に見た てて実行す る 。 演 算結杲は下位 4 ビ ッ 卜 の桁あふれでキ ヤ リ ー発生 と な る 。 ま た 、 上位 4 ビ ッ 卜 に は何が入力 さ れて も 結果 に は影響 し な い。 図 6及び図 7 に 4 ビ ッ ト の H E X値 " 7 " と " B " と を加算及び減算 し た場合の例を示す。 図 6 の加 算 の 例 で は下位 4 ビ ッ 卜 の キ ヤ リ 一 力く キ ヤ リ ー フ ラ グ C F に セ ッ ト さ れ る 。 図 7 の減算の例では下位 4 ビ ッ 卜 の ボ ロ ー がキ ャ リ ー フ ラ グ C F にセ ッ 卜 さ れ る 。 こ の例 に お いて も 入力項の上位 4 ビ ッ ト に何が入力 さ れて も 、 出 力の上位 4 ビ ッ ト は を出力す る 。 ア ンパ ッ ク 演算 ( 4 ビ ッ ト 演算) は後述す る ア ンパ ッ ク フ ラ グ " U F " によ っ て使用す る か否かが選択 さ れ る。 The 8-bit arithmetic processing is executed by looking at the 4-bit data. In arithmetic results, carry occurs when the lower 4 bits overflow. Also, whatever is entered in the upper 4 bits does not affect the result. FIGS. 6 and 7 show examples in which a 4-bit HEX value “7” and “B” are added and subtracted, respectively. In the example of addition in Fig. 6, the lower four bits of the carry flag C carry flag C Set to F. In the subtraction example of FIG. 7, the lower four bits of the borrow are set in the carry flag CF. In this example, no matter what is input to the upper 4 bits of the input term, the upper 4 bits of the output will output. Whether or not to use the amp operation (4-bit operation) is selected by the amp flag "UF" described later.
以上のデ シマ ノレフ ラ グ " D F " 及びア ン ク フ ラ グ " U F " に よ る 演算モー ドは次の 4 種類 と な る 。  There are four types of operation modes using the above-mentioned design flag "DF" and anchor flag "UF".
ひ F U F 演算モ 一 ド  H F U F operation mode
0 0 8 ビ ッ ト 1 6 進数演算  0 0 8-bit 1 Hexadecimal operation
0 8 ビ ッ ト 1 0 進数演算 0 8-bit 1 0-base arithmetic
0 1 4 ビ ッ ト 1 6 進数演算 0 1 4-bit 1 Hexadecimal operation
1 4 ビ ッ ト 1 0 進数演算 上記の 4 ビ ッ ト 1 0 進数演算は 則演算器に特に効果 的であ る ο  14-bit 10-digit arithmetic The above 4-bit 10-digit arithmetic is particularly effective for law arithmetic units ο
次に 、 4 ビ ッ ト 1 0 進数演算の例を説.明す る 。  Next, an example of 4-bit decimal arithmetic will be described.
4 ビ ッ 卜 の B C D 値 " 5 " と " 9 " と を加算及び減算 す る ½合 につ い て見 る と 、 図 8 に示 さ れ る 加算の下位 4 ビ ッ 卜 の キ ャ リ ーがキ ャ リ ー フ ラ グ C F に セ ッ ト さ れ る 図 9 の減算の例で は下位 4 ビ ッ ト の ボ がキ ヤ リ ー フ ラ グ C F にセ ッ ト さ れ る 。  Looking at the addition and subtraction of the 4-bit BCD values "5" and "9", the carry of the lower 4 bits of the addition shown in Figure 8 is shown. Is set in the carry flag CF In the subtraction example in Figure 9, the lower 4 bits are set in the carry flag CF.
次に 、 パ ッ ク 及びア ンパ ッ ク の動作説明をす る 。  Next, the operation of the packing and the packing will be described.
ァ ン ク は 8 ビ ッ ト レ ジ ス タ 上の デー タ を 1 6 ビ ッ ト レ ジ ス 夕 上に、 図 1 0 に示すよ う に ア ンパ ッ ク 展開す る o の ァ ン ッ ク 処理は、 本実施例におい て は " U N P A C K " 命令等 に よ り 行われ る 。 The function expands the data on the 8-bit register into the 16-bit register in the evening as shown in Fig. 10. The processing is “UN” in this embodiment. PACK "instruction.
パ ッ ク は、. 1 6 ビ ッ ト レ ジ ス 夕 上の デー タ を 8 ビ ッ ト レ ジ ス タ 上に 、 図 1 1 に示す よ う に 、 パ ッ ク (逆展開) す る 。 こ のパ ッ ク 処理 は、 本実施例 に お い て は " U N P A C K " 命令等に よ り 行われ る 。  The pack packs (reversely expands) the 16-bit register data on the 8-bit register as shown in Figure 11 on the 8-bit register. This packing process is performed by an "UNP ACK" instruction or the like in the present embodiment.
以上の説明 に よ り デ シ マ ノレア ジ ャ ス ト 演算、 ア ンパ ッ ク 演算及びパ ッ ク 演算の概念が明 ら かに な っ た と こ ろ で、 次に、 図 1 2 A 、 図 1 2 B 及 び図 1 3 の フ ロ ー チ ャ ー ト に従 っ て図 1 の.半導体装置の動作説明 をす る 。 例え ば入 力 デー タ と し て、 図 1 4 に示すよ う に、 「 5 7 1 4 . 9 2 + 9 6 . 1 3 8 6 = 」 をキ ー ボー ド 3 2 を介 し て入力 す る 場合 につ い て説明す る 。  Based on the above explanation, the concepts of the decimation-rearrangement operation, the unpacking operation, and the backpacking operation have been clarified. Next, FIG. 12A and FIG. The operation of the semiconductor device of FIG. 1 will be described in accordance with the flowcharts of FIGS. 12B and 13. For example, as input data, enter "57 14.9.92 + 96.1.38 8 =" via the keyboard 32 as shown in Fig. 14. Is explained.
キー入力等は R A M 3 6 に入力 さ れ る が、 そ の時の デ 一 夕 構造は図 1 5 に示 さ れ る よ う に 、 ア ド レ ス 「 0 0 0 X 」 は加算項 ワ ー ク エ リ ア であ り 、 ア ド レ ス 「 0 0 I X 」 は被加算項 ワ ー ク エ リ ア と な っ て い る 。 そ し て、 各デ一 夕 に お い て、 符号 6 0 で示 し た個所は小数点の境界線で あ り 、 6 1 は小数点第 1 位、 6 2 は小数点第 2 位、 6 3 は小数点第 7 を それぞれ示 し て い る 。 ま た、 6 4 は 「 1 」 の位、 6 5 は 1 0 0 万の位、 6 6 は 1 0 0 0 万の位を そ れぞれ示 し てお り 、 6 7 はキ ー 入力取 り 込み時の小数点 の 位置を格納す る 領域であ る 。  The key input and the like are input to the RAM 36, and the data structure at that time is, as shown in FIG. 15, the address "0000X" is the addition term word as shown in FIG. It is a query, and the address “0 0 IX” is a work area to be added. In each case, the point indicated by reference numeral 60 is the boundary of the decimal point, 61 is the first decimal place, 62 is the second decimal place, and 63 is the decimal point. The seventh is shown respectively. In addition, 64 indicates the “1” digit, 65 indicates the 100,000 digit, 66 indicates the 1,000,000 digit, and 67 indicates the key input value. This area is used to store the position of the decimal point at the time of import.
(1) キ ー ボー ド 3 2 の ク リ ア キー (図示せず) をキ 一 入力す る と 、 R A M 3 6 の ア ド レ ス 「 0 0 0 0 」 〜 「 0 0 1 E J 力 ク リ ア さ れ る (S10) 。 そ し て、 図 1 6 A の状 態が得 られ る 。 (1) When a clear key (not shown) of the keyboard 32 is input, the address of the RAM 36 is changed from “0000” to “001”. (S10), and the shape shown in Fig. 16A Condition is obtained.
(2) 次に、 各種の フ ラ グを初期化す る (S11) 。 例え ば ポ イ ン タ ー M ( 0 0 0 F ) に 「 8 」 を格納す る o イ ン デ ッ ク ス レ ジ ス タ I X に 「 0 0 0 E 」 を格納す る 。 桁数力 ゥ ン タ に 「 0 」 をセ ッ ト し、 小数点フ ラ グに 「 0 _| をセ, ッ ト し 、 更に、 有効数字フ ラ グに 「 0 」 をセ ッ 卜 す る こ と に よ り こ れ ら の フ ラ グを リ セ ッ 卜 す る。  (2) Next, various flags are initialized (S11). For example, store “8” in pointer M (0000F). O Store “0000E” in index register IX. Set "0" to the digit number counter, set "0_ |" to the decimal point flag, and set "0" to the significant digit flag. And reset these flags.
(3) 入力 ポ ー ト 3 0 の デー タ を読み込む (S 12) 。 そ し て、 そ の デ ー タ 力 ど の キ ー 入 力 で あ る か を 判 別 す る (S13) 。  (3) Read the data of input port 30 (S12). Then, it is determined which key input the data force is (S13).
(4) こ こ で は、 キー入力が数値入力であ る と す る と 、 桁数カ ウ ン タ が 「 8 」 未満であ る か ど う かを判断 し (S20 ) 、 こ こ では 「 8 」 未満であ る と し た と き 、 次にキー入 力が 「 0 」 であ る か ど う かを判断す る (S21) 。 「 0 」 で な い場合 に は、 次に そ の数値力く 「 1 」 〜 「 9 」 の いずれ で あ る かを判断す る (S22) 。 そ し て、 そ .の数値をア ンパ ッ ク し た状態で M ( I X ) に格納す る (S23) 。 例えばそ の数値が 「 1 」 であれば 「 0 1 」 と し て格納す る 。  (4) In this case, if the key input is a numerical input, it is determined whether the digit number counter is less than "8" (S20). If it is determined that the value is less than "8", it is determined whether the key input is "0" (S21). If it is not "0", it is next determined which of "1" to "9" is the numerical value (S22). Then, the numerical value is stored in M (IX) in an unpacked state (S23). For example, if the numerical value is “1”, it is stored as “01”.
(5) 次に、 小数点フ ラ グが 「 1 」 であ る か ど う かを判 定 し (S26) 、 こ こ で は小数点フ ラ グ力 「 1 」 ではな い と す る と 、 '次に レ ジス タ M ( 0 0 0 F ) に レ ジス タ M ( 0 (5) Next, it is determined whether or not the decimal point flag is “1” (S26), and if it is not “1” here, Next, register M (0 0 F) is assigned to register M (0
0 0 F ) — 1 の値を格納す る (S27) 。 初期値 M ( 0 0 0 F ) = 0 8 であ り 、 こ こ で は 「 0 7 」 と な る 。 0 0 F) — Store the value of 1 (S27). The initial value M (0 0 0 F) is 0 8, which is “07” here.
(6) レ ジ ス タ I X に I X — 1 の値を格納す る (S28) 。  (6) Store the value of IX-1 in the register IX (S28).
1 X の初期値は 「 0 0 0 E 」 であ り 、 こ こ では 「 0 0 0 D 」 と な り 桁位置が 1 桁下位に な る 。 桁数カ ウ ン タ を 1 イ ン ク リ メ ン ト す る (S29) 。 有効数字フ ラ グに 「 1 」 を セ ッ ト す る (S30) 。 The initial value of 1 X is “0000E”, where “0000” D ”and the digit position is one digit lower. Increment the digit counter by one (S29). "1" is set to the significant digit flag (S30).
次に、 再 び入力 ポ ー ト 3 0 の デ ー タ を 読 み 込 む処理 (S12) に戻 る 。 以上の処理を繰 り 返 し て、 「 5 」 「 7 」 . 「 1 」 「 4 」 と い う デー タ がア ド レ ス ( 0 0 0 X ) に順 次格納 さ れて い く 。  Next, the processing returns to the processing of reading the data of the input port 30 again (S12). By repeating the above processing, the data "5", "7", "1" and "4" are sequentially stored in the address (0000X).
次 に。 キ ー 入力 と し て 「 . 」 が入力 し た場合 につ い て 説明す る 。  next. A description will be given of a case where “.” Is input as a key input.
(7) キー入力 の種類を判定 し てそれが小数点 「 . 」 で あ る と す る と ( S 13 ) 、 小数点 フ ラ グに 「 1 」 をセ ッ 卜 し (S18) 、 次 に有効数字フ ラ グが 「 1 」 であ る か ど う かを 判断す る (S19) 。 こ こ で は、 有効数字フ ラ グが既 に 「 1 」 に セ ッ 卜 さ れて い る ので、 次 に再ぴ入力 ポ ー ト 3 0 の デ 一 夕 を読み込む処理 (S12) に戻 る 。  (7) If the type of key input is determined and the decimal point is "." (S13), "1" is set to the decimal point flag (S18), and the next significant digit is set. It is determined whether or not the flag is "1" (S19). In this case, since the significant digit flag has already been set to “1”, the process returns to the process of reading the data of the re-input port 30 (S12). .
(8) 次 に、 再び小数点以下の数値が入力 し た場合 に は、 ス テ ッ プ (S12) 、 (S20) 〜 (S22) の処理を経由 し 、 次に 小数点 フ ラ グ力 「 1 」 に セ ッ 卜 さ れてい る 力、 ど う 力、を判 定す る が、 こ こ で は既 に 「 1 」 に セ ッ 卜 さ れて い る の で、 ス テ ッ プ (S27) の処理を飛ば し て ス テ ッ プ (S28) 以降の 処理に進む。  (8) Next, when a value after the decimal point is input again, the process goes through steps (S12) and (S20) to (S22), and then the decimal point flag power “1” The force set in the step (S27) is determined because the force set in step (S27) is already set to "1". Skip the processing and proceed to the processing after step (S28).
以上の処理を繰 り 返す こ と に よ り 、 小数点以下の数値 「 9 2 」 力《 ア ド レ ス ( 0 0 0 X ) に順次取 り 込 ま れて い By repeating the above processing, the value after the decimal point “92” is sequentially captured in the address (0000X).
< 0 <0
こ の よ う に し て数値 「 5 7 1 4 . 9 2 」 を入力 し た後 の ア ド レ ス ( 0 0 0 X ) の デー タ は図 1 4 B に示 さ れ る よ う に な る 。-In this way, after inputting the numerical value "57 14.9.92" The data at the address (0000X) at this time is as shown in FIG. 14B. -
(9) 次に、 「 十 」 キーが入力す る と 、 キー入力の種類 が判断 さ れた 際に、 演算ルー チ ンが呼び出 さ れて演算処 理に移 る ( S 16 ) 。 (9) Next, when the "ten" key is input, when the type of key input is determined, the operation routine is called and the operation proceeds to the operation process (S16).
ま ず。 M ( 0 0 0 F ) が 「 0 」 であ る かど う かを判断 し (S50) 、 こ こ で は 「 4 」 に設定 さ れて い る ので、 次に レ ジ ス 夕 I X に 「 0 」 をセ ッ 卜 し (S51) 、 M ( I X + 1 ) の値を M ( I X ) に格納す る 。 I X + 1 を レ ジ ス タ I X に格納 し て (S53) 、 こ の I X の値力《 「 0 0 0 E 」 と等 し く な つ たか ど う かにつ い て判断 し (S 54) 、 等 し く な けれ ば上記の処理 (S52) , (S53) の処理を繰 り 返す。 こ の処 理が繰 り 返 さ れ る こ と に よ り 、 入力 デー タ が 1 桁ずつ下 位側 (右方向) に シ フ ト す る 。  First. It is determined whether or not M (0000F) is "0" (S50). Since it is set to "4" in this case, next, "0" is added to the register IX. Is set (S51), and the value of M (IX + 1) is stored in M (IX). IX + 1 is stored in the register IX (S53), and it is determined whether or not the value of the IX is equal to “0000E” (S54). If they are not equal to each other, the above processes (S52) and (S53) are repeated. By repeating this process, the input data is shifted one digit downward (to the right).
(10)次に、 I X力 「 0 0 0 E 」 に な る と (S 54) 、 M (10) Next, when the IX force becomes "0000E" (S54), M
( I X ) に 「 0 」 をセ ッ ト す る (S55) 。 ま り 、 「 0 0 0 E 」 の桁に 「 0 」 力 セ ッ ト さ れ る 。 (0) is set to (IX) (S55). In addition, "0" is set at the digit "0000E".
M ( 0 0 0 F ) に M ( 0 0 0 F ) — 1 の値をセ ッ ト し 、 M ( 0 0 0 F ) が 「 4 」 であ っ た ので、 こ こ では 「 3 」 と な る。 こ の よ う に M ( 0 0 0 F ) の値を 「 1 」 ずつ減 じ て い き 、 M ( 0 0 0 F ) の値が零にな る ま で繰 り 返す (S50) 。 M ( 0 0 0 F ) の値が零に な っ た状態の デ一 夕 は図 1 6 C に示 さ れた状態に な り 、 小数点の位置合わせ が完了す る 。  M (0000F) is set to the value of M (0000F) — 1 and M (0000F) was "4", so it is "3" here. You. As described above, the value of M (0000F) is reduced by "1", and the process is repeated until the value of M (0000F) becomes zero (S50). When the value of M (0000F) becomes zero, the state shown in Fig. 16C is reached, and the decimal point alignment is completed.
(11 )フ ラ グ U F に 「 1 」 をセ ッ 卜 し ( S 57 ) 、 フ ラ グ D F に 「 1 」 を セ ッ 卜 す る (S58) 。 レ ジ ス タ I Y に 「 0 0 0 0 」 を セ ッ 卜 し (S59) 、 レ ジ ス 夕 I X に 「 0 0 1 0 」 をセ ッ 卜 す る (S60) 。 (11) “1” is set in the flag UF (S57), and the flag D is set. "1" is set to F (S58). "0000" is set in the register IY (S59), and "010" is set in the register IX (S60).
(12) M ( I X ) に M ( I X ) + M ( I Y ) + C F ( : C F の初期値は零) の演算 し た結果を格納す る ( こ の処 理 に つ い て は そ の詳細を後述す る 。 ) 。 次に、 レ ジ ス タ I Y及 び I X の 値を そ れ ぞれ 「 1 」 ずつ イ ン ク リ メ ン 卜 し (S62) , (S63) 、 レ ジ ス タ I X の値力、' 「 0 0 0 F 」 に な る ま で繰 り 返す (S64) 。 こ の よ う に し て、 ア ド レ ス (12) Store the result of the operation of M (IX) + M (IY) + CF (: the initial value of CF is zero) in M (IX) (the details of this processing are described in detail below). Will be described later.) Next, the values of the registers IY and IX are each incremented by “1” (S62) and (S63), and the value of the register IX, '' 0 It repeats until it becomes "0 0 F" (S64). In this way, the address
「 0 0 0 X 」 の値 と ア ド レ ス 「 0 0 1 X 」 の値 ( こ こ で は 「 0 」 で あ る 力 ) と を加算 し て、 ア ド レ ス 「 0 0 1 X 」 に格納す る 。 こ こ で は ア ド レ ス 「 0 0 1 X 」 の値 は 当初The value of “0000X” and the value of address “001X” (here, the force that is “0”) are added, and the address “001X” is added. Store in. Here, the value of the address “001 X” is initially
「 0 」 で あ る 力、 ら 、 ア ド レ ス 「 o o o x」 の値を ァ ド レ ス 「 0 0 1 X 」 に コ ピ ー し た状態 と な り 、 図 1 6 D に示 さ れ た 状態 と な る 。 The force that is “0”, and the value of the address “ooox” is copied to the address “001X”, as shown in FIG. 16D. State.
(13)次 に 、 フ ラ グ U F 及 び フ ラ グ D F.に 「 0 」 を そ れ ぞれセ ッ ト し (S65) , (S66) 、 有効桁を判断 し て 「 5 7 1 4 , 9 2 」 と い う 数値を L C D ノ、。ネ ノレ 4 0 に表示す る (S67) , (S68)  (13) Next, “0” is set for each of the flag UF and the flag DF (S65) and (S66), and the effective digits are determined. , 9 2 ”is the LCD value. Displayed on the reference 40 (S67), (S68)
(14)次に、 加算値 「 9 6 . 1 3 8 4 」 をキ ー入力す る 。 こ の場合 も 上記に お い て 「 5 7 1 4 . 9 2 」 を入力 し た と き と 同様 に処理 さ れて ア ド レ ス 「 0 0 0 X 」 に 「 9 6 . 1 3 8 4 」 の デ ー タ が格納 さ れ る 。 こ の 時の状態 は 図 1 (14) Next, enter the added value “96.13384” by key. In this case as well, the processing is performed in the same way as when "571.4.92" is input in the above, and the address "0000X" is displayed as "96.1338" Is stored. Figure 1 shows the state at this time.
6 E に示 さ れ る と お り であ る 。 It is as shown in 6E.
(15)次 に 「 == 」 キ ー が入力 さ れ る と 、 そ の キ ー の 種類 が判断 さ れ 「 = 」 キ ーであ る と 判断 さ れる と (S 13) 、 有 効数値フ ラ グが 「 0 」 であ る か ど う かを判断す る (S14) こ こ では既に有効数値フ ラ グ は 「 1 」 にセ ッ ト さ れて い る ので、 次に演算ルー チ ン を呼び出 し てそ の処理に移 る (S15) o (15) When the "==" key is input next, the type of the key When it is determined that the key is the “=” key (S13), it is determined whether the effective numerical value flag is “0” (S14). Since the effective numerical value flag is set to "1", the operation routine is called next, and the process proceeds (S15).
(16)演算ル — チ ンで は上述の場合 と 同様に処理ざれ、 加算項の小数点位置が調整 さ れ(S50) 〜 (S56) 、 図 1 6 (16) In the arithmetic routine, the processing is performed in the same way as in the above case, and the decimal point position of the addition term is adjusted (S50) to (S56), and FIG.
F の状態が得 ら れ る 。 そ し て、 加算項 と 被加算項と の加 算演算が行われ、 そ の演算結果は図 1 6 G の と お り 、 ァ ド レ ス 「 0 0 I X」 に格納 さ れ る (S57) 〜 (S64) 。 上述 の場合と 同様に 、 フ ラ グ U F 及び フ ラ グ D F に 「 0 」 を それぞれセ ッ ト し (S65) , (S66) 、 有効桁を判断 し て演 算結果 「 5 8 1 1 . 0 5 8 6 」 を L C Dノヽ。ネ ノレ 4 0 に表 示す る (S67) , (S68) o The state of F is obtained. Then, an addition operation is performed on the addition term and the augmented term, and the operation result is stored in the address “0 IX” as shown in FIG. 16G (S57). ~ (S64). As in the case described above, “0” is set in each of the flag UF and the flag DF (S65) and (S66), the effective digits are determined, and the operation result “58111.0” is determined. 5 8 6 "LCD. (S67), (S68) o
と こ ろ で、 M ( I X ) に M ( I X ) + M ( I Y ) + C F の演算 し た結果を格納す る 処理は、 プ.ロ グラ ム上次の よ う に表現 さ れ る 。  At this point, the process of storing the result of the operation of M (IX) + M (IY) + CF in M (IX) is expressed as follows in a program.
4 6 L D A , [ I X ] 4 6 LDA, [IX]
O F A D C A , [ I Y ]  O F A D C A, [I Y]
6 0 L D [ I X ] , A  6 0 L D [I X], A
なお、 上記 4 6 , 6 0 はマ シ ン コ ー ドの例であ る 。 こ の実施例 に お い て は、 内部バ ス は 1 6 ビ ッ ト 構成で あ る 力く、 上記の命令に お いて は下位 8 ビ ッ ト ( I Β 0 7 〜 0 0 ) の みを使用 し 、 実行サイ ク ルを低減す る た め に C P u の 内部構造は複数のバ ス ラ イ ン ( 内部バ ス 及 び外 部バ ス ) で構成 さ れて い る 。 こ の 命令 の実行は 図 1 7 に 示 さ れ る タ イ ミ ン グ チ ヤ 一 卜 に 示 さ れ る タ イ ミ ン グで処 理 さ れ る 。 The above 46 and 60 are examples of machine code. In this embodiment, the internal bus is a powerful 16-bit configuration, and only the lower 8 bits (IΒ07 to 00) are used in the above instruction. Use and reduce execution cycles The internal structure of CPu is composed of multiple bus lines (internal bus and external bus). The execution of this instruction is processed at the timing shown in the timing chart shown in FIG.
こ こ で 、 デ ー タ パ ス の た め の.マ イ ク ロ イ ン ス ト ラ ク シ ョ ン 群 の 各命令 の 内容 は次の と お り で あ る 。  Here, the contents of each instruction of the micro-instruction group for the data path are as follows.
U M V E B : メ モ リ か ら 外部バ ス へ の読み 出 し  U M V E B: Read from memory to external bus
U I L V E B : 内部バ ス 下位か ら外部バ ス への転送 U E B V I L : 外部バ ス か ら 内部バ ス 下位へ の転送 U A V I L : A レ ジ ス タ か ら 内部バ ス 下位への 読み 出 し  UILVEB: Transfer from lower internal bus to external bus UEBIL: Transfer from lower external bus to lower internal bus UAVIL: Read from A register to lower internal bus
U J L V I L : テ ン ポ ァ ラ リ レ ジ ス タ X 下位力、 ら 内部 バ ス 下位への読み 出 し  U J L V I L: Temporary register X lower read, internal bus lower read
U E B V E L : 外部バ ス 力、 ら テ ン ポ ラ リ レ ジ ス タ A下 位への 書 き 込み  U E B V E L: External bus force, write to lower register A of temporary register
U I L V G L : 内 部バ ス 下位力、 ら テ ン.ボ ラ リ ア レ ジ ス 夕 B 下位への書 き 込 み  U I L V G L: Write to lower part of internal bus, lower part of tenor bolary register B
U I L V A : 内部バ ス下位力、 ら A レ ジ ス タ へ の書込み U W I T H C : キ ャ リ ー フ ラ グ 力、 ら テ ン ポ ラ リ キ ヤ リ 一 フ ラ グ へ の 書込 み  UILVA: Internal bus lower power, write to A register UWITHC: Carry flag power, write to temporary carrier flag
ま た 、 ァ ド レ ス 制御 の た め の マ イ ク ロ イ ン ス ト ラ ク シ ョ ン 群 の 各命令 の 内容 は 次の と お り で あ る 。.  The contents of each of the instructions in the microinstruction group for address control are as follows. .
U A D P C : ア ド レ ス ノく ス に P C を 出力す る 。  U A D P C: Outputs PC to the address nozzle.
U A D I X : ァ ド レ ス バ ス に I X を 出力す る 。  U A D I X: Outputs I X to the address bus.
U A D I Y : Ύ ド レ ス バ ス に I Y を 出力す る 。 図 1 7 の タ イ ミ ン グチ ヤ 一 ト カ、 ら も 明 ら かな よ う に 、 デ ー タ の流れ は次の よ う に な る 。 UADIY: Ύ Outputs IY to the dress bus. As is clear from the timing chart of FIG. 17, the data flow is as follows.
(1) 4 6 →外部バ ス E B (命令フ ユ ツ チ )  (1) 4 6 → External bus EB (Instruction unit)
(2) ( I X ) → E B →内部ノく ス下位 8 ビ ッ ト I L → A レ ジ ス タ A reg  (2) (I X) → EB → lower 8 bits of internal noise I L → A register A reg
(3) 0 F — E B (命令 フ ユ ツ チ )  (3) 0 F — E B (instruction unit)
(4) ( I Y ) → E B →テ ン ポ ラ リ レ ジ ス タ A C T A ) A reg → I L — テ ン ポ ラ リ レ ジ ス タ B ( T B ) 、 キ ヤ リ ー フ ラ グ C F →テ ン ポ ラ リ キ ヤ リ ー フ ラ グ T C  (4) (IY) → EB → Temporary register ACTA) A reg → IL — Temporary register B (TB), carry flag CF → Polariary flag TC
(5) テ ン ポ ラ リ レ ジ ス タ X ( T X ) → I L → A reg A L U キ ャ リ ー 出力— C F 、  (5) Temporary register X (TX) → I L → A reg A L U Carry output — C F,
6 0 → E B (命令 フ ェ ッ チ )  60 → EB (instruction fetch)
(6) A reg → I L → E B → ( I X )  (6) A reg → I L → E B → (I X)
次 に 、 図 1 7 の④、 ⑤のバ ス サ イ ク ルの 間 に行われて い る A D D 命令につ い て説明す る 。  Next, the ADD instruction executed during the bus cycle (1) and (2) in FIG. 17 will be described.
フ ラ グ ϋ F , D F が共 に 「 1 」 に セ ッ ト さ れて い る と き の加算命令 ( A D D 命令) は図 1 8 に示すよ う に な る 。 例え ば 「 1 9 + 5 8 」 を求め る 際 に は テ ン ポ ラ リ レ ジ ス 夕 A ( T A ) に は下位 8 ビ ッ 卜 に 「 1 9 」 が格納 さ れ、 テ ン ポ ラ リ レ ジ ス タ B ( T B ) に は下位 8 ビ ッ ト に 「 5 8 」 が格納 さ れて い る 。 そ し て、 そ の両者 と テ ン ポ ラ リ フ ラ グ T C と を加算 し 、 1 6 ビ ッ 卜 の ア ツ ダー 出力 C A L は デ シ マ ノレ ア ジ ャ ス ト フ イ ノレ 夕 · ア ン ノ ッ ク ロ ジ ッ ク に入力をす る 。 デ シ マ ゾレア ジ ャ ス ト フ イ ノレ タ · ア ン パ ッ ク ロ ジ ッ ク で は B C D 補正、 ア ンパ ッ ク 補正が行な われ、 そ の 出力 D A F は図示の よ う に な り 、 演算出力 は 「 0 〇 0 0 1 0 0 0 」 と な り 、 キ ャ リ ー フ ラ グ C F に 「 1 」 が セ ッ 卜 さ れ る 。 When flags F and DF are both set to "1", the addition instruction (ADD instruction) is as shown in FIG. For example, to obtain “19 + 58”, the temporary register “A” (TA) stores “19” in the lower eight bits, and the temporary register. Register B (TB) stores "58" in the lower 8 bits. Then, both of them are added to the temporary flag TC, and the 16-bit adder output CAL is output to the decimal output register. Make an input to the knock logic. Decimazorea Just Finale Amp In the clock, BCD correction and unpack correction are performed, the output DAF is as shown in the figure, and the calculation output is “0〇0100”. "1" is set in the carry flag CF.
以上の よ う に し てァ ンパ ッ ク 演算及びデ シ マ ノレア ジ ャ ス ト 演算に よ る 加算処理を行 っ た例を示 し たが、 こ れ ら の演算 に よ れば次に述べ る 利点があ る こ と が分か る 。  In the above, an example of performing the addition processing by the amp operation and the decimal-normal-just operation as described above is shown. You can see that there are advantages.
a ) 図 1 5 に示 し た R A M 3 6 の デー タ 構造 に示す と お り 、 入力 デー タ に対 し て各桁を 1 0 進数で 1 ア ド レ ス 単位 に格納 し て い る た め、 加算項 と 被加算項 と の 間での 小数点位置を合わせ る のが容易 に行え る 。  a) As shown in the data structure of the RAM 36 shown in Fig. 15, each digit of the input data is stored in one-address units in decimal notation. The position of the decimal point between the addition term and the augmented term can be easily adjusted.
b ) ま た、 各桁の加算を 1 0 進法 1 桁 ( B C D · 4 ビ ッ ト ) で出力す る こ と がで き 、 かつ そ の 1 桁の加算のォ ー バ — フ ロ ー力 キ ャ リ ー フ ラ グ C F に反映で き る た め、 上位桁への桁上げ処理が容易 にで き る 。  b) In addition, addition of each digit can be output in one-digit decimal system (BCD, 4 bits), and the addition of the one digit is an overflow. Since it can be reflected in the carry flag CF, carry processing to the upper digit can be easily performed.
c ) パ ッ ク 命令及びア ン パ ッ ク 命令 は.1 ア ド レ ス · 2 桁 に濃縮 さ れた デー タ と 1 ァ ド レ ス · 1 桁 に還元 さ れた デー タ と の交互変換 に効果的であ る 。  c) Packing and unpacking instructions are used to alternate between 1-address, 2-digit enriched data and 1-address, 1-digit reduced data. It is effective for
と こ ろ で、 上述の加算命令が終了 し て後 そ の デー タ を 格納す る 際 に は プ ロ グ ラ ム でパ ッ ク 命令 ( P A C K 命令) を実行 さ せ る こ と に よ り 記憶容量の節約を図 る こ と がで さ る 。  At the time of storing the data after completion of the above-mentioned addition instruction, the program is executed by executing a pack instruction (PACK instruction) to store the data. This can save space.
こ こ で は、 A : 3 7 , B : 9 5 の数値を例 に説明す る 。 テ ン ポ ラ リ レ ジ ス タ A ( T A ) に は B と A と 力 < 1 6 ビ ッ ト デー タ と し て格納 さ れてお り 、 テ ン ポ ラ リ レ ジ ス 夕 B ( T B ) に は 「 0 0 0 0 H」 が格納 さ れ る 。 そ し て、 そ の両者を加算す る と 1 6 ビ ッ ト の ア ツ ダー 出力 C A L が得 られ、 それはデ シマ ルア ジ ヤ ス ト フ ィ ノレ 夕 · ア ンノ ッ ク ロ ジ ッ ク 回路 5 2 に入力 さ れ る 。 そ の 出力 D A F は 図示の よ う に な り 下位 4 ビ ッ ト の デー タ と 、 ア ツ ダ一 出 力 C A L の 9 ビ ッ ト 目 力、 ら 1 2 ビ ッ ト 目 の デ一 夕 と がノ、。 ッ ク さ れて A L U 2 2 の 出力 と し て得 ら れる 。 従 っ て、 A L U 2 2 の 出力 の下位 8 ビ ッ ト は有効デー タ と し て扱 われて R A M 3 6 に格納 さ れ る が、 上位 8 ビ ッ ト は無効 デー タ と し て扱われ る 。 In this example, the numerical values of A: 37 and B: 95 will be described as examples. Temporary register A (TA) stores B, A, and force as 16-bit data. “0000H” is stored in B (TB). Then, when the two are added, a 16-bit adder output CAL is obtained. Entered in 2. The output DAF is as shown in the figure, and the lower 4 bits of data, the 9th power of the output CAL, and the 12th bit of data are output. No ,. And obtained as the output of ALU22. Therefore, the lower 8 bits of the output of ALU 22 are treated as valid data and stored in RAM 36, but the upper 8 bits are treated as invalid data. .
こ の よ う にパ ッ ク さ れた デー タ を再び R A M 3 6 力、 ら 読み 出す場合に はプ ロ グラ ムで逆に ア ンパ ッ ク 命令 ( U N P A C K命令) を実行す る 。  When the packed data is read out again from the RAM 36, an unpacking instruction (UNP ACK instruction) is executed by the program.
こ こ では、 A : 6 5 の数値を例 ίこ説明す る 。  Here, A: A numerical value of 65 will be explained as an example.
テ ン ポ ラ リ レ ジ ス タ A ( T A ) に は上位に 「 ◦ 0 H」 が、 下位に は A レ ジス 夕 の値が格納 さ れ.てお り 、 テ ン ポ ラ リ レ ジ ス 夕 B ( T B ) に は 「 0 0 0 0 H」 力 格納 さ れ る 。 そ し て、 そ の両者を加算す る と 1 6 ビ ッ ト の ア ツ ダ 一出力 C A L が得 ら れ、 それはデ シ マ ノレア ジ ャ ス ト フ ィ ルタ · ア ンパ ッ ク ロ ジ ッ ク 回路に入力 さ れる 。 そ の 出力 D A F は図示の よ う に な り 、 下位 4 ビ ヅ 卜 の デー タ はそ の ま ま A L U の 出力 の最下位 4 ビ ッ ト の デー タ と な り 、 次の 4 ビ ッ ト に は Γ 0 H 」 が揷入 さ れる 。 ま た次の 4 ビ ッ 卜 に は D A F の 出力の上位 4 ビ ッ 卜 の デー タ が出力 さ れ、 更に次の最上位 4 ビ ッ ト に は、 「 0 H 」 が挿入さ れ る 。 こ の よ う に し て ア ンパ ッ ク 化デー タ 「 0 6 0 5 」 が 得 ら れ る 。 Temporary register A (TA) stores the value of `` 0H '' in the upper part and the value of register A in the lower part. In the evening B (TB), "0000H" is stored. Addition of the two results in a 16-bit Atsuta output CAL, which is a digital filter, a digital filter, and a logic filter. Input to the circuit. The output DAF is as shown in the figure, and the lower 4 bits of data remain the same as the lower 4 bits of the ALU output, and the next 4 bits are output. "0H" is introduced. In the next 4 bits, the data of the upper 4 bits of the DAF output is output, and in the next 4 most significant bits, “0H” is inserted. . In this way, the unpacked data "0605" is obtained.
A L U 2 2 の具体的な 回路構成 は図 2 1 A 〜図 2 9 に 示す と お り の構成に な っ て い る 。 図 2 1 A及び図 2 1 B は A L U の結線図であ り 、 図 2 2 A及び図 2 2 B は 1 6 ビ ッ ト ア ツ ダ一 回路、 図 2 3 はデ シ マ ルア ジ ャ ス ト フ ィ ル 夕 ♦ ア ンノ、。 ッ ク ロ ジ ッ ク 回路、 図 2 4 は A L U シ フ タ 、 図 2 5 は制御 フ ラ グの 各構成を示す回路図あ る 。 図 2 6 〜図 2 9 は図 2 5 に示 さ れ る 制御 フ ラ グを構成す る ラ ッ チ群の具体的 な 回路図であ る 。 図 2 5 は図 2 1 B の F L A G プ ロ ッ ク に対応 し 、 図 2 1 B は図 1 の コ ン デ ィ シ ョ ン フ ラ グ 2 6 に対応す る 。 図 2 6 は ゼ ロ フ ラ グ、 オ ー バ — フ ラ グ、 ネ ガテ ィ ブフ ラ グラ ッ チ部の 回路図であ る 。 図 2 7 は 2 ビ ッ 卜 割 り 込み フ ラ グラ ッ チ部回路図、 図 2 8 はキ ャ リ ー フ ラ グ ラ ッ チ部回路図、 図 2 9 は デ シ マ ル フ ラ グ、 ア ンパ ッ ク フ ラ グラ ッ チ部回路.図で あ る 。  The specific circuit configuration of ALU22 is as shown in FIGS. 21A to 29. FIG. FIGS. 21A and 21B are ALU wiring diagrams. FIGS. 22A and 22B are 16-bit atlas circuits, and FIG. 23 is a decimal adjuster. Evening ♦ Anno. FIG. 24 is a circuit diagram showing the configuration of a clock logic circuit, FIG. 24 is an ALU shifter, and FIG. 25 is a circuit diagram showing each configuration of a control flag. FIGS. 26 to 29 are specific circuit diagrams of the latches constituting the control flag shown in FIG. FIG. 25 corresponds to the FLAG block of FIG. 21B, and FIG. 21B corresponds to the condition flag 26 of FIG. Figure 26 is a circuit diagram of the zero-flag, over-flag, and negative flag grabbers. Figure 27 is a circuit diagram of the 2-bit interrupt flag latch, Figure 28 is a circuit diagram of the carry flag latch, and Figure 29 is a decimal flag. This is the circuit diagram of the amp flag latch section.

Claims

請 求 の 範 囲 The scope of the claims
1 . 入力 デー タ をア ンパ ッ ク し た状態で取 り 込む入力手 段 と 、 . 1. An input means for capturing input data in an unpacked state;
ア ンパ ッ ク演算処理をす る 際に ア ンパ ッ ク フ ラ グがセ ッ ト さ れ る レ ジ ス タ と 、  A register in which the amp flag is set when the amp operation is performed.
複数の ビ ッ ト 幅の デー タ を演算処理す る こ と がで き 、 前記 レ ジ ス 夕 に ア ンパ ッ ク フ ラ グがセ ッ 卜 さ れ、 かつ短 ぃ ビ ッ ト 幅の デー タ 処理が命令 さ れて い る状態では、 ァ ン ノ、 ' ッ ク さ れた入力デー タ の 1 / 2 の ビ ッ ト 幅の デー タ につ い て演算 し 、 そ の上位 ビ ッ ト への キ ャ リ ー又はボ ロ 一をキ ャ リ ー フ ラ グに セ ッ 卜 す る A L U と  It is possible to perform arithmetic processing on data having a plurality of bit widths, and to set an amp flag in the register area and to execute data processing with a short bit width. In the state where processing is instructed, the operation is performed on data with a bit width of 1/2 of the input data that has been checked, and the upper bit is transferred. ALU that sets the carry or the borrower on the carry flag
を有す る 半導体装置。 A semiconductor device having:
2 , A L U は、 1 6 ビ ッ ト 及び 8 ビ ッ ト の ビ ッ ト 幅の演 算処理機能を有 し 、 8 ビ ッ ト の ビ ッ ト 幅の デー タ の演算 処理が選択さ れ、 かつ ア ンパ ッ ク フ ラ グがセ ッ ト さ れて い る と き 、 下位 4 ビ ッ ト に つ い ての演算処理を行い、 こ の 4 ビ ッ 卜 目 の キ ヤ リ ー又 はボ ロ ーをキ ヤ リ 一 フ ラ グに セ ッ 卜 す る 請求項 1 記載の半導体装置。 2. The ALU has an arithmetic processing function of 16-bit and 8-bit bit widths, and an arithmetic processing of data of an 8-bit bit width is selected, and When the amp flag is set, the arithmetic processing is performed for the lower 4 bits, and the carry or borrow of the 4th bit is performed. The semiconductor device according to claim 1, wherein the key is set in a carrier flag.
3 . デ シマ ノレ フ ラ グ力 セ ッ 卜 さ れ る レ ジ ス タ を有 し 、 A L U は、 こ の デ シマ ルフ ラ グ力 セ ッ ト さ れてい る と き に は、 1 6 進の演算結果を 1 0 進デー タ に変換 し て出力す る 請求項 1 記載の半導体装置。 3. The register has a decimal flag set, and the ALU has a hexadecimal value when the decimal flag is set. 2. The semiconductor device according to claim 1, wherein the operation result is converted into decimal data and output.
4 . A L U は、 演算結果を記憶装置 に格納す る 際に はァ ン ノ、。 ッ ク さ れた デー タ をパ ッ ク し て格納 し 、 記憶装置か ら デー タ を読み 出す際に は逆に ア ンパ ッ ク し て読み 出す 請求項 1 記載の半導体装置。 4. ALU is used when storing the operation result in the storage device. 2. The semiconductor device according to claim 1, wherein the packed data is packed and stored, and when reading the data from the storage device, the data is unpacked and read.
5 . 入力 デー タ を ア ン パ ッ ク し た状態で取 り 込む入力手 段 と 、 ア ンパ ッ ク 演算処理をす る 際に ア ンパ ッ ク フ ラ グ がセ ッ 卜 さ れ る レ ジ ス タ と 、 複数の ビ ッ ト 幅の デー タ を 演算処理す る こ と がで き 、 前記 レ ジ ス タ に ア ンパ ッ ク フ ラ グがセ ッ 卜 さ れ、 かつ短い ビ ッ ト 幅の デー タ 処理が命 令 さ れて い る 状態で は、 ァ ンパ ッ ク さ れた入力 デー タ の 1 / 2 の ビ ッ ト 輻の デー タ に つ い て演算 し 、 そ の上位 ビ ッ 卜 の キ ャ リ ー又は ボ ロ ー をキ ャ リ ー フ ラ グに セ ッ ト す る A L U と を有す る 半導体装置を、 内蔵 し た電子機器。 5. An input means to capture the input data in the unpacked state, and a register in which the unpacked flag is set when performing the unpacking operation It is possible to perform arithmetic processing on the data of a bit and a plurality of bit widths. The register is set with an amp flag and the bit width is short. In the state where the data processing of the input data is instructed, the calculation is performed on the data of the bit radiation of 1/2 of the amplified input data, and the upper bit is calculated. An electronic device with a built-in semiconductor device that has an ALU that sets the carry or borrow of a unit in a carry flag.
PCT/JP1991/001496 1990-11-02 1991-11-01 Semiconductor device WO1992008188A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2/297677 1990-11-02
JP29767790 1990-11-02

Publications (1)

Publication Number Publication Date
WO1992008188A1 true WO1992008188A1 (en) 1992-05-14

Family

ID=17849714

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP1991/001496 WO1992008188A1 (en) 1990-11-02 1991-11-01 Semiconductor device

Country Status (1)

Country Link
WO (1) WO1992008188A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7966482B2 (en) 1994-12-02 2011-06-21 Intel Corporation Interleaving saturated lower half of data elements from two source registers of packed data

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6222144A (en) * 1985-07-23 1987-01-30 Nec Corp Decimal arithmetic circuit
JPS63175927A (en) * 1987-01-12 1988-07-20 アメリカン テレフオン アンド テレグラフ カムパニ− Method and apparatus for processing binary coded dicimal/backed data
JPS6462726A (en) * 1987-09-03 1989-03-09 Fujitsu Ltd Adder-subtracter
JPS6462727A (en) * 1987-09-03 1989-03-09 Fujitsu Ltd Adder-subtracter

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6222144A (en) * 1985-07-23 1987-01-30 Nec Corp Decimal arithmetic circuit
JPS63175927A (en) * 1987-01-12 1988-07-20 アメリカン テレフオン アンド テレグラフ カムパニ− Method and apparatus for processing binary coded dicimal/backed data
JPS6462726A (en) * 1987-09-03 1989-03-09 Fujitsu Ltd Adder-subtracter
JPS6462727A (en) * 1987-09-03 1989-03-09 Fujitsu Ltd Adder-subtracter

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7966482B2 (en) 1994-12-02 2011-06-21 Intel Corporation Interleaving saturated lower half of data elements from two source registers of packed data
US8190867B2 (en) 1994-12-02 2012-05-29 Intel Corporation Packing two packed signed data in registers with saturation
US8495346B2 (en) 1994-12-02 2013-07-23 Intel Corporation Processor executing pack and unpack instructions
US8521994B2 (en) 1994-12-02 2013-08-27 Intel Corporation Interleaving corresponding data elements from part of two source registers to destination register in processor operable to perform saturation
US8601246B2 (en) 1994-12-02 2013-12-03 Intel Corporation Execution of instruction with element size control bit to interleavingly store half packed data elements of source registers in same size destination register
US8639914B2 (en) 1994-12-02 2014-01-28 Intel Corporation Packing signed word elements from two source registers to saturated signed byte elements in destination register
US8793475B2 (en) 1994-12-02 2014-07-29 Intel Corporation Method and apparatus for unpacking and moving packed data
US8838946B2 (en) 1994-12-02 2014-09-16 Intel Corporation Packing lower half bits of signed data elements in two source registers in a destination register with saturation
US9015453B2 (en) 1994-12-02 2015-04-21 Intel Corporation Packing odd bytes from two source registers of packed data
US9116687B2 (en) 1994-12-02 2015-08-25 Intel Corporation Packing in destination register half of each element with saturation from two source packed data registers
US9141387B2 (en) 1994-12-02 2015-09-22 Intel Corporation Processor executing unpack and pack instructions specifying two source packed data operands and saturation
US9182983B2 (en) 1994-12-02 2015-11-10 Intel Corporation Executing unpack instruction and pack instruction with saturation on packed data elements from two source operand registers
US9223572B2 (en) 1994-12-02 2015-12-29 Intel Corporation Interleaving half of packed data elements of size specified in instruction and stored in two source registers
US9361100B2 (en) 1994-12-02 2016-06-07 Intel Corporation Packing saturated lower 8-bit elements from two source registers of packed 16-bit elements
US9389858B2 (en) 1994-12-02 2016-07-12 Intel Corporation Orderly storing of corresponding packed bytes from first and second source registers in result register

Similar Documents

Publication Publication Date Title
US3646522A (en) General purpose optimized microprogrammed miniprocessor
US5440702A (en) Data processing system with condition code architecture for executing single instruction range checking and limiting operations
JPS5811652B2 (en) Arithmetic unit
JPS62191926A (en) Arithmetic unit
US4893267A (en) Method and apparatus for a data processor to support multi-mode, multi-precision integer arithmetic
JP2001022582A5 (en)
US6078940A (en) Microprocessor with an instruction for multiply and left shift with saturate
WO1992008188A1 (en) Semiconductor device
JPS6027030A (en) Microprocessor
JPH0916398A (en) Information processor
US5386534A (en) Data processing system for generating symmetrical range of addresses of instructing-address-value with the use of inverting sign value
KR100328141B1 (en) Binary odds implemented by existing hardware with little change
JPH10187416A (en) Floating point arithmetic unit
JPH0560629B2 (en)
EP0547230B1 (en) Apparatus for sum-of-product operation
US5708800A (en) High speed microprocessor for processing and transferring N-bits of M-bit data
JP2000039995A (en) Flexible accumulate register file to be used in high performance microprocessor
CA1173164A (en) Fraction calculator
US20080256335A1 (en) Microprocessor, microcomputer, and electronic instrument
US5142636A (en) Memory bank address calculation with reduced instruction execution cycles
US5086406A (en) Circuit arrangement for decimal arithmetic
KR100385233B1 (en) Exponent unit for data processing system
US20030037088A1 (en) Speed of execution of a conditional subtract instruction and increasing the range of operands over which the instruction would be performed correctly
JP3551291B2 (en) Serial numerical operation device
JP3525582B2 (en) Bit operation circuit

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A1

Designated state(s): JP KR US