WO2013128624A1 - マイクロコンピュータおよび不揮発性半導体装置 - Google Patents

マイクロコンピュータおよび不揮発性半導体装置 Download PDF

Info

Publication number
WO2013128624A1
WO2013128624A1 PCT/JP2012/055341 JP2012055341W WO2013128624A1 WO 2013128624 A1 WO2013128624 A1 WO 2013128624A1 JP 2012055341 W JP2012055341 W JP 2012055341W WO 2013128624 A1 WO2013128624 A1 WO 2013128624A1
Authority
WO
WIPO (PCT)
Prior art keywords
address
code
signal
register
output
Prior art date
Application number
PCT/JP2012/055341
Other languages
English (en)
French (fr)
Inventor
多実結 加藤
由紀子 丸山
伸也 和泉
中木村 清
瀬口 禎浩
Original Assignee
ルネサスエレクトロニクス株式会社
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 ルネサスエレクトロニクス株式会社 filed Critical ルネサスエレクトロニクス株式会社
Priority to CN201280071070.5A priority Critical patent/CN104145247A/zh
Priority to US14/382,159 priority patent/US20150301935A1/en
Priority to PCT/JP2012/055341 priority patent/WO2013128624A1/ja
Priority to JP2014501922A priority patent/JP5933685B2/ja
Publication of WO2013128624A1 publication Critical patent/WO2013128624A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/3005Arrangements for executing specific machine instructions to perform operations for flow control
    • G06F9/30065Loop control instructions; iterative instructions, e.g. LOOP, REPEAT
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/32Address formation of the next instruction, e.g. by incrementing the instruction counter
    • G06F9/322Address formation of the next instruction, e.g. by incrementing the instruction counter for non-sequential address
    • G06F9/324Address formation of the next instruction, e.g. by incrementing the instruction counter for non-sequential address using program counter relative addressing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7208Multiple device management, e.g. distributing data over multiple flash devices

Definitions

  • the device of Patent Document 1 Japanese Patent Laid-Open No. 10-27704 includes a modified address register and a comparison circuit.
  • the ROM fetch address and the value of the modified address register are compared by the comparison circuit, and the result is sent to the instruction decoder.
  • the instruction decoder detects a match in the comparison circuit, the microinstruction is executed to start from a predetermined address on the RAM.
  • the configuration is such that the start address of the correction program is acquired and execution of the program is branched to the start address of the correction program in the same RAM.
  • the device disclosed in Japanese Patent Application Laid-Open No. 8-95946 discloses an instruction queue, a fetch pointer, a register for storing the address of a bug portion of the built-in ROM, and a memory based on an output result of a comparison circuit that compares the contents of the register and the fetch pointer.
  • a selection circuit for outputting the above program or a specific branch instruction is provided. When the content of the fetch pointer matches the content of the register, the branch instruction is transferred from the selection circuit to the instruction queue, and the CPU shifts to the correction program by executing the branch instruction, and the execution of the bug portion is avoided.
  • Patent Document 1 and Patent Document 2 can insert and change codes, there is a problem that a large amount of hardware is required. In addition, the performance of the apparatus deteriorates due to the overhead time associated with the branch jump.
  • a microcomputer includes a program counter that updates an address by adding a first value or a second value, and stops updating the address when a multi-cycle instruction is executed, and a program counter A selection circuit that selects either the insertion code corresponding to the address specified by the program counter in the register or the original code of the address specified by the program counter in the ROM according to the address of the register, and selection by the selection circuit An instruction execution unit for executing the generated code.
  • microcomputer and the nonvolatile semiconductor device of one embodiment of the present invention it is possible to insert a code and execute a multi-cycle instruction.
  • (A) is a figure showing the example of the code (original code) currently recorded on ROM, and the code inserted.
  • (B) is a figure showing the code after a change of the microcomputer A provided with the code change function.
  • (C) is a figure showing the code after change of ROM of the microcomputer B provided with the code insertion function.
  • (A) is a figure showing the example of the code (original code) currently recorded on ROM, and the code to change.
  • (B) is a figure showing the code after a change of the microcomputer A provided with the code change function.
  • (C) is a figure showing the code after the change of the microcomputer B provided with the code insertion function.
  • (A) is a diagram showing instruction fetch and execution timing in a single cycle system.
  • (A) is a diagram showing an example of values held in the address register 31 of the code insertion register set 29-i.
  • (B) is a diagram showing an original code and an insertion code.
  • (C) is a timing chart under the conditions shown in (a) and (b).
  • (A) is a diagram showing an example of values held in the address register 31 of the code insertion register set 29-i.
  • (B) is a diagram showing an original code and an insertion code.
  • (C) is a timing chart under the conditions shown in (a) and (b). It is a figure showing the structure of the flash memory control part 102 of 2nd Embodiment. It is a figure showing the structure of the program counter 51.
  • FIG. 22 is a diagram illustrating a configuration of a code insertion register set 40-0 included in an insertion code register set block 396. It is a figure showing the structure of the flash memory control part 423 of 6th Embodiment.
  • FIG. 6 is a diagram illustrating a configuration of a program counter 72.
  • FIG. 10 is a diagram showing a configuration of an insertion code register set block 743.
  • FIG. 22 is a diagram illustrating a configuration of a code insertion register set 88-0 included in an insertion code register set block 743.
  • (A) is a diagram showing an example of values held in the address register 31 of the code insertion register set 88-i.
  • (B) is a timing chart under the conditions of (a). It is a figure showing the structure of the flash memory control part 388 of 9th Embodiment.
  • FIG. 11 is a diagram illustrating a configuration of an insertion code register set block 389.
  • FIG. 25 is a diagram illustrating a configuration of a code insertion register set 86-0 included in an insertion code register set block 389.
  • A) is a diagram showing an example of values held in the address register 31 of the code insertion register set 86-i.
  • (B) is a timing chart under the conditions of (a).
  • FIG. 1A shows an example of a code (original code) recorded in the ROM and a code to be inserted.
  • the original code is the instructions 0 to 10, 11, and 12, and the code inserted after the instruction 3 is the instruction 3 ′.
  • FIG. 1B is a diagram showing the code after the change of the microcomputer A having the code change function.
  • the instruction 3 ′ is stored at the address “0x0108”. Since the NOP area before the change is the address “0x0116”, the storage positions of the instruction 4 to the instruction 10 are moved to the addresses “0x010A” to “0x0116”. Therefore, the necessary change code amount is “8”. That is, since it is necessary to change from the area to be inserted to the NOP area, a huge amount of change is required depending on the position of the NOP area. It is necessary to provide only a register set for the change, and the hardware becomes large-scale. As a countermeasure against this, it is conceivable to provide a large NOP area. However, since the redundant processing time increases, the processing performance of the CPU deteriorates.
  • FIG. 1 (c) is a diagram showing the code after the ROM of the microcomputer B having the code insertion function is changed.
  • the instruction 3 ' is stored at the address "0x0106". Therefore, the necessary change code amount is “1”.
  • FIG. 2A shows an example of a code (original code) recorded in the ROM and a code to be changed.
  • the original codes are the instructions 0 to 10, 11, and 12, indicating that the instruction 3 is changed to the instruction 3 '.
  • FIG. 2 (b) is a diagram showing the code after the change of the microcomputer A having the code change function.
  • the instruction 3 stored in the address “0x0106” is changed to the instruction 3 ′. Therefore, the necessary change code amount is “1”.
  • FIG. 2 (c) is a diagram showing the code after the change of the microcomputer B having the code insertion function.
  • the instruction 3 ′ and the jump instruction “JUMP0108” are stored at the address “0x0104”. Therefore, the necessary change code amount is “2”.
  • a cycle is a cycle of a so-called constant frequency reference clock signal that serves as a reference for operation timing.
  • the program counter is updated in conjunction with this cycle.
  • FIG. 3A is a diagram showing instruction fetch and execution timing in the single cycle method.
  • FIG. 3B is a diagram showing instruction fetch and execution timing in the multi-cycle method.
  • the single cycle method has the disadvantages that the time of one cycle is limited by the longest path (longest instruction execution time), the time of one cycle becomes long, and the required amount of hardware increases. Therefore, it can be said that it is desirable to adopt a multi-cycle method.
  • the code insertion function needs to correspond to the multi-cycle method.
  • the PC update stop signal is for one cycle as described in paragraph [0049], and is not compatible with the multi-cycle method.
  • FIG. 4 is a timing diagram in the case of inserting a single cycle instruction in Patent Document 3 when a part of the code (original code) recorded in the ROM is a multi-cycle instruction.
  • R0106 which is a part of the original code is a multi-cycle instruction (3-cycle instruction).
  • “0x...” Represents a hexadecimal display.
  • a PC stall signal which is a signal for stopping the update of the program counter for a period of (multi-cycle number-1), is output from the instruction execution unit.
  • the PC stall signal is a signal output when a multi-cycle instruction is executed by a general processor. Then, a simple logic is generated from the PC stall signal and the address coincidence signal, and it is considered to realize a code insertion function in multicycle instruction execution.
  • FIG. 5A is a timing chart in the case where a normal operation is performed even if a single cycle instruction is inserted when a part of the code (original code) recorded in the ROM is a multi-cycle instruction.
  • the timing diagram of the IF execution code, address, IF stage execution code, and EX stage execution code is an expected value necessary for realizing the code insertion.
  • the timing chart of the PC stall signal shows the operation in a general multi-cycle microcomputer, and the timing chart of the address match signal shows the operation when a simple comparator is used.
  • the address match signal and the PC stall signal are both at the “H” level in the previous cycle, the address match signal is at the “H” level in the current cycle, and the PC stall signal is “ In such a case, it is necessary to provide a logic circuit so that the newly provided PC update stop signal becomes “H” level.
  • FIG. 5B is a timing chart when the code (original code) recorded in the ROM is a single cycle instruction and operates normally even if a multi-cycle instruction is inserted.
  • the address match signal and the PC stall signal are both at the “L” level in the previous cycle, the address match signal is at the “H” level, and the PC stall signal is “ In such a case, it is necessary to provide a logic circuit in which the PC update stop signal becomes “H” level.
  • the address match signal and the PC The level of the stall signal is the same.
  • the code to be fetched is the CodeReg side that holds the insertion code in FIG. 5A, and the ROM side that holds the original code in FIG. 5B, and they do not match.
  • FIG. 6 is a diagram showing the configuration of the microcomputer according to the present embodiment.
  • the microcomputer shown in the figure is not particularly limited, but is formed on a semiconductor substrate (chip) by a known semiconductor integrated circuit manufacturing technique.
  • CPU 4 controls the entire processing of the microcomputer 1.
  • the CPU 4 can access the flash memory 3.
  • the RAM 5 stores various data and is used as a work area for the CPU 4.
  • the peripheral device 6 exchanges data with the outside via the I / O port 11.
  • the AD converter 7 converts an analog signal input from the analog input terminal 9 into a digital signal.
  • the DA converter 8 converts the digital signal into an analog signal and outputs the analog signal to the analog output terminal 10.
  • the flash memory 3 is a non-volatile memory, and can be electrically erased and written on the semiconductor substrate.
  • the flash memory 3 stores an operation program of the CPU 4 or various data, although not particularly limited.
  • the flash memory control unit 2 controls the flash memory 3 in a predetermined sequence according to the access from the CPU 3.
  • the flash memory control unit 2 stores a program for controlling operations such as erasing, writing, and reading of the flash memory 3, and also executes the program.
  • This program includes, for example, an instruction for monitoring an error in rewriting operation of the flash memory.
  • the flash memory control unit 2 checks the register indicating the error, and if there is an error, transmits the error to the CPU 4.
  • the instruction for monitoring such an error is arranged for every fixed address in the program so that it is read at a fixed time interval. Execution of this instruction causes other processing performance to deteriorate. Therefore, it is necessary to arrange this program at an appropriate interval. On the other hand, there is a case where safety is emphasized and the error monitoring time interval is shortened even at the expense of some degradation in processing performance.
  • the flash memory control unit 2 has a function of inserting a new code into a program made up of an original code that is an instruction incorporated in advance, so that the hardware of the microcomputer is not changed. It becomes possible to respond to the request.
  • FIG. 7 is a diagram illustrating a configuration of the flash memory control unit 2 according to the first embodiment.
  • the flash memory control unit 2 includes a program counter 12, a flash control code ROM 13, an insertion code register set block 17, a register selection signal generation circuit 18, a code selection circuit 14, an instruction An execution unit 15 and an interface controller 16 are provided.
  • the flash control code ROM 13 stores a plurality of original codes which are pre-installed instructions.
  • the flash control code ROM 13 outputs the original code stored at the address output from the program counter 12.
  • the second and higher bits from the least significant bit of the output of the program counter are valid.
  • the flash control code ROM 13 according to the present embodiment is functionally equivalent to a mask ROM, but is not in a so-called large-capacity memory write-in-prohibited state, but is assumed to be fixedly incorporated in advance by a logic circuit or the like. is doing.
  • the insertion code register set block 17 has at least one insertion code and a register set that holds the address of the insertion code.
  • the insertion code register set block 17 sends the first signal to the program counter when the bit excluding the least significant bit of the address of the insertion code held matches the bit excluding the least significant bit of the address of the program counter 12. 12 and output (that is, the address match signal is set to the “H” level).
  • the insertion code register set block 17 outputs the first signal and outputs the second signal to the code selection circuit 14 when the least significant bit of the address of the program counter 12 is “1” (that is, the address The complete match signal is set to the “H” level), and the held insertion code is output as a code register output signal.
  • the program counter 12 updates the address that is the counter value by adding the first value or the second value. That is, the program counter 12 updates the counter value based on the address match signal and the PC control signal, and outputs an address that is the counter value to the internal address bus 23.
  • the program counter 12 stops updating the address when the multi-cycle instruction is executed. More specifically, when receiving the first signal, the program counter 12 adds “1” to the least significant bit, and when not receiving the first signal, the program counter 12 is the second least significant bit. "1" is added to.
  • the register selection signal generation circuit 18 supplies code register selection signals 0 to n and address register selection signals 0 to n, which will be described later, to the insertion code register set block 17.
  • the code register selection signals 0 to n and the address register selection signals 0 to n are activated as selection signals when the code to be inserted and the address to insert the code are set in the insertion code register set block 17.
  • the code selection circuit 14 inserts the original code output from the flash control code ROM 13 and the insertion code output from the insertion code register set block 17 on the basis of the address complete match signal that changes according to the address output from the program counter 12.
  • One of the codes is output to the instruction execution unit 15 as an execution code. More specifically, the code selection circuit 14 selects the insertion code when receiving the second signal, and selects the original code when not receiving the second signal.
  • the instruction execution unit 15 fetches the execution code output from the code selection circuit 14 and executes the fetched execution code.
  • At least one of a plurality of original codes and insertion codes is a multi-cycle instruction. That is, in the control of the flash memory 3, processing with a multi-cycle instruction is required.
  • the interface controller 16 is connected to the main data bus 273, receives an interrupt from the outside of the flash memory control unit, and outputs an interrupt signal to the instruction execution unit 15.
  • the instruction execution unit 15 and the interface controller 16 are connected to the flash memory 3 via the internal data bus 21.
  • FIG. 8 is a diagram for explaining the functions of the instruction execution unit 15 and the program counter 12.
  • the instruction execution unit 15 includes a fetch unit 35 and an execution unit 36.
  • the fetch unit 35 fetches the execution code output from the code selection circuit 14 and outputs it to the execution unit 35.
  • the execution unit 36 executes the fetched execution code.
  • the execution unit 36 outputs to the program counter 12 a calculation result PC indicating an immediate value, a calculation result PC selection signal for instructing selection of an immediate value, and a PC control signal such as a PC stall signal.
  • the PC stall signal is set to the “H” level when the multi-cycle instruction is executed.
  • FIG. 9 is a diagram showing the configuration of the program counter 12. As shown in FIG. 9, the program counter 12 includes a selector 24, an adder 25, a selector 26, a selector 27, and a PC register 28.
  • the selector 24 outputs “0x01” when the address match signal output from the insertion code register set block 17 is “H” level, and outputs “0x02” when the address match signal is “L” level.
  • the selector 26 receives the output of the adder 25 and the calculation result PC (that is, the immediate value) output from the instruction execution unit 15.
  • the selector 26 outputs the operation result PC when the operation result PC selection signal output from the instruction execution unit 15 is “H” level, and outputs the output of the adder 25 when the operation result PC selection signal is “L” level. Output.
  • the selector 27 receives the output of the selector 26 and the address output from the PC register 28.
  • the selector 27 outputs the address output from the PC register 28 when the PC stall signal output from the instruction execution unit 15 is “H” level, and outputs the output of the selector 26 when the PC stall signal is “L” level. Output.
  • the PC register 28 latches the output of the selector 27 and outputs it to the internal address bus 23 as the address of the flash control code ROM 13.
  • the logic circuit OR2 outputs a logical sum of (n + 1) code register output signals 0 to n as a code register output signal. That is, when at least one of the (n + 1) code register output signals 0 to n has an “H” level bit (that is, when an insertion code is output), the code register output signal becomes an insertion code. That is, when all the bits of (n + 1) code register output signals 0 to n are at “L” level (that is, when no insertion code is output), all the bits of the code register output signal are “L”. Become.
  • the logic circuit OR3 outputs a logical sum of (n + 1) address complete match signals 0 to n as an address complete match signal. That is, when at least one of (n + 1) address complete match signals 0 to n is at “H” level, the address complete match signal is at “H” level.
  • FIG. 11 is a diagram showing the configuration of the code insertion register set 29-0.
  • the configuration of the code insertion register sets 29-1 to 29-n is the same as that of the code insertion register set 29-0 in FIG.
  • the logic circuit AND1 outputs an “H” level signal to the control terminal of the address register 31 when the clock clk and the address register selection signal 0 are both “H” level.
  • the logic circuit AND2 has a complete address when the address match signal 0 is “H” level and the least significant bit (address [0]) of the 16-bit address output from the program counter 12 is “1”.
  • Match signal 0 is set to "H" level.
  • the least significant bit that is not valid as the address of the plurality of original codes in the flash control code ROM 13 is “1”, it means that an address that is not in the flash control code ROM 13 is designated. Become.
  • the logic circuit AND4 outputs an “H” level signal to the control terminal of the code register 32 when the clock clk and the code register selection signal 0 are both at the “H” level.
  • FIG. 12 is a diagram showing the configuration of the code selection circuit 14. As shown in FIG. 12, the code selection circuit 14 includes a selector 33.
  • the code selection circuit 14 outputs the original code “R0102” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0100” output to the fetch unit 35 in the previous cycle.
  • the code selection circuit 14 outputs the original code “R0104” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0102” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 12 outputs “0x02”.
  • the output address of the program counter 12 becomes “0x0106” added by “0x02”.
  • the upper 15 bits of the address “0x0106” match the upper 15 bits of the address “0x0106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal becomes “H” level (because address match signal 0 becomes “H” level).
  • the least significant bit of the output address of the program counter 12 is “0”.
  • the address complete match signal remains at “L” level, and the code register output signal remains “0x0000”.
  • R0106 which is the original code of the address “0x0106”
  • the code selection circuit 14 outputs the original code “R0106” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0104” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 12 outputs “0x01”.
  • the output address of the program counter 12 becomes “0x0107” added by “0x01”.
  • the upper 15 bits of the address “0x0107” match the upper 15 bits of the address “0x0106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal becomes “H” level (because address match signal 0 becomes “H” level).
  • the least significant bit of the output address of the program counter 12 is “1”.
  • the address complete match signal becomes “H” level (because the address complete match signal 0 becomes “H” level).
  • the code register output signal becomes the insertion code “Code Reg. 0” held in the code register 32 (because the code register output signal 0 becomes “Code Reg. 0”). Since the address complete match signal is at “H” level, the code selection circuit 14 outputs the insertion code “Code Reg. 0” to the fetch unit 35 of the instruction execution unit 15. The execution unit 36 of the instruction execution unit 15 executes the original code “R0106” output to the fetch unit 35 in the previous cycle.
  • the code selection circuit 14 outputs the original code “R0108” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the insertion code “Code Reg. 0” output to the fetch unit 35 in the previous cycle.
  • FIG. 14A shows an example of values held in the address register 31 of the code insertion register set 29-i (hereinafter, code insertion register set #i).
  • code insertion register set #i the upper 15 bits (2nd to 16th bits) of “0x0106” are held in the address register 31 of the code insertion register set # 0 and stored in the address register 31 of the code insertion register set # 1.
  • the upper 15 bits of “0x8000” are held, and the upper 15 bits of “0x8002” are held in the address register 31 of the code insertion register set # 2.
  • the insertion code “Code Reg. 0” is held in the code register 32 of the register set for code insertion # 0.
  • the original code “R0106” is a 3-cycle instruction
  • the other original code is a 1-cycle instruction
  • the insertion code “Code Reg. 0” is a 1-cycle instruction.
  • FIG. 14 (c) is a timing chart under the conditions shown in FIGS. 14 (a) and 14 (b).
  • the 16-bit address (PC value [15: 0]) output from the program counter 12 is “0x0102”.
  • the upper 15 bits of the address “0x0102” are different from the upper 15 bits of the address “0x0106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal and the address complete match signal become “L” level, and the code register output signal becomes “0x0000”.
  • “R0102” that is the original code of the address “0x0102” is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R0102” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0100” output to the fetch unit 35 in the previous cycle.
  • the code selection circuit 14 outputs the original code “R0104” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0102” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 12 outputs “0x02”.
  • the output address of the program counter 12 becomes “0x0106” added by “0x02”.
  • the upper 15 bits of the address “0x0106” match the upper 15 bits of the address “0x0106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal becomes “H” level (because address match signal 0 becomes “H” level).
  • the least significant bit of the output address of the program counter 12 is “0”.
  • the address complete match signal remains at “L” level, and the code register output signal remains “0x0000”.
  • the selector 24 of the program counter 12 outputs “0x01”.
  • the output address of the program counter 12 becomes “0x0107” added by “0x01”.
  • the upper 15 bits of the address “0x0107” match the upper 15 bits of the address “0x0106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal becomes “H” level (because address match signal 0 becomes “H” level).
  • the output address of the program counter 12 is “1” because the least significant bit is “0x01” added.
  • the address complete match signal becomes “H” level (because the address complete match signal 0 becomes “H” level).
  • the code register output signal becomes the insertion code “Code Reg. 0” held in the code register 32 (because the code register output signal 0 becomes “Code Reg. 0”). Since the address complete match signal is at “H” level, the code selection circuit 14 outputs the insertion code “Code Reg. 0” to the fetch unit 35 of the instruction execution unit 15.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0106” output to the fetch unit 35 in the previous cycle.
  • the execution unit 36 sets the PC stall signal to the “H” level.
  • the code selection circuit 14 outputs the insertion code “Code Reg. 0” to the fetch unit 35 of the instruction execution unit 15.
  • the execution unit 36 of the instruction execution unit 15 continues to execute the original code “R0106” of the three-cycle instruction (end of execution for two cycles).
  • the program counter 12 outputs the same address “0x0107” as in the previous cycle.
  • the upper 15 bits of the address “0x0107” match the upper 15 bits of the address “0x0106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal becomes “H” level (because address match signal 0 becomes “H” level).
  • the address complete match signal becomes “H” level (because the address complete match signal 0 becomes “H” level).
  • the code register output signal becomes the insertion code “Code Reg.
  • the code selection circuit 14 outputs the original code “R0108” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the insertion code “Code Reg. 0” output to the fetch unit 35 in the previous cycle.
  • the code selection circuit 14 outputs the original code “R010A” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0108” output to the fetch unit 35 in the previous cycle.
  • FIG. 15A shows an example of values held in the address register 31 of the code insertion register set 29-i (hereinafter, code insertion register set #i).
  • code insertion register set #i the upper 15 bits of “0x0106” are held in the address register 31 of the code insertion register set # 0
  • the upper 15 bits of “0x8000” are held in the address register 31 of the code insertion register set # 1.
  • the upper 15 bits of “0x8002” are held in the address register 31 of the code insertion register set # 2.
  • the insertion code “Code Reg. 0” is held in the code register 32 of the register set for code insertion # 0.
  • the original code “R0106” is a one-cycle instruction
  • the other original codes are also one-cycle instructions
  • the insertion code “Code Reg.0” is a three-cycle instruction.
  • FIG. 15 (c) is a timing chart under the conditions shown in FIGS. 15 (a) and 15 (b).
  • the 16-bit address (PC value [15: 0]) output from the program counter 12 is “0x0102”.
  • the upper 15 bits of the address “0x0102” are different from the upper 15 bits of the address “0x0106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal and the address complete match signal become “L” level, and the code register output signal becomes “0x0000”.
  • “R0102” that is the original code of the address “0x0102” is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R0102” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0100” output to the fetch unit 35 in the previous cycle.
  • the code selection circuit 14 outputs the original code “R0104” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0102” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 12 outputs “0x02”.
  • the output address of the program counter 12 becomes “0x0106” added by “0x02”.
  • the upper 15 bits of the address “0x0106” match the upper 15 bits of the address “0x0106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal becomes “H” level (because address match signal 0 becomes “H” level).
  • the address complete match signal remains “L” level and the code register output signal remains “0x0000”.
  • R0106 which is the original code of the address “0x0106”
  • the code selection circuit 14 outputs the original code “R0106” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0104” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 12 outputs “0x01”.
  • the output address of the program counter 12 becomes “0x0107” added by “0x01”.
  • the upper 15 bits of the address “0x0107” match the upper 15 bits of the address “0x0106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal becomes “H” level (because address match signal 0 becomes “H” level).
  • the output address of the program counter 12 is “1” because the least significant bit is “0x01” added.
  • the address complete match signal becomes “H” level (because the address complete match signal 0 becomes “H” level).
  • the code register output signal becomes the insertion code “Code Reg. 0” held in the code register 32 (because the code register output signal 0 becomes “Code Reg. 0”). Since the address complete match signal is at “H” level, the code selection circuit 14 outputs the insertion code “Code Reg. 0” to the fetch unit 35 of the instruction execution unit 15. The execution unit 36 of the instruction execution unit 15 executes the original code “R0106” output to the fetch unit 35 in the previous cycle.
  • the code selection circuit 14 outputs the original code “R0108” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the insertion code “Code Reg. 0” output to the fetch unit 35 in the previous cycle.
  • the execution unit 36 sets the PC stall signal to the “H” level.
  • the program counter 12 outputs the same address “0x0108” as in the previous cycle.
  • the upper 15 bits of the address “0x0108” are different from the upper 15 bits of the address “0x0106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal and the address complete match signal become “L” level, and the code register output signal becomes “0x0000”.
  • the execution unit 36 of the instruction execution unit 15 continues to execute the insertion code “Code Reg. 0” of the 3-cycle instruction (end of execution for two cycles).
  • the program counter 12 outputs the same address “0x0108” as in the previous cycle.
  • the upper 15 bits of the address “0x0108” are different from the upper 15 bits of the address “0x0106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal and the address complete match signal become “L” level, and the code register output signal becomes “0x0000”.
  • the execution unit 36 of the instruction execution unit 15 continues to execute the insertion code “Code Reg. 0” of the 3-cycle instruction (end of execution for 3 cycles).
  • the execution unit 36 ends the execution of the insertion code “Code Reg. 0”, which is a three-cycle instruction, and sets the PC stall signal to the “L” level.
  • the code selection circuit 14 outputs the original code “R010A” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0108” output to the fetch unit 35 in the previous cycle.
  • the addresses of the plurality of original codes are valid from the least significant bit to the (k + 1) th bit or more.
  • k is a natural number of 1 or more.
  • FIG. 16 is a diagram illustrating the configuration of the flash memory control unit 102 according to the second embodiment.
  • 16 differs from the flash memory control unit 2 in FIG. 7 in a program counter 51 and an insertion code register set block 52.
  • the insertion code register set block 52 holds a maximum of 2k-1 insertion codes and the address of the insertion code.
  • the insertion code register set block 52 determines that when the bit excluding the k bits from the least significant bit of the held insertion code address matches the bit excluding the k bits from the least significant address of the program counter 51.
  • the first signal is output (that is, the address match signal is set to the “H” level).
  • the insertion code register set block 52 outputs the first signal and holds the k bits from the least significant bit of the address of the insertion code held therein and the k bits from the least significant address of the program counter 51 address.
  • the second signal is output (that is, the address complete match signal is set to the “H” level), and the insertion code held corresponding to the address of the program counter 51 is output.
  • the insertion code register set block 52 outputs a second signal and simultaneously outputs an insertion end signal indicating an insertion end when outputting the last insertion code when a plurality of insertion codes are successively inserted. To do. The generation of the insertion end signal will be described later.
  • the program counter 51 adds “1” to the least significant bit when receiving the first signal, and “1” to the (k + 1) th bit from the least significant bit when not receiving the first signal. Is added. When receiving the insertion end signal, the program counter 51 adds “1” to the (k + 1) th bit from the least significant bit and sets the k bits from the least significant bit to “0” even when the first signal is received. "
  • FIG. 17 is a diagram showing the configuration of the program counter 51.
  • the program counter 51 includes a selector 53, an adder 25, a logic circuit AND74, a selector 26, a selector 27, and a PC register 28.
  • the selector 53 receives the address match signal and the insertion end signal from the insertion code register set block 52.
  • the selector 53 outputs “0x01” when the address match signal is at “H” level and the insertion end signal is at “L” level.
  • the selector 53 receives the address match signal when the address match signal is “L” level and the insertion end signal is “H” level.
  • the “L” level and the insertion end signal are “L” level, “0x20” is output.
  • the adder 25 adds the 20-bit address output from the PC register 28 and the value output from the selector 53.
  • the logic circuit AND74 outputs a logical product of the negative 5 bits of the 20 bits output from the adder 25 and the negative of the insertion end signal. In other words, the logic circuit AND74 outputs the lower 5 bits of the 20 bits output from the adder 25 when the insertion end signal is at the “L” level.
  • the logic circuit AND74 outputs 5-bit “0b00000” when the insertion end signal is at “H” level.
  • “0b...” Represents binary display.
  • the selector 26 includes a signal in which the upper 15 bits of the 20 bits output from the adder 25 are set to the upper 15 bits, and the 5-bit signal output from the logic circuit AND 74 is set to the lower 5 bits.
  • the output calculation result PC is received.
  • the selector 26 outputs the operation result PC when the operation result PC selection signal output from the instruction execution unit 15 is at “H” level, and the adder 25 and the logic circuit when the operation result PC selection signal is at “L” level.
  • the signal from the AND 74 is output.
  • the selector 27 receives the output of the selector 26 and the address output from the PC register 28.
  • the selector 27 outputs an address output from the PC register 28 when the PC stall signal output from the instruction execution unit 15 is “H” level, and receives from the selector 26 when the PC stall signal is “L” level. Output a signal.
  • the PC register 28 latches the output of the selector 27 and outputs it to the internal address bus 23 as the address of the flash control code ROM.
  • FIG. 18 is a diagram illustrating the configuration of the insertion code register set block 52.
  • the code insertion register set 54-i receives an address output from the program counter 51 and data transmitted through the data bus, and further receives a code register selection signal i, an address register selection signal i, an address from the code selection circuit 14. In response to the less register 2 selection signal i and the insertion end register selection signal i, an address match signal i, an address complete match signal i, an insertion end signal i, and a code register output signal i are output.
  • the logic circuit OR1 outputs a logical sum of (n + 1) address match signals 0 to n as an address match signal. That is, when at least one of (n + 1) address match signals 0 to n is at “H” level, the address match signal is at “H” level.
  • the logic circuit OR2 outputs a logical sum of (n + 1) code register output signals 0 to n as a code register output signal. That is, when at least one of the (n + 1) code register output signals 0 to n has an “H” level bit (that is, when an insertion code is output), the code register output signal becomes an insertion code. That is, when all the bits of (n + 1) code register output signals 0 to n are at “L” level (that is, when no insertion code is output), all the bits of the code register output signal are “L”. Become.
  • the logic circuit OR3 outputs a logical sum of (n + 1) address complete match signals 0 to n as an address complete match signal. That is, when at least one of (n + 1) address complete match signals 0 to n is at “H” level, the address complete match signal is at “H” level.
  • the logic circuit OR 54 outputs a logical sum of (n + 1) insertion end signals 0 to n as an insertion end signal. That is, when at least one of (n + 1) insertion end signals 0 to n is at “H” level, the insertion end signal is at “H” level.
  • the address match signals 0 to n and the address match signal are 1-bit signals.
  • the address complete match signals 0 to n and the address complete match signal are 1-bit signals.
  • the insertion end signals 0 to n and the insertion end signal are 1-bit signals.
  • the code register output signals 0 to n and the code register output signal are 16-bit signals.
  • FIG. 19 is a diagram showing the configuration of the code insertion register set 54-0.
  • the configuration of the code insertion register sets 54-1 to 54-n is the same as the configuration of the code insertion register set 54-0 in FIG.
  • the code insertion register set 54-0 includes a logic circuit AND1, an address register 31, an address comparator 30, a logic circuit AND4, a code register 32, a logic circuit 54, and an address register. 56, an address comparator 57, a logic circuit 56, an insertion end register 59, a logic circuit AND2, a logic circuit 55, and a logic circuit AND3.
  • the logic circuit AND1 outputs an “H” level signal to the control terminal of the address register 31 when the clock clk and the address register selection signal 0 are both “H” level.
  • the address register 31 latches and holds the 15-bit address (that is, the address to insert the insertion code) sent through the data bus when the input to the control terminal is at “H” level.
  • the address comparator 30 matches the upper 15 bits (address [19: 5]) of the 20-bit address output from the program counter 12 with the 15-bit address held in the address register 31.
  • the address match signal 0 is set to the “H” level.
  • the logic circuit AND 54 outputs an “H” level signal to the control terminal of the code register 32 when the clock clk and the address register 2 selection signal 0 are both “H” level.
  • the address register 56 latches and holds the 5-bit address sent through the data bus when the input to the control terminal is at “H” level.
  • the address register 56 holds an address indicating the insertion order when a plurality of insertion codes are successively inserted.
  • the logic circuit AND 56 outputs a signal of “H” level to the control terminal of the insertion end register 59 when the clock clk and the insertion end register selection signal 0 are both “H” level.
  • the logic circuit AND55 receives the address complete match signal 0 and the output of the insertion end register 59.
  • the logic circuit AND55 outputs 1-bit data (insertion end) held in the insertion end register 59 as the insertion end signal 0 when the address complete match signal 0 is at “H” level.
  • the logic circuit AND4 outputs an “H” level signal to the control terminal of the code register 32 when the clock clk and the code register selection signal 0 are both at the “H” level.
  • the logic circuit AND3 receives the address complete match signal 0 and the output of the code register 32.
  • the logic circuit AND3 outputs 16-bit data (that is, an insertion code) held in the code register 32 as the code register output signal 0 when the address complete match signal 0 is at “H” level.
  • the logic circuit AND3 outputs 16-bit “0x0000” as the code register output signal 0 when the address complete match signal 0 is at “L” level.
  • the address match signal 0 is a 1-bit signal.
  • the address complete match signal 0 is a 1-bit signal.
  • the insertion end signal 0 is a 1-bit signal.
  • the code register output signal 0 is a 16-bit signal.
  • the upper 15 bits of “0x01062” are held in the address register 31 of the code insertion register set # 1, and the lower 5 bits of “0x01062” are held in the address register 56. Further, the insertion code “Code Reg. 1” is held in the code register 32 of the code insertion register set # 1, and the insertion end “0b1” is held in the insertion end register 59 of the code insertion register set # 1. Further, it is assumed that the original code “R...” Is held at the address “0x...” Of the flash control code ROM 13.
  • R01020 which is the original code of the address “0x01020”, is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R01020” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R01000” output to the fetch unit 35 in the previous cycle.
  • the selector 53 of the program counter 51 outputs “0x20”.
  • the output address of the program counter 51 becomes “0x01040” added by “0x20”.
  • the upper 15 bits of the address “0x01040” are different from the upper 15 bits of the address “0x01061” held in the address register 31 of the code insertion register set # 0, and the address of the code insertion register set # 1. This is also different from the upper 15 bits of the address “0x01062” held in the register 31.
  • the selector 53 of the program counter 51 outputs “0x20”.
  • the output address of the program counter 51 becomes “0x01060” added by “0x20”.
  • the upper 15 bits of the address “0x01060” match the upper 15 bits of the address “0x01061” held in the address register 31 of the code insertion register set # 0, and the address of the code insertion register set # 1 This also matches the upper 15 bits of the address “0x01062” held in the register 31.
  • the address match signal becomes “H” level (because address match signal 0 and address match signal 1 become “H” level).
  • the lower 5 bits of the address “0x01060” are different from the lower 5 bits of the address “0x01061” held in the address register 56 of the code insertion register set # 0, and the address of the code insertion register set # 1. This is different from the lower 5 bits of the address “0x01062” held in the register 56.
  • the address complete match signal remains at “L” level (because address complete match signal 0 and address complete match signal 1 remain at “L” level). Since the address complete match signal is “L” level, the code register output signal is “0x0000” and the insertion end signal is “0b0”.
  • “R01060”, which is the original code of the address “0x01060”, is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R01060” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R01040” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 51 outputs “0x01”. Therefore, the output address of the program counter 51 is “0x01061” added by “0x01”.
  • the upper 15 bits of the address “0x01061” match the upper 15 bits of the address “0x01061” held in the address register 31 of the code insertion register set # 0, and the address of the code insertion register set # 1 This matches the upper 15 bits of the address “0x01062” held in the register 31.
  • the address match signal becomes “H” level (because address match signal 0 and address match signal 1 become “H” level).
  • the address complete match signal is at the “H” level. (Because the address complete match signal 0 is at “H” level). Since the address complete match signal 0 becomes “H” level, the code register output signal 0 becomes the insertion code “Code Reg. 0” held in the code register 32 of the code insertion register set # 0. As a result, the code register output signal becomes the insertion code “Code Reg. 0”.
  • the insertion end signal 0 becomes the insertion end “0b0” held in the insertion end register 59 of the code insertion register set # 0. As a result, the insertion end signal becomes “0b0”. Since the address complete match signal is at “H” level, the code selection circuit 14 outputs the insertion code “Code Reg. 0” to the fetch unit 35 of the instruction execution unit 15. The execution unit 36 of the instruction execution unit 15 executes the original code “R01060” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 51 outputs “0x01”. Therefore, the output address of the program counter 51 is “0x01062” added by “0x01”.
  • the upper 15 bits of the address “0x01062” match the upper 15 bits of the address “0x01061” held in the address register 31 of the code insertion register set # 0, and the address register 31 of the code insertion register set # 1. Matches the upper 15 bits of the address “0x01062” held in the. As a result, the address match signal becomes “H” level (because address match signal 0 and address match signal 1 become “H” level).
  • the address complete match signal is at the “H” level. (Because the address complete match signal 1 is at "H” level). Since the address complete match signal 1 becomes “H” level, the code register output signal 1 becomes the insertion code “Code Reg. 1” held in the code register 32 of the code insertion register set # 1. As a result, the code register output signal becomes the insertion code “Code Reg. 1”. Since the address complete match signal 1 becomes “H” level, the insertion end signal 1 becomes the insertion end “0b1” held in the insertion end register 59 of the code insertion register set # 1.
  • the code selection circuit 14 outputs the insertion code “Code Reg. 1” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at “H” level.
  • the execution unit 36 of the instruction execution unit 15 executes the insertion code “Code Reg. 0” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 51 outputs “0x20”. Since the insertion end signal is “0b1”, the lower 5 bits of the output of the adder 25 are set to “0” by the logic circuit 74. As a result, the output address of the program counter 51 is “0x01080”. The upper 15 bits of the address “0x01080” are different from the upper 15 bits of the address “0x01061” held in the address register 31 of the code insertion register set # 0, and the address register 31 of the code insertion register set # 1. This is different from the upper 15 bits of the address “0x01062” held in.
  • the selector 53 of the program counter 51 outputs “0x20”.
  • the output address of the program counter 51 becomes “0x010A0” added by “0x20”.
  • the upper 15 bits of the address “0x010A0” are different from the upper 15 bits of the address “0x01061” held in the address register 31 of the code insertion register set # 0, and the address register 31 of the code insertion register set # 1. This is different from the upper 15 bits of the address “0x01062” held in.
  • the address match signal and the address complete match signal become “L” level
  • the code register output signal becomes “0x0000”
  • the insertion end signal becomes “0b0”.
  • “R010A0” which is the original code of the address “0x010A0”
  • the code selection circuit 14 outputs the original code “R010A0” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R01080” output to the fetch unit 35 in the previous cycle.
  • the operation is the same as in the sixth cycle.
  • the address of the original code is designated by bits other than the predetermined number of bits from the least significant bit of the program counter address, and the code is inserted using the predetermined number of bits from the least significant bit. Therefore, one or more codes can be inserted between two original codes, and a multi-cycle instruction can be executed.
  • the output of the program counter 12 has been described as 16 bits. However, in this embodiment, since a plurality of instruction codes are inserted, the output of the program counter 51 is 20 bits. Assumed.
  • FIG. 21 is a diagram illustrating a configuration of the flash memory control unit 312 according to the third embodiment.
  • the insertion code register set block 164 outputs the first signal when the bit except the least significant bit of the held insertion code address matches the bit except the least significant bit of the address of the program counter 12. (That is, the address match signal is set to the “H” level).
  • the insertion code register set block 164 outputs the first signal and outputs the second signal when the least significant bit of the address of the insertion code that is held matches the least significant bit of the address of the program counter 12. Output (that is, set the address match signal to “H” level) and output the held insertion code.
  • FIG. 22 is a diagram showing the configuration of the code insertion register set 64-0 included in the insertion code register set block 164.
  • the configuration of the code insertion register sets 64-1 to 64-n is the same as that of the code insertion register set 64-0 in FIG.
  • the address register 131 latches and holds the 16-bit address sent through the data bus when the output of the logic circuit AND1 is at “H” level.
  • the coincidence circuit XNOR1 has the least significant bit (address [0]) of the 16-bit address output from the program counter 12 and the least significant bit of the 16-bit address held in the address register 131. When they match, the match signal is set to the “H” level.
  • the logic circuit AND2 sets the address complete match signal 0 to “H” level when the address match signal 0 is “H” level and the match signal output from the match circuit NROR1 is “H” level.
  • FIG. 23A is a diagram showing an example of values held in the address register 31 of the code insertion register set 64-i (hereinafter, code insertion register set #i).
  • code insertion register set #i 16-bit “0x0106” is held in the address register 131 of the code insertion register set # 0.
  • the insertion code “Code Reg. 0” is held in the code register 32 of the register set for code insertion # 0.
  • the original code “R...” Is held at the address “0x...” Of the flash control code ROM 13.
  • FIG. 23B is a timing chart under the conditions of FIG. In the 0th cycle, the 16-bit address (PC value [15: 0]) output from the program counter 12 is “0x0102”.
  • the upper 15 bits of the address “0x0102” are different from the upper 15 bits of the address “0x0106” held in the address register 131.
  • the address match signal and the address complete match signal become “L” level, and the code register output signal becomes “0x0000”.
  • “R0102” that is the original code of the address “0x0102” is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R0102” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0100” output to the fetch unit 35 in the previous cycle.
  • the code selection circuit 14 outputs the original code “R0104” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0102” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 12 outputs “0x02”, so that the output address of the program counter 12 is added by “0x02”. It becomes “0x0106”. Since the upper 15 bits of the address “0x0106” match the upper 15 bits of the address “0x0106” held in the address register 131, the address match signal becomes “H” level (the address match signal 0 is “H”). To become a level). Further, since the lower 1 bit of the address “0x0106” matches the lower 1 bit of the address “0x0106” held in the address register 131, the address complete match signal becomes “H” level (address complete match signal 0). Is at “H” level).
  • the code register output signal becomes the insertion code “Code Reg. 0” held in the code register 32 (because the code register output signal 0 becomes “Code Reg. 0”). Since the address complete match signal is at “H” level, the code selection circuit 14 outputs the insertion code “Code Reg. 0” to the fetch unit 35 of the instruction execution unit 15. The execution unit 36 of the instruction execution unit 15 executes the original code “R0104” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 12 outputs “0x01”.
  • the output address of the program counter 12 becomes “0x0107” added by “0x01”. Since the upper 15 bits of the address “0x0107” match the upper 15 bits of the address “0x0106” held in the address register 131, the address match signal becomes “H” level (the address match signal 0 is “H”). To become a level).
  • the lower 1 bit of the address “0x0107” is different from the lower 1 bit of the address “0x0106” held in the address register 131.
  • the address complete match signal becomes “L” level (because the address complete match signal 0 and the address complete match signal become “L” level), and the code register output signal becomes “0x0000”.
  • the code selection circuit 14 outputs the original code “R0106” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the insertion code “Code Reg. 0” output to the fetch unit 35 in the previous cycle.
  • the code selection circuit 14 outputs the original code “R0108” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R0106” output to the fetch unit 35 in the previous cycle.
  • the operation is the same as the fourth cycle.
  • the address of the original code is designated by bits other than the least significant bit of the address of the program counter, and the code is coded using the least significant bit. Since the insertion is controlled, one code can be inserted between two original codes, and a multi-cycle instruction can be executed. Further, according to the present embodiment, it is possible to select whether to execute the inserted code after the original code (post-insertion) or before the original code (pre-insertion).
  • FIG. 24 is a diagram illustrating a configuration of the flash memory control unit 103 according to the fourth embodiment.
  • the flash memory control unit 103 in FIG. 24 is different from the flash memory control unit 102 in the second embodiment in FIG.
  • the program counter 65 When the program counter 65 receives the insertion end signal, the k bits from the least significant bit are set to “1”.
  • FIG. 25 is a diagram illustrating the configuration of the program counter 65 according to the fourth embodiment.
  • the program counter 65 includes a selector 68, an adder 25, a logic circuit OR68, a selector 26, a selector 27, and a PC register 28.
  • the selector 68 receives an address match signal from the insertion code register set block 52.
  • the selector 68 outputs “0x01” when the address match signal is at “H” level.
  • the selector 68 outputs “0x20” when the address match signal is at “L” level.
  • the adder 25 adds the 20-bit address “19: 0” output from the PC register 28 and the value output from the selector 68.
  • the logic circuit OR68 outputs the logical sum of the lower 5 bits of the 20 bits output from the adder 25 and the insertion end signal. That is, logic circuit OR 68 outputs the lower 5 bits of the 20 bits output from adder 25 when the insertion end signal is at “L” level. The logic circuit OR68 outputs 5-bit “0b11111” when the insertion end signal is at “H” level.
  • the selector 26 sets the upper 15 bits (6th to 20th bits) of the 20 bits output from the adder 25 as the upper 15 bits, and sets the 5-bit signal output from the logic circuit OR68 as the lower 5 bits. And the calculation result PC output from the instruction execution unit 15 are received.
  • the selector 26 outputs the operation result PC when the operation result PC selection signal output from the instruction execution unit 15 is at “H” level, and the adder 25 and the logic circuit when the operation result PC selection signal is at “L” level. 58 signals are output.
  • the selector 27 receives the output of the selector 26 and the address output from the PC register 28.
  • the selector 27 outputs the address output from the PC register 28 when the PC stall signal output from the instruction execution unit 15 is “H” level, and outputs the output of the selector 26 when the PC stall signal is “L” level. Output.
  • the PC register 28 latches the output of the selector 27 and outputs it to the internal address bus 23 as the address of the flash control code ROM.
  • FIG. 26B is a timing chart under the condition of FIG. In the 0th cycle, the 20-bit address (PC value [19: 0]) output from the program counter 65 is “0x01020”.
  • the upper 15 bits of the address “0x01020” are different from the upper 15 bits of the address “0x01060” held in the address register 31 of the code insertion register set # 0, and the address register 31 of the code insertion register set # 1. This is different from the upper 15 bits of the address “0x01061” held in.
  • the address match signal and the address complete match signal become “L” level
  • the code register output signal becomes “0x0000”
  • the insertion end signal becomes “0b0”.
  • R01020 which is the original code of the address “0x01020”, is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R01020” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R01000” output to the fetch unit 35 in the previous cycle.
  • the selector 68 of the program counter 65 outputs “0x20”.
  • the output address of the program counter 65 becomes “0x01040” added by “0x20”.
  • the upper 15 bits of the address “0x01040” are different from the upper 15 bits of the address “0x01061” held in the address register 31 of the code insertion register set # 0, and the address register 31 of the code insertion register set # 1. This is different from the upper 15 bits of the address “0x01062” held in.
  • the address match signal and the address complete match signal become “L” level, the code register output signal becomes “0x0000”, and the insertion end signal becomes “0b0”.
  • R01040 which is the original code of the address “0x01040” is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R01040” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R01020” output to the fetch unit 35 in the previous cycle.
  • the selector 68 of the program counter 65 outputs “0x20”.
  • the output address of the program counter 65 becomes “0x01060” added by “0x20”.
  • the upper 15 bits of the address “0x01060” match the upper 15 bits of the address “0x01060” held in the address register 31 of the code insertion register set # 0, and the address register 31 of the code insertion register set # 1 Since the upper 15 bits of the address “0x01061” held in the address match, the address match signal becomes “H” level (because the address match signal 0 and the address match signal 1 become “H” level).
  • the address complete match signal is “H” level. (Because the address complete match signal 0 is at “H” level). Since the address complete match signal 0 becomes “H” level, the code register output signal 0 becomes the insertion code “Code Reg. 0” held in the code register 32 of the code insertion register set # 0. As a result, the code register output signal becomes the insertion code “Code Reg. 0”.
  • the insertion end signal 0 becomes the insertion end “0b0” held in the insertion end register 59 of the code insertion register set # 0. As a result, the insertion end signal becomes “0b0”. Since the address complete match signal is at “H” level, the code selection circuit 14 outputs the insertion code “Code Reg. 0” to the fetch unit 35 of the instruction execution unit 15. The execution unit 36 of the instruction execution unit 15 executes the original code “R01040” output to the fetch unit 35 in the previous cycle.
  • the selector 68 of the program counter 65 outputs “0x01”.
  • the output address of the program counter 65 becomes “0x01061” added by “0x01”.
  • the upper 15 bits (6th to 20th bits) of the address “0x01061” match the upper 15 bits of the address “0x01060” held in the address register 31 of the code insertion register set # 0, and the code is inserted. This corresponds to the upper 15 bits of the address “0x01061” held in the address register 31 of the register set # 1.
  • the address match signal becomes “H” level (because address match signal 0 and address match signal 1 become “H” level).
  • the lower 5 bits of the address “0x01061” match the lower 5 bits of the address “0x01061” held in the address register 56 of the code insertion register set # 1.
  • the address complete match signal becomes “H” level (because the address complete match signal 1 becomes “H” level).
  • the code register output signal 1 becomes the insertion code “Code Reg. 1” held in the code register 32 of the code insertion register set # 1.
  • the code register output signal becomes the insertion code “Code Reg. 1”. Since the address complete match signal 1 becomes “H” level, the insertion end signal 1 becomes the insertion end “0b1” held in the insertion end register 59 of the code insertion register set # 1.
  • the code selection circuit 14 outputs the insertion code “Code Reg. 1” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at “H” level.
  • the execution unit 36 of the instruction execution unit 15 executes the insertion code “Code Reg. 0” output to the fetch unit 35 in the previous cycle.
  • the selector 68 of the program counter 65 outputs “0x01”. Since the insertion end signal is “0b1”, the lower 5 bits of the 20-bit address output from the adder 25 are set to “1” by the logic circuit OR68. As a result, the output address of the program counter 65 is “0x0107F”. The upper 15 bits (6th to 20th bits) of the address “0x0107F” match the upper 15 bits of the address “0x01060” held in the address register 31 of the code insertion register set # 0, and the code is inserted. This matches the upper 15 bits of the address “0x01061” held in the address register 31 of the register set # 1.
  • the address match signal becomes “H” level (because address match signal 0 and address match signal 1 become “H” level).
  • the lower 5 bits of the address “0x0107F” are different from the lower 5 bits of the address “0x01060” held in the address register 56 of the code insertion register set # 0, and the address of the code insertion register set # 1. This is different from the lower 5 bits of the address “0x01061” held in the register 56.
  • the address complete match signal is at the “L” level (because the address complete match signal 0 and the address complete match signal are at the “L” level). Since the address complete match signal becomes “L” level, the code register output signal becomes “0x0000” and the insertion end signal becomes “0b0”.
  • the selector 68 of the program counter 65 outputs “0x01”. Since the insertion end signal is “0b0”, the lower 5 bits of the 20-bit address output from the adder 25 are output as they are by the logic circuit OR68. As a result, the output address of the program counter 65 is “0x01080”. The upper 15 bits of the address “0x01080” are different from the upper 15 bits of the address “0x01060” held in the address register 31 of the code insertion register set # 0, and the address of the code insertion register set # 1 This is different from the upper 15 bits of the address “0x01061” held in the register 31.
  • the address match signal becomes “L” level (because address match signal 0 and address match signal 1 become “L” level).
  • the lower 5 bits of the address “0x01080” are different from the lower 5 bits of the address “0x01060” held in the address register 56 of the code insertion register set # 0, and the address register of the code insertion register set # 1 This is different from the lower 5 bits of the address “0x01061” held in 56.
  • the address complete match signal becomes “L” level (because address complete match signal 0 and address complete match signal 1 become “L” level). Since the address complete match signal is “L” level, the code register output signal is “0x0000” and the insertion end signal is “0b0”.
  • R01080 which is the original code of the address “0x01080”, is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R01080” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R01060” output to the fetch unit 35 in the previous cycle.
  • the selector 68 of the program counter 65 outputs “0x20”, so that the output address of the program counter 65 is incremented by “0x20”. It becomes “0x010A0”.
  • the upper 15 bits of the address “0x010A0” are different from the upper 15 bits of the address “0x01060” held in the address register 31 of the code insertion register set # 0, and the address register 31 of the code insertion register set # 1. This is different from the upper 15 bits of the address “0x01061” held in.
  • the operation is the same as in the sixth cycle.
  • the address of the original code is specified by bits other than the predetermined number of bits from the least significant bit of the address of the program counter, and the predetermined address from the least significant bit is designated. Since the insertion of the code is controlled using the number of bits, it is possible to insert one or more codes between two original codes and to execute a multi-cycle instruction. Further, according to the present embodiment, when the address from the program counter matches the value of the address register, the insertion code is executed with respect to the second embodiment in which the execution of the insertion code is executed before the original code. Is executed after the original code.
  • FIG. 27 is a diagram illustrating the configuration of the flash memory control unit 395 according to the fifth embodiment.
  • the flash memory control unit 395 in FIG. 27 is different from the flash memory control unit 2 in the first embodiment in FIG. 7 in an insertion code register set block 396.
  • FIG. 28 is a diagram showing the configuration of the code insertion register set 40-0 included in the insertion code register set block 396.
  • the configuration of the code insertion register sets 40-1 to 40-n is the same as that of the code insertion register set 40-0 in FIG.
  • the code insertion register set 40-0 in FIG. 28 is different from the code insertion register set 29-0 in the first embodiment in FIG. 11 in the logic circuit AND6, the status register 34, and the logic circuit AND5. is there.
  • the logic circuit AND6 outputs an “H” level signal to the control terminal of the status register 34 when the clock clk and the status register selection signal 0 are both at the “H” level.
  • the status register 34 latches and holds the 1-bit status value sent through the data bus when the input to the control terminal is at “H” level.
  • the logic circuit AND5 outputs a logical product of the output of the status register 34 and the output of the address comparator 30 as an address match signal 0. Therefore, when the status value is set to “0”, the address match signal 0 and the address complete match signal 0 are always at the “L” level. As a result, when the stator value is “0”, the code selection circuit 12 selects the original code output from the flash control code ROM 13 regardless of the address of the program counter 12. As a result, the code insertion function described in this embodiment is disabled.
  • the validity / invalidity of the code insertion function can be switched according to the status value.
  • FIG. 29 is a diagram illustrating a configuration of the flash memory control unit 423 according to the sixth embodiment.
  • the insertion code register set block 424 outputs the first signal when the bit except the most significant bit of the held insertion code address matches the bit other than the most significant bit of the address of the program counter 72. (That is, the address match signal is set to the “H” level).
  • the insertion code register set block 424 outputs the first signal and outputs the second signal when the most significant bit of the address of the program counter 72 is “1” (that is, the address complete match signal “ And the held insertion code is output.
  • the program counter 72 adds “1” to the most significant bit when receiving the first signal, and adds “1” to the second least significant bit when not receiving the first signal.
  • FIG. 30 shows a configuration of program counter 72.
  • the program counter 72 includes a selector 73, an adder 25, a logic circuit AND 72, a selector 26, a selector 27, and a PC register 28.
  • the selector 73 receives the address match signal and the address complete match signal from the insertion code register set block 424.
  • the selector 73 outputs “0x10000” when the address match signal is “H” level and the address complete match signal is “L” level.
  • the selector 73 is operable when the address match signal is “L” level and the address complete match signal is “H” level, when the address match signal is “L” level and the address complete match signal is “L” level, or When the coincidence signal is “H” level and the address complete coincidence signal is “H” level, “0x02” is output.
  • the adder 25 adds the 17-bit address “16: 0” output from the PC register 28 and the value output from the selector 73.
  • the output of the program counter 72 is assumed to be 17 bits.
  • the logic circuit AND72 outputs the logical product of the most significant 1 bit of the 17 bits output from the adder 25 and the negative of the address complete match signal. That is, the logic circuit AND 72 outputs the most significant 1 bit of the 17 bits output from the adder 25 when the address complete match signal is at “L” level. Logic circuit AND72 outputs 1-bit “0b0” when the address complete match signal is at “H” level.
  • the selector 26 sets the lower 16 bits of the 17 bits output from the adder 25 as the lower 16 bits, the 1 bit signal output from the logic circuit AND 72 as the highest 1 bit, and the instruction execution unit 15. And the calculation result PC output from.
  • the selector 26 outputs the operation result PC when the operation result PC selection signal output from the instruction execution unit 15 is at “H” level, and the adder 25 and the logic circuit when the operation result PC selection signal is at “L” level.
  • the signal from the AND 72 is output.
  • the selector 27 receives the output of the selector 26 and the address output from the PC register 28.
  • the selector 27 outputs the address output from the PC register 28 when the PC stall signal output from the instruction execution unit 15 is “H” level, and outputs the output of the selector 26 when the PC stall signal is “L” level. Output.
  • the PC register 28 latches the output of the selector 27 and outputs it to the internal address bus 23 as the address of the flash control code ROM.
  • FIG. 31 is a diagram showing the configuration of the code insertion register set 71-0 included in the insertion code register set block 424.
  • the configuration of the code insertion register sets 71-1 to 71-n is the same as that of the code insertion register set 71-0 in FIG.
  • the code insertion register set 71-0 includes a logic circuit AND1, an address register 31, an address comparator 30, a logic circuit AND4, a code register 32, and a logic circuit AND71.
  • the logic circuit AND1 outputs an “H” level signal to the control terminal of the address register 31 when the clock clk and the address register selection signal 0 are both “H” level.
  • the address register 31 latches and holds the 16-bit address sent through the data bus when the input to the control terminal is at “H” level.
  • the address comparator 30 matches the lower 16 bits (address [15: 0]) of the 17-bit address output from the program counter 72 with the 16-bit address held in the address register 31.
  • the address match signal 0 is set to the “H” level.
  • the logic circuit AND4 outputs an “H” level signal to the control terminal of the code register 32 when the clock clk and the code register selection signal 0 are both at the “H” level.
  • the code register 32 latches and holds 16-bit data (that is, an insertion code) sent through the data bus when the input to the control terminal is at “H” level.
  • FIG. 32A shows an example of values held in the address register 31 of the code insertion register set 71-i (hereinafter, code insertion register set #i).
  • code insertion register set #i the lower 16 bits of “0x00106” are held in the address register 31 of the code insertion register set # 0.
  • the insertion code “Code Reg. 0” is held in the code register 32 of the code insertion register set # 0. Further, it is assumed that the original code “R...” Is held at the address “0x...” Of the flash control code ROM 13.
  • FIG. 32B is a timing chart under the condition of FIG. In the 0th cycle, the 17-bit address (PC value [16: 0]) output from the program counter 72 is “0x00102”.
  • the lower 16 bits of the address “0x00102” are different from the lower 16 bits of the address “0x00106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal and the address complete match signal become “L” level, and the code register output signal becomes “0x00000”.
  • “R00102” which is the original code of the address “0x00102” is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R00102” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00100” output to the fetch unit 35 in the previous cycle.
  • the code selection circuit 14 outputs the original code “R00104” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00102” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 72 outputs “0x02”.
  • the output address of the program counter 72 becomes “0x00106” added by “0x02”.
  • the lower 16 bits of the address “0x00106” match the lower 16 bits of the address “0x00106” held in the address register 31 of the code insertion register set # 0.
  • the address match signal becomes “H” level (because address match signal 0 becomes “H” level).
  • the address complete match signal remains “L” level and the code register output signal remains “0x00000”.
  • R00106 which is the original code of the address “0x00106”
  • the code selection circuit 14 outputs the original code “R00106” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00104” output to the fetch unit 35 in the previous cycle.
  • the selector 73 of the program counter 72 outputs “0x10000”. As a result, the output address of the program counter 72 becomes “0x10106” added by “0x10000”. Since the lower 16 bits of the address “0x10106” match the lower 16 bits of the address “0x00106” held in the address register 31 of the code insertion register set # 0, the address match signal becomes “H” level ( This is because the address match signal 0 becomes “H” level). Since the most significant bit of the output address of the program counter 72 is “1”, the address complete match signal becomes “H” level (because the address match signal 0 becomes “H” level).
  • the code register output signal becomes the insertion code “Code Reg. 0” held in the code register 32 (because the code register output signal 0 becomes “Code Reg. 0”). Since the address complete match signal is at “H” level, the code selection circuit 14 outputs the insertion code “Code Reg. 0” to the fetch unit 35 of the instruction execution unit 15. The execution unit 36 of the instruction execution unit 15 executes the original code “R00106” output to the fetch unit 35 in the previous cycle.
  • R00108 which is the original code of the address “0x00108”
  • the code selection circuit 14 outputs the original code “R00108” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the insertion code “Code Reg. 0” output to the fetch unit 35 in the previous cycle.
  • the addresses of the plurality of original codes are valid from the second least significant bit, but the present invention is not limited to this, and the addresses of the plurality of original codes are the least significant bits.
  • the nth bit or more may be effective. However, n is a natural number of 1 or more.
  • the program counter 72 may add “1” to the nth bit from the least significant bit when the first signal is not received (when the address match signal is “L” level).
  • the address input to each program counter and insertion code register set may be [15: 1], but [15: 0] It is written.
  • FIG. 33 is a diagram illustrating a configuration of the flash memory control unit 623 according to the seventh embodiment.
  • the flash memory control unit 623 in FIG. 33 is different from the flash memory control unit 102 in the second embodiment in FIG. 16 in an insertion code register set block 624 and a program counter 74.
  • the insertion code register set block 624 holds a maximum of 2k-1 insertion codes and the address of the insertion code.
  • the insertion code register set block 624 is configured such that when the bit excluding the k bits from the most significant address of the held insertion code matches the bit excluding the k bits from the most significant address of the program counter 74.
  • the first signal is output (that is, the address match signal is set to the “H” level).
  • the insertion code register set block 624 outputs the first signal and holds the k bits from the most significant bit of the address of the insertion code held therein and the k bits from the most significant address of the program counter 74 address. When this occurs, the second signal is output (the address complete match signal is set to the “H” level), and the inserted code corresponding to the address of the program counter 74 is output.
  • the insertion code register set block 624 outputs a second signal and simultaneously outputs an insertion end signal indicating an insertion end when outputting the last insertion code when a plurality of insertion codes are successively inserted. To do.
  • the program counter 74 When the program counter 74 receives the first signal, the program counter 74 adds “1” to the kth bit from the most significant bit, and when not receiving the first signal, the program counter 74 adds “1” to the mth bit from the least significant bit. Add 1 ”.
  • the program counter 74 When receiving the insertion end signal, the program counter 74 adds “1” to the mth bit from the least significant bit and “0” the k bits from the most significant bit even when receiving the first signal. To.
  • FIG. 34 shows a configuration of program counter 74.
  • the program counter 74 includes a selector 77, an adder 25, a logic circuit AND74, a selector 26, a selector 27, and a PC register 28.
  • the selector 77 receives the address match signal and the insertion end signal from the insertion code register set block 624.
  • the selector 77 outputs “0x10000” when the address match signal is “H” level and the insertion end signal is “L” level.
  • the selector 73 selects the address match signal when the address match signal is “L” level and the insertion end signal is “H” level, when the address match signal is “L” level and when the insertion end signal is “L” level, or the address match signal. Is “H” level and the insertion end signal is “H” level, “0x02” is output.
  • the adder 25 adds the 20-bit address output from the PC register 28 and the value output from the selector 73.
  • the logic circuit AND74 outputs the logical product of the upper 4 bits of the 20 bits output from the adder 25 and the negative of the insertion end signal. That is, logic circuit AND 74 outputs the upper 4 bits of the 20 bits output from adder 25 when the insertion end signal is at “L” level. The logic circuit AND74 outputs 4-bit “0b0000” when the insertion end signal is at “H” level.
  • the selector 26 sets the lower 16 bits of the 20 bits output from the adder 25 as lower 16 bits, the 4-bit signal output from the logic circuit AND 74 as upper 4 bits, and the instruction execution unit 15
  • the output calculation result PC is received.
  • the selector 26 outputs the operation result PC when the operation result PC selection signal output from the instruction execution unit 15 is at “H” level, and the adder 25 and the logic circuit when the operation result PC selection signal is at “L” level.
  • the signal from the AND 74 is output.
  • the selector 27 receives the output of the selector 26 and the address output from the PC register 28.
  • the selector 27 outputs the address output from the PC register 28 when the PC stall signal output from the instruction execution unit 15 is “H” level, and outputs the output of the selector 26 when the PC stall signal is “L” level. Output.
  • the PC register 28 latches the output of the selector 27 and outputs it to the internal address bus 23 as the address of the flash control code ROM.
  • FIG. 35 is a diagram showing a configuration of a code insertion register set 78-0 included in the insertion code register set block 624.
  • the configuration of the code insertion register sets 78-1 to 78-n is the same as that of the code insertion register set 78-0 in FIG.
  • the code insertion register set 78-0 includes a logic circuit AND1, an address register 31, an address comparator 30, a logic circuit AND4, a code register 32, a logic circuit 54, and an address register. 156, an address comparator 157, a logic circuit 56, an insertion end register 59, a logic circuit AND2, a logic circuit 55, and a logic circuit AND3.
  • the logic circuit AND1 outputs an “H” level signal to the control terminal of the address register 31 when the clock clk and the address register selection signal 0 are both “H” level.
  • the address register 31 latches and holds the 16-bit address sent through the data bus when the input to the control terminal is at “H” level.
  • the address comparator 30 matches the lower 16 bits (address [15: 0]) of the 20-bit address output from the program counter 74 with the 16-bit address held in the address register 31.
  • the address match signal 0 is set to the “H” level.
  • the logic circuit AND 54 outputs an “H” level signal to the control terminal of the code register 32 when the clock clk and the address register 2 selection signal 0 are both “H” level.
  • the address register 156 latches and holds the 4-bit address sent through the data bus when the input to the control terminal is at “H” level.
  • the address comparator 57 determines that the upper 4 bits (address [19:16]) of the 20-bit address output from the program counter 74 and the 4-bit address held in the address register 156 match. In addition, an “H” level coincidence signal is output.
  • the logic circuit AND2 sets the address complete match signal 0 to “H” level when the address match signal 0 is “H” level and the match signal output from the address comparator 157 is “H” level.
  • the insertion end register 59 latches and holds 1-bit data (insertion end) sent through the data bus when the input to the control terminal is at “H” level.
  • the logic circuit AND55 receives the address complete match signal 0 and the output of the insertion end register 59.
  • the logic circuit AND55 outputs 1-bit data (insertion end) held in the insertion end register 59 as the insertion end signal 0 when the address complete match signal 0 is at “H” level.
  • the logic circuit AND4 outputs an “H” level signal to the control terminal of the code register 32 when the clock clk and the code register selection signal 0 are both at the “H” level.
  • the code register 32 latches and holds 16-bit data (that is, an insertion code) sent through the data bus when the input to the control terminal is at “H” level.
  • the logic circuit AND3 receives the address complete match signal 0 and the output of the code register 32.
  • the logic circuit AND3 outputs 16-bit data (that is, an insertion code) held in the code register 32 as the code register output signal 0 when the address complete match signal 0 is at “H” level.
  • the logic circuit AND3 outputs 16-bit “0x0000” as the code register output signal 0 when the address complete match signal 0 is at “L” level.
  • the lower 16 bits “0x20106” are held in the address register 31 of the code insertion register set # 1, and the upper 4 bits “0x20106” are held in the address register 156.
  • the insertion code “Code Reg. 1” is held in the code register 32 of the code insertion register set # 01.
  • the insertion end “0b1” is held in the insertion end register 59 of the code insertion register set # 1. Further, it is assumed that the original code “R...” Is held at the address “0x...” Of the flash control code ROM 13.
  • FIG. 36B is a timing chart under the condition of FIG. In the 0th cycle, the 20-bit address (PC value [19: 0]) output from the program counter 74 is “0x00102”.
  • the upper 15 bits of the address “0x00102” are different from the lower 16 bits of the address “0x10106” held in the address register 31 of the code insertion register set # 0, and the address register 31 of the code insertion register set # 1. This is different from the lower 16 bits of the address “0x20106” held in.
  • the address match signal and the address complete match signal become “L” level
  • the code register output signal becomes “0x0000”
  • the insertion end signal becomes “0b0”.
  • R00102 which is the original code of the address “0x00102” is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R00102” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00100” output to the fetch unit 35 in the previous cycle.
  • the selector 77 of the program counter 74 outputs “0x02”.
  • the output address of the program counter 74 is “0x00104” added by “0x02”.
  • the lower 16 bits of the address “0x00104” are different from the lower 16 bits of the address “0x10106” held in the address register 31 of the code insertion register set # 0, and the address register 31 of the code insertion register set # 1. This is different from the lower 16 bits of the address “0x20106” held in.
  • the address match signal and the address complete match signal become “L” level
  • the code register output signal becomes “0x0000”
  • the insertion end signal becomes “0b0”.
  • “R00104” which is the original code of the address “0x00104”
  • the code selection circuit 14 outputs the original code “R00104” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00102” output to the fetch unit 35 in the previous cycle.
  • the upper 4 bits of the address “0x00106” are different from the upper 4 bits of the address “0x10106” held in the address register 156 of the code insertion register set # 0, and the address of the code insertion register set # 1 This is different from the upper 4 bits of the address “0x20106” held in the register 156.
  • the address complete match signal remains at “L” level (because address complete match signal 0 and address complete match signal 1 remain at “L” level). Since the address complete match signal is “L” level, the code register output signal is “0x0000” and the insertion end signal is “0b0”.
  • “R00106”, which is the original code of the address “0x00106”, is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R00106” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00104” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 74 outputs “0x10000”. Therefore, the output address of the program counter 74 is “0x10106” added by “0x10000”.
  • the lower 16 bits of the address “0x10106” match the lower 16 bits of the address “0x10106” held in the address register 31 of the code insertion register set # 0, and the address of the code insertion register set # 1 Since it matches the lower 16 bits of the address “0x20106” held in the register 31, the address match signal becomes “H” level (because the address match signal 0 and the address match signal 1 become “H” level).
  • the upper 4 bits of the address “0x10106” match the upper 4 bits of the address “0x10106” held in the address register 156 of the code insertion register set # 0.
  • the address complete match signal becomes “H” level (because the address complete match signal 0 becomes “H” level).
  • the code register output signal 0 becomes the insertion code “Code Reg. 0” held in the code register 32 of the code insertion register set # 0.
  • the code register output signal becomes the insertion code “Code Reg. 0”. Since the address complete match signal 0 becomes “H” level, the insertion end signal 0 becomes the insertion end “0b0” held in the insertion end register 59 of the code insertion register set # 0.
  • the insertion end signal becomes “0b0”. Since the address complete match signal is at “H” level, the code selection circuit 14 outputs the insertion code “Code Reg. 0” to the fetch unit 35 of the instruction execution unit 15. The execution unit 36 of the instruction execution unit 15 executes the original code “R00106” output to the fetch unit 35 in the previous cycle.
  • the selector 77 of the program counter 74 outputs “0x10000”. Therefore, the output address of the program counter 74 is “0x20106” added by “0x10000”.
  • the lower 16 bits of the address “0x20106” match the lower 16 bits of the address “0x10106” held in the address register 31 of the code insertion register set # 0, and the address register 31 of the code insertion register set # 1. Matches the lower 16 bits of the address “0x20106” held in the. As a result, the address match signal becomes “H” level (because address match signal 0 and address match signal 1 become “H” level).
  • the upper 4 bits of the address “0x20106” match the upper 4 bits of the address “0x20106” held in the address register 156 of the code insertion register set # 1.
  • the address complete match signal becomes “H” level (because the address complete match signal 1 becomes “H” level).
  • the code register output signal 1 becomes the insertion code “Code Reg. 1” held in the code register 32 of the code insertion register set # 1.
  • the code register output signal becomes the insertion code “Code Reg. 1”. Since the address complete match signal 1 becomes “H” level, the insertion end signal 1 becomes the insertion end “0b1” held in the insertion end register 59 of the code insertion register set # 1.
  • the code selection circuit 14 outputs the insertion code “Code Reg. 1” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at “H” level.
  • the execution unit 36 of the instruction execution unit 15 executes the insertion code “Code Reg. 0” output to the fetch unit 35 in the previous cycle.
  • the selector 24 of the program counter 74 outputs “0x02”. Further, since the insertion end signal is “0b1”, the upper 4 bits (17th to 20th bits) of the output of the adder 25 are set to “0” by the logic circuit AND74. As a result, the output address of the program counter 74 is “0x00108”. The lower 16 bits of the address “0x00108” are different from the lower 16 bits of the address “0x10106” held in the address register 31 of the code insertion register set # 0, and the address register 31 of the code insertion register set # 1.
  • the address match signal becomes “L” level (because address match signal 0 and address match signal 1 become “L” level).
  • the upper 4 bits of the address “0x00108” are different from the upper 4 bits of the address “0x10106” held in the address register 156 of the code insertion register set # 0, and the address register of the code insertion register set # 1 This is different from the upper 4 bits of the address “0x20106” held in 156.
  • the address complete match signal becomes “L” level (because address complete match signal 0 and address complete match signal 1 become “L” level).
  • the code register output signal is “0x0000” and the insertion end signal is “0b0”.
  • “R00108”, which is the original code of the address “0x00108”, is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R00108” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the insertion code “Code Reg. 1” output to the fetch unit 35 in the previous cycle.
  • the selector 77 of the program counter 74 outputs “0x02”.
  • the output address of the program counter 74 is “0x0010A” added by “0x02”.
  • the lower 16 bits of the address “0x0010A” are different from the lower 16 bits of the address “0x10106” held in the address register 31 of the code insertion register set # 0, and the address register 31 of the code insertion register set # 1. This is different from the lower 16 bits of the address “0x20106” held in.
  • the m address coincidence signal and the address complete coincidence signal become “L” level
  • the code register output signal becomes “0x0000”
  • the insertion end signal becomes “0b0”.
  • “R0010A” which is the original code of the address “0x0010A”
  • the code selection circuit 14 outputs the original code “R0010A” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00108” output to the fetch unit 35 in the previous cycle.
  • the operation is the same as in the sixth cycle.
  • the address of the original code is specified by bits other than the predetermined number of bits from the most significant bit of the program counter address, and the code is inserted using the predetermined number of bits from the most significant bit. Therefore, one or more codes can be inserted between two original codes, and a multi-cycle instruction can be executed.
  • the addresses of the plurality of original codes are valid for the second and higher bits from the least significant bit and excluding the most significant bit.
  • FIG. 37 is a diagram illustrating the configuration of the flash memory control unit 742 according to the eighth embodiment.
  • the flash memory control unit 742 in FIG. 37 is different from the flash memory control unit 2 in the first embodiment in FIG. 7 in an insertion code register set block 743 and a program counter 91.
  • the insertion code register set block 743 matches the bits other than the most significant bit of the address of the insertion code that is held with the bits other than the most significant bit of the address of the program counter 91, and the most significant of the address of the program counter 91.
  • the bit is “1”
  • the first signal is output (the address complete match signal is set to “H” level), and the held insertion code is output.
  • the program counter 91 adds “1” to the most significant bit when receiving the first signal, and adds “1” to the second least significant bit when not receiving the first signal, The most significant bit is set to “0”.
  • FIG. 38 is a diagram showing the configuration of program counter 91.
  • the program counter 91 of FIG. 38 is different from the program counter 72 of the sixth embodiment of FIG. 30 in a selector 92 and a logic circuit AND92.
  • the selector 92 receives an address complete match signal from the insertion code register set block 743.
  • the selector 92 outputs “0x10000” when the address complete match signal is at “H” level.
  • the selector 92 outputs “0x02” when the address complete match signal is “L”.
  • the logic circuit AND92 outputs the logical product of the most significant bit of the 17 bits output from the adder 25 and the address complete match signal. In other words, logic circuit AND 92 outputs the most significant bit of the 17 bits output from adder 25 when the address complete match signal is at “H” level. Logic circuit AND92 outputs 1-bit “0b0” when the address complete match signal is at “L” level.
  • FIG. 39 shows a structure of insertion code register set block 743.
  • the code insertion register set 88-i receives an address output from the program counter 91 and data transmitted in the data bus, and further receives a code register selection signal i and an address register selection signal i from the code selection circuit 14. In response, an address complete match signal i and a code register output signal i are output.
  • the logic circuit OR 88 outputs a logical sum of (n + 1) code register output signals 0 to n as a code register output signal. That is, when at least one of the (n + 1) code register output signals 0 to n has an “H” level bit (that is, when an insertion code is output), the code register output signal becomes an insertion code. That is, when all the bits of (n + 1) code register output signals 0 to n are at “L” level (that is, when no insertion code is output), all the bits of the code register output signal are “L”. Become.
  • the logic circuit OR89 outputs a logical sum of (n + 1) address complete match signals 0 to n as an address complete match signal. That is, when at least one of (n + 1) address complete match signals 0 to n is at “H” level, the address complete match signal is at “H” level.
  • FIG. 40 is a diagram showing the configuration of the code insertion register set 88-0 included in the insertion code register set block 743.
  • the configuration of the code insertion register sets 88-1 to 88-n is the same as that of the code insertion register set 88-0 in FIG.
  • the code insertion register set 88-0 in FIG. 40 is different from the code insertion register set 71-0 in the sixth embodiment in FIG. 31 in that an address match signal is not output from the address comparator 30 to the outside. And a logic circuit AND88.
  • FIG. 41A shows an example of values held in the address register 31 of the code insertion register set 88-i (hereinafter, code insertion register set #i).
  • code insertion register set #i the lower 16 bits of “0x00106” are held in the address register 31 of the code insertion register set # 0.
  • the insertion code “Code Reg. 0” is held in the code register 32 of the code insertion register set # 0. Further, it is assumed that the original code “R...” Is held at the address “0x...” Of the flash control code ROM 13.
  • FIG. 41 (b) is a timing chart under the conditions of FIG. 41 (a).
  • the 17-bit address output from the program counter 91 (PC value [16: 0] is “0x00102”.
  • the lower 16 bits of the address “0x00102” are the register set # for code insertion. This is different from the lower 16 bits of the address “0x00106” held in the address register 31 of 0.
  • the address complete match signal becomes “L” level and the code register output signal becomes “0x00000”.
  • “R00102”, which is the original code of the address “0x00102” is output from the ROM 13. Since the address complete match signal is at the “L” level, the code selection circuit 14 uses the original code “R00102” as the instruction execution unit 15.
  • Execution unit 36 of the line section 15 executes the original code "R00100" outputted to the fetch unit 35 in the previous cycle.
  • the code selection circuit 14 outputs the original code “R00104” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00102” output to the fetch unit 35 in the previous cycle.
  • the selector 92 of the program counter 91 outputs “0x02”.
  • the output address of the program counter 91 becomes “0x00106” added by “0x02”.
  • the lower 16 bits of the address “0x00106” match the lower 16 bits of the address “0x0106” held in the address register 31 of the code insertion register set # 0.
  • the most significant bit (17th bit: address [16]) of the address “0x00106” is “0”.
  • the address complete match signal becomes “H” level (because the address complete match signal 0 becomes “H” level).
  • the code register output signal becomes the insertion code “Code Reg.
  • the code selection circuit 14 outputs the insertion code “Code Reg. 0” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at “H” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00106” output to the fetch unit 35 in the previous cycle.
  • the selector 92 of the program counter 91 outputs “0x10000”. As a result, the output address of the program counter 91 becomes “0x10106” added by “0x10000”.
  • the lower 16 bits of the address “0x10106” match the lower 16 bits of the address “0x00106” held in the address register 31 of the code insertion register set # 0, but the most significant bit (17 bits) of the address “0x10106” Eye: Address [16]) is “1”.
  • the address complete match signal becomes “L” level (because the address complete match signal 0 becomes “L” level).
  • the code register output signal becomes “0x00000”.
  • the flash control code ROM 13 outputs “R00106” which is the original code of the address “0x00106” in which the most significant bit (17th bit) of the output address “0x10106” of the program counter 91 is set to “0”.
  • the selector 92 of the program counter 91 outputs “0x00002”. Further, since the address complete match signal is at “L” level, the most significant bit (17th bit) of the output address of the adder 25 becomes “0”. As a result, the output address of the program counter 91 is “0x00108”. The lower 16 bits of the address “0x00108” are different from the lower 16 bits of the address “0x00106” held in the address register 31 of the code insertion register set # 0. As a result, the address complete match signal becomes “L” level and the code register output signal becomes “0x00000”.
  • the operation is the same as the fourth cycle.
  • the address of the original code is designated by bits other than the most significant bit of the address of the program counter, and the code is coded using the most significant bit. Since the insertion is controlled, one or more codes can be inserted between two original codes, and a multi-cycle instruction can be executed. Further, according to the present embodiment, when the address from the program counter matches the value of the address register, the insertion code is executed in comparison with the sixth embodiment in which the execution of the insertion code is executed after the original code. Execute before the original code.
  • the addresses of the plurality of original codes are valid for the second and higher bits from the least significant bit and excluding the most significant bit.
  • the address may be valid for the nth bit from the least significant bit and excluding the most significant bit.
  • n is a natural number of 1 or more.
  • the program counter 91 adds “1” to the nth bit from the least significant bit, and the most significant bit.
  • the bit can be set to “0”.
  • FIG. 42 is a diagram illustrating the configuration of the flash memory control unit 388 of the ninth embodiment.
  • the flash memory control unit 388 of FIG. 42 is different from the flash memory control unit 102 of the second embodiment of FIG. 16 in an insertion code register set block 389 and a program counter 94.
  • the insertion code register set block 389 holds a maximum of 2k-1 insertion codes and the address of the insertion code.
  • the bits excluding the k bits from the most significant bit of the held insertion code address match the bits excluding the k bits from the most significant address of the program counter 94, and
  • a first signal is output (address complete match signal is At the same time, the inserted insertion code corresponding to the address of the program counter 94 is output.
  • the program counter 94 When receiving the first signal, the program counter 94 adds “1” to the kth bit from the most significant bit, and when not receiving the first signal, the program counter 94 adds “1” to the mth bit from the least significant bit. 1 ”is added, and k bits from the most significant bit are set to“ 0 ”.
  • FIG. 43 is a diagram showing the configuration of program counter 94.
  • the selector 92 receives an address complete match signal from the insertion code register set block 389.
  • the selector 92 outputs “0x10000” when the address complete match signal is at “H” level.
  • the selector 92 outputs “0x02” when the address complete match signal is “L”.
  • the logic circuit AND94 outputs a logical product of the upper 4 bits (17th to 19th bits) of the 20 bits output from the adder 25 and the address complete match signal. That is, logic circuit AND 94 outputs the upper 4 bits of the 20 bits output from adder 25 when the address complete match signal is at “H” level. The logic circuit AND94 outputs 4-bit “0b0” when the address complete match signal is at “L” level.
  • FIG. 44 shows a structure of insertion code register set block 389.
  • the code insertion register set 86-i receives an address output from the program counter 94 and data transmitted through the data bus, and further receives a code register selection signal i, an address register selection signal i and an address from the code selection circuit 14. In response to the register 2 selection signal i, an address complete match signal i and a code register output signal i are output.
  • the logic circuit OR 88 outputs a logical sum of (n + 1) code register output signals 0 to n as a code register output signal. That is, when at least one of the (n + 1) code register output signals 0 to n has an “H” level bit (that is, when an insertion code is output), the code register output signal becomes an insertion code. That is, when all the bits of (n + 1) code register output signals 0 to n are at “L” level (that is, when no insertion code is output), all the bits of the code register output signal are “L”. Become.
  • FIG. 45 is a diagram showing the configuration of the code insertion register set 86-0 included in the insertion code register set block 389. As shown in FIG. The configuration of the code insertion register sets 86-1 to 86-n is the same as that of the code insertion register set 86-0 in FIG.
  • the lower 16 bits of “0x10106” are held in the address register 31 of the code insertion register set # 1, and the upper 4 bits (17th to 20th bits) of “0x10106” are held in the address register 156. Also, the insertion code “Code Reg. 1” is held in the code register 32 of the code insertion register set # 1. Further, it is assumed that the original code “R...” Is held at the address “0x...” Of the flash control code ROM 13.
  • FIG. 46B is a timing chart under the condition of FIG. In the 0th cycle, the 20-bit address (PC value [19: 0]) output from the program counter 94 is “0x00102”.
  • the lower 16 bits of the address “0x00102” are different from the lower 16 bits of the address “0x00106” held in the address register 31 of the code insertion register set # 0.
  • the address complete match signal becomes “L” level and the code register output signal becomes “0x00000”.
  • “R00102” which is the original code of the address “0x00102” is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R00102” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00100” output to the fetch unit 35 in the previous cycle.
  • the code selection circuit 14 outputs the original code “R00104” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00102” output to the fetch unit 35 in the previous cycle.
  • the selector 92 of the program counter 94 outputs “0x02”. As a result, the output address of the program counter 94 becomes “0x00106” added by “0x02”.
  • the lower 16 bits of the address “0x00106” match the lower 16 bits of the address “0x00106” held in the address register 31 of the code insertion register set # 0.
  • the upper 4 bits (17th to 20th bits) address [16] to [19] of address “0x00106” are the addresses “0x0106” held in address register 156 of code insertion register set # 0. Matches the upper 4 bits of.
  • the address complete match signal becomes “H” level (because the address complete match signal 0 becomes “H” level).
  • the code register output signal becomes the insertion code “Code Reg. 0” held in the code register 32 (because the code register output signal 0 becomes “Code Reg. 0”). Since the address complete match signal is at “H” level, the code selection circuit 14 outputs the insertion code “Code Reg. 0” to the fetch unit 35 of the instruction execution unit 15.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00104” output to the fetch unit 35 in the previous cycle.
  • the selector 92 of the program counter 94 outputs “0x10000”. As a result, the output address of the program counter 94 becomes “0x10106” added by “0x10000”.
  • the lower 16 bits of the address “0x10106” match the lower 16 bits of the address “0x10106” held in the address register 31 of the code insertion register set # 1.
  • the upper 4 bits (17th to 20th bits) addresses [16] to [19] of the address “0x10106” are the addresses “0x10106” held in the address register 156 of the code insertion register set # 1. Matches the upper 4 bits of.
  • the address complete match signal becomes “H” level (because the address complete match signal 1 becomes “H” level).
  • the code register output signal becomes the insertion code “Code Reg. 1” held in the code register 32 (because the code register output signal 0 becomes “Code Reg. 1”).
  • the code selection circuit 14 outputs the insertion code “Code Reg. 1” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at “H” level.
  • the execution unit 36 of the instruction execution unit 15 executes the insertion code “Code Reg. 0” output to the fetch unit 35 in the previous cycle.
  • the selector 92 of the program counter 94 outputs “0x10000”.
  • the output address of the program counter 94 becomes “0x20106” added by “0x10000”.
  • the lower 16 bits of the address “0x20106” match the lower 16 bits of the addresses “0x00106” and “0x10106” held in the address registers 31 of the code insertion register sets # 0 and # 1.
  • the upper 4 bits (17th to 20th bits) addresses [16] to [19] of the address “0x20106” are the addresses held in the address registers 156 of the code insertion register sets # 0 and # 1.
  • the address complete match signal becomes “L” level (because the address complete match signal 0 and the address complete match signal become “L” level).
  • the code register output signal becomes “0x00000”.
  • the flash control code ROM 13 outputs “R00106”, which is the original code of the address “0x00106” in which the upper 4 bits (17th to 20th bits) of the output address “0x20106” of the program counter 94 are set to “0”.
  • the code selection circuit 14 outputs the original code “R00106” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the insertion code “Code Reg. 1” output to the fetch unit 35 in the previous cycle.
  • the selector 92 of the program counter 94 outputs “0x02”. Further, since the address complete match signal is at “L” level, the upper 4 bits (17th to 20th bits) of the output address of the adder 25 become “0”. As a result, the output address of the program counter 94 is “0x00108”. Further, since the lower 16 bits of the address “0x00108” are different from the lower 16 bits of the address “0x00106” held in the address register 31, the address complete match signal becomes “L” level, and the code register output signal becomes “ 0x00000 ". “R00108”, which is the original code of the address “0x00108”, is output from the flash control code ROM 13.
  • the code selection circuit 14 outputs the original code “R00108” to the fetch unit 35 of the instruction execution unit 15 because the address complete match signal is at the “L” level.
  • the execution unit 36 of the instruction execution unit 15 executes the original code “R00106” output to the fetch unit 35 in the previous cycle.
  • the operation is the same as the fifth cycle.
  • the address of the original code is designated by bits other than the predetermined number of bits from the most significant bit of the program counter address, and the predetermined value is designated from the most significant bit. Since the insertion of the code is controlled using the number of bits, it is possible to insert one or more codes between two original codes and to execute a multi-cycle instruction. Further, according to the present embodiment, when the address from the program counter matches the value of the address register, the insertion code is executed with respect to the seventh embodiment in which the execution of the insertion code is executed after the original code. Execute before the original code.
  • the present invention is not fixed to the above embodiment.
  • the code register value may be fixed to a specific value.
  • the code types that can be inserted are limited, but the size of the register can be reduced.
  • code register value may be stored in the ROM, or may be stored in a circuit combining logic circuits. Only a specific command (for example, an error monitor command) may be inserted.
  • the flash memory control unit can also have a general-purpose processor having the same function.
  • the flash memory 3 and the flash memory control unit 2 shown in FIG. 6 may constitute a nonvolatile semiconductor device formed on one semiconductor substrate (chip).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Microcomputers (AREA)
  • Stored Programmes (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

 プログラムカウンタ(12)は、第1の値または第2の値を加算することによって、アドレスを更新する。コード選択回路(14)は、プログラムカウンタ(12)のアドレスに応じて、挿入コードレジスタセットブロック(17)内のプログラムカウンタ(12)で指定されるアドレスに対応する挿入コードか、フラッシュ制御コード用ROM(13)内のプログラムカウンタ(12)で指定されるアドレスのオリジナルコードのいずれかを選択する。命令実行部(15)は、選択されたコードを実行する。複数のオリジナルコードおよび挿入コードのうちの少なくとも1つが、マルチサイクル命令である。プログラムカウンタ(14)は、マルチサイクル命令の実行時には、アドレスの更新を停止する。

Description

マイクロコンピュータおよび不揮発性半導体装置
 本発明は、マイクロコンピュータおよび不揮発性半導体装置に関し、特にオリジナルのコードに追加のコードを挿入する機能を備えたマイクロコンピュータおよび不揮発性半導体装置に関する。
 従来から、マイクロコンピュータのROM(Read Only Memory)に記録されたプログラムを変更する方法が知られている。
 特許文献1(特開平10-27704号公報)の装置は、修正アドレスレジスタと比較回路とを備える。ROMフェッチアドレスと修正アドレスレジスタの値を比較回路で比較し、その結果を命令解読器へ送出し、命令解読器では比較回路での一致を検出するとマイクロ命令の実行によりRAM上の所定のアドレスから修正プログラムの開始アドレスを取得し、プログラムの実行を同RAM内の修正プログラムの開始番地へ分岐させるという構成を有する。
 特許文献2(特開平8-95946号公報)の装置は、命令キュー、フェッチポインタ、内蔵ROMのバグ部分のアドレスを格納するレジスタ、レジスタとフェッチポインタの内容を比較する比較回路の出力結果によりメモリ上のプログラム又は特定の分岐命令を出力する選択回路を備える。フェッチポインタの内容がレジスタの内容と一致した時点で、選択回路から分岐命令を命令キューへ転送し、CPUは該分岐命令の実行により修正プログラムに移行し、バグ部分の実行が回避される。
 特許文献3(特開2004-46318号公報)の装置は、命令データ列が記憶されたメモリと、命令レジスタ、及び、メモリに記憶された命令データのうち命令レジスタに出力すべき特定命令データが記憶された特定命令アドレスを示すプログラムカウンタを有するCPUとを備える。さらに、この装置は、外部から書き込み可能で、命令データ列に追加する追加命令データとこの追加命令データを追加する位置を示す追加アドレスとからなるデータ-アドレス対を記憶可能に構成されてなる追加命令記憶手段と、プログラムカウンタの示す特定命令アドレスと追加命令記憶手段に記憶された追加アドレスとを比較して特定命令データと追加命令データのいずれかを選択する。特定命令アドレスと追加アドレスとが一致したとき、プログラムカウンタは特定命令アドレスの更新を停止する。
特開平10-27704号公報 特開平8-95946号公報 特開2004-46318号公報
 しかしながら、特許文献1および特許文献2の装置では、コードの挿入と変更が可能であるが、必要とするハードウエア量が大きいという問題がある。また、分岐ジャンプに伴うオーバーヘッド時間によって、装置の性能が劣化する。
 特許文献3の装置では、コードの挿入が可能であるが、コードの挿入時にプログラムカウンタが1サイクル停止するため、マルチサイクル命令への適用が困難である。その他の課題と新規な特徴は、本明細書の記述および添付図面から明らかになるであろう。
 本実施の一実施形態のマイクロコンピュータは、第1の値または第2の値を加算することによって、アドレスを更新し、マルチサイクル命令の実行時には、アドレスの更新を停止するプログラムカウンタと、プログラムカウンタのアドレスに応じて、レジスタ内のプログラムカウンタで指定されるアドレスに対応する挿入コードか、ROM内のプログラムカウンタで指定されるアドレスのオリジナルコードのいずれかを選択する選択回路と、選択回路で選択されたコードを実行する命令実行部とを備える。
 本発明の一実施形態のマイクロコンピュータおよび不揮発性半導体装置によれば、コードの挿入が可能で、かつマルチサイクル命令の実行が可能となる。
(a)は、ROMに記録されているコード(オリジナルコード)と、挿入するコードの例を表わす図である。(b)は、コード変更機能を備えたマイクロコンピュータAの変更後のコードを表わす図である。(c)は、コード挿入機能を備えたマイクロコンピュータBのROMの変更後のコードを表わす図である。 (a)は、ROMに記録されているコード(オリジナルコード)と、変更するコードの例を表わす図である。(b)は、コード変更機能を備えたマイクロコンピュータAの変更後のコードを表わす図である。(c)は、コード挿入機能を備えたマイクロコンピュータBの変更後のコードを表わす図である。 (a)は、単一サイクル方式における命令のフェッチおよび実行のタイミングを表わす図である。(b)は、マルチサイクル方式における命令のフェッチおよび実行のタイミングを表わす図である。 特許文献3において、ROMに記録されているコード(オリジナルコード)の一部がマルチサイクル命令の場合において単一サイクル命令を挿入する場合のタイミング図である。 (a)は、ROMに記録されているコード(オリジナルコード)の一部がマルチサイクル命令の場合において、単一サイクル命令を挿入しても、正常に動作する場合のタイミング図である。(b)は、ROMに記録されているコード(オリジナルコード)が単一サイクル命令の場合において、マルチサイクル命令を挿入しても、正常に動作する場合のタイミング図である。 本実施の形態のマイクロコンピュータの構成を表わす図である。 第1の実施形態のフラッシュメモリ制御部2の構成を表わす図である。 命令実行部15とプログラムカウンタ12の機能を説明するための図である。 プログラムカウンタ12の構成を表わす図である。 挿入コードレジスタセットブロック17の構成を表わす図である。 コード挿入用レジスタセット29-0の構成を表わす図である。 コード選択回路14の構成を表わす図である。 (a)は、コード挿入用レジスタセット29-iのアドレスレジスタ31に保持されている値の例を示す図である。(b)は、(a)の条件下でのタイミング図である。 (a)は、コード挿入用レジスタセット29-iのアドレスレジスタ31に保持されている値の例を示す図である。(b)は、オリジナルコードと挿入コードを表わす図である。(c)は、(a)および(b)に示す条件下でのタイミング図である。 (a)は、コード挿入用レジスタセット29-iのアドレスレジスタ31に保持されている値の例を示す図である。(b)は、オリジナルコードと挿入コードを表わす図である。(c)は、(a)および(b)に示す条件下でのタイミング図である。 第2の実施形態のフラッシュメモリ制御部102の構成を表わす図である。 プログラムカウンタ51の構成を表わす図である。 挿入コードレジスタセットブロック52の構成を表わす図である。 コード挿入用レジスタセット54-0の構成を表わす図である。 (a)は、コード挿入用レジスタセット29-iのアドレスレジスタ31に保持されている値の例を示す図である。(b)は、(a)の条件下でのタイミング図である。 第3の実施形態のフラッシュメモリ制御部312の構成を表わす図である。 挿入コードレジスタセットブロック164に含まれるコード挿入用レジスタセット64-0の構成を表わす図である。 (a)は、コード挿入用レジスタセット64-iのアドレスレジスタ31に保持されている値の例を示す図である。(b)は、(a)の条件下でのタイミング図である。 第4の実施形態のフラッシュメモリ制御部103の構成を表わす図である。 第4の実施形態のプログラムカウンタ65の構成を表わす図である。 (a)は、コード挿入用レジスタセット54-iのアドレスレジスタ31に保持されている値の例を示す図である。(b)は、(a)の条件下でのタイミング図である。 第5の実施形態のフラッシュメモリ制御部395の構成を表わす図である。 挿入コードレジスタセットブロック396に含まれるコード挿入用レジスタセット40-0の構成を表わす図である。 第6の実施形態のフラッシュメモリ制御部423の構成を表わす図である。 プログラムカウンタ72の構成を表わす図である。 挿入コードレジスタセットブロック424に含まれるコード挿入用レジスタセット71-0の構成を表わす図である。 (a)は、コード挿入用レジスタセット71-iのアドレスレジスタ31に保持されている値の例を示す図である。(b)は、(a)の条件下でのタイミング図である。 第7の実施形態のフラッシュメモリ制御部623の構成を表わす図である。 プログラムカウンタ74の構成を表わす図である。 挿入コードレジスタセットブロック624に含まれるコード挿入用レジスタセット78-0の構成を表わす図である。 (a)は、コード挿入用レジスタセット78-iのアドレスレジスタ31に保持されている値の例を示す図である。(b)は、(a)の条件下でのタイミング図である。 第8の実施形態のフラッシュメモリ制御部742の構成を表わす図である。 プログラムカウンタ94の構成を表わす図である。 挿入コードレジスタセットブロック743の構成を表わす図である。 挿入コードレジスタセットブロック743に含まれるコード挿入用レジスタセット88-0の構成を表わす図である。 (a)は、コード挿入用レジスタセット88-iのアドレスレジスタ31に保持されている値の例を示す図である。(b)は、(a)の条件下でのタイミング図である。 第9の実施形態のフラッシュメモリ制御部388の構成を表わす図である。 プログラムカウンタ94の構成を表わす図である。 挿入コードレジスタセットブロック389の構成を表わす図である。 挿入コードレジスタセットブロック389に含まれるコード挿入用レジスタセット86-0の構成を表わす図である。 (a)は、コード挿入用レジスタセット86-iのアドレスレジスタ31に保持されている値の例を示す図である。(b)は、(a)の条件下でのタイミング図である。
 以下、本発明の実施形態について、図面を用いて説明する。
 [第1の実施形態]
 (コード挿入とコード変更について)
 まず、コード変更機能を備えたマイクロコンピュータAと、コード追加機能を備えたマイクロコンピュータBにおいて、コード挿入に伴う変更が必要なコード量について説明する。
 図1(a)は、ROMに記録されているコード(オリジナルコード)と、挿入するコードの例を表わす図である。図1(a)の例では、オリジナルコードが命令0~10、11、12であり、命令3の後に挿入するコードが命令3′である。
 図1(b)は、コード変更機能を備えたマイクロコンピュータAの変更後のコードを表わす図である。
 図1(b)に示すように、アドレス「0x0108」に命令3′が記憶される。変更前のNOP領域がアドレス「0x0116」であるため、命令4~命令10の格納位置がアドレス「0x010A」~「0x0116」に移動する。したがって、必要な変更コード量は「8」である。つまり、挿入する領域からNOP領域まで変更が必要なため、NOP領域の位置によって、膨大な量の変更が必要となる。変更する分だけのレジスタセットを設ける必要となり、ハードウエアが大規模化する。この対策として、NOP領域を多く設けることが考えられるが、冗長な処理時間が増えるので、CPUの処理性能が劣化する。
 図1(c)は、コード挿入機能を備えたマイクロコンピュータBのROMの変更後のコードを表わす図である。
 図1(c)に示すように、アドレス「0x0106」に命令3′が記憶される。したがって、必要な変更コード量は「1」である。
 次に、コード変更機能を備えたマイクロコンピュータAと、コード追加機能を備えたマイクロコンピュータBにおけるコード変更に伴って、変更が必要なコード量について説明する。
 図2(a)は、ROMに記録されているコード(オリジナルコード)と、変更するコードの例を表わす図である。図2(a)の例では、オリジナルコードが命令0~10、11、12であり、命令3を命令3′に変更することが示されている。
 図2(b)は、コード変更機能を備えたマイクロコンピュータAの変更後のコードを表わす図である。
 図2(b)に示すように、アドレス「0x0106」に記憶される命令3が命令3′に変更される。したがって、必要な変更コード量は「1」である。
 図2(c)は、コード挿入機能を備えたマイクロコンピュータBの変更後のコードを表わす図である。
 図2(c)に示すように、アドレス「0x0104」に命令3′とジャンプ命令「JUMP0108」が記憶される。したがって、必要な変更コード量は「2」である。
 以上説明したように、コード変更機能を備えたマイクロコンピュータにおいて、コードを挿入する場合に、膨大な量のコードの変更が必要となる場合があり、変更する分だけのレジスタセットを設けることが必要となる。したがって、コード変更機能によって、コードを挿入するのは効率が悪いといえる。
 (単一サイクル方式とマルチサイクル方式)
 次に、単一サイクル方式とマルチサイクル方式について説明する。以下、サイクルとは、動作タイミングの基準となる、所謂一定周波数の基準クロック信号のサイクルである。
そして、このサイクルに連動してプログラムカウンタの更新が実施されるものとする。
 図3(a)は、単一サイクル方式における命令のフェッチおよび実行のタイミングを表わす図である。
 各サイクルで、プログラムカウンタで示されるROMのアドレスから命令がフェッチされ(IFステージ)、同時に1つ前のサイクルでフェッチされた命令が実行される(EXステージ)。単一サイクルでは、すべてのサイクルの時間が同一である。
 図3(b)は、マルチサイクル方式における命令のフェッチおよび実行のタイミングを表わす図である。
 マルチサイクル方式でも、単一サイクル方式と同様に、各サイクルで、プログラムカウンタで示されるROMのアドレスから命令がフェッチされ(IFステージ)、同時に1つ前のサイクルでフェッチされた命令が実行される(EXステージ)。マルチサイクルでは、少なくとも1つの命令実行が、複数のサイクルに跨って行われる。
 単一サイクル方式では、最長パス(最長の命令実行時間)により1サイクルの時間が律速され1サイクルの時間が長くなる、必要ハードウェア量が多くなるなどの欠点がある。そのため、マルチサイクル方式を採用するのが望ましいといえる。マルチサイクル方式を採用する場合には、コード挿入機能もマルチサイクル方式に対応する必要がある。しかしながら、特許文献3の装置は、段落[0049]に記載されているようにPC更新停止信号は1サイクル分となっており、マルチサイクル方式に対応していない。
 (マルチサイクル方式でコード挿入機能を設ける場合の問題点)
 次に、ROMに記録されているコード(オリジナルコード)の一部がマルチサイクル命令の場合において単一サイクル命令を挿入する場合の問題点を説明する。
 図4は、特許文献3において、ROMに記録されているコード(オリジナルコード)の一部がマルチサイクル命令の場合において単一サイクル命令を挿入する場合のタイミング図である。
 図4の例では、オリジナルコードの一部である「R0106」がマルチサイクル命令(3サイクル命令)である。このコードのアドレスが「0x0106」であり、このコードの後に単一サイクルの挿入コード「Code 0」を挿入する場合の例が示されている。ここで、「0x・・・・」は、16進数表示であることを表わす。
 第3サイクルにおいて、プログラムカウンタの値がアドレス「0x0108」と一致すると、挿入コードCode0がフェッチされるとともに、プログラムカウンタ更新停止信号は有効となる。しかしながら、第3サイクルにおいては、プログラムカウンタは、マルチサイクル命令を実行するため停止中であるので、プログラムカウンタ更新停止信号は、挿入のためにプログラムカウンタを停止するという役割を果たすことができない。その結果、アドレス「0x0108」のROMのコードがフェッチされず、実行されないことになる。アドレス「0x0108」のROMのコードを実行するために、図4に示すように、PC更新停止を3サイクル期間停止させる必要があるが、そのためには複雑な制御が必要となる。以下、その理由について説明する。
 マルチサイクル命令実行時には、命令実行部からプログラムカウンタの更新を(マルチサイクル数―1)の期間停止するための信号であるPCストール信号が出力される。PCストール信号とは、一般的なプロセッサでマルチサイクル命令を実行した時に出力される信号である。そして、このPCストール信号とアドレス一致信号から単純な論理を生成し、マルチサイクル命令実行でのコード挿入機能を実現することを検討してみる。
 図5(a)は、ROMに記録されているコード(オリジナルコード)の一部がマルチサイクル命令の場合において、単一サイクル命令を挿入しても、正常に動作する場合のタイミング図である。尚、IF実行コード、アドレス、IFステージの実行コード、EXステージの実行コードのタイミング図は、コード挿入を実現するために必要な期待値である。
PCストール信号のタイミング図は、一般的なマルチサイクル方式のマイクロコンピュータにおける動作を示したもの、アドレス一致信号のタイミング図は、単純な比較器を用いた場合の動作を示したものである。
 図5(a)の例では、オリジナルコードの一部である「R0106」がマルチサイクル命令(3サイクル命令)であり、このコードのアドレスが「0x0106」であり、このコードの後に単一サイクルの挿入コード「Code 0」を挿入する場合の例が示されている。
 第3サイクルにおいて、プログラムカウンタの値がアドレス「0x0108」と一致すると、アドレス一致信号が4つのサイクルの期間「H」レベルとなり、PCストール信号が2つのサイクルの期間「H」レベルとなる。図5(a)に示すように、アドレス「0x0108」のROMのコードをフェッチして実行するためには、PCストール信号が「L」レベルである第5サイクルにおいて、プログラムカウンタの更新を停止させるためのPC更新停止信号を別途発生させる必要がある。図5(a)の場合は、1つ前のサイクルでアドレス一致信号とPCストール信号がいずれも「H」レベルであり、かつ現サイクルでアドレス一致信号が「H」レベル、PCストール信号が「L」レベルとなるような場合に、新たに設けたPC更新停止信号が「H」レベルとなるような論理回路を設ける必要がある。
 図5(b)は、ROMに記録されているコード(オリジナルコード)が単一サイクル命令の場合において、マルチサイクル命令を挿入しても、正常に動作する場合のタイミング図である。
 図5(b)の例では、オリジナルコードの一部である「R0106」の後に、3サイクル命令である挿入コード「Code 0」を挿入する場合の例が示されている。
 第3サイクルにおいて、プログラムカウンタの値がアドレス「0x0108」と一致すると、アドレス一致信号が4つのサイクルの期間「H」レベルとなり、PCストール信号が第4サイクルから2サイクルの期間「H」レベルとなる。図5(b)に示すように、アドレス「0x0108」のROMのコードをフェッチして実行するためには、PCストール信号が「L」レベルである第3サイクルにおいて、プログラムカウンタの更新を停止させるためのPC更新停止信号を発生させる必要がある。図5(b)の場合は、1つ前のサイクルでアドレス一致信号とPCストール信号がいずれも「L」レベルであり、かつ現サイクルでアドレス一致信号が「H」レベル、PCストール信号が「L」レベルとなるような場合に、PC更新停止信号が「H」レベルとなるような論理回路を設ける必要がある。
 以上のように、図5(a)と図5(b)の場合では、PC更新停止信号を生成するために別個の論理回路が必要となる。
 また、図5(a)の第5サイクルと1つ前のサイクルの第4サイクルと、図5(b)の第6サイクルと1つ前のサイクルの第5サイクルとでは、アドレス一致信号とPCストール信号のレベルが同一である。しかしながら、フェッチされるコードは、図5(a)では、挿入コードを保持するCodeReg側であり、図5(b)では、オリジナルコードを保持するROM側であり、両者は一致しない。
 したがって単純に論理回路を追加するだけでは、コード挿入機能を実現するためのPC更新停止信号と、オリジナルコートか挿入コードかを選択して命令実行部に送るセレクタを切替えるための切り替え信号を生成すること困難である。本実施の形態では、これらの課題を解決して、コード挿入を可能とするマルチサイクル方式のマイクロコンピュータでを実現する。
 (第1の実施形態の構成)
 図6は、本実施の形態のマイクロコンピュータの構成を表わす図である。同図に示されるマイクロコンピュータは、特に制限されないが、公知の半導体集積回路製造技術により、半導体基板(チップ)に形成される。
 図6に示すように、このマイクロコンピュータ1は、CPU(Central Processing Unit)4と、RAM(Random Access Memory)5と、周辺装置6と、アナログ入力端子9と、A-D変換器7と、アナログ出力端子10と、D-A変換器8と、I/Oポート11と、フラッシュメモリ3と、主に、このフラッシュメモリ3の制御を行うフラッシュメモリ制御部2、これらの各種回路間の信号伝達のためのメインデータバス273とを備える。
 CPU4は、マイクロコンピュータ1の全体の処理を制御する。CPU4は、フラッシュメモリ3へのアクセスが可能である。
 RAM5は、各種のデータを記憶し、CPU4のワーク領域などに利用される。
 周辺装置6は、I/Oポート11を介して外部との間でデータを授受する。
 A-D変換器7は、アナログ入力端子9から入力されるアナログ信号をデジタル信号に変換する。
 D-A変換器8は、デジタル信号をアナログ信号に変換して、アナログ出力端子10に出力する。
 フラッシュメモリ3は、不揮発性メモリであって、半導体基板に電気的に消去および書込みが可能である。フラッシュメモリ3は、特に制限されないが、CPU4の動作プログラムもしくは各種のデータを記憶する。
 フラッシュメモリ制御部2は、CPU3からのアクセスに従い所定のシーケンスで、フラッシュメモリ3の制御を行なう。フラッシュメモリ制御部2は、フラッシュメモリ3の消去、書込み、読出し等の動作制御をするプログラムが格納されていると共に、それのプログラムの実行も行う。このプログラムには、例えば、フラッシュメモリの書換え動作のエラーをモニタする命令を含む。フラッシュメモリ制御部2は、このエラーをモニタする命令を読み出したときには、エラーを示すレジスタをチェックし、エラーがあればCPU4にエラーを伝達する。
 このようなエラーをモニタする命令は、一定の時間間隔で読み出されるようにプログラム中の一定のアドレスごとに配置されている。この命令の実行は、他の処理性能の劣化を招く。そのため、このプログラムは、適度な間隔で配置する必要がある。一方、処理性能の多少の劣化を犠牲にしても、安全性を重視し、エラーモニタの時間間隔を短縮したい場合がある。
 本実施の形態のフラッシュメモリ制御部2は、予め組み込まれ命令であるオリジナルコードからなるプログラムに新たなコードを挿入する機能を有することによって、マイクロコンピュータのハードウェアを変更することなく、このような要求に対応することが可能となる。
 図7は、第1の実施形態のフラッシュメモリ制御部2の構成を表わす図である。
 図7に示すように、このフラッシュメモリ制御部2は、プログラムカウンタ12と、フラッシュ制御コード用ROM13と、挿入コードレジスタセットブロック17と、レジスタ選択信号生成回路18と、コード選択回路14と、命令実行部15と、インタフェースコントローラ16とを備える。
 フラッシュ制御コード用ROM13は、予め組み込まれた命令である複数のオリジナルコードを記憶する。フラッシュ制御コード用ROM13は、プログラムカウンタ12から出力されるアドレスに格納されているオリジナルコードを出力する。ここで、フラッシュ制御コード用ROM13内の複数のオリジナルコードのアドレスは、プログラムカウンタの出力の最下位から2ビット目以上のビットが有効である。また、本実施の形態におけるフラッシュ制御コード用ROM13は、機能的にはマスクROMに相当するが、所謂大容量メモリの書込み禁止状態ではなく、予め論理回路等で固定的に組み込まれたものを想定している。
 挿入コードレジスタセットブロック17は、少なくとも1つの挿入コードと、挿入コードのアドレスを保持するレジスタセットを有する。挿入コードレジスタセットブロック17は、保持している挿入コードのアドレスの最下位ビットを除くビットとプログラムカウンタ12のアドレスの最下位ビットを除くビットとが一致したときに、第1の信号をプログラムカウンタ12へ出力し出力する(すなわち、アドレス一致信号を「H」レベルに設定する。)。挿入コードレジスタセットブロック17は、第1の信号を出力し、かつプログラムカウンタ12のアドレスの最下位ビットが「1」のときに、第2の信号をコード選択回路14へ出力する(すなわち、アドレス完全一致信号を「H」レベルに設定する)とともに、保持している挿入コードをコードレジスタ出力信号として出力する。
 プログラムカウンタ12は、第1の値または第2の値を加算することによって、カウンタ値であるアドレスを更新する。すなわち、プログラムカウンタ12は、アドレス一致信号およびPC制御信号に基づいて、カウンタ値を更新し、カウンタ値であるアドレスを内部アドレスバス23に出力する。プログラムカウンタ12は、マルチサイクル命令の実行時には、アドレスの更新を停止する。より、具体的には、プログラムカウンタ12は、第1の信号を受けたときに、最下位ビットに「1」を加算し、第1の信号を受けないときに、最下位から2番目のビットに「1」を加算する。
 レジスタ選択信号生成回路18は、挿入コードレジスタセットブロック17へ後述するコードレジスタ選択信号0~nおよびアドレスレジスタ選択信号0~nを供給する。コードレジスタ選択信号0~nおよびアドレスレジスタ選択信号0~nは、挿入したいコードと、そのコードを挿入するアドレスとを挿入コードレジスタセットブロック17に設定する際、選択信号として活性化される。
 コード選択回路14は、プログラムカウンタ12から出力されるアドレスに応じて変化するアドレス完全一致信号に基づいて、フラッシュ制御コード用ROM13から出力されたオリジナルコードおよび挿入コードレジスタセットブロック17から出力された挿入コードのいずれかを実行コードとして命令実行部15に出力する。より具体的には、コード選択回路14は、第2の信号を受けたときに、挿入コードを選択し、第2の信号を受けなかったときに、オリジナルコードを選択する。
 命令実行部15は、コード選択回路14から出力される実行コードをフェッチし、フェッチした実行コードを実行する。
 本実施の形態では、複数のオリジナルコードおよび挿入コードのうちの少なくとも1つが、マルチサイクル命令であるものとする。すなわち、フラッシュメモリ3の制御において、マルチサイクル命令での処理が必要とされるものとする。
 インタフェースコントローラ16は、メインデータバス273に接続され、フラッシュメモリ制御部の外部からの割込みを受けて、命令実行部15に割込信号を出力する。
 命令実行部15およびインタフェースコントローラ16は、内部データバス21を介してフラッシュメモリ3に接続される。
 図8は、命令実行部15とプログラムカウンタ12の機能を説明するための図である。
 図8に示すように、命令実行部15は、フェッチ部35と、実行部36とを備える。フェッチ部35は、コード選択回路14から出力される実行コードをフェッチし、実行部35に出力する。実行部36は、フェッチされた実行コードを実行する。実行部36は、即値を示す演算結果PC、即値の選択を指示する演算結果PC選択信号、およびPCストール信号などのPC制御信号をプログラムカウンタ12へ出力する。PCストール信号は、マルチサイクル命令の実行時に「H」レベルに設定される。
 図9は、プログラムカウンタ12の構成を表わす図である。
 図9に示すように、プログラムカウンタ12は、セレクタ24と、加算器25と、セレクタ26と、セレクタ27と、PC用レジスタ28とを備える。
 セレクタ24は、挿入コードレジスタセットブロック17から出力されるアドレス一致信号が「H」レベルのときには「0x01」を出力し、アドレス一致信号が「L」レベルのときには「0x02」を出力する。
 加算器25は、PC用レジスタ28から出力される16ビットのアドレスとセレクタ24から出力される値を加算する。
 セレクタ26は、加算器25の出力と、命令実行部15から出力される演算結果PC(すなわち、即値)とを受ける。セレクタ26は、命令実行部15から出力される演算結果PC選択信号が「H」レベルのときには演算結果PCを出力し、演算結果PC選択信号が「L」レベルのときには、加算器25の出力を出力する。
 セレクタ27は、セレクタ26の出力と、PC用レジスタ28から出力されるアドレスとを受ける。セレクタ27は、命令実行部15から出力されるPCストール信号が「H」レベルのときにはPC用レジスタ28から出力されるアドレスを出力し、PCストール信号が「L」レベルのときにはセレクタ26の出力を出力する。
 PC用レジスタ28は、セレクタ27の出力をラッチして、フラッシュ制御コード用ROM13のアドレスとして内部アドレスバス23へ出力する。
 図10は、挿入コードレジスタセットブロック17の構成を表わす図である。
 図10に示すように、挿入コードレジスタセットブロック17は、挿入するコードおよびこのコードを挿入する場所(アドレス)を保持するコード挿入用レジスタセット29-i(i=0~n)と、論理回路OR1,OR2,OR3とを備える。
 コード挿入用レジスタセット29-iは、プログラムカウンタ12から出力されるアドレスと、データバス内を伝送するデータとを受け、さらに、レジスタ選択信号生成回路18からコードレジスタ選択信号iおよびアドレスレジスタ選択信号iとを受けて、コード選択回路14へアドレス一致信号i、アドレス完全一致信号i、およびコードレジスタ出力信号iを出力する。付言すれば、コードレジスタ選択信号iおよびアドレスレジスタ選択信号iにより挿入コードレジスタセットブロック17内のコード挿入用レジスタセット29-iが選択され、内部データバス21から伝送される挿入コードおよびアドレスが、選択されたコード挿入用レジスタセット29-iのコード用レジスタおよびアドレス用レジスタに書き込まれる。
 論理回路OR1は、(n+1)個のアドレス一致信号0~nの論理和をアドレス一致信号として出力する。すなわち、アドレス一致信号0~nの少なくとも1つが「H」レベルのときに、アドレス一致信号が「H」レベルとなる。
 論理回路OR2は、(n+1)個のコードレジスタ出力信号0~nの論理和をコードレジスタ出力信号として出力する。すなわち、(n+1)個のコードレジスタ出力信号0~nの少なくとも1つが「H」レベルのビットを有するとき(すなわち、挿入コードが出力されたとき)に、コードレジスタ出力信号が挿入コードとなる。すなわち、(n+1)個のコードレジスタ出力信号0~nの全ビットのすべてが「L」レベルのとき(すなわち、挿入コードが出力されないとき)に、コードレジスタ出力信号の全ビットが「L」となる。
 論理回路OR3は、(n+1)個のアドレス完全一致信号0~nの論理和をアドレス完全一致信号として出力する。すなわち、(n+1)個のアドレス完全一致信号0~nの少なくとも1つが「H」レベルのときに、アドレス完全一致信号が「H」レベルとなる。
 図11は、コード挿入用レジスタセット29-0の構成を表わす図である。コード挿入用レジスタセット29-1~29-nの構成も、図11のコード挿入用レジスタセット29-0の構成と同様である。
 図11に示すように、コード挿入用レジスタセット29-0は、論理回路AND1と、アドレスレジスタ31と、アドレス比較器30と、論理回路AND4と、コードレジスタ32と、論理回路AND2と、論理回路AND3とを備える。
 論理回路AND1は、クロックclkと、アドレスレジスタ選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号をアドレスレジスタ31の制御端子に出力する。
 アドレスレジスタ31は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた15ビットのアドレス(つまり、挿入コードを挿入するアドレス)をラッチして保持する。すなわち、クロックclkに同期してアドレスレジスタ選択信号0を受けつけ、データバスからの信号を挿入コードの挿入先アドレスとして選択されたアドレスレジスタ31に記憶させる。
 アドレス比較器30は、プログラムカウンタ12から出力される16ビットのアドレスのうちの上位15ビット(アドレス[15:1])と、アドレスレジスタ31に保持されている15ビットのアドレスとが一致するときに、アドレス一致信号0を「H」レベルに設定する。
 論理回路AND2は、アドレス一致信号0が「H」レベルであり、プログラムカウンタ12から出力される16ビットのアドレスのうちの最下位ビット(アドレス[0])が「1」のときに、アドレス完全一致信号0を「H」レベルに設定する。ここで、フラッシュ制御コード用ROM13内の複数のオリジナルコードのアドレスとして有効でない最下位ビットが「1」である時とは、フラッシュ制御コード用ROM13内にないアドレスが指定されていた時ということになる。
 論理回路AND4は、クロックclkと、コードレジスタ選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号をコードレジスタ32の制御端子に出力する。
 コードレジスタ32は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた16ビットのデータ(つまり、挿入コード)をラッチして保持する。すなわち、クロックclkに同期してコードレジスタ選択信号0を受けつけ、データバスからの信号を挿入コードとして選択されたコードレジスタに記憶させる。
 論理回路AND3は、アドレス完全一致信号0と、コードレジスタ32の出力とを受ける。論理回路AND3は、アドレス完全一致信号0が「H」レベルのときに、コードレジスタ32に保持された16ビットのデータ(挿入コード)をコードレジスタ出力信号0として出力する。論理回路AND3は、アドレス完全一致信号0が「L」レベルのときに、16ビットの「0x0000」をコードレジスタ出力信号0として出力する。
 図12は、コード選択回路14の構成を表わす図である。
 図12に示すように、コード選択回路14は、セレクタ33を含む。
 セレクタ33は、フラッシュ制御コード用ROM13から出力されるオリジナルコードと、挿入コードレジスタセットブロック17から出力されるコードレジスタ出力信号(挿入コード)とを受ける。セレクタ33は、アドレス完全一致信号に基づいて、入力される2つの信号のいずれかを出力する。セレクタ33は、アドレス完全一致信号が「H」レベルのときには、コードレジスタ出力信号(挿入コード)を出力し、アドレス完全一致信号が「L」レベルのときには、オリジナルコードを実行コードとして出力する。
 (第1の実施形態の動作例1)
 次に、オリジナルコードおよび挿入コードが単一サイクル命令の場合の動作例を説明する。
 図13(a)は、コード挿入用レジスタセット29-i(以下、コード挿入用レジスタセット#i)のアドレスレジスタ31に保持されている値の例を示す図である。この例では、コード挿入用レジスタセット#0のアドレスレジスタ31に「0x0106」の上位15ビット(第2ビット目~第16ビット目)が保持されている。ただし、ここで、第1ビット目をLSB(Least Significant bit)とし、第Xビット目をLSBよりも(X-1)ビットだけ上位のビットとする。
 また、コード挿入用レジスタセット#0のコードレジスタ32に挿入コード「Code Reg.0」が保持されている。さらに、フラッシュ制御コード用ROM13のアドレス「0x・・・・」には、オリジナルコード「R・・・・」が保持されているものとする。
 図13(b)は、図13(a)の条件下でのタイミング図である。
 第0サイクルでは、プログラムカウンタ12から出力される16ビットのアドレス(PC(Program Counter)値[15:0])は、「0x0102」である。また、アドレス「0x0102」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x0102」のアドレスのオリジナルコードである「R0102」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0102」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0100」を実行する。
 第1サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるため、プログラムカウンタ12のセレクタ24が「0x02」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x02」だけ加算された「0x0104」となる。また、アドレス「0x0104」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x0104」のアドレスのオリジナルコードである「R0104」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0104」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0102」を実行する。
 第2サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるため、プログラムカウンタ12のセレクタ24が「0x02」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x02」だけ加算された「0x0106」となる。アドレス「0x0106」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。一方、プログラムカウンタ12の出力アドレスの最下位ビットが「0」である。その結果、アドレス完全一致信号が「L」レベルのままで、コードレジスタ出力信号が「0x0000」のままである。フラッシュ制御コード用ROM13から「0x0106」のアドレスのオリジナルコードである「R0106」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0106」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0104」を実行する。
 第3サイクルでは、前サイクルのアドレス一致信号が「H」レベルであるため、プログラムカウンタ12のセレクタ24が「0x01」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x01」だけ加算された「0x0107」となる。アドレス「0x0107」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。また、プログラムカウンタ12の出力アドレスの最下位ビットが「1」である、その結果、アドレス完全一致信号は「H」レベルとなる(アドレス完全一致信号0が「H」レベルとなるため)。さらに、コードレジスタ出力信号は、コードレジスタ32に保持された挿入コード「Code Reg.0」となる(コードレジスタ出力信号0が「Code Reg.0」となるため)。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0106」を実行する。
 第4サイクルでは、前サイクルのアドレス一致信号が「H」レベルであるため、プログラムカウンタ12のセレクタ24が「0x01」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x01」だけ加算された「0x0108」となる。アドレス「0x0108」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0108」の上位15ビットと相違する。その結果、アドレス一致信号およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x0108」のアドレスのオリジナルコードである「R0108」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0108」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.0」を実行する。
 第5サイクル以降は、第4サイクルと同様に動作する。
 (第1の実施形態の動作例2)
 次に、オリジナルコードの一部がマルチサイクル命令であり、挿入コードが単一サイクル命令の場合の動作を説明する。
 図14(a)は、コード挿入用レジスタセット29-i(以下、コード挿入用レジスタセット#i)のアドレスレジスタ31に保持されている値の例を示す図である。この例では、コード挿入用レジスタセット#0のアドレスレジスタ31に「0x0106」の上位15ビット(第2ビット目~第16ビット目)が保持され、コード挿入用レジスタセット#1のアドレスレジスタ31に「0x8000」の上位15ビットが保持され、コード挿入用レジスタセット#2のアドレスレジスタ31に「0x8002」の上位15ビットが保持されている。また、コード挿入用レジスタセット#0のコードレジスタ32に挿入コード「Code Reg.0」が保持されている。また、フラッシュ制御コード用ROM13のアドレス「0x・・・・」には、オリジナルコード「R・・・・」が保持されているものとする。
 図14(b)に示すように、オリジナルコード「R0106」は3サイクル命令、他のオリジナルコードは1サイクル命令、挿入コード「Code Reg.0」は1サイクル命令とする。
 図14(c)は、図14(a)および(b)に示す条件下でのタイミング図である。
 第0サイクルでは、プログラムカウンタ12から出力される16ビットのアドレス(PC値[15:0])は、「0x0102」である。また、アドレス「0x0102」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x0102」のアドレスのオリジナルコードである「R0102」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0102」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0100」を実行する。
 第1サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるため、プログラムカウンタ12のセレクタ24が「0x02」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x02」だけ加算された「0x0104」となる。アドレス「0x0104」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x0104」のアドレスのオリジナルコードである「R0104」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0104」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0102」を実行する。
 第2サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるため、プログラムカウンタ12のセレクタ24が「0x02」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x02」だけ加算された「0x0106」となる。アドレス「0x0106」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。一方、プログラムカウンタ12の出力アドレスの最下位ビットが「0」である。その結果、アドレス完全一致信号が「L」レベルのままで、コードレジスタ出力信号が「0x0000」のままである。フラッシュ制御コード用ROM13から「0x0106」のアドレスのオリジナルコードである「R0106」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0106」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0104」を実行する。
 第3サイクルでは、前サイクルのアドレス一致信号が「H」レベルであるため、プログラムカウンタ12のセレクタ24が「0x01」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x01」だけ加算された「0x0107」となる。また、アドレス「0x0107」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。プログラムカウンタ12の出力アドレスは、「0x01」の加算が行われたため最下位ビットが「1」である。その結果、アドレス完全一致信号は「H」レベルとなる(アドレス完全一致信号0が「H」レベルとなるため)。さらに、コードレジスタ出力信号は、コードレジスタ32に保持された挿入コード「Code Reg.0」となる(コードレジスタ出力信号0が「Code Reg.0」となるため)。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0106」を実行する。ここで、オリジナルコード「R0106」は3サイクル命令のため、実行部36は、PCストール信号を「H」レベルに設定する。
 第4サイクルでは、前サイクルでPCストール信号が「H」レベルに設定されたため、プログラムカウンタ12は、前サイクルと同じアドレス「0x0107」を出力する。アドレス「0x0107」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。また、プログラムカウンタ12の出力アドレスの最下位ビットが「1」である。その結果、アドレス完全一致信号は「H」レベルとなる(アドレス完全一致信号0が「H」レベルとなるため)。さらに、コードレジスタ出力信号は、コードレジスタ32に保持された挿入コード「Code Reg.0」となる(コードレジスタ出力信号0が「Code Reg.0」となるため)。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、3サイクル命令のオリジナルコード「R0106」を引き続き実行する(2サイクル分の実行終了)。
 第5サイクルでは、前サイクルでPCストール信号が「H」レベルに設定されたため、プログラムカウンタ12は、前サイクルと同じアドレス「0x0107」を出力する。また、アドレス「0x0107」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。プログラムカウンタ12の出力アドレスの最下位ビットが「1」のため、アドレス完全一致信号は「H」レベルとなる(アドレス完全一致信号0が「H」レベルとなるため)。さらに、コードレジスタ出力信号は、コードレジスタ32に保持された挿入コード「Code Reg.0」となる(コードレジスタ出力信号0が「Code Reg.0」となるため)。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、3サイクル命令のオリジナルコード「R0106」を引き続き実行する(3サイクル分の実行終了)。実行部36は、3サイクル命令であるオリジナルコード「R0106」の実行を終了したので、PCストール信号を「L」レベルに設定する。
 第6サイクルでは、前サイクルのアドレス一致信号が「H」レベルであるため、プログラムカウンタ12のセレクタ24が「0x01」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x01」だけ加算された「0x0108」となる。また、アドレス「0x0108」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x0108」のアドレスのオリジナルコードである「R0108」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0108」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.0」を実行する。
 第7サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるため、プログラムカウンタ12のセレクタ24が「0x02」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x02」だけ加算された「0x010A」となる。アドレス「0x010A」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x010A」のアドレスのオリジナルコードである「R010A」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R010A」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0108」を実行する。
 第8サイクル以降は、第7サイクルと同様に動作する。
 (第1の実施形態の動作例3)
 次に、オリジナルコードが単一サイクル命令であり、挿入コードがマルチサイクル命令の場合の動作を説明する。
 図15(a)は、コード挿入用レジスタセット29-i(以下、コード挿入用レジスタセット#i)のアドレスレジスタ31に保持されている値の例を示す図である。この例では、コード挿入用レジスタセット#0のアドレスレジスタ31に「0x0106」の上位15ビットが保持され、コード挿入用レジスタセット#1のアドレスレジスタ31に「0x8000」の上位15ビットが保持され、コード挿入用レジスタセット#2のアドレスレジスタ31に「0x8002」の上位15ビットが保持されている。また、コード挿入用レジスタセット#0のコードレジスタ32に挿入コード「Code Reg.0」が保持されている。また、フラッシュ制御コード用ROM13のアドレス「0x・・・・」には、オリジナルコード「R・・・・」が保持されているものとする。
 図15(b)に示すように、オリジナルコード「R0106」は1サイクル命令、他のオリジナルコードも同様に1サイクル命令、挿入コード「Code Reg.0」は3サイクル命令とする。
 図15(c)は、図15(a)および(b)に示す条件下でのタイミング図である。
 第0サイクルでは、プログラムカウンタ12から出力される16ビットのアドレス(PC値[15:0])は、「0x0102」である。また、アドレス「0x0102」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x0102」のアドレスのオリジナルコードである「R0102」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0102」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0100」を実行する。
 第1サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるため、プログラムカウンタ12のセレクタ24が「0x02」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x02」だけ加算された「0x0104」となる。また、アドレス「0x0104」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x0104」のアドレスのオリジナルコードである「R0104」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0104」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0102」を実行する。
 第2サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるため、プログラムカウンタ12のセレクタ24が「0x02」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x02」だけ加算された「0x0106」となる。アドレス「0x0106」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。一方、プログラムカウンタ12の出力アドレスの最下位ビットが「0」のため、アドレス完全一致信号が「L」レベルのままで、コードレジスタ出力信号が「0x0000」のままである。フラッシュ制御コード用ROM13から「0x0106」のアドレスのオリジナルコードである「R0106」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0106」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0104」を実行する。
 第3サイクルでは、前サイクルのアドレス一致信号が「H」レベルであるため、プログラムカウンタ12のセレクタ24が「0x01」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x01」だけ加算された「0x0107」となる。アドレス「0x0107」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。プログラムカウンタ12の出力アドレスは、「0x01」の加算が行われたため最下位ビットが「1」である。その結果、アドレス完全一致信号は「H」レベルとなる(アドレス完全一致信号0が「H」レベルとなるため)。さらに、コードレジスタ出力信号は、コードレジスタ32に保持された挿入コード「Code Reg.0」となる(コードレジスタ出力信号0が「Code Reg.0」となるため)。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0106」を実行する。
 第4サイクルでは、前サイクルのアドレス一致信号が「H」レベルであるため、プログラムカウンタ12のセレクタ24が「0x01」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x01」だけ加算された「0x0108」となる。アドレス「0x0108」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x0108」のアドレスのオリジナルコードである「R0108」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0108」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.0」を実行する。ここで、挿入コード「Code Reg.0」は3サイクル命令のため、実行部36は、PCストール信号を「H」レベルに設定する。
 第5サイクルでは、前サイクルでPCストール信号が「H」レベルに設定されたため、プログラムカウンタ12は、前サイクルと同じアドレス「0x0108」を出力する。アドレス「0x0108」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。命令実行部15の実行部36は、3サイクル命令の挿入コード「Code Reg.0」を引き続き実行する(2サイクル分の実行終了)。
 第6サイクルでは、前サイクルでPCストール信号が「H」レベルに設定されたため、プログラムカウンタ12は、前サイクルと同じアドレス「0x0108」を出力する。また、アドレス「0x0108」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。命令実行部15の実行部36は、3サイクル命令の挿入コード「Code Reg.0」を引き続き実行する(3サイクル分の実行終了)。実行部36は、3サイクル命令である挿入コード「Code Reg.0」の実行を終了したので、PCストール信号を「L」レベルに設定する。
 第7サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるため、プログラムカウンタ12のセレクタ24が「0x02」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x02」だけ加算された「0x010A」となる。また、アドレス「0x010A」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号、アドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x010A」のアドレスのオリジナルコードである「R010A」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R010A」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0108」を実行する。
 第8サイクル以降は、第7サイクルと同様に動作する。
 [第2の実施形態]
 本実施の形態では、複数のオリジナルコードのアドレスは、最下位から(k+1)ビット目以上のビットが有効である。ただし、kは1以上の自然数である。
 (構成)
 図16は、第2の実施形態のフラッシュメモリ制御部102の構成を表わす図である。
 図16のフラッシュメモリ制御部102が、図7のフラッシュメモリ制御部2と相違する点は、プログラムカウンタ51と、挿入コードレジスタセットブロック52である。
 挿入コードレジスタセットブロック52は、最大で2k-1個の挿入コードと、挿入コードのアドレスを保持する。挿入コードレジスタセットブロック52は、保持している挿入コードのアドレスの最下位からk個のビットを除くビットとプログラムカウンタ51のアドレスの最下位からk個のビットを除くビットとが一致したときに、第1の信号を出力する(すなわち、アドレス一致信号を「H」レベルに設定する)。
 挿入コードレジスタセットブロック52は、第1の信号を出力し、かつ保持している挿入コードのアドレスの最下位からk個のビットとプログラムカウンタ51のアドレスの最下位からk個のビットとが一致したときに、第2の信号を出力する(すなわち、アドレス完全一致信号を「H」レベルに設定する)とともに、プログラムカウンタ51のアドレスに対応する保持している挿入コードを出力する。
 挿入コードレジスタセットブロック52は、複数の挿入コードを連続して挿入するときに最後の挿入コードを出力する場合には、第2の信号を出力するとともに、同時に挿入エンドを示す挿入エンド信号を出力する。挿入エンド信号の発生については、後述する。
 プログラムカウンタ51は、第1の信号を受けたときに、最下位ビットに「1」を加算し、第1の信号を受けなかったときに、最下位から(k+1)番目のビットに「1」を加算する。プログラムカウンタ51は、挿入エンド信号を受けたときには、第1の信号を受けたときでも、最下位から(k+1)番目のビットに「1」を加算し、最下位からk個のビットを「0」にする。
 以下の説明では、kを5として説明する。
 図17は、プログラムカウンタ51の構成を表わす図である。
 図17に示すように、プログラムカウンタ51は、セレクタ53と、加算器25と、論理回路AND74と、セレクタ26と、セレクタ27と、PC用レジスタ28とを備える。
 セレクタ53は、挿入コードレジスタセットブロック52からアドレス一致信号と挿入エンド信号とを受ける。セレクタ53は、アドレス一致信号が「H」レベル、かつ挿入エンド信号が「L」レベルのときには、「0x01」を出力する。セレクタ53は、アドレス一致信号が「H」レベル、かつ挿入エンド信号が「H」レベルのとき、アドレス一致信号が「L」レベル、かつ挿入エンド信号が「H」レベルのとき、アドレス一致信号が「L」レベル、かつ挿入エンド信号が「L」レベルのときには、「0x20」を出力する。
 加算器25は、PC用レジスタ28から出力される20ビットのアドレスとセレクタ53から出力される値を加算する。
 論理回路AND74は、加算器25から出力される20ビットのうちの下位5ビットと、挿入エンド信号の否定の論理積を出力する。すなわち、論理回路AND74は、挿入エンド信号が「L」レベルのときには、加算器25から出力される20ビットのうちの下位5ビットを出力する。論理回路AND74は、挿入エンド信号が「H」レベルのときには、5ビットの「0b00000」を出力する。ここで、「0b・・・・」は、2進数表示であることを表わす。
 セレクタ26は、加算器25から出力される20ビットのうちの上位15ビットを上位15ビットとし、論理回路AND74から出力される5ビットの信号を下位5ビットとした信号と、命令実行部15から出力される演算結果PCとを受ける。セレクタ26は、命令実行部15から出力される演算結果PC選択信号が「H」レベルのときには演算結果PCを出力し、演算結果PC選択信号が「L」レベルのときには、加算器25および論理回路AND74からの信号を出力する。
 セレクタ27は、セレクタ26の出力と、PC用レジスタ28から出力されるアドレスとを受ける。セレクタ27は、命令実行部15から出力されるPCストール信号が「H」レベルのときにはPC用レジスタ28から出力されるアドレスを出力し、PCストール信号が「L」レベルのときにはセレクタ26から受けた信号を出力する。
 PC用レジスタ28は、セレクタ27の出力をラッチして、フラッシュ制御用コード用ROMのアドレスとして内部アドレスバス23へ出力する。
 図18は、挿入コードレジスタセットブロック52の構成を表わす図である。
 図18に示すように、挿入コードレジスタセットブロック52は、コード挿入用レジスタセット54-i(i=0~n)と、論理回路OR1,OR2,OR3,OR54とを備える。
 コード挿入用レジスタセット54-iは、プログラムカウンタ51から出力されるアドレスと、データバス内を伝送するデータとを受け、さらにコード選択回路14からコードレジスタ選択信号i、アドレスレジスタ選択信号i、アトレスレジスタ2選択信号i、挿入エンドレジスタ選択信号iとを受けて、アドレス一致信号i、アドレス完全一致信号i、挿入エンド信号iおよびコードレジスタ出力信号iを出力する。
 論理回路OR1は、(n+1)個のアドレス一致信号0~nの論理和をアドレス一致信号として出力する。すなわち、(n+1)個のアドレス一致信号0~nの少なくとも1つが「H」レベルのときに、アドレス一致信号が「H」レベルとなる。
 論理回路OR2は、(n+1)個のコードレジスタ出力信号0~nの論理和をコードレジスタ出力信号として出力する。すなわち、(n+1)個のコードレジスタ出力信号0~nの少なくとも1つが「H」レベルのビットを有するとき(すなわち、挿入コードが出力されたとき)に、コードレジスタ出力信号が挿入コードとなる。すなわち、(n+1)個のコードレジスタ出力信号0~nの全ビットのすべてが「L」レベルのとき(すなわち、挿入コードが出力されないとき)に、コードレジスタ出力信号の全ビットが「L」となる。
 論理回路OR3は、(n+1)個のアドレス完全一致信号0~nの論理和をアドレス完全一致信号として出力する。すなわち、(n+1)個のアドレス完全一致信号0~nの少なくとも1つが「H」レベルのときに、アドレス完全一致信号が「H」レベルとなる。
 論理回路OR54は、(n+1)個の挿入エンド信号0~nの論理和を挿入エンド信号として出力する。すなわち、(n+1)個の挿入エンド信号0~nの少なくとも1つが「H」レベルのときに、挿入エンド信号が「H」レベルとなる。
 図18において、アドレス一致信号0~n、アドレス一致信号は、1ビットの信号である。アドレス完全一致信号0~n、アドレス完全一致信号は、1ビットの信号である。挿入エンド信号0~n、挿入エンド信号は、1ビットの信号である。コードレジスタ出力信号0~n、コードレジスタ出力信号は、16ビットの信号である。
 図19は、コード挿入用レジスタセット54-0の構成を表わす図である。コード挿入用レジスタセット54-1~54-nの構成も、図19のコード挿入用レジスタセット54-0の構成と同様である。
 図19に示すように、コード挿入用レジスタセット54-0は、論理回路AND1と、アドレスレジスタ31と、アドレス比較器30と、論理回路AND4と、コードレジスタ32と、論理回路54と、アドレスレジスタ56と、アドレス比較器57と、論理回路56と、挿入エンドレジスタ59と、論理回路AND2と、論理回路55と、論理回路AND3とを備える。
 論理回路AND1は、クロックclkと、アドレスレジスタ選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号をアドレスレジスタ31の制御端子に出力する。
 アドレスレジスタ31は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた15ビットのアドレス(つまり、挿入コードを挿入するアドレス)をラッチして保持する。
 アドレス比較器30は、プログラムカウンタ12から出力される20ビットのアドレスのうちの上位15ビット(アドレス[19:5])と、アドレスレジスタ31に保持されている15ビットのアドレスとが一致するときに、アドレス一致信号0を「H」レベルに設定する。
 論理回路AND54は、クロックclkと、アドレスレジスタ2選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号をコードレジスタ32の制御端子に出力する。
 アドレスレジスタ56は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた5ビットのアドレスをラッチして保持する。このアドレスレジスタ56には、複数個の挿入コードを連続して挿入する際の挿入順番を示すアドレスが保持される。
 アドレス比較器57は、プログラムカウンタ12から出力される20ビットのアドレスのうちの下位5ビット(アドレス[4:0])と、アドレスレジスタ56に保持されている5ビットのアドレスとが一致するときに、「H」レベルの一致信号を出力する。
 論理回路AND2は、アドレス一致信号0が「H」レベルで、アドレス比較器57から出力される一致信号が「H」レベルのときに、アドレス完全一致信号0を「H」レベルに設定する。
 論理回路AND56は、クロックclkと、挿入エンドレジスタ選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号を挿入エンドレジスタ59の制御端子に出力する。
 挿入エンドレジスタ59は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた1ビットのデータ(挿入エンド)をラッチして保持する。コード挿入用レジスタセット54-0のうち、対応の挿入エンドレジスタ59に「H」(「1」)のデータが保持されているということは、その対応のコード挿入用レジスタセットの挿入コードの挿入でコード挿入が一端終了することを示している。
 論理回路AND55は、アドレス完全一致信号0と、挿入エンドレジスタ59の出力とを受ける。論理回路AND55は、アドレス完全一致信号0が「H」レベルのときに、挿入エンドレジスタ59に保持された1ビットのデータ(挿入エンド)を挿入エンド信号0として出力する。
 論理回路AND4は、クロックclkと、コードレジスタ選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号をコードレジスタ32の制御端子に出力する。
 コードレジスタ32は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた16ビットのデータ(つまり、挿入コード)をラッチして保持する。
 論理回路AND3は、アドレス完全一致信号0と、コードレジスタ32の出力とを受ける。論理回路AND3は、アドレス完全一致信号0が「H」レベルのときに、コードレジスタ32に保持された16ビットのデータ(つまり、挿入コード)をコードレジスタ出力信号0として出力する。論理回路AND3は、アドレス完全一致信号0が「L」レベルのときに、16ビットの「0x0000」をコードレジスタ出力信号0として出力する。
 図19において、アドレス一致信号0は、1ビットの信号である。アドレス完全一致信号0は、1ビットの信号である。挿入エンド信号0は、1ビットの信号である。コードレジスタ出力信号0は、16ビットの信号である。これらの事項は、他の図面でも同様である。
 (第2の実施形態の動作例)
 図20(a)は、コード挿入用レジスタセット29-i(以下、コード挿入用レジスタセット#i)のアドレスレジスタ31に保持されている値の例を示す図である。この例では、コード挿入用レジスタセット#0のアドレスレジスタ31に「0x01061」の上位15ビット(第6ビット目~第20ビット目)が保持され、アドレスレジスタ56に「0x01061」の下位5ビット(第1ビット目~第5ビット目)が保持されている。また、コード挿入用レジスタセット#0のコードレジスタ32に挿入コード「Code Reg.0」が保持され、コード挿入用レジスタセット#0の挿入エンドレジスタ59に挿入エンド「0b0」が保持されている。
 コード挿入用レジスタセット#1のアドレスレジスタ31に「0x01062」の上位15ビットが保持され、アドレスレジスタ56に「0x01062」の下位5ビットが保持されている。また、コード挿入用レジスタセット#1のコードレジスタ32に挿入コード「Code Reg.1」が保持され、コード挿入用レジスタセット#1の挿入エンドレジスタ59に挿入エンド「0b1」が保持されている。また、フラッシュ制御コード用ROM13のアドレス「0x・・・・」には、オリジナルコード「R・・・・」が保持されているものとする。
 図20(b)は、図20(a)の条件下でのタイミング図である。
 第0サイクルでは、プログラムカウンタ51から出力される20ビットのアドレス(PC値[19:0])は、「0x01020」である。また、アドレス「0x01020」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01062」の上位15ビットとも相違するため、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x01020」のアドレスのオリジナルコードである「R01020」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R01020」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R01000」を実行する。
 第1サイクルでは、前サイクルのアドレス一致信号が「L」レベルであり、挿入エンド信号が「0b0」であるため、プログラムカウンタ51のセレクタ53が「0x20」を出力する。これにより、プログラムカウンタ51の出力アドレスは、「0x20」だけ加算された「0x01040」となる。また、アドレス「0x01040」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01062」の上位15ビットとも相違する。したがって、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x01020」のアドレスのオリジナルコードである「R01040」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R01040」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R01020」を実行する。
 第2サイクルでは、前サイクルのアドレス一致信号が「L」レベルであり、挿入エンド信号が「0b0」であるため、プログラムカウンタ51のセレクタ53が「0x20」を出力する。これにより、プログラムカウンタ51の出力アドレスは、「0x20」だけ加算された「0x01060」となる。また、アドレス「0x01060」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと一致し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01062」の上位15ビットとも一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0およびアドレス一致信号1が「H」レベルとなるため)。また、アドレス「0x01060」の下位5ビットは、コード挿入用レジスタセット#0のアドレスレジスタ56に保持されているアドレス「0x01061」の下位5ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ56に保持されているアドレス「0x01062」の下位5ビットと相違する。その結果、アドレス完全一致信号が「L」レベルのままである(アドレス完全一致信号0およびアドレス完全一致信号1が「L」レベルのままのため)。アドレス完全一致信号が「L」レベルのため、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x01060」のアドレスのオリジナルコードである「R01060」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R01060」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R01040」を実行する。
 第3サイクルでは、前サイクルのアドレス一致信号が「H」レベルであり、挿入エンド信号が「0b0」であるため、プログラムカウンタ51のセレクタ24が「0x01」を出力する。そのため、プログラムカウンタ51の出力アドレスは、「0x01」だけ加算された「0x01061」となる。また、アドレス「0x01061」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと一致し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01062」の上位15ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0およびアドレス一致信号1が「H」レベルとなるため)。また、アドレス「0x01061」の下位5ビットは、コード挿入用レジスタセット#0のアドレスレジスタ56に保持されているアドレス「0x01061」の下位5ビットと一致するため、アドレス完全一致信号は「H」レベルとなる(アドレス完全一致信号0が「H」レベルとなるため)。アドレス完全一致信号0が「H」レベルとなるので、コードレジスタ出力信号0は、コード挿入用レジスタセット#0のコードレジスタ32に保持された挿入コード「Code Reg.0」となる。これにより、コードレジスタ出力信号は、挿入コード「Code Reg.0」となる。アドレス完全一致信号0が「H」レベルとなるので、挿入エンド信号0は、コード挿入用レジスタセット#0の挿入エンドレジスタ59に保持された挿入エンド「0b0」となる。これにより、挿入エンド信号は、「0b0」となる。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R01060」を実行する。
 第4サイクルでは、前サイクルのアドレス一致信号が「H」レベルであり、挿入エンド信号が「0b0」であるため、プログラムカウンタ51のセレクタ24が「0x01」を出力する。そのため、プログラムカウンタ51の出力アドレスは、「0x01」だけ加算された「0x01062」となる。アドレス「0x01062」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと一致し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01062」の上位15ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0およびアドレス一致信号1が「H」レベルとなるため)。また、アドレス「0x01062」の下位5ビットは、コード挿入用レジスタセット#1のアドレスレジスタ56に保持されているアドレス「0x01062」の下位5ビットと一致するため、アドレス完全一致信号は「H」レベルとなる(アドレス完全一致信号1が「H」レベルとなるため)。アドレス完全一致信号1が「H」レベルとなるので、コードレジスタ出力信号1は、コード挿入用レジスタセット#1のコードレジスタ32に保持された挿入コード「Code Reg.1」となる。これにより、コードレジスタ出力信号は、挿入コード「Code Reg.1」となる。アドレス完全一致信号1が「H」レベルとなるので、挿入エンド信号1は、コード挿入用レジスタセット#1の挿入エンドレジスタ59に保持された挿入エンド「0b1」となる。これにより、挿入エンド信号は、「0b1」となる。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.1」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.0」を実行する。
 第5サイクルでは、前サイクルのアドレス一致信号が「H」レベルであり、挿入エンド信号が「0b1」であるため、プログラムカウンタ51のセレクタ24が「0x20」を出力する。また、挿入エンド信号が「0b1」であるので、論理回路74によって、加算器25の出力の下位5ビットが「0」となる。その結果、プログラムカウンタ51の出力アドレスは、「0x01080」となる。アドレス「0x01080」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01062」の上位15ビットと相違する。その結果、アドレス一致信号が「L」レベルとなる(アドレス一致信号0およびアドレス一致信号1が「L」レベルとなるため)。また、アドレス「0x01080」の下位5ビットは、コード挿入用レジスタセット#0のアドレスレジスタ56に保持されているアドレス「0x01061」の下位5ビットと相違し、コード挿入用レジスタセット#1のアドレスレジスタ56に保持されているアドレス「0x01062」の下位5ビットと相違する。その結果、アドレス完全一致信号は「L」レベルとなる(アドレス完全一致信号0およびアドレス完全一致信号1が「L」レベルとなるため)。アドレス完全一致信号が「L」レベルのため、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x01080」のアドレスのオリジナルコードである「R01080」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R01080」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.1」を実行する。
 第6サイクルでは、前サイクルのアドレス一致信号が「L」レベルであり、挿入エンド信号が「0b0」であるため、プログラムカウンタ51のセレクタ53が「0x20」を出力する。これによって、プログラムカウンタ51の出力アドレスは、「0x20」だけ加算された「0x010A0」となる。アドレス「0x010A0」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01062」の上位15ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x010A0」のアドレスのオリジナルコードである「R010A0」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R010A0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R01080」を実行する。
 第7サイクル以降は、第6サイクルと同様に動作する。
 以上のように、本実施の形態によれば、プログラムカウンタのアドレスの最下位から所定個数のビット以外のビットでオリジナルコードのアドレスを指定し、最下位から所定個数のビットを用いてコードの挿入を制御するので、2つのオリジナルコードの間に1個以上のコードの挿入が可能で、かつマルチサイクル命令の実行が可能となる。また、第1の実施の形態によれば、プログラムカウンタ12の出力は16ビットとして説明したが、本実施の形態では、複数個の命令コードを挿入する為、プログラムカウンタ51の出力は20ビットと仮定した。
 [第3の実施形態]
 (構成)
 図21は、第3の実施形態のフラッシュメモリ制御部312の構成を表わす図である。
 図21のフラッシュメモリ制御部312が、図7の第1の実施形態のフラッシュメモリ制御部2と相違する点は、挿入コードレジスタセットブロック164である。
 挿入コードレジスタセットブロック164は、保持している挿入コードのアドレスの最下位ビットを除くビットとプログラムカウンタ12のアドレスの最下位ビットを除くビットとが一致したときに、第1の信号を出力する(すなわち、アドレス一致信号を「H」レベルに設定する)。挿入コードレジスタセットブロック164は、第1の信号を出力し、かつ保持している挿入コードのアドレスの最下位ビットとプログラムカウンタ12のアドレスの最下位ビットが一致するときに、第2の信号を出力する(すなわち、アドレス一致信号を「H」レベルに設定する)とともに、保持している挿入コードを出力する。
 図22は、挿入コードレジスタセットブロック164に含まれるコード挿入用レジスタセット64-0の構成を表わす図である。コード挿入用レジスタセット64-1~64-nの構成も、図22のコード挿入用レジスタセット64-0の構成と同様である。
 図22のコード挿入用レジスタセット64-0が、図11の第1の実施形態のコード挿入用レジスタセット29-0と相違する点は、アドレスレジスタ131と、一致回路NEOR1を備える点である。
 アドレスレジスタ131は、論理回路AND1の出力が「H」レベルのときに、データバスを通じて送られてきた16ビットのアドレスをラッチして保持する。
 一致回路XNOR1は、プログラムカウンタ12から出力される16ビットのアドレスのうちの最下位ビット(アドレス[0])と、アドレスレジスタ131に保持されている16ビットのアドレスのうちの最下位ビットとが一致するときに、一致信号を「H」レベルに設定する。
 論理回路AND2は、アドレス一致信号0が「H」レベルで、一致回路NROR1から出力される一致信号が「H」レベルのときに、アドレス完全一致信号0を「H」レベルに設定する。
 (第3の実施形態の動作例)
 挿入前のオリジナルコードおよび挿入コードが単一サイクル命令の場合の動作例を説明する。
 図23(a)は、コード挿入用レジスタセット64-i(以下、コード挿入用レジスタセット#i)のアドレスレジスタ31に保持されている値の例を示す図である。この例では、コード挿入用レジスタセット#0のアドレスレジスタ131に16ビットの「0x0106」が保持されているとする。また、コード挿入用レジスタセット#0のコードレジスタ32に挿入コード「Code Reg.0」が保持されている。また、フラッシュ制御コード用ROM13のアドレス「0x・・・・」には、オリジナルコード「R・・・・」が保持されているものとする。
 図23(b)は、図23(a)の条件下でのタイミング図である。
 第0サイクルでは、プログラムカウンタ12から出力される16ビットのアドレス(PC値[15:0])は、「0x0102」である。アドレス「0x0102」の上位15ビットは、アドレスレジスタ131に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x0102」のアドレスのオリジナルコードである「R0102」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0102」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0100」を実行する。
 第1サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるため、プログラムカウンタ12のセレクタ24が「0x02」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x02」だけ加算された「0x0104」となる。アドレス「0x0104」の上位15ビットは、アドレスレジスタ131に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号、アドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x0104」のアドレスのオリジナルコードである「R0104」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0104」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0102」を実行する。
 第2サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるため、プログラムカウンタ12のセレクタ24が「0x02」を出力するため、プログラムカウンタ12の出力アドレスは、「0x02」だけ加算された「0x0106」となる。アドレス「0x0106」の上位15ビットは、アドレスレジスタ131に保持されているアドレス「0x0106」の上位15ビットと一致するため、アドレス一致信号が「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。また、アドレス「0x0106」の下位1ビットは、アドレスレジスタ131に保持されているアドレス「0x0106」の下位1ビットと一致するため、アドレス完全一致信号が「H」レベルとなる(アドレス完全一致信号0が「H」レベルとなるため)。さらに、コードレジスタ出力信号は、コードレジスタ32に保持された挿入コード「Code Reg.0」となる(コードレジスタ出力信号0が「Code Reg.0」となるため)。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0104」を実行する。
 第3サイクルでは、前サイクルのアドレス一致信号が「H」レベルであるため、プログラムカウンタ12のセレクタ24が「0x01」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x01」だけ加算された「0x0107」となる。アドレス「0x0107」の上位15ビットは、アドレスレジスタ131に保持されているアドレス「0x0106」の上位15ビットと一致するため、アドレス一致信号が「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。また、アドレス「0x0107」の下位1ビットは、アドレスレジスタ131に保持されているアドレス「0x0106」の下位1ビットと相違する。その結果、アドレス完全一致信号が「L」レベルとなり(アドレス完全一致信号0およびアドレス完全一致信号が「L」レベルとなるため)、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13からプログラムカウンタ12の出力アドレス「0x0107」の下位1ビットだけを無視することによって同一となる「0x0106」のアドレスのオリジナルコードである「R0106」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0106」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.0」を実行する。
 第4サイクルでは、前サイクルのアドレス一致信号が「H」レベルであるため、プログラムカウンタ12のセレクタ24が「0x01」を出力する。これにより、プログラムカウンタ12の出力アドレスは、「0x01」だけ加算された「0x0108」となる。アドレス「0x0108」の上位15ビットは、アドレスレジスタ131に保持されているアドレス「0x0106」の上位15ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となる。フラッシュ制御コード用ROM13から「0x0108」のアドレスのオリジナルコードである「R0108」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0108」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R0106」を実行する。
 第5サイクル以降は、第4サイクルと同様に動作する。
 以上のように、本実施の形態によれば、第1の実施形態と同様に、プログラムカウンタのアドレスの最下位ビット以外のビットでオリジナルコードのアドレスを指定し、最下位ビットを用いてコードの挿入を制御するので、2つのオリジナルコードの間に1個のコードの挿入が可能で、かつマルチサイクル命令の実行が可能となる。また、本実施の形態によれば、挿入コードの実行を オリジナルコードの後に実行するか(後挿入)かオリジナルコードの前に実行するか(前挿入)を選択することができる。
 [第4の実施形態]
 (構成)
 図24は、第4の実施形態のフラッシュメモリ制御部103の構成を表わす図である。
 図24のフラッシュメモリ制御部103が、図16の第2の実施形態のフラッシュメモリ制御部102と相違する点は、プログラムカウンタ65である。
 プログラムカウンタ65は、挿入エンド信号を受けたときには、最下位からk個のビットを「1」にする。
 以下では、k=5として説明する。
 図25は、第4の実施形態のプログラムカウンタ65の構成を表わす図である。
 図25に示すように、プログラムカウンタ65は、セレクタ68と、加算器25と、論理回路OR68と、セレクタ26と、セレクタ27と、PC用レジスタ28とを備える。
 セレクタ68は、挿入コードレジスタセットブロック52からアドレス一致信号を受ける。セレクタ68は、アドレス一致信号が「H」レベルのときには、「0x01」を出力する。セレクタ68は、アドレス一致信号が「L」レベルのときには、「0x20」を出力する。
 加算器25は、PC用レジスタ28から出力される20ビットのアドレス「19:0]とセレクタ68から出力される値を加算する。
 論理回路OR68は、加算器25から出力される20ビットのうちの下位5ビットと、挿入エンド信号の論理和を出力する。すなわち、論理回路OR68は、挿入エンド信号が「L」レベルのときには、加算器25から出力される20ビットのうちの下位5ビットを出力する。論理回路OR68は、挿入エンド信号が「H」レベルのときには、5ビットの「0b11111」を出力する。
 セレクタ26は、加算器25から出力される20ビットのうちの上位15ビット(6ビット目~20ビット目)を上位15ビットとし、論理回路OR68から出力される5ビットの信号を下位5ビットとした信号と、命令実行部15から出力される演算結果PCとを受ける。セレクタ26は、命令実行部15から出力される演算結果PC選択信号が「H」レベルのときには演算結果PCを出力し、演算結果PC選択信号が「L」レベルのときには、加算器25および論理回路58の信号を出力する。
 セレクタ27は、セレクタ26の出力と、PC用レジスタ28から出力されるアドレスとを受ける。セレクタ27は、命令実行部15から出力されるPCストール信号が「H」レベルのときにはPC用レジスタ28から出力されるアドレスを出力し、PCストール信号が「L」レベルのときにはセレクタ26の出力を出力する。
 PC用レジスタ28は、セレクタ27の出力をラッチして、フラッシュ制御用コード用ROMのアドレスとして内部アドレスバス23へ出力する。
 (第4の実施形態の動作例)
 図26(a)は、コード挿入用レジスタセット54-i(以下、コード挿入用レジスタセット#i)のアドレスレジスタ31に保持されている値の例を示す図である。この例では、コード挿入用レジスタセット#0のアドレスレジスタ31に「0x01060」の上位15ビットが保持され、アドレスレジスタ56に「0x01060」の下位5ビットが保持されている。また、コード挿入用レジスタセット#0のコードレジスタ32に挿入コード「Code Reg.0」が保持されている。また、コード挿入用レジスタセット#0の挿入エンドレジスタ59に挿入エンド「0b0」が保持されている。コード挿入用レジスタセット#1のアドレスレジスタ31に「0x01061」の上位15ビットが保持され、アドレスレジスタ56に「0x01061」の下位5ビットが保持されている。また、コード挿入用レジスタセット#01コードレジスタ32に挿入コード「Code Reg.1」が保持されている。また、コード挿入用レジスタセット#1の挿入エンドレジスタ59に挿入エンド「0b1」が保持されている。また、フラッシュ制御コード用ROM13のアドレス「0x・・・・」には、オリジナルコード「R・・・・」が保持されているものとする。
 図26(b)は、図26(a)の条件下でのタイミング図である。
 第0サイクルでは、プログラムカウンタ65から出力される20ビットのアドレス(PC値[19:0])は、「0x01020」である。アドレス「0x01020」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01060」の上位15ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x01020」のアドレスのオリジナルコードである「R01020」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R01020」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R01000」を実行する。
 第1サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるため、プログラムカウンタ65のセレクタ68が「0x20」を出力する。これにより、プログラムカウンタ65の出力アドレスは、「0x20」だけ加算された「0x01040」となる。アドレス「0x01040」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01062」の上位15ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x01040」のアドレスのオリジナルコードである「R01040」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R01040」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R01020」を実行する。
 第2サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるため、プログラムカウンタ65のセレクタ68が「0x20」を出力する。これにより、プログラムカウンタ65の出力アドレスは、「0x20」だけ加算された「0x01060」となる。アドレス「0x01060」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01060」の上位15ビットと一致し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと一致するため、アドレス一致信号が「H」レベルとなる(アドレス一致信号0およびアドレス一致信号1が「H」レベルとなるため)。また、アドレス「0x01060」の下位5ビットは、コード挿入用レジスタセット#0のアドレスレジスタ56に保持されているアドレス「0x01060」の下位5ビットと一致するため、アドレス完全一致信号は「H」レベルとなる(アドレス完全一致信号0が「H」レベルとなるため)。アドレス完全一致信号0が「H」レベルとなるので、コードレジスタ出力信号0は、コード挿入用レジスタセット#0のコードレジスタ32に保持された挿入コード「Code Reg.0」となる。これにより、コードレジスタ出力信号は、挿入コード「Code Reg.0」となる。アドレス完全一致信号0が「H」レベルとなるので、挿入エンド信号0は、コード挿入用レジスタセット#0の挿入エンドレジスタ59に保持された挿入エンド「0b0」となる。これにより、挿入エンド信号は、「0b0」となる。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R01040」を実行する。
 第3サイクルでは、前サイクルのアドレス一致信号が「H」レベルであるため、プログラムカウンタ65のセレクタ68が「0x01」を出力する。これにより、プログラムカウンタ65の出力アドレスは、「0x01」だけ加算された「0x01061」となる。アドレス「0x01061」の上位15ビット(6ビット目~20ビット目)は、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01060」の上位15ビットと一致し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと一致するたる。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0およびアドレス一致信号1が「H」レベルとなるため)。また、アドレス「0x01061」の下位5ビットは、コード挿入用レジスタセット#1のアドレスレジスタ56に保持されているアドレス「0x01061」の下位5ビットと一致する。その結果、アドレス完全一致信号は「H」レベルとなる(アドレス完全一致信号1が「H」レベルとなるため)。アドレス完全一致信号1が「H」レベルとなるので、コードレジスタ出力信号1は、コード挿入用レジスタセット#1のコードレジスタ32に保持された挿入コード「Code Reg.1」となる。これにより、コードレジスタ出力信号は、挿入コード「Code Reg.1」となる。アドレス完全一致信号1が「H」レベルとなるので、挿入エンド信号1は、コード挿入用レジスタセット#1の挿入エンドレジスタ59に保持された挿入エンド「0b1」となる。これにより、挿入エンド信号は、「0b1」となる。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.1」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.0」を実行する。
 第4サイクルでは、前サイクルのアドレス一致信号が「H」レベルであるため、プログラムカウンタ65のセレクタ68が「0x01」を出力する。また、挿入エンド信号「0b1」のため、論理回路OR68によって、加算器25から出力される20ビットのアドレスの下位5ビットが「1」となる。その結果、プログラムカウンタ65の出力アドレスは、「0x0107F」となる。アドレス「0x0107F」の上位15ビット(6ビット目~20ビット目)は、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01060」の上位15ビットと一致し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0およびアドレス一致信号1が「H」レベルとなるため)。また、アドレス「0x0107F」の下位5ビットは、コード挿入用レジスタセット#0のアドレスレジスタ56に保持されているアドレス「0x01060」の下位5ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ56に保持されているアドレス「0x01061」の下位5ビットと相違する。その結果、アドレス完全一致信号は「L」レベルとなる(アドレス完全一致信号0およびアドレス完全一致信号が「L」レベルとなるため)。アドレス完全一致信号が「L」レベルとなるのでコードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x0107F」のアドレスの下位5ビットを無視することによって同一となるアドレス「0x01060」のオリジナルコードである「R01060」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R01060」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.1」を実行する。
 第5サイクルでは、前サイクルのアドレス一致信号が「H」レベルであるので、プログラムカウンタ65のセレクタ68が「0x01」を出力する。また、挿入エンド信号が「0b0」のため、論理回路OR68によって、加算器25から出力される20ビットのアドレスの下位5ビットがそのまま出力される。その結果、プログラムカウンタ65の出力アドレスは、「0x01080」となる。また、アドレス「0x01080」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01060」の上位15ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと相違する。その結果、アドレス一致信号が「L」レベルとなる(アドレス一致信号0およびアドレス一致信号1が「L」レベルとなるため)。また、アドレス「0x01080」の下位5ビットは、コード挿入用レジスタセット#0のアドレスレジスタ56に保持されているアドレス「0x01060」の下位5ビットと相違し、コード挿入用レジスタセット#1のアドレスレジスタ56に保持されているアドレス「0x01061」の下位5ビットと相違する。その結果、アドレス完全一致信号は「L」レベルとなる(アドレス完全一致信号0およびアドレス完全一致信号1が「L」レベルとなるため)。アドレス完全一致信号が「L」レベルのため、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x01080」のアドレスのオリジナルコードである「R01080」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R01080」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R01060」を実行する。
 第6サイクルでは、前サイクルのアドレス一致信号が「L」レベルであるので、プログラムカウンタ65のセレクタ68が「0x20」を出力するため、プログラムカウンタ65の出力アドレスは、「0x20」だけ加算された「0x010A0」となる。アドレス「0x010A0」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x01060」の上位15ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x01061」の上位15ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x010A0」のアドレスのオリジナルコードである「R010A0」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R010A0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R01080」を実行する。
 第7サイクル以降は、第6サイクルと同様に動作する。
 以上のように、本実施の形態によれば、第2の実施形態と同様に、プログラムカウンタのアドレスの最下位から所定個数のビット以外のビットでオリジナルコードのアドレスを指定し、最下位から所定個数のビットを用いてコードの挿入を制御するので、2つのオリジナルコードの間に1個以上のコードの挿入が可能で、かつマルチサイクル命令の実行が可能となる。また、本実施の形態によれば、プログラムカウンタからのアドレスがアドレスレジスタの値と一致した場合、挿入コードの実行をオリジナルコードの前に実行していた第2の実施の形態に対し、挿入コードの実行をオリジナルコードの後に実行する。
 [第5の実施形態]
 (構成)
 図27は、第5の実施形態のフラッシュメモリ制御部395の構成を表わす図である。
 図27のフラッシュメモリ制御部395が、図7の第1の実施形態のフラッシュメモリ制御部2と相違する点は、挿入コードレジスタセットブロック396である。
 図28は、挿入コードレジスタセットブロック396に含まれるコード挿入用レジスタセット40-0の構成を表わす図である。コード挿入用レジスタセット40-1~40-nの構成も、図28のコード挿入用レジスタセット40-0の構成と同様である。
 図28のコード挿入用レジスタセット40-0が、図11の第1の実施形態のコード挿入用レジスタセット29-0と相違する点は、論理回路AND6と、ステータスレジスタ34と、論理回路AND5である。
 論理回路AND6は、クロックclkと、ステータスレジスタ選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号をステータスレジスタ34の制御端子に出力する。
 ステータスレジスタ34は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた1ビットのステータス値をラッチして保持する。
 論理回路AND5は、ステータスレジスタ34の出力と、アドレス比較器30の出力との論理積をアドレス一致信号0として出力する。したがって、ステータス値が「0」に設定されるときには、アドレス一致信号0、アドレス完全一致信号0が常に「L」レベルとなる。その結果、コード選択回路12は、ステータ値が「0」のときに、プログラムカウンタ12のアドレスに係わらず、フラッシュ制御コード用ROM13から出力されるオリジナルコードを選択する。これによって、本実施の形態で説明するコードの挿入機能が無効となる。
 以上のように、本実施の形態によれば、ステータス値に応じて、コードの挿入機能の有効/無効を切替えることができる。
 [第6の実施形態]
 (構成)
 図29は、第6の実施形態のフラッシュメモリ制御部423の構成を表わす図である。
 図29のフラッシュメモリ制御部423が、図7の第1の実施形態のフラッシュメモリ制御部102と相違する点は、挿入コードレジスタセットブロック424とプロラムカウンタ72である。
 挿入コードレジスタセットブロック424は、保持している挿入コードのアドレスの最上位ビットを除くビットとプログラムカウンタ72のアドレスの最上位ビットを除くビットとが一致したときに、第1の信号を出力する(すなわち、アドレス一致信号を「H」レベルに設定する)。
 挿入コードレジスタセットブロック424は、第1の信号を出力し、かつプログラムカウンタ72のアドレスの最上位ビットが「1」のときに、第2の信号を出力する(すなわち、アドレス完全一致信号を「H」レベルに設定する)とともに、保持している挿入コードを出力する。
 プログラムカウンタ72は、第1の信号を受けたときに、最上位ビットに「1」を加算し、第1の信号を受けないときに、最下位から2ビット目に「1」を加算する。
 図30は、プログラムカウンタ72の構成を表わす図である。
 図30に示すように、プログラムカウンタ72は、セレクタ73と、加算器25と、論理回路AND72と、セレクタ26と、セレクタ27と、PC用レジスタ28とを備える。
 セレクタ73は、挿入コードレジスタセットブロック424からアドレス一致信号とアドレス完全一致信号とを受ける。セレクタ73は、アドレス一致信号が「H」レベル、かつアドレス完全一致信号が「L」レベルのときには、「0x10000」を出力する。セレクタ73は、アドレス一致信号が「L」レベル、かつアドレス完全一致信号が「H」レベルのとき、アドレス一致信号が「L」レベル、かつアドレス完全一致信号が「L」レベルのとき、またはアドレス一致信号が「H」レベル、かつアドレス完全一致信号が「H」レベルのときには、「0x02」を出力する。
 加算器25は、PC用レジスタ28から出力される17ビットのアドレス「16:0]とセレクタ73から出力される値を加算する。本実施の形態では、1個の命令コードを挿入する為、プログラムカウンタ72の出力は17ビットと仮定した。
 論理回路AND72は、加算器25から出力される17ビットのうちの最上位1ビットと、アドレス完全一致信号の否定の論理積を出力する。すなわち、論理回路AND72は、アドレス完全一致信号が「L」レベルのときには、加算器25から出力される17ビットのうちの最上位1ビットを出力する。論理回路AND72は、アドレス完全一致信号が「H」レベルのときには、1ビットの「0b0」を出力する。
 セレクタ26は、加算器25から出力される17ビットのうちの下位16ビットを下位16ビットとし、論理回路AND72から出力される1ビットの信号を最上位1ビットとした信号と、命令実行部15から出力される演算結果PCとを受ける。セレクタ26は、命令実行部15から出力される演算結果PC選択信号が「H」レベルのときには演算結果PCを出力し、演算結果PC選択信号が「L」レベルのときには、加算器25および論理回路AND72からの信号を出力する。
 セレクタ27は、セレクタ26の出力と、PC用レジスタ28から出力されるアドレスとを受ける。セレクタ27は、命令実行部15から出力されるPCストール信号が「H」レベルのときにはPC用レジスタ28から出力されるアドレスを出力し、PCストール信号が「L」レベルのときにはセレクタ26の出力を出力する。
 PC用レジスタ28は、セレクタ27の出力をラッチして、フラッシュ制御用コード用ROMのアドレスとして内部アドレスバス23へ出力する。
 図31は、挿入コードレジスタセットブロック424に含まれるコード挿入用レジスタセット71-0の構成を表わす図である。コード挿入用レジスタセット71-1~71-nの構成も、図31のコード挿入用レジスタセット71-0の構成と同様である。
 図31に示すように、コード挿入用レジスタセット71-0は、論理回路AND1と、アドレスレジスタ31と、アドレス比較器30と、論理回路AND4と、コードレジスタ32と、論理回路AND71とを備える。
 論理回路AND1は、クロックclkと、アドレスレジスタ選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号をアドレスレジスタ31の制御端子に出力する。
 アドレスレジスタ31は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた16ビットのアドレスをラッチして保持する。
 アドレス比較器30は、プログラムカウンタ72から出力される17ビットのアドレスのうちの下位16ビット(アドレス[15:0])と、アドレスレジスタ31に保持されている16ビットのアドレスとが一致するときに、アドレス一致信号0を「H」レベルに設定する。
 論理回路AND71は、アドレス一致信号0が「H」レベルで、プログラムカウンタ72から出力される17ビットのアドレスのうちの最上位1ビット(アドレス[16])が「1」のときに、アドレス完全一致信号0を「H」レベルに設定する。
 論理回路AND4は、クロックclkと、コードレジスタ選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号をコードレジスタ32の制御端子に出力する。
 コードレジスタ32は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた16ビットのデータ(つまり、挿入コード)をラッチして保持する。
 (第6の実施形態の動作例)
 図32(a)は、コード挿入用レジスタセット71-i(以下、コード挿入用レジスタセット#i)のアドレスレジスタ31に保持されている値の例を示す図である。この例では、コード挿入用レジスタセット#0のアドレスレジスタ31に「0x00106」の下位16ビットが保持されている。また、コード挿入用レジスタセット#0のコードレジスタ32に挿入コード「Code Reg.0」が保持されている。また、フラッシュ制御コード用ROM13のアドレス「0x・・・・」には、オリジナルコード「R・・・・」が保持されているものとする。
 図32(b)は、図32(a)の条件下でのタイミング図である。
 第0サイクルでは、プログラムカウンタ72から出力される17ビットのアドレス(PC値[16:0])は、「0x00102」である。また、アドレス「0x00102」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x00000」となる。フラッシュ制御コード用ROM13から「0x00102」のアドレスのオリジナルコードである「R00102」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00102」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00100」を実行する。
 第1サイクルでは、前サイクルのアドレス一致信号が「L」レベルであり、アドレス完全一致信号が「L」レベルであるため、プログラムカウンタ72のセレクタ73が「0x02」を出力する。これにより、プログラムカウンタ72の出力アドレスは、「0x02」だけ加算された「0x00104」となる。アドレス「0x00104」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと相違する。その結果、アドレス一致信号、アドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x00000」となる。フラッシュ制御コード用ROM13から「0x00104」のアドレスのオリジナルコードである「R00104」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00104」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00102」を実行する。
 第2サイクルでは、前サイクルのアドレス一致信号が「L」レベルであり、アドレス完全一致信号が「L」レベルであるため、プログラムカウンタ72のセレクタ24が「0x02」を出力する。これにより、プログラムカウンタ72の出力アドレスは、「0x02」だけ加算された「0x00106」となる。アドレス「0x00106」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。一方、プログラムカウンタ72の出力アドレスの最上位ビットが「0」のため、アドレス完全一致信号が「L」レベルのままで、コードレジスタ出力信号が「0x00000」のままである。フラッシュ制御コード用ROM13から「0x00106」のアドレスのオリジナルコードである「R00106」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00106」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00104」を実行する。
 第3サイクルでは、前サイクルのアドレス一致信号が「H」レベルであり、アドレス完全一致信号が「L」レベルのため、プログラムカウンタ72のセレクタ73が「0x10000」を出力する。これにより、プログラムカウンタ72の出力アドレスは、「0x10000」だけ加算された「0x10106」となる。アドレス「0x10106」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと一致するため、アドレス一致信号が「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。プログラムカウンタ72の出力アドレスの最上位ビットが「1」のため、アドレス完全一致信号は「H」レベルとなる(アドレス一致信号0が「H」レベルとなるため)。さらに、コードレジスタ出力信号は、コードレジスタ32に保持された挿入コード「Code Reg.0」となる(コードレジスタ出力信号0が「Code Reg.0」となるため)。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00106」を実行する。
 第4サイクルでは、前サイクルのアドレス一致信号が「H」レベルであり、アドレス完全一致信号が「H」レベルのため、プログラムカウンタ72のセレクタ73が「0x02」を出力する。アドレス完全一致信号が「H」レベルなので、論理回路AND72によって、加算器25の出力の最上位ビット(17ビット目)が「0」となる。その結果、プログラムカウンタ72の出力アドレスは、「0x00108」となる。アドレス「0x00108」の下位16ビットは、アドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと相違する。その結果、アドレス一致信号、アドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x00000」となる。フラッシュ制御コード用ROM13から「0x00108」のアドレスのオリジナルコードである「R00108」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00108」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.0」を実行する。
 第5サイクル以降は、第4サイクルと同様に動作する。
 以上のように、本実施の形態によれば、プログラムカウンタのアドレスの最上位ビット以外のビットでオリジナルコードのアドレスを指定し、最上位ビットを用いてコードの挿入を制御するので、2つのオリジナルコードの間に1個のコードの挿入が可能で、かつマルチサイクル命令の実行が可能となる。
 なお、本実施の形態では、複数のオリジナルコードのアドレスは、最下位から2ビット目以上のビットが有効としたが、これに限定されるものではなく、複数のオリジナルコードのアドレスは、最下位からnビット目以上のビットが有効としてもよい。ただし、nは1以上の自然数である。この場合には、プログラムカウンタ72は、第1の信号を受けないとき(アドレス一致信号が「L」レベルのとき)に、最下位からnビット目に「1」を加算すればよい。尚、本実施の形態以降では、最下位ビットは使用しない構成であるため、各プログラムカウンタおよび挿入コードレジスタセットへのアドレス入力は[15:1]でも構わないが、[15:0]でとして記してある。
 [第7の実施形態]
 本実施の形態では、複数のオリジナルコードのアドレスは、最下位からmビット目以上のビットが有効であるとする。
 図33は、第7の実施形態のフラッシュメモリ制御部623の構成を表わす図である。
 図33のフラッシュメモリ制御部623が、図16の第2の実施形態のフラッシュメモリ制御部102と相違する点は、挿入コードレジスタセットブロック624とプロラムカウンタ74である。
 挿入コードレジスタセットブロック624は、最大で2k-1個の挿入コードと、挿入コードのアドレスを保持する。挿入コードレジスタセットブロック624は、保持している挿入コードのアドレスの最上位からk個のビットを除くビットとプログラムカウンタ74のアドレスの最上位からk個のビットを除くビットとが一致したときに、第1の信号を出力する(すなわち、アドレス一致信号を「H」レベルに設定する。)。
 挿入コードレジスタセットブロック624は、第1の信号を出力し、かつ保持している挿入コードのアドレスの最上位からk個のビットとプログラムカウンタ74のアドレスの最上位からk個のビットとが一致したときに、第2の信号を出力する(アドレス完全一致信号を「H」レベルに設定する)とともに、プログラムカウンタ74のアドレスに対応する保持している挿入コードを出力する。
 挿入コードレジスタセットブロック624は、複数の挿入コードを連続して挿入するときに最後の挿入コードを出力する場合には、第2の信号を出力するとともに、同時に挿入エンドを示す挿入エンド信号を出力する。
 プログラムカウンタ74は、第1の信号を受けたときに、最上位からk番目のビットに「1」を加算し、第1の信号を受けなかったときに、最下位からm番目のビットに「1」を加算する。
 プログラムカウンタ74は、挿入エンド信号を受けたときには、第1の信号を受けたときでも、最下位からm番目のビットに「1」を加算し、かつ最上位からk個のビットを「0」にする。
 本実施の形態では、m=2、k=4として説明する。
 図34は、プログラムカウンタ74の構成を表わす図である。
 図34に示すように、プログラムカウンタ74は、セレクタ77と、加算器25と、論理回路AND74と、セレクタ26と、セレクタ27と、PC用レジスタ28とを備える。
 セレクタ77は、挿入コードレジスタセットブロック624からアドレス一致信号と挿入エンド信号とを受ける。セレクタ77は、アドレス一致信号が「H」レベル、かつ挿入エンド信号が「L」レベルのときには、「0x10000」を出力する。セレクタ73は、アドレス一致信号が「L」レベル、かつ挿入エンド信号が「H」レベルのとき、アドレス一致信号が「L」レベル、かつ挿入エンド信号が「L」レベルのとき、またはアドレス一致信号が「H」レベル、かつ挿入エンド信号が「H」レベルのときには、「0x02」を出力する。
 加算器25は、PC用レジスタ28から出力される20ビットのアドレスとセレクタ73から出力される値を加算する。
 論理回路AND74は、加算器25から出力される20ビットのうちの上位4ビットと、挿入エンド信号の否定の論理積を出力する。すなわち、論理回路AND74は、挿入エンド信号が「L」レベルのときには、加算器25から出力される20ビットのうちの上位4ビットを出力する。論理回路AND74は、挿入エンド信号が「H」レベルのときには、4ビットの「0b0000」を出力する。
 セレクタ26は、加算器25から出力される20ビットのうちの下位16ビットを下位16ビットとし、論理回路AND74から出力される4ビットの信号を上位4ビットとした信号と、命令実行部15から出力される演算結果PCとを受ける。セレクタ26は、命令実行部15から出力される演算結果PC選択信号が「H」レベルのときには演算結果PCを出力し、演算結果PC選択信号が「L」レベルのときには、加算器25および論理回路AND74からの信号を出力する。
 セレクタ27は、セレクタ26の出力と、PC用レジスタ28から出力されるアドレスとを受ける。セレクタ27は、命令実行部15から出力されるPCストール信号が「H」レベルのときにはPC用レジスタ28から出力されるアドレスを出力し、PCストール信号が「L」レベルのときにはセレクタ26の出力を出力する。
 PC用レジスタ28は、セレクタ27の出力をラッチして、フラッシュ制御用コード用ROMのアドレスとして内部アドレスバス23へ出力する。
 図35は、挿入コードレジスタセットブロック624に含まれるコード挿入用レジスタセット78-0の構成を表わす図である。コード挿入用レジスタセット78-1~78-nの構成も、図35のコード挿入用レジスタセット78-0の構成と同様である。
 図35に示すように、コード挿入用レジスタセット78-0は、論理回路AND1と、アドレスレジスタ31と、アドレス比較器30と、論理回路AND4と、コードレジスタ32と、論理回路54と、アドレスレジスタ156と、アドレス比較器157と、論理回路56と、挿入エンドレジスタ59と、論理回路AND2と、論理回路55と、論理回路AND3とを備える。
 論理回路AND1は、クロックclkと、アドレスレジスタ選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号をアドレスレジスタ31の制御端子に出力する。
 アドレスレジスタ31は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた16ビットのアドレスをラッチして保持する。
 アドレス比較器30は、プログラムカウンタ74から出力される20ビットのアドレスのうちの下位16ビット(アドレス[15:0])と、アドレスレジスタ31に保持されている16ビットのアドレスとが一致するときに、アドレス一致信号0を「H」レベルに設定する。
 論理回路AND54は、クロックclkと、アドレスレジスタ2選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号をコードレジスタ32の制御端子に出力する。
 アドレスレジスタ156は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた4ビットのアドレスをラッチして保持する。
 アドレス比較器57は、プログラムカウンタ74から出力される20ビットのアドレスのうちの上位4ビット(アドレス[19:16])と、アドレスレジスタ156に保持されている4ビットのアドレスとが一致するときに、「H」レベルの一致信号を出力する。
 論理回路AND2は、アドレス一致信号0が「H」レベルで、アドレス比較器157から出力される一致信号が「H」レベルのときに、アドレス完全一致信号0を「H」レベルに設定する。
 論理回路AND56は、クロックclkと、挿入エンドレジスタ選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号を挿入エンドレジスタ59の制御端子に出力する。
 挿入エンドレジスタ59は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた1ビットのデータ(挿入エンド)をラッチして保持する。
 論理回路AND55は、アドレス完全一致信号0と、挿入エンドレジスタ59の出力とを受ける。論理回路AND55は、アドレス完全一致信号0が「H」レベルのときに、挿入エンドレジスタ59に保持された1ビットのデータ(挿入エンド)を挿入エンド信号0として出力する。
 論理回路AND4は、クロックclkと、コードレジスタ選択信号0とがいずれも「H」レベルのときに、「H」レベルの信号をコードレジスタ32の制御端子に出力する。
 コードレジスタ32は、制御端子への入力が「H」レベルのときに、データバスを通じて送られてきた16ビットのデータ(つまり、挿入コード)をラッチして保持する。
 論理回路AND3は、アドレス完全一致信号0と、コードレジスタ32の出力とを受ける。論理回路AND3は、アドレス完全一致信号0が「H」レベルのときに、コードレジスタ32に保持された16ビットのデータ(つまり、挿入コード)をコードレジスタ出力信号0として出力する。論理回路AND3は、アドレス完全一致信号0が「L」レベルのときに、16ビットの「0x0000」をコードレジスタ出力信号0として出力する。
 (第7の実施形態の動作例)
 図36(a)は、コード挿入用レジスタセット78-i(以下、コード挿入用レジスタセット#i)のアドレスレジスタ31に保持されている値の例を示す図である。この例では、コード挿入用レジスタセット#0のアドレスレジスタ31に「0x10106」の下位16ビットが保持され、アドレスレジスタ156に「0x10106」の上位4ビットが保持されている。また、コード挿入用レジスタセット#0のコードレジスタ32に挿入コード「Code Reg.0」が保持されている。また、コード挿入用レジスタセット#0の挿入エンドレジスタ59に挿入エンド「0b0」が保持されている。コード挿入用レジスタセット#1のアドレスレジスタ31に「0x20106」の下位16ビットが保持され、アドレスレジスタ156に「0x20106」の上位4ビットが保持されている。また、コード挿入用レジスタセット#01のコードレジスタ32に挿入コード「Code Reg.1」が保持されている。また、コード挿入用レジスタセット#1の挿入エンドレジスタ59に挿入エンド「0b1」が保持されている。また、フラッシュ制御コード用ROM13のアドレス「0x・・・・」には、オリジナルコード「R・・・・」が保持されているものとする。
 図36(b)は、図36(a)の条件下でのタイミング図である。
 第0サイクルでは、プログラムカウンタ74から出力される20ビットのアドレス(PC値[19:0])は、「0x00102」である。アドレス「0x00102」の上位15ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x10106」の下位16ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x20106」の下位16ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x00102」のアドレスのオリジナルコードである「R00102」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00102」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00100」を実行する。
 第1サイクルでは、前サイクルのアドレス一致信号が「L」レベルであり、挿入エンド信号が「0b0」であるため、プログラムカウンタ74のセレクタ77が「0x02」を出力する。プログラムカウンタ74の出力アドレスは、「0x02」だけ加算された「0x00104」となる。アドレス「0x00104」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x10106」の下位16ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x20106」の下位16ビットと相違する。その結果、アドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x00104」のアドレスのオリジナルコードである「R00104」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00104」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00102」を実行する。
 第2サイクルでは、前サイクルのアドレス一致信号が「L」レベルであり、挿入エンド信号が「0b0」であるため、プログラムカウンタ74のセレクタ77が「0x02」を出力する。その結果、プログラムカウンタ74の出力アドレスは、「0x02」だけ加算された「0x00106」となる。アドレス「0x00106」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x10106」の下位16ビットと一致し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x20106」の下位16ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0およびアドレス一致信号1が「H」レベルとなるため)。また、アドレス「0x00106」の上位4ビットは、コード挿入用レジスタセット#0のアドレスレジスタ156に保持されているアドレス「0x10106」の上位4ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ156に保持されているアドレス「0x20106」の上位4ビットと相違する。その結果、アドレス完全一致信号が「L」レベルのままである(アドレス完全一致信号0およびアドレス完全一致信号1が「L」レベルのままのため)。アドレス完全一致信号が「L」レベルのため、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x00106」のアドレスのオリジナルコードである「R00106」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00106」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00104」を実行する。
 第3サイクルでは、前サイクルのアドレス一致信号が「H」レベルであり、挿入エンド信号が「0b0」であるため、プログラムカウンタ74のセレクタ24が「0x10000」を出力する。そのため、プログラムカウンタ74の出力アドレスは、「0x10000」だけ加算された「0x10106」となる。また、アドレス「0x10106」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x10106」の下位16ビットと一致し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x20106」の下位16ビットと一致するため、アドレス一致信号が「H」レベルとなる(アドレス一致信号0およびアドレス一致信号1が「H」レベルとなるため)。また、アドレス「0x10106」の上位4ビットは、コード挿入用レジスタセット#0のアドレスレジスタ156に保持されているアドレス「0x10106」の上位4ビットと一致する。その結果、アドレス完全一致信号は「H」レベルとなる(アドレス完全一致信号0が「H」レベルとなるため)。アドレス完全一致信号0が「H」レベルとなるので、コードレジスタ出力信号0は、コード挿入用レジスタセット#0のコードレジスタ32に保持された挿入コード「Code Reg.0」となる。これにより、コードレジスタ出力信号は、挿入コード「Code Reg.0」となる。アドレス完全一致信号0が「H」レベルとなるので、挿入エンド信号0は、コード挿入用レジスタセット#0の挿入エンドレジスタ59に保持された挿入エンド「0b0」となる。これにより、挿入エンド信号は、「0b0」となる。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00106」を実行する。
 第4サイクルでは、前サイクルのアドレス一致信号が「H」レベルであり、挿入エンド信号が「0b0」であるため、プログラムカウンタ74のセレクタ77が「0x10000」を出力する。そのため、プログラムカウンタ74の出力アドレスは、「0x10000」だけ加算された「0x20106」となる。アドレス「0x20106」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x10106」の下位16ビットと一致し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x20106」の下位16ビットと一致する。その結果、アドレス一致信号が「H」レベルとなる(アドレス一致信号0およびアドレス一致信号1が「H」レベルとなるため)。また、アドレス「0x20106」の上位4ビットは、コード挿入用レジスタセット#1のアドレスレジスタ156に保持されているアドレス「0x20106」の上位4ビットと一致する。その結果、アドレス完全一致信号は「H」レベルとなる(アドレス完全一致信号1が「H」レベルとなるため)。アドレス完全一致信号1が「H」レベルとなるので、コードレジスタ出力信号1は、コード挿入用レジスタセット#1のコードレジスタ32に保持された挿入コード「Code Reg.1」となる。これにより、コードレジスタ出力信号は、挿入コード「Code Reg.1」となる。アドレス完全一致信号1が「H」レベルとなるので、挿入エンド信号1は、コード挿入用レジスタセット#1の挿入エンドレジスタ59に保持された挿入エンド「0b1」となる。これにより、挿入エンド信号は、「0b1」となる。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.1」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.0」を実行する。
 第5サイクルでは、前サイクルのアドレス一致信号が「H」レベルであり、挿入エンド信号が「0b1」であるため、プログラムカウンタ74のセレクタ24が「0x02」を出力する。また、挿入エンド信号が「0b1」なので、論理回路AND74によって、加算器25の出力の上位4ビット(17ビット目~20ビット目)が「0」となる。その結果、プログラムカウンタ74の出力アドレスは、「0x00108」となる。アドレス「0x00108」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x10106」の下位16ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x20106」の下位16ビットと相違する。その結果、アドレス一致信号が「L」レベルとなる(アドレス一致信号0およびアドレス一致信号1が「L」レベルとなるため)。また、アドレス「0x00108」の上位4ビットは、コード挿入用レジスタセット#0のアドレスレジスタ156に保持されているアドレス「0x10106」の上位4ビットと相違し、コード挿入用レジスタセット#1のアドレスレジスタ156に保持されているアドレス「0x20106」の上位4ビットと相違する。その結果、アドレス完全一致信号は「L」レベルとなる(アドレス完全一致信号0およびアドレス完全一致信号1が「L」レベルとなるため)。アドレス完全一致信号が「L」レベルのため、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x00108」のアドレスのオリジナルコードである「R00108」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00108」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.1」を実行する。
 第6サイクルでは、前サイクルのアドレス一致信号が「L」レベルであり、挿入エンド信号が「0b0」であるため、プログラムカウンタ74のセレクタ77が「0x02」を出力する。これにより、プログラムカウンタ74の出力アドレスは、「0x02」だけ加算された「0x0010A」となる。アドレス「0x0010A」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x10106」の下位16ビットと相違し、かつコード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x20106」の下位16ビットと相違する。その結果、mアドレス一致信号、およびアドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x0000」となり、挿入エンド信号が「0b0」となる。フラッシュ制御コード用ROM13から「0x0010A」のアドレスのオリジナルコードである「R0010A」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R0010A」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00108」を実行する。
 第7サイクル以降は、第6サイクルと同様に動作する。
 以上のように、本実施の形態によれば、プログラムカウンタのアドレスの最上位から所定個数のビット以外のビットでオリジナルコードのアドレスを指定し、最上位から所定個数のビットを用いてコードの挿入を制御するので、2つのオリジナルコードの間に1個以上のコードの挿入が可能で、かつマルチサイクル命令の実行が可能となる。
 [第8の実施形態]
 本実施の形態では、複数のオリジナルコードのアドレスは、最下位から2ビット目以上、かつ最上位ビットを除くビットが有効である。
 図37は、第8の実施形態のフラッシュメモリ制御部742の構成を表わす図である。
 図37のフラッシュメモリ制御部742が、図7の第1の実施形態のフラッシュメモリ制御部2と相違する点は、挿入コードレジスタセットブロック743とプログラムカウンタ91である。
 挿入コードレジスタセットブロック743は、保持している挿入コードのアドレスの最上位ビットを除くビットとプログラムカウンタ91のアドレスの最上位ビットを除くビットとが一致し、かつプログラムカウンタ91のアドレスの最上位ビットが「1」のときに、第1の信号を出力する(アドレス完全一致信号を「H」レベルに設定する)とともに、保持している挿入コードを出力する。
 プログラムカウンタ91は、第1の信号を受けたときに、最上位ビットに「1」を加算し、第1の信号を受けないときに、最下位から2ビット目に「1」を加算し、かつ最上位ビットを「0」にする。
 図38は、プログラムカウンタ91の構成を表わす図である。
 図38のプログラムカウンタ91が、図30の第6の実施形態のプログラムカウンタ72と相違する点は、セレクタ92と論理回路AND92である。
 セレクタ92は、挿入コードレジスタセットブロック743からアドレス完全一致信号を受ける。セレクタ92は、アドレス完全一致信号が「H」レベルのときには、「0x10000」を出力する。セレクタ92は、アドレス完全一致信号が「L」のときには、「0x02」を出力する。
 論理回路AND92は、加算器25から出力される17ビットのうちの最上位ビットと、アドレス完全一致信号の論理積を出力する。すなわち、論理回路AND92は、アドレス完全一致信号が「H」レベルのときには、加算器25から出力される17ビットのうちの最上位ビットを出力する。論理回路AND92は、アドレス完全一致信号が「L」レベルのときには、1ビットの「0b0」を出力する。
 図39は、挿入コードレジスタセットブロック743の構成を表わす図である。
 図39に示すように、挿入コードレジスタセットブロック743は、挿入するコードおよび挿入するアドレスを保持するコード挿入用レジスタセット88-i(i=0~n)と、論理回路OR88,OR89とを備える。
 コード挿入用レジスタセット88-iは、プログラムカウンタ91から出力されるアドレスと、データバス内を伝送するデータとを受け、さらにコード選択回路14からコードレジスタ選択信号iおよびアドレスレジスタ選択信号iとを受けて、アドレス完全一致信号i、およびコードレジスタ出力信号iを出力する。
 論理回路OR88は、(n+1)個のコードレジスタ出力信号0~nの論理和をコードレジスタ出力信号として出力する。すなわち、(n+1)個のコードレジスタ出力信号0~nの少なくとも1つが「H」レベルのビットを有するとき(すなわち、挿入コードが出力されたとき)に、コードレジスタ出力信号が挿入コードとなる。すなわち、(n+1)個のコードレジスタ出力信号0~nの全ビットのすべてが「L」レベルのとき(すなわち、挿入コードが出力されないとき)に、コードレジスタ出力信号の全ビットが「L」となる。
 論理回路OR89は、(n+1)個のアドレス完全一致信号0~nの論理和をアドレス完全一致信号として出力する。すなわち、(n+1)個のアドレス完全一致信号0~nの少なくとも1つが「H」レベルのときに、アドレス完全一致信号が「H」レベルとなる。
 図40は、挿入コードレジスタセットブロック743に含まれるコード挿入用レジスタセット88-0の構成を表わす図である。コード挿入用レジスタセット88-1~88-nの構成も、図35のコード挿入用レジスタセット88-0の構成と同様である。
 図40のコード挿入用レジスタセット88-0が、図31の第6の実施形態のコード挿入用レジスタセット71-0と相違する点は、アドレス比較器30からアドレス一致信号が外部に出力されない点と、論理回路AND88である。
 論理回路AND88は、アドレス比較器30から出力される信号が「H」レベルで、プログラムカウンタ91から出力される17ビットのアドレスのうちの最上位ビット(アドレス[16])が「0」のときに、アドレス完全一致信号0を「H」レベルに設定する。
 (第8の実施形態の動作例)
 図41(a)は、コード挿入用レジスタセット88-i(以下、コード挿入用レジスタセット#i)のアドレスレジスタ31に保持されている値の例を示す図である。この例では、コード挿入用レジスタセット#0のアドレスレジスタ31に「0x00106」の下位16ビットが保持されている。また、コード挿入用レジスタセット#0のコードレジスタ32に挿入コード「Code Reg.0」が保持されている。また、フラッシュ制御コード用ROM13のアドレス「0x・・・・」には、オリジナルコード「R・・・・」が保持されているものとする。
 図41(b)は、図41(a)の条件下でのタイミング図である。
 第0サイクルでは、プログラムカウンタ91から出力される17ビットのアドレス(PC値[16:0]は、「0x00102」である。また、アドレス「0x00102」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと相違する。その結果、アドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x00000」となる。フラッシュ制御コード用ROM13から「0x00102」のアドレスのオリジナルコードである「R00102」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00102」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00100」を実行する。
 第1サイクルでは、前サイクルのアドレス完全一致信号が「L」レベルであるため、プログラムカウンタ91のセレクタ92が「0x02」を出力する。その結果、プログラムカウンタ91の出力アドレスは、「0x02」だけ加算された「0x00104」となる。アドレス「0x00104」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと相違する。その結果、アドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x00000」となる。フラッシュ制御コード用ROM13から「0x00104」のアドレスのオリジナルコードである「R00104」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00104」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00102」を実行する。
 第2サイクルでは、前サイクルのアドレス完全一致信号が「L」レベルであるため、プログラムカウンタ91のセレクタ92が「0x02」を出力する。これにより、プログラムカウンタ91の出力アドレスは、「0x02」だけ加算された「0x00106」となる。アドレス「0x00106」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x0106」の下位16ビットと一致する。また、アドレス「0x00106」の最上位ビット(17ビット目:アドレス[16])は「0」である。その結果、アドレス完全一致信号が「H」レベルとなる(アドレス完全一致信号0が「H」レベルとなるため)。さらに、コードレジスタ出力信号は、コードレジスタ32に保持された挿入コード「Code Reg.0」となる(コードレジスタ出力信号0が「Code Reg.0」となるため)。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00106」を実行する。
 第3サイクルでは、前サイクルのアドレス完全一致信号が「H」レベルのため、プログラムカウンタ91のセレクタ92が「0x10000」を出力する。これにより、プログラムカウンタ91の出力アドレスは、「0x10000」だけ加算された「0x10106」となる。アドレス「0x10106」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと一致するが、アドレス「0x10106」の最上位ビット(17ビット目:アドレス[16])は「1」である。その結果、アドレス完全一致信号が「L」レベルとなる(アドレス完全一致信号0が「L」レベルとなるため)。さらに、コードレジスタ出力信号が「0x00000」となる。フラッシュ制御コード用ROM13からプログラムカウンタ91の出力アドレス「0x10106」の最上位ビット(17ビット目)を「0」にした「0x00106」のアドレスのオリジナルコードである「R00106」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00106」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.0」を実行する。
 第4サイクルでは、前サイクルのアドレス完全一致信号が「L」レベルのため、プログラムカウンタ91のセレクタ92が「0x00002」を出力する。さらに、アドレス完全一致信号が「L」レベルのため、加算器25の出力アドレスの最上位ビット(17ビット目)が「0」となる。その結果、プログラムカウンタ91の出力アドレスは、「0x00108」となる。アドレス「0x00108」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと相違する。その結果、アドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x00000」となる。フラッシュ制御コード用ROM13から「0x00108」のアドレスのオリジナルコードである「R00108」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00108」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00106」を実行する。
 第5サイクル以降は、第4サイクルと同様に動作する。
 以上のように、本実施の形態によれば、第6の実施形態と同様に、プログラムカウンタのアドレスの最上位ビット以外のビットでオリジナルコードのアドレスを指定し、最上位ビットを用いてコードの挿入を制御するので、2つのオリジナルコードの間に1個以上のコードの挿入が可能で、かつマルチサイクル命令の実行が可能となる。また、本実施の形態によれば、プログラムカウンタからのアドレスがアドレスレジスタの値と一致した場合、挿入コードの実行をオリジナルコードの後に実行していた第6の実施の形態に対し、挿入コードの実行をオリジナルコードの前に実行する。
 なお、本実施の形態では、複数のオリジナルコードのアドレスは、最下位から2ビット目以上かつ最上位ビットを除くビットが有効としたが、これに限定されるものではなく、複数のオリジナルコードのアドレスは、最下位からnビット目以上かつ最上位ビットを除くビットが有効としてもよい。ただし、nは1以上の自然数である。この場合には、プログラムカウンタ91は、第1の信号を受けないとき(アドレス完全一致信号が「L」レベルのとき)に、最下位からnビット目に「1」を加算し、かつ最上位ビットを「0」にすることができる。
 [第9の実施形態]
 本実施の形態では、複数のオリジナルコードのアドレスは、最下位からmビット目以上のビットが有効であるとする。
 図42は、第9の実施形態のフラッシュメモリ制御部388の構成を表わす図である。
 図42のフラッシュメモリ制御部388が、図16の第2の実施形態のフラッシュメモリ制御部102と相違する点は、挿入コードレジスタセットブロック389と、プロラムカウンタ94である。
 挿入コードレジスタセットブロック389は、最大で2k-1個の挿入コードと、挿入コードのアドレスを保持する。挿入コードレジスタセットブロック389は、保持している挿入コードのアドレスの最上位からk個のビットを除くビットとプログラムカウンタ94のアドレスの最上位からk個のビットを除くビットとが一致し、かつ保持している挿入コードのアドレスの最上位からk個のビットとプログラムカウンタ94のアドレスの最上位からk個のビットとが一致したときに、第1の信号を出力する(アドレス完全一致信号を「H」レベルに設定する)とともに、プログラムカウンタ94のアドレスに対応する保持している挿入コードを出力する。
 プログラムカウンタ94は、第1の信号を受けたときに、最上位からk番目のビットに「1」を加算し、第1の信号を受けなかったときに、最下位からm番目のビットに「1」を加算し、かつ最上位からk個のビットを「0」にする。
 以下、本実施の形態では、m=2、k=4として説明する。
 図43は、プログラムカウンタ94の構成を表わす図である。
 図43のプログラムカウンタ94が、図34の第7の実施形態のプログラムカウンタ74と相違する点は、セレクタ92と論理回路AND94である。
 セレクタ92は、挿入コードレジスタセットブロック389からアドレス完全一致信号を受ける。セレクタ92は、アドレス完全一致信号が「H」レベルのときには、「0x10000」を出力する。セレクタ92は、アドレス完全一致信号が「L」のときには、「0x02」を出力する。
 論理回路AND94は、加算器25から出力される20ビットのうちの上位4ビット(17ビット目~19ビット目)と、アドレス完全一致信号の論理積を出力する。すなわち、論理回路AND94は、アドレス完全一致信号が「H」レベルのときには、加算器25から出力される20ビットのうちの上位4ビットを出力する。論理回路AND94は、アドレス完全一致信号が「L」レベルのときには、4ビットの「0b0」を出力する。
 図44は、挿入コードレジスタセットブロック389の構成を表わす図である。
 図44に示すように、挿入コードレジスタセットブロック389は、挿入するコードおよび挿入するアドレスを保持するコード挿入用レジスタセット86-i(i=0~n)と、論理回路OR88,OR89とを備える。
 コード挿入用レジスタセット86-iは、プログラムカウンタ94から出力されるアドレスと、データバス内を伝送するデータとを受け、さらにコード選択回路14からコードレジスタ選択信号i、アドレスレジスタ選択信号iおよびアドレスレジスタ2選択信号iとを受けて、アドレス完全一致信号i、およびコードレジスタ出力信号iを出力する。
 論理回路OR88は、(n+1)個のコードレジスタ出力信号0~nの論理和をコードレジスタ出力信号として出力する。すなわち、(n+1)個のコードレジスタ出力信号0~nの少なくとも1つが「H」レベルのビットを有するとき(すなわち、挿入コードが出力されたとき)に、コードレジスタ出力信号が挿入コードとなる。すなわち、(n+1)個のコードレジスタ出力信号0~nの全ビットのすべてが「L」レベルのとき(すなわち、挿入コードが出力されないとき)に、コードレジスタ出力信号の全ビットが「L」となる。
 論理回路OR89は、(n+1)個のアドレス完全一致信号0~nの論理和をアドレス完全一致信号として出力する。すなわち、(n+1)個のアドレス完全一致信号0~nの少なくとも1つが「H」レベルのときに、アドレス完全一致信号が「H」レベルとなる。
 図45は、挿入コードレジスタセットブロック389に含まれるコード挿入用レジスタセット86-0の構成を表わす図である。コード挿入用レジスタセット86-1~86-nの構成も、図45のコード挿入用レジスタセット86-0の構成と同様である。
 図45のコード挿入用レジスタセット64-0が、図35の第7の実施形態のコード挿入用レジスタセット78-0と相違する点は、アドレス比較30から出力されるアドレス一致信号が外部に出力されない点と、論理回路AND56および挿入エンドレジスタ59を含まない点である。
 (第9の実施形態の動作例)
 図46(a)は、コード挿入用レジスタセット86-i(以下、コード挿入用レジスタセット#i)のアドレスレジスタ31に保持されている値の例を示す図である。この例では、コード挿入用レジスタセット#0のアドレスレジスタ31に「0x00106」の下位16ビットが保持され、アドレスレジスタ156に「0x00106」の上位4ビット(17ビット目~20ビット目)が保持されている。また、コード挿入用レジスタセット#0のコードレジスタ32に挿入コード「Code Reg.0」が保持されている。コード挿入用レジスタセット#1のアドレスレジスタ31に「0x10106」の下位16ビットが保持され、アドレスレジスタ156に「0x10106」の上位4ビット(17ビット目~20ビット目)が保持されている。また、コード挿入用レジスタセット#1のコードレジスタ32に挿入コード「Code Reg.1」が保持されている。また、フラッシュ制御コード用ROM13のアドレス「0x・・・・」には、オリジナルコード「R・・・・」が保持されているものとする。
 図46(b)は、図46(a)の条件下でのタイミング図である。
 第0サイクルでは、プログラムカウンタ94から出力される20ビットのアドレス(PC値[19:0])は、「0x00102」である。アドレス「0x00102」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと相違する。その結果、アドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x00000」となる。フラッシュ制御コード用ROM13から「0x00102」のアドレスのオリジナルコードである「R00102」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00102」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00100」を実行する。
 第1サイクルでは、前サイクルのアドレス完全一致信号が「L」レベルであるため、プログラムカウンタ94のセレクタ92が「0x02」を出力する。これにより、プログラムカウンタ94の出力アドレスは、「0x02」だけ加算された「0x00104」となる。アドレス「0x00104」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと相違する。その結果、アドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x00000」となる。フラッシュ制御コード用ROM13から「0x00104」のアドレスのオリジナルコードである「R00104」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00104」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00102」を実行する。
 第2サイクルでは、前サイクルのアドレス完全一致信号が「L」レベルであるため、プログラムカウンタ94のセレクタ92が「0x02」を出力する。これにより、プログラムカウンタ94の出力アドレスは、「0x02」だけ加算された「0x00106」となる。アドレス「0x00106」の下位16ビットは、コード挿入用レジスタセット#0のアドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと一致する。また、アドレス「0x00106」の上位4ビット(17ビット目~20ビット目」アドレス[16]~[19])は、コード挿入用レジスタセット#0のアドレスレジスタ156に保持されているアドレス「0x0106」の上位4ビットと一致する。その結果、アドレス完全一致信号が「H」レベルとなる(アドレス完全一致信号0が「H」レベルとなるため)。さらに、コードレジスタ出力信号は、コードレジスタ32に保持された挿入コード「Code Reg.0」となる(コードレジスタ出力信号0が「Code Reg.0」となるため)。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.0」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00104」を実行する。
 第3サイクルでは、前サイクルのアドレス完全一致信号が「H」レベルのため、プログラムカウンタ94のセレクタ92が「0x10000」を出力する。これにより、プログラムカウンタ94の出力アドレスは、「0x10000」だけ加算された「0x10106」となる。アドレス「0x10106」の下位16ビットは、コード挿入用レジスタセット#1のアドレスレジスタ31に保持されているアドレス「0x10106」の下位16ビットと一致する。また、アドレス「0x10106」の上位4ビット(17ビット目~20ビット目」アドレス[16]~[19])は、コード挿入用レジスタセット#1のアドレスレジスタ156に保持されているアドレス「0x10106」の上位4ビットと一致する。その結果、アドレス完全一致信号が「H」レベルとなる(アドレス完全一致信号1が「H」レベルとなるため)。さらに、コードレジスタ出力信号は、コードレジスタ32に保持された挿入コード「Code Reg.1」となる(コードレジスタ出力信号0が「Code Reg.1」となるため)。コード選択回路14は、アドレス完全一致信号が「H」レベルであるので、挿入コード「Code Reg.1」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.0」を実行する。
 第4サイクルでは、前サイクルのアドレス完全一致信号が「H」レベルのため、プログラムカウンタ94のセレクタ92が「0x10000」を出力する。これにより、プログラムカウンタ94の出力アドレスは、「0x10000」だけ加算された「0x20106」となる。アドレス「0x20106」の下位16ビットは、コード挿入用レジスタセット#0および#1のアドレスレジスタ31に保持されているアドレス「0x00106」,「0x10106」の下位16ビットと一致する。しかし、アドレス「0x20106」の上位4ビット(17ビット目~20ビット目」アドレス[16]~[19])は、コード挿入用レジスタセット#0および#1のアドレスレジスタ156に保持されているアドレス「0x00106」、「0x10106」の上位4ビットと相違する。その結果、アドレス完全一致信号が「L」レベルとなる(アドレス完全一致信号0およびアドレス完全一致信号が「L」レベルとなるため)。さらに、コードレジスタ出力信号が「0x00000」となる。フラッシュ制御コード用ROM13からプログラムカウンタ94の出力アドレス「0x20106」の上位4ビット(17ビット目~20ビット目)を「0」にした「0x00106」のアドレスのオリジナルコードである「R00106」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00106」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力された挿入コード「Code Reg.1」を実行する。
 第5サイクルでは、前サイクルのアドレス完全一致信号が「L」レベルのため、プログラムカウンタ94のセレクタ92が「0x02」を出力する。さらに、アドレス完全一致信号が「L」レベルのため、加算器25の出力アドレスの上位4ビット(17ビット目~20ビット目)が「0」となる。その結果、プログラムカウンタ94の出力アドレスは、「0x00108」となる。また、アドレス「0x00108」の下位16ビットは、アドレスレジスタ31に保持されているアドレス「0x00106」の下位16ビットと相違するため、アドレス完全一致信号が「L」レベルとなり、コードレジスタ出力信号が「0x00000」となる。フラッシュ制御コード用ROM13から「0x00108」のアドレスのオリジナルコードである「R00108」が出力される。コード選択回路14は、アドレス完全一致信号が「L」レベルであるので、オリジナルコード「R00108」を命令実行部15のフェッチ部35に出力する。命令実行部15の実行部36は、1つ前のサイクルでフェッチ部35に出力されたオリジナルコード「R00106」を実行する。
 第6サイクル以降は、第5サイクルと同様に動作する。
 以上のように、本実施の形態によれば、第7の実施形態と同様に、プログラムカウンタのアドレスの最上位から所定個数のビット以外のビットでオリジナルコードのアドレスを指定し、最上位から所定個数のビットを用いてコードの挿入を制御するので、2つのオリジナルコードの間に1個以上のコードの挿入が可能で、かつマルチサイクル命令の実行が可能となる。また、本実施の形態によれば、プログラムカウンタからのアドレスがアドレスレジスタの値と一致した場合、挿入コードの実行をオリジナルコードの後に実行していた第7の実施の形態に対し、挿入コードの実行をオリジナルコードの前に実行する。
 (変形例)
 本発明は、上記の実施形態に固定されるものではない。たとえば、コードレジスタ値を特定の値に固定することとしてもよい。これにより、挿入可能なコード種類は限定されるが、レジスタのサイズを縮小可能である。
 さらに、コードレジスタ値をROMに記憶させてもよいし、または論理回路の組み合わせた回路に記憶させることとしてもよい。特定コマンドのみ(たとえばエラーモニタ用コマンド)のみを挿入できるものとしてもよい。
 また、本実施の形態では、フラッシュメモリ制御部が、汎用のプロセッサにも同様の機能を持たせるようにすることも可能である。また、図6に示されるフラッシュメモリ3とフラッシュメモリ制御部2で一つの半導体基板(チップ)に形成された不揮発性半導体装置が構成されることもある。
 今回開示された実施の形態はすべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲はした説明ではなくて請求の範囲によって示され、請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。
 1 マイクロコンピュータ、2,102,103,312,395,423,623,742 フラッシュメモリ制御部、3 フラッシュメモリ、4 CPU、5 RAM、6 周辺装置、7 A-D変換器、8 D-A変換器、9 アナログ入力端子、10 アナログ出力端子、11 I/Oポート、12,51,65,72,74,91,94 プログラムカウンタ、13 フラッシュ制御コード用ROM、14 コード選択回路、15 命令実行部、16 インタフェースコントローラ、17,52,164,396,399,424,624,743 挿入コードレジスタセットブロック、18 レジスタ選択信号生成回路、21 内部データバス、22,23 内部アドレスバス、24,26,27,33,53,68,73,77,92 セレクタ、25 加算器、28 PC用レジスタ、29-0~29-n,40-0,54-0~54-n,64-0,71-0,78-0,86-0~86-n,88-0~88-n コード挿入用レジスタセット、30,157 アドレス比較器、31,56,156 アドレスレジスタ、32 コードレジスタ、34 ステータスレジスタ、35 フェッチ部、36 実行部、59 挿入エンドレジスタ、273 メインデータバス、OR1,OR2,OR3,OR54,OR68,OR88,OR89,AND1,AND2,AND3,AND4,AND5,AND6,AND54,AND55,AND56,AND71,AND72,AND74,AND88,AND92 論理回路、NEOR1 一致回路。

Claims (17)

  1.  複数のオリジナルコードを記憶したROMと、
     第1の値または第2の値を加算することによって、アドレスを更新するプログラムカウンタと、
     少なくとも1つの挿入コードと、前記挿入コードのアドレスを保持したレジスタと、
     前記プログラムカウンタのアドレスに応じて、前記レジスタ内の前記プログラムカウンタで指定されるアドレスに対応する挿入コードか、前記ROM内の前記プログラムカウンタで指定されるアドレスのオリジナルコードのいずれかを選択する選択回路と、
     前記選択回路で選択されたコードを実行する命令実行部とを備え、
     前記複数のオリジナルコードおよび前記挿入コードのうちの少なくとも1つが、マルチサイクル命令であり、
     前記プログラムカウンタは、マルチサイクル命令の実行時には、アドレスの更新を停止する、マイクロコンピュータ。
  2.  前記ROM内の複数のオリジナルコードのアドレスは、最下位から2ビット目以上のビットが有効であり、
     前記レジスタは、
     前記保持している挿入コードのアドレスの最下位ビットを除くビットと前記プログラムカウンタのアドレスの最下位ビットを除くビットとが一致したときに、第1の信号を出力し、
     前記第1の信号を出力し、かつ前記プログラムカウンタのアドレスの最下位ビットが「1」のときに、第2の信号を出力するとともに、前記保持している挿入コードを出力し、
     前記プログラムカウンタは、前記第1の信号を受けたときに、最下位ビットに「1」を加算し、前記第1の信号を受けないときに、最下位から2番目のビットに「1」を加算し、
     前記選択回路は、前記第2の信号を受けたときに、前記挿入コードを選択し、前記第2の信号を受けなかったときに、前記オリジナルコードを選択する、請求項1に記載のマイクロコンピュータ。
  3.  前記ROM内の複数のオリジナルコードのアドレスは、最下位から2ビット目以上のビットが有効であり、
     前記レジスタは、
     前記保持している挿入コードのアドレスの最下位ビットを除くビットと前記プログラムカウンタのアドレスの最下位ビットを除くビットとが一致したときに、第1の信号を出力し、
     前記第1の信号を出力し、かつ前記保持している挿入コードのアドレスの最下位ビットと前記プログラムカウンタのアドレスの最下位ビットが一致する
    ときに、第2の信号を出力するとともに、前記保持している挿入コードを出力し、
     前記プログラムカウンタは、前記第1の信号を受けたときに、最下位ビットに「1」を加算し、前記第1の信号を受けないときに、最下位から2番目のビットに「1」を加算し、
     前記選択回路は、前記第2の信号を受けたときに、前記挿入コードを選択し、前記第2の信号を受けなかったときに、前記オリジナルコートを選択する、請求項1に記載のマイクロコンピュータ。
  4.  前記ROM内の複数のオリジナルコードのアドレスは、最下位からnビット目以上のビットが有効であり、
     前記レジスタは、
     前記保持している挿入コードのアドレスの最上位ビットを除くビットと前記プログラムカウンタのアドレスの最上位ビットを除くビットとが一致したときに、第1の信号を出力し、
     前記第1の信号を出力し、かつ前記プログラムカウンタのアドレスの最上位ビットが「1」のときに、第2の信号を出力するとともに、前記保持している挿入コードを出力し、
     前記プログラムカウンタは、前記第1の信号を受けたときに、最上位ビットに「1」を加算し、前記第1の信号を受けないときに、最下位からnビット目に「1」を加算し、
     前記選択回路は、前記第2の信号を受けたときに、前記挿入コードを選択し、前記第2の信号を受けなかったときに、前記オリジナルコートを選択する、請求項1に記載のマイクロコンピュータ。
  5.  前記ROM内の複数のオリジナルコードのアドレスは、最下位からnビット目以上かつ最上位ビットを除くビットが有効であり、
     前記レジスタは、
     前記保持している挿入コードのアドレスの最上位ビットを除くビットと前記プログラムカウンタのアドレスの最上位ビットを除くビットとが一致し、かつ前記プログラムカウンタのアドレスの最上位ビットが「1」のときに、第1の信号を出力するとともに、前記保持している挿入コードを出力し、
     前記プログラムカウンタは、前記第1の信号を受けたときに、最上位ビットに「1」を加算し、前記第1の信号を受けないときに、最下位からnビット目に「1」を加算し、かつ最上位ビットを「0」にし、
     前記選択回路は、前記第1の信号を受けたときに、前記挿入コードを選択し、前記第1の信号を受けなかったときに、前記オリジナルコードを選択する、請求項1に記載のマイクロコンピュータ。
  6.  前記ROM内の複数のオリジナルコードのアドレスは、最下位から(n+1)ビット目以上のビットが有効であり、
     前記レジスタは、
     最大で2n-1個の挿入コードと、前記挿入コードのアドレスを保持し、
     前記保持している挿入コードのアドレスの最下位からn個のビットを除くビットと前記プログラムカウンタのアドレスの最下位からn個のビットを除くビットとが一致したときに、第1の信号を出力し、
     前記第1の信号を出力し、かつ前記保持している挿入コードのアドレスの最下位からn個のビットと前記プログラムカウンタのアドレスの最下位からn個のビットとが一致したときに、第2の信号を出力するとともに、前記プログラムカウンタのアドレスに対応する前記保持している挿入コードを出力し、
     前記プログラムカウンタは、前記第1の信号を受けたときに、最下位ビットに「1」を加算し、前記第1の信号を受けなかったときに、最下位から(n+1)番目のビットに「1」を加算し、
     前記選択回路は、前記第2の信号を受けたときに、前記挿入コードを選択し、前記第2の信号を受けなかったときに、前記オリジナルコードを選択する、請求項1に記載のマイクロコンピュータ。
  7.  前記レジスタは、
     複数の挿入コードを連続して挿入するときに最後の挿入コードを出力する場合には、前記第2の信号を出力するとともに、同時に挿入エンドを示す挿入エンド信号を出力する、請求項6に記載のマイクロコンピュータ。
  8.  前記プログラムカウンタは、前記挿入エンド信号を受けたときには、前記第1の信号を受けたときでも、最下位から(n+1)番目のビットに「1」を加算し、最下位からn個のビットを「0」にする、請求項7に記載のマイクロコンピュータ。
  9.  前記プログラムカウンタは、前記挿入エンド信号を受けたときには、最下位からn個のビットを「1」にする、請求項7に記載のマイクロコンピュータ。
  10.  前記ROM内の複数のオリジナルコードのアドレスは、最下位からmビット目以上のビットが有効であり、
     前記レジスタは、
     最大で2n-1個の挿入コードと、前記挿入コードのアドレスを保持し、
     前記保持している挿入コードのアドレスの最上位からn個のビットを除くビットと前記プログラムカウンタのアドレスの最上位からn個のビットを除くビットとが一致したときに、第1の信号を出力し、
     前記第1の信号を出力し、かつ前記保持している挿入コードのアドレスの最上位からn個のビットと前記プログラムカウンタのアドレスの最上位からn個のビットとが一致したときに、第2の信号を出力するとともに、前記プログラムカウンタのアドレスに対応する前記保持している挿入コードを出力し、
     前記プログラムカウンタは、前記第1の信号を受けたときに、最上位からn番目のビットに「1」を加算し、前記第1の信号を受けなかったときに、最下位からm番目のビットに「1」を加算し、
     前記選択回路は、前記第2の信号を受けたときに、前記挿入コードを選択し、前記第2の信号を受けなかったときに、前記オリジナルコードを選択する、請求項1に記載のマイクロコンピュータ。
  11.  前記レジスタは、
     複数の挿入コードを連続して挿入するときに最後の挿入コードを出力する場合には、前記第2の信号を出力するとともに、同時に挿入エンドを示す挿入エンド信号を出力する、請求項10に記載のマイクロコンピュータ。
  12.  前記プログラムカウンタは、前記挿入エンド信号を受けたときには、前記第1の信号を受けたときでも、最下位からm番目のビットに「1」を加算し、かつ最上位からn個のビットを「0」にする、請求項11に記載のマイクロコンピュータ。
  13.  前記ROM内の複数のオリジナルコードのアドレスは、最下位からmビット目以上のビットが有効であり、
     前記レジスタは、
     最大で2n-1個の挿入コードと、前記挿入コードのアドレスを保持し、
     前記保持している挿入コードのアドレスの最上位からn個のビットを除くビットと前記プログラムカウンタのアドレスの最上位からn個のビットを除くビットとが一致し、かつ前記保持している挿入コードのアドレスの最上位からn個のビットと前記プログラムカウンタのアドレスの最上位からn個のビットとが一致したときに、第1の信号を出力するとともに、前記プログラムカウンタのアドレスに対応する前記保持している挿入コードを出力し、
     前記プログラムカウンタは、前記第1の信号を受けたときに、最上位からn番目のビットに「1」を加算し、前記第1の信号を受けなかったときに、最下位からm番目のビットに「1」を加算し、かつ最上位からn個のビットを「0」にし、
     前記選択回路は、前記第1の信号を受けたときに、前記挿入コードを選択し、前記第1の信号を受けなかったときに、前記オリジナルコードを選択する、請求項1に記載のマイクロコンピュータ。
  14.  前記レジスタは、ステータスビットを保持し、
     前記選択回路は、前記ステータスビットの値が第1の値のときに、前記プログラムカウンタのアドレスに係わらず、前記オリジナルコードを選択する、請求項1に記載のマイクロコンピュータ。
  15.  半導体基板に電気的に消去および書込みが可能な不揮発性メモリと、前記不揮発性メモリをアクセス可能な中央処理装置と、前記中央処理装置からのアクセスに従い所定のシーケンスで前記不揮発性メモリの制御を行う不揮発性メモリ制御回路を備え、
    前記不揮発性メモリ制御回路は、
    所定のシーケンスで実行される複数の命令コードがM個の有効ビットで指定されるアドレスに格納されたROMと、
     前記ROMに格納された命令コードを選択するアドレス更新するK(>M)ビット出力のプログラムカウンタと、
     前記所定のシーケンスで実行される複数の命令コードの間に挿入する挿入コードと前記挿入コードの挿入先を示すアドレスを保持したレジスタ回路と、
     前記プログラムカウンタからのアドレスと前記レジスタ回路に保持された挿入コードの挿入先を示すアドレスとの一致検出結果に応じて、前記ROMに格納された命令コードと前記レジスタ回路に保持された挿入コードのいずれかを選択するコード選択回路と、
     前記選択回路で選択されたコードを実行する命令実行部とを備え、
     前記プログラムカウンタは、コード挿入時に前記M個の有効ビット中の最下位ビットへの1ビット加算を前記M個の有効ビット外の出力ビットへの1ビット加算に切り替える加算値選択回路を備え、
     前記命令実行部は、少なくとも1つのマルチサイクル命令を実行可能であり、前記マルチサイクル命令の実行時に前記プログラムカウンタへアドレスの更新停止を指示する、マイクロコンピュータ。
  16.  前記挿入コードの挿入先を示すアドレスを保持したレジスタは、前記プログラムカウンタの出力と同じビット数(Kビット)のビットデータを保持する、請求項15記載のマイクロコンピュータ。
  17.  半導体基板に電気的に消去および書込みが可能な不揮発性メモリと、所定のシーケンスで前記不揮発性メモリの制御を行う不揮発性メモリ制御回路を備え、
    前記不揮発性メモリ制御回路は、
    所定のシーケンスで実行される複数の命令コードがM個の有効ビットで指定されるアドレスに格納されたROMと、
     前記ROMに格納された命令コードを選択するアドレス更新するK(>M)ビット出力のプログラムカウンタと、
     前記所定のシーケンスで実行される複数の命令コードの間に挿入する挿入コードと前記挿入コードの挿入先を示すアドレスを保持したレジスタ回路と、
     前記プログラムカウンタからのアドレスと前記レジスタ回路に保持された挿入コードの挿入先を示すアドレスとの一致検出結果に応じて、前記ROMに格納された命令コードと前記レジスタ回路に保持された挿入コードのいずれかを選択するコード選択回路と、
     前記選択回路で選択されたコードを実行する命令実行部とを備え、
     前記プログラムカウンタは、コード挿入時に前記M個の有効ビット中の最下位ビットへの1ビット加算を前記M個の有効ビットと異なる出力ビットへの1ビット加算に切り替える加算値選択回路を備え、
     前記命令実行部は、少なくとも1つのマルチサイクル命令を実行可能であり、前記マルチサイクル命令の実行時に前記プログラムカウンタへアドレスの更新停止を指示する、不揮発性半導体装置。
PCT/JP2012/055341 2012-03-02 2012-03-02 マイクロコンピュータおよび不揮発性半導体装置 WO2013128624A1 (ja)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN201280071070.5A CN104145247A (zh) 2012-03-02 2012-03-02 微型计算机及非易失性半导体装置
US14/382,159 US20150301935A1 (en) 2012-03-02 2012-03-02 Microcomputer and nonvolatile semiconductor device
PCT/JP2012/055341 WO2013128624A1 (ja) 2012-03-02 2012-03-02 マイクロコンピュータおよび不揮発性半導体装置
JP2014501922A JP5933685B2 (ja) 2012-03-02 2012-03-02 マイクロコンピュータおよび不揮発性半導体装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2012/055341 WO2013128624A1 (ja) 2012-03-02 2012-03-02 マイクロコンピュータおよび不揮発性半導体装置

Publications (1)

Publication Number Publication Date
WO2013128624A1 true WO2013128624A1 (ja) 2013-09-06

Family

ID=49081868

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2012/055341 WO2013128624A1 (ja) 2012-03-02 2012-03-02 マイクロコンピュータおよび不揮発性半導体装置

Country Status (4)

Country Link
US (1) US20150301935A1 (ja)
JP (1) JP5933685B2 (ja)
CN (1) CN104145247A (ja)
WO (1) WO2013128624A1 (ja)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10990384B2 (en) * 2018-09-27 2021-04-27 Intel Corporation System, apparatus and method for dynamic update to code stored in a read-only memory (ROM)
KR102577268B1 (ko) * 2018-10-15 2023-09-12 에스케이하이닉스 주식회사 메모리 장치 및 이의 동작 방법
KR20210012818A (ko) * 2019-07-26 2021-02-03 에스케이하이닉스 주식회사 메모리 장치 및 그 동작 방법

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000259406A (ja) * 1999-03-04 2000-09-22 Nec Corp マイクロプロセッサ及び命令romの誤り訂正方法
JP2004046318A (ja) * 2002-07-09 2004-02-12 Fujitsu Ltd 計算機、集積回路装置、及び計算機における命令実行方法
JP2005134987A (ja) * 2003-10-28 2005-05-26 Seiko Epson Corp パイプライン演算処理装置
JP2011154505A (ja) * 2010-01-27 2011-08-11 Seiko Epson Corp 演算処理装置及び演算実行方法

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE69534396T2 (de) * 1994-11-24 2006-03-16 Sanyo Electric Co., Ltd., Moriguchi Ein-Chip-Mikrorechner mit eingebautem nichtflüchtigem Speicher
US6631454B1 (en) * 1996-11-13 2003-10-07 Intel Corporation Processor and data cache with data storage unit and tag hit/miss logic operated at a first and second clock frequencies
JP2001346170A (ja) * 2000-05-31 2001-12-14 Nec Corp データ挿入強度調整方法及びデータ挿入回路
WO2006085595A1 (ja) * 2005-02-10 2006-08-17 Matsushita Electric Industrial Co., Ltd. プログラム変換装置及びプログラム実行装置
JP2006293663A (ja) * 2005-04-11 2006-10-26 Sanyo Electric Co Ltd メモリアドレス生成装置及びそれを有したプロセッサ、メモリアドレス生成方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000259406A (ja) * 1999-03-04 2000-09-22 Nec Corp マイクロプロセッサ及び命令romの誤り訂正方法
JP2004046318A (ja) * 2002-07-09 2004-02-12 Fujitsu Ltd 計算機、集積回路装置、及び計算機における命令実行方法
JP2005134987A (ja) * 2003-10-28 2005-05-26 Seiko Epson Corp パイプライン演算処理装置
JP2011154505A (ja) * 2010-01-27 2011-08-11 Seiko Epson Corp 演算処理装置及び演算実行方法

Also Published As

Publication number Publication date
JP5933685B2 (ja) 2016-06-15
JPWO2013128624A1 (ja) 2015-07-30
CN104145247A (zh) 2014-11-12
US20150301935A1 (en) 2015-10-22

Similar Documents

Publication Publication Date Title
KR102451950B1 (ko) 융합된 단일 사이클 증가-비교-점프를 수행하기 위한 명령어 및 로직
US6865667B2 (en) Data processing system having redirecting circuitry and method therefor
US7480783B2 (en) Systems for loading unaligned words and methods of operating the same
US20090271593A1 (en) Patching device for patching rom code, method for patching rom code, and electronic device utilizing the same
TW201730751A (zh) 切換影堆疊指標的硬體設備以及方法
US7644223B2 (en) Circuit and method for patching for program ROM
US6891765B2 (en) Circuit and/or method for implementing a patch mechanism for embedded program ROM
JP5933685B2 (ja) マイクロコンピュータおよび不揮発性半導体装置
JP6073392B2 (ja) 命令としてデータ値を評価するシステムおよび方法
US10069512B2 (en) Systems, methods, and apparatuses for decompression using hardware and software
US10437598B2 (en) Method and apparatus for selecting among a plurality of instruction sets to a microprocessor
US7308553B2 (en) Processor device capable of cross-boundary alignment of plural register data and the method thereof
US7290120B2 (en) Microprocessor having a power-saving fetch and decoding unit for fetching and decoding compressed program instructions and having a program instruction sequencer
US7895414B2 (en) Instruction length determination device and method using concatenate bits to determine an instruction length in a multi-mode processor
US9619228B2 (en) Data processor with a load instruction that branches based on a control register value and a bit or bits read from memory
US6363469B1 (en) Address generation apparatus
US8255672B2 (en) Single instruction decode circuit for decoding instruction from memory and instructions from an instruction generation circuit
US7308555B2 (en) Processor-based structure and method for loading unaligned data
JP3588951B2 (ja) マイクロコンピュータのプログラム変更装置
JP2004302827A (ja) マイクロコントローラ
US20060015704A1 (en) Operation apparatus and instruction code executing method
JP2004288203A (ja) プロセッサコア及びこれを用いたプロセッサ
JPH0736694A (ja) 命令フェッチ方式
JPH08161170A (ja) マイクロプロセッサとその制御方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12869828

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2014501922

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 14382159

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12869828

Country of ref document: EP

Kind code of ref document: A1