Abstract:
A program execution device includes: a lookup table storage section that stores a lookup table stipulating a plurality of relations between a plurality of input data and a plurality of output data that are results of operation conducted on the plurality of input data; a program storage section that stores a program including a command directing to obtain one of the output data that is a result of the operation conducted on one of the input data, which is defined by the one of the input data and the operation; and a program execution section having a first cycle of designating the one of the input data in the command to the lookup table in the lookup table storage section, and a second cycle of receiving the one of the output data corresponding to the one of the input data from the lookup table.

Description:
[0001]    The entire disclosure of Japanese Patent Application No. 2007-023823, filed Feb. 2, 2007 is expressly incorporated by reference herein. 
       BACKGROUND 
       [0002]    1. Technical Field 
         [0003]    The invention relates to program execution devices having a program execution unit such as a microprocessor (MPU: Micro Processing Unit) and electronic apparatuses including the program execution device. 
         [0004]    2. Related Art 
         [0005]    A program execution device PE 10  in related art includes, as shown in  FIG. 8 , a MPU  10   a  having registers reg 0  and reg 1 , a MPU  2   a , a ROM  10   b  that stores a program  10   c  to be executed by the MPU  10   a , a ROM  20   b  that stores a program  20   c  to be executed by the MPU  20   a , and a RAM  30  that is a work area to execute the programs  10   c  and  20   c.    
         [0006]    The RAM  30  stores data at each address, as shown in  FIG. 9 , and for example, stores data “14” at an address “0000,” and data “32” at an address “0001.” 
         [0007]    The program  10   c  stored in the RAM  10   b  and the program  20   c  stored in the RAM  20   b  each include a command  9 , and the command  9  stipulates, for example, that M (0001), i.e., data stored at an address “0001” of the RAM  30 , and M (0003), i.e., data stored at an address “0003” of the RAM  30  are to be added, and the result of the addition should be stored at M (M0005), i.e., at an address “0005” of the RAM  30 . 
         [0008]    An execution of the command  9  in the program  10   c  by the MPU  10   a  is composed of four cycles, as shown in  FIG. 11 , namely, (1) Fetch, (2) Decode, (3) Execution, and (4) Write-back. 
         [0009]    (1) In Fetch, as shown in  FIG. 11 , the MPU  10   a  transfers data “32” at an address “0001” of the RAM  30  to the register reg 0  in the MPU  10   a , and also transfers data “54” at an address “0003” of the RAM  30  to the register reg 1  in the MPU  10   a.    
         [0010]    (2) In Decode, the MPU  10   a  decodes “+” (addition operation). 
         [0011]    (3) In Execution, the MPU  10   a  adds the data “32” in the register reg 0  and the data “54” in the register reg 1 , and temporarily stores the result of addition, data “86,” in the register reg 0 . 
         [0012]    (4) In Write-back, the MPU  10   a  stores the data “86” in the register reg 0  to an address “0005” of the RAM  30 . 
         [0013]    However, with the program execution device PE 10  in related art, the MPU  10   a  needs four cycles to execute one command  9 , as described above, and therefore entails a problem in that it takes a long time to process the command  9 . 
         [0014]    Further, as shown in  FIG. 12 , when the MPU  10   a  executes another command  14  in the program  10   c , in other words, when the MPU  10   a  executes the command  14  stipulating that a result of addition (operation 2) of a result of multiplication (operation 1) of data at an address “0001” and data at an address “0002” and data at an address “0003” should be stored at an address “0004,” and when the operation 1 is to be executed by the MPU  20   a  with a scheme for executing the operation 1 at high speeds and adjusting the load between the MPU  10   a  and the MPU  20   a , and the operation 2 is to be executed by the MPU  20   a , the MPU  10   a  must wait the execution of the operation 2 until the MPU  20   a  finishes the execution of the operation 1, as shown in  FIG. 13 . Therefore there is a problem in that, for execution of the command  14 , the execution order of the operation 1 and the operation 2 must be adjusted between the MPU  10   a  and MPU  20   a.    
       SUMMARY 
       [0015]    In accordance with an embodiment of the present invention, a program execution device includes a lookup table storage section that stores a lookup table stipulating a plurality of relations between a plurality of input data and a plurality of output data that are results of operation conducted on the plurality of input data; a program storage section that stores a program including a command directing to obtain one of the output data that is a result of the operation conducted on one of the input data, which is defined by the one of the input data and the operation; and a program execution section having (1) a first cycle of designating the one of the input data in the command to the lookup table in the lookup table storage section, and (2) a second cycle of receiving the one of the output data corresponding to the one of the input data from the lookup table. 
         [0016]    According to the program execution device in accordance with the present embodiment, the program storage section stores the lookup table, such that the program execution section can obtain the one of the output data corresponding to the one of the input data in two cycles, the first cycle and the second cycle. Therefore, the time to process the command can be made shorter, compared to the program execution device in related art that obtains one output data in four cycles. 
         [0017]    In the program execution device in accordance with an aspect of the present embodiment, the lookup table storage section may be comprised of a RAM. 
         [0018]    According to the program execution device in accordance with the aforementioned aspect of the present embodiment, the lookup table storage section is comprised of a RAM, such that the lookup table can be rewritten, and therefore the lookup table can be updated with time. 
         [0019]    In the program execution device in accordance with an aspect of the present embodiment, the RAM may be comprised of a ferroelectric memory. 
         [0020]    According to the program execution device in accordance with the aforementioned aspect of the present embodiment, the RAM is comprised of a ferroelectric memory. Therefore, even when an electrical power supply to the ferroelectric memory is interrupted, the ferroelectric memory continues storing the lookup table stored immediately before the interruption, such that updating of the lookup table does not need to be re-done from the beginning, but can be continued from the moment immediately before the interruption. 
         [0021]    The program execution device in accordance with an aspect of the present embodiment may have a plurality of the lookup table storage sections, and therefore has a function to perform simultaneous parallel executions of independent operations. 
         [0022]    The program execution device in accordance with an aspect of the present embodiment may be equipped with a function of independently, directly inputting table values to be placed in the lookup table storage section, independently of the program execution section, and has a function of optionally, directly rewriting table values in the lookup table storage section. 
         [0023]    The program execution device in accordance with an aspect of the present embodiment may be equipped with a function of independently operating and inputting table values to be placed in the lookup table storage section, independently of the program execution section, and has a function of optionally, directly rewriting table values in the lookup table storage section with operation resultant values. 
         [0024]    An electronic apparatus in accordance with an embodiment of the invention includes the program execution device described above. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0025]      FIG. 1  is a schematic diagram of the structure of a program execution device in accordance with Embodiment Example 1 of the invention. 
           [0026]      FIG. 2  is a figure showing contents of a lookup table in accordance with Embodiment Example 1. 
           [0027]      FIGS. 3A and 3B  are figures showing operations of the program execution device in accordance with Embodiment Example 1. 
           [0028]      FIG. 4  is a schematic diagram of the structure of a program execution device in accordance with Embodiment Example 2. 
           [0029]      FIG. 5  is a figure showing changes of lookup tables in accordance with Embodiment Example 2. 
           [0030]      FIG. 6  is a schematic diagram of the structure of a program execution device in accordance with Embodiment Example 3. 
           [0031]      FIG. 7  is a figure showing renewal of a lookup table in accordance with Embodiment Example 3. 
           [0032]      FIG. 8  is a schematic diagram of the structure of a program execution device in related art. 
           [0033]      FIG. 9  is a figure showing contents of a RAM in related art. 
           [0034]      FIG. 10  is a figure showing contents of a program in related art. 
           [0035]      FIG. 11  is a figure showing cycles of executing the program in related art. 
           [0036]      FIG. 12  is a figure showing contents of another program in related art. 
           [0037]      FIG. 13  is a figure showing execution of the other program in related art. 
       
    
    
     DESCRIPTION OF EXEMPLARY EMBODIMENTS 
       [0038]    Program execution devices in accordance with preferred embodiments of the invention are described below with reference to the accompanying drawings. 
       Embodiment Example 1 
       [0039]    Structure 
         [0040]      FIG. 1  shows the structure of a program execution device PE 1  in accordance with Embodiment Example 1. The program execution device PE 1  includes a MPU  1   a , a ROM  1   b , a storage section  2   a  and a RAM  3 , as shown in  FIG. 1 . 
         [0041]    The MPU  1   a  is a “program execution section,” and executes a program  1   c  stored in the ROM  1   b.    
         [0042]    The ROM  1   b  is a “program storage section,” and stores a program  1   c  including a command  9  and a command  14  to be executed by the MPU  1   a , like the ROM  10   b  of related art shown in  FIG. 10  and  FIG. 12 . 
         [0043]    The storage section  2   a  is a “lookup table storage section,” and stores a lookup table  1   b  to be referred to by the MPU  1   a  when executing the program  1   c . As shown in  FIG. 2 , the lookup table  2   b  has an input  1  terminal that receives a designation of input data as “input  1 ,” an input terminal  2  that receives a designation of input data as “input  2 ,” an operation terminal that receives a designation of the kind of “operation” (addition, subtraction, multiplication, or division), and an output terminal that externally provides output data as an output that is a result obtained by conducting the “operation” on input data designated as the “input  1  ” and input data designated as the “input  2 .” 
         [0044]    Upon receiving designations of input data and the kind of operation at the input  1  terminal, the input terminal  2  and the operation terminal of the lookup table  2   b , respectively, the storage section  2   a  outputs output data specified by the input data and the kind of operation on the lookup table  2   b  from the output terminal (first cycle). When the output data appears at the output terminal of the lookup table  2   b , the MPU  1   a  writes the output data to the RAM  3  (second cycle). 
         [0045]    The RAM  3  is a work area where the MPU  1   a  executes the program  1   c , and is used for storing data at each address, like the RAM  30  in related art shown in  FIG. 9 . More specifically, the RAM  3  is used for storing the input data and the output data after the operation. 
         [0046]    Operation 
         [0047]    Operations of the program execution device in accordance with Embodiment Example 1 are described. For easier explanation and understanding, it is assumed that the RAM  3  stores data at each address shown in  FIG. 9 , and the MPU  1   a  executes the command  9  shown in  FIG. 10 . 
         [0048]    The first cycle: According to the command  9  in the program  10   c , in other words, for “M (0001)+M (0003)→M (0005),” the MPU  1   a  designates data “32” stored at the address “0001” of the RAM  3  to the input  1  terminal of the lookup table  2   b , designates data “54” stored at the address “0003” of the RAM  3  to the input terminal  2  of the lookup table  2   b , and designates an addition operation “+” to the operation terminal of the lookup table  2   b , as shown in  FIGS. 3A and 3B . When “32 is designated to the input  1  terminal, “54” is designated to the input terminal  2 , and the “+” is designated to the operation terminal, the lookup table  2   b  outputs a result of addition “86” to the output terminal, as shown in  FIG. 3A . 
         [0049]    Second cycle: As shown in  FIGS. 3A and 3B , the MPU  1   a  transfers the result of addition “86” outputted at the output terminal of the lookup table  2   b  to an address “0005,” and writes the result of addition “86” to the address “0005.” 
         [0050]    Effects 
         [0051]    As described above, according to the program execution device PE 1  of Embodiment Example 1, the storage section  2   a  stores the lookup table  2   b  that stipulates relations between inputs  1 , inputs  2 , operations, and outputs that are results of the operations rendered on the inputs  1  and inputs  2 , and the MPU  1   a  executes the command  9  that includes one of the inputs  1 , one of the inputs  2  and one of the operations through referring to the lookup table  2   b , whereby the execution of the command  9  is completed in two cycles. Accordingly, the time for processing the command  9  can be shortened, compared to the program execution device PE 10  of related art, as shown in  FIG. 11 , which completes the execution of a command  9  in four cycles. 
         [0052]    According to the program execution device PE 1  of Embodiment Example 1, only the MPU  1   a  alone executes the program  1   c , and it is not required for two MPUs  10   a  and  20   a  to work together to execute one program  10   c , like the related art, whereby complexities, such as, adjustment of the order of executions of operation between the two MPUs  10   a  and  20   a  can be avoided. 
       Embodiment Example 2 
       [0053]    Structure 
         [0054]      FIG. 4  shows the structure of a program execution device PE 2  in accordance with Embodiment Example 2. It is clear from the comparison between the program execution device PE 1  of Embodiment Example 1 shown in  FIG. 1  and the program execution device PE 2  of Embodiment Example 2 shown in  FIG. 4  that the program execution device PE 2  in accordance with Embodiment Example 2 includes a MPU  1   a , a ROM  1   b , a program  1   c  and a RAM  3 , like the program execution device PE 1  of Embodiment Example 1, and on the other hand includes a RAM  4   a  that is a rewritable memory and a lookup table  4   b , instead of the storage section  2   a  and the lookup table  2   b , for processing (for example, rendering correction of saturation and luminosity on), for example, images of a changing object to be photographed (for example, scenes and person), which is different from the program execution device PE 1  of Embodiment Example 1. 
         [0055]    In order to change the contents of processing to be rendered on the photographed image according to the contents of the change in the object, in other words, in order to change the result to be obtained by executing the command  9 , the lookup table  4   b  stored in the RAM  4   a  is changed to a lookup table  4   b  (1), a lookup table  4   b  (2) and a lookup table  4 B (3) in an arbitrary order or in a regular order (for example, cyclically), which have mutually different contents (“weight” values to be described below), as indicated in  FIG. 5 . 
         [0056]    The lookup tables  4   b  (1),  4   b  (2) and  4   b  (3) each stipulate an “addition with weighting” in which a result of input  1  weighted by a weight  1  and a result of input  2  weighted by a weight  2  are added, more correctly, stipulate relations between inputs  1 , inputs  2 , a weight  1 , a weight  2  and outputs that are results of addition. The lookup tables  4   b  (1),  4   b  (2) and  4   b  (3) have mutually different values in the weight  1  and the weight  2 . The weight  1  and the weight  2  are 0.5 and 0.5 in the lookup table  4   b  (1), 1.0 and 0 in the lookup table  4   b  ( b ), and 0 and 1.0 in the lookup table  4   b  (3). 
         [0057]    Operation 
         [0058]    Operations of the program execution device in accordance with Embodiment Example 2 are described. For easier explanation and understanding, it is assumed that the MPU  1   a  executes a command  32  (not shown) that specifies an addition “3+2” through referring to the lookup table  4   b.    
         [0059]    In the program execution device PE 2  in accordance with Embodiment Example 2, the RAM  4   a  initially stores, for example, a lookup table  4   b  (1) with a weight  1 =0.5 and a weight  2 =0.5, as the lookup table  4   b , as shown in  FIG. 5  (1). The MPU  1   a  executes the command  32  through referring to the lookup table  4   b  (1), and renders its execution result “2.5,” as a processing content to be rendered on the object, on an image of the object. 
         [0060]    Then, the MPU  1   a  changes the weight  1  from 0.5 to 1.0, and the weight  2  from 0.5 to 0 according to the change in the object, as indicated in  FIG. 5  (2), thereby changing the lookup table  4   b  (1) to the lookup table  4   b  (2), then executes the command  32  through referring to the lookup table  4   b  (2) in a similar manner as described above, and renders its execution result “3” on the image of the object. 
         [0061]    Further, the MPU  1   a  changes the weight  1  from 1.0 to 0, and the weight  2  from 0 to 1.0 according to the change in the object, as indicated in  FIG. 5  (3), thereby changing the lookup table  4   b  (2) to the lookup table  4   b  (3), then executes the command  32  through referring to the lookup table  4   b  (3) in a similar manner as described above, and renders its execution result “2” on the image of the object. 
         [0062]    Effect 
         [0063]    As described above, in the program execution device PE 2  in accordance with Embodiment Example 2, the lookup table  4   b  is sequentially changed from the lookup table  4   b  (1), to the lookup table  4   b  (2) and to the lookup table  4   b  (3), in other words, the lookup table  4   b  is updated, according to changes in the object that is photographed, such that the execution result of the command  32 , which is the content of a processing to be rendered on the image of the object, can be changed according to changes in the object. 
       Embodiment Example 3 
       [0064]    Structure 
         [0065]      FIG. 6  shows the structure of a program execution device PE 3  in accordance with Embodiment Example 3. As shown in  FIG. 6 , the program execution device PE 3  in accordance with Embodiment Example 3 includes a MPU  1   a , a ROM  1   b , a program  1   c  and a RAM  3 , like the program execution devices PE 1  and PE 2  of Embodiment Example 1 and Embodiment Example 2, and on the other hand includes a FeRAM  5   a  that is a ferroelectric memory having nonvolatility and a lookup table  5   b , instead of the storage section  2   a  and the lookup table  2   b , and the RAM  4   a  and the lookup table  4   b , which are different from the program execution devices PE 1  and PE 2  of Embodiment Example 1 and Embodiment Example 2. 
         [0066]    The lookup table  5   b  stored in the FeRAM  5   a  stipulates, as shown in  FIG. 7 , an “addition with weighting” similar to that of the lookup table  4   b  of Embodiment Example 2, and is sequentially changed from a lookup table  5   b  (1), to a lookup table  5   b  (2), to a lookup table  5   b  (3), to a lookup table  5   b  (4), . . . , etc., according to changes in the object that is photographed. By this, the MPU  1   b  would change its execution result of a command, which is the content of a processing to be rendered on the image of the object, even with the same command, like Embodiment Example 2. 
         [0067]    Operation 
         [0068]    Operations of the program execution device in accordance with Embodiment Example 3 are described. For easier explanation and understanding, it is assumed that the MPU  1   a  executes a command  32  (not shown) that specifies an addition “3+2” through referring to the lookup table  4   b , like Embodiment Example 2. 
         [0069]    In the program execution device PE 3  in accordance with Embodiment Example 3, the FeRAM  5   a  initially stores a lookup table  5   b  (1) with a weight  1 =0.5 and a weight  2 =0.5, as the lookup table  5   b , as shown in  FIG. 7  (1). The MPU  1   a  executes the command  32  through referring to the lookup table  5   b  (1), and renders its execution result “2.5” on an image of the object. 
         [0070]    Then, the MPU  1   a  changes the weight  1  from 0.5 to 0.6, and the weight  2  from 0.5 to 0.4 according to the change in the object, as indicated in  FIG. 7  (2), thereby changing the lookup table  5   b  (1) to the lookup table  5   b  (2), then executes the command  32  through referring to the lookup table  5   b  (2), and renders its execution result “2.6” on the image of the object. 
         [0071]    Then, the MPU  1   a  changes the lookup table  5   b  (2) to the lookup table  5   b  (3) according to the change in the object, as indicated in  FIG. 7  (3), then executes the command  32  through referring to the lookup table  5   b  (3), and renders its execution result “2.7” on the image of the object. 
         [0072]    If the power supply (electrical power supply) to the program execution device PE 3  is unexpectedly interrupted at the time when the execution of the command  32  is completed through referring to the lookup table  5   b  (3), the FeRAM  5   a  with nonvolatility would continue storing the lookup table  5   b  (3) that is stored immediately before the interruption of the power supply. As a result, as indicated in  FIG. 7  (4), at the time of restart, in other words, when the power supply is restored, the MPU  1   a  can execute the command  32  through referring to the lookup table  5   b  (3) stored immediately before the power supply interruption, but not through referring to the initial lookup table  5   b  (1). 
         [0073]    Furthermore, the MPU  1   a  can make an update, based on the lookup table  5   b  (3) at the time of restart, and according to a later change in the object to be photographed, to a lookup table  5   b  (4). 
         [0074]    Also, by preparing a plurality of lookup tables, an appropriate one of the lookup tables can be freely selected according to changes in an object, such that multiple references may be made at once, and multiple operations may be simultaneously processed. 
         [0075]    Effect 
         [0076]    As described above, in the program execution device PE 3  in accordance with Embodiment Example 3, the lookup table  5   b  to be referred to when the MPU  1   a  executes the command  32  is stored in the FeRAM  5   a  having nonvolatility. Therefore, even when the power supply to the program execution device PE 3  is unexpectedly interrupted, whereby the power supply to the FeRAM  5   a  is shut off, the lookup table  5   b  (3) stored immediately before the interruption of the power supply continues to be stored. Accordingly, when the power supply is restored at the time of restart, the MPU  1   a  can execute the program  1   c  through referring to the lookup table  5   b  (3) in which updates by rewriting have progressed, but not through going back to the initial state and referring to the initial lookup table  5   b  (1), and may further quickly update the lookup table  5   b  to the lookup table  5   b  (4) according to the lookup table  5   b  (3) and a later change in the object. Also, multiple references to the lookup tables may be combined for making an update, and such multiple references may be simultaneously executed, whereby different plural similar effects can be obtained. 
       Embodiment Example 4  
       [0077]    An electronic apparatus that includes a program execution device in accordance with an embodiment of the invention is described. Embodiment examples of the electronic apparatus include one of the program execution devices PE 1 -PE 3  in accordance with Embodiment Examples 1-3, and may be, for example, computers, cellular phones, digital cameras, digital TV apparatuses, automobiles, robots, and controller apparatuses. In the electronic apparatus, the MPU  1   a  described above executes commands in a program  1   c  that stipulate processings (for example, data processing, communication processing and image processing) to be performed by the electronic apparatus, in a similar manner as described above, through referring to the lookup table  2   b  stored in the storage section  2   a , the lookup table  4   b  stored in the RAM  4   a  or the lookup table  5   b  stored in the FeRAM  5   a , whereby effects similar to those described above can be obtained.