WO2019065302A1 - 車載マルチコア制御用データ伝達装置および電子制御装置 - Google Patents

車載マルチコア制御用データ伝達装置および電子制御装置 Download PDF

Info

Publication number
WO2019065302A1
WO2019065302A1 PCT/JP2018/034137 JP2018034137W WO2019065302A1 WO 2019065302 A1 WO2019065302 A1 WO 2019065302A1 JP 2018034137 W JP2018034137 W JP 2018034137W WO 2019065302 A1 WO2019065302 A1 WO 2019065302A1
Authority
WO
WIPO (PCT)
Prior art keywords
bank
memory
bank memory
memories
writing
Prior art date
Application number
PCT/JP2018/034137
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 JP2019544584A priority Critical patent/JP6873256B2/ja
Priority to US16/647,807 priority patent/US11836547B2/en
Publication of WO2019065302A1 publication Critical patent/WO2019065302A1/ja

Links

Images

Classifications

    • 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • 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/3004Arrangements for executing specific machine instructions to perform operations on memory
    • FMECHANICAL ENGINEERING; LIGHTING; HEATING; WEAPONS; BLASTING
    • F02COMBUSTION ENGINES; HOT-GAS OR COMBUSTION-PRODUCT ENGINE PLANTS
    • F02DCONTROLLING COMBUSTION ENGINES
    • F02D45/00Electrical control not provided for in groups F02D41/00 - F02D43/00
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • G06F15/163Interprocessor communication
    • G06F15/167Interprocessor communication using a common memory, e.g. mailbox
    • 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/30098Register arrangements
    • G06F9/30101Special purpose registers
    • 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/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/52Indexing scheme relating to G06F9/52
    • G06F2209/521Atomic

Definitions

  • the present invention relates to an on-board multi-core control data transmission device and an electronic control device applicable to engine fuel control and the like.
  • a set of data may be transmitted from a sender CPU to a receiver CPU while securing the synchronization.
  • some protection mechanism is not set, a phenomenon may occur in which the sender's CPU rewrites other data in the data set while the receiver's CPU reads part of the data in the data set. This is because a plurality of CPUs each have their own execution code and basically operate asynchronously.
  • spin lock control using a lock variable has been known conventionally. This is to use an atomic variable check and write instruction such as a test and set instruction to lock a specific lock variable with an in-use key, and only the keyed CPU can access a specific memory area. It is an interprocessor exclusive control system that can be accessed.
  • the execution section related to resources for performing inter-processor exclusion control in spin lock control is not a parallel execution section but a serial execution section for a multi-core. Therefore, the longer the serial execution time, the lower the parallel execution performance as viewed as a whole of the multi-core according to Amdal's law.
  • Amdal's law is a phenomenon in which, when using multiple processors and trying to speed up a program by parallel computation, speeding up is limited by the time of the part of the program that must be executed sequentially.
  • the method to lower the memory granularity is opposite in motivation, and the upper limit number of lock variables that can be set is determined due to the constraints of the system and multi-core OS, and copying values for different locks with the same variable Since the management becomes complicated, the lock granularity tends to be large in design. In extreme terms, it is better to treat the global variable as a whole lock unit rather than using a lot of fine-grained locks. (This is called a giant lock.) Therefore, as a result of this method, the number of CPUs that lock the lock increases, and the lock waiting time tends not to be overlooked.
  • Patent Document 1 considers that the CPU of the data sender is a server, and the CPU of the receiver is a client, thereby exchanging data according to the server-client model.
  • the receiver's CPU writes a data request command in the notification area (shared memory), the sender CPU interprets the command, writes the requested data in the receiver's assigned area (shared memory), and completes the command Rewrite to the existing value.
  • the scheme is broken if the request frequency of the receiver's CPU and the data generation frequency of the sender's CPU are not completely synchronized, which is a complete handshake operation.
  • the receiver can not appropriately read over the same data when the request frequency of the receiver is large, or can not appropriately skip the data when the data generation frequency of the sender is large. This becomes a burden in an asynchronous inter-CPU data exchange system. (The exchange of data is not loose coupling.)
  • the server-client model is a remote calling method for the CPU (sender's CPU) to which the object to be operated belongs. Therefore, it is necessary to interrupt the operation of the CPU (sender's CPU) that generates the data, and the CPU (the receiver's CPU) that requested the operation also has to wait for the operation completion notification. Real-time performance gets worse.
  • the present invention has been made in view of the above circumstances, and an object thereof is data in which the synchronization is secured while improving the real time processing of processing by the core even when the core in the multi-core system operates asynchronously.
  • An object of the present invention is to provide an on-board multi-core control data transmission device and an electronic control device capable of transmitting a set between cores.
  • an on-vehicle multi-core control data transmission device comprises M (M is an integer of 2 or more) bank memories and N (N is 2 or more) accessible to the bank memory.
  • Data transfer device for on-board multi-core control provided with (an integer number of) processors, wherein the M bank memories are arranged, and a shared memory accessible from the N processors and the bank memory are specified
  • an access control unit for controlling access from the processor to the bank memory based on identification information.
  • FIG. 1 is a block diagram showing the hardware configuration of the multi-core control device according to the embodiment.
  • FIG. 2 is a block diagram showing a configuration example of a fuel injection system of an engine to which the electronic control unit according to the embodiment is applied.
  • FIG. 3A shows the data structure of a single precision floating point number applicable to the data transfer apparatus according to the embodiment, and FIG. 3B is applicable to the data transfer apparatus according to the embodiment
  • FIG. 3C is a diagram showing a data structure of a double precision floating point number
  • FIG. 3C is a diagram showing a method of assigning bits of the data structures of FIG. 3A and FIG. 3B.
  • FIG. 4 is a flowchart showing a spin lock control method according to a comparative example of the embodiment.
  • FIG. 4 is a flowchart showing a spin lock control method according to a comparative example of the embodiment.
  • FIG. 5 is a flowchart showing the relationship between spin lock control and interrupt prohibition according to a comparative example of the embodiment.
  • FIG. 6 is a block diagram showing an example of the configuration of the data transfer apparatus according to the embodiment.
  • FIG. 7 is a flowchart showing the read procedure of the data transfer apparatus according to the embodiment.
  • FIG. 8 is a flow chart showing a write procedure of the data transfer apparatus according to the embodiment.
  • FIG. 9 is a flowchart showing a data transmission procedure when the data transmission device according to the embodiment is applied to a fuel injection system of an engine.
  • FIG. 10 is a sequence diagram showing a data transmission method in time series when the data transmission device according to the embodiment is applied to a fuel injection system of an engine.
  • FIG. 10 is a sequence diagram showing a data transmission method in time series when the data transmission device according to the embodiment is applied to a fuel injection system of an engine.
  • FIG. 11 (a) is a diagram showing the occupancy relationship between the write core and the scratch pad memory of the data transfer device according to the embodiment
  • FIG. 11 (b) is each scratch pad memory of the data transfer device according to the embodiment. It is a figure showing how to assign a function to the core of.
  • FIG. 12 is a diagram showing the relationship between the number of banks and the number of cores of the scratch pad memory of the data transfer apparatus according to the embodiment.
  • FIG. 1 is a block diagram showing the hardware configuration of the multi-core control device according to the embodiment.
  • achieved the fuel control apparatus of the engine by 2 cores was taken as an example.
  • the fuel control device is provided with central processing units (CPUs) 100 and 110, an execution code storage area storing execution codes 101 and 111, local random access memories (RAMs) 102 and 112, and a shared RAM 120. It is done.
  • CPUs central processing units
  • RAMs local random access memories
  • An air flow meter 103, a pressure sensor 104, a throttle sensor 105, and a rotational speed sensor 106 are connected to the CPU 100 as sensor inputs.
  • the air flow meter 103 outputs a sensor value for calculating the air intake amount Q.
  • the pressure sensor 104 outputs a sensor value for calculating the intake pipe pressure P.
  • the throttle sensor 105 outputs a sensor value for calculating the throttle opening degree ⁇ .
  • the rotation speed sensor 106 outputs a sensor value for calculating the engine rotation speed Ne.
  • a fuel injection amount instruction device 113 is connected to the CPU 110 as an actuator output.
  • the fuel injection amount instruction device 113 outputs a fuel injection amount q of the engine.
  • the CPU 100 is mainly in charge of processing of sensor input, and executes processing using the execution code 101 and the local RAM 102.
  • the local RAM 102 is a memory resource accessible only by the CPU 100.
  • the CPU 110 is mainly in charge of numerical operation and output actuator operation, and executes processing using the execution code 111 and the local RAM 112.
  • the local RAM 112 is a memory resource accessible only by the CPU 110.
  • a shared RAM 120 is connected to the CPUs 100 and 110 via a bus 107 as commonly accessible resources.
  • the shared RAM 120 there is provided a storage area for data that needs to be disclosed from one CPU 100 or 110 to the other CPU 110 or 100 in order to establish control as a whole.
  • the CPU disclosure data 121 and 122 are stored in this storage area.
  • an air intake amount Q, an intake pipe pressure P, a throttle opening degree ⁇ , and an engine speed Ne can be set.
  • the fuel injection amount q can be set in the CPU disclosure data 122.
  • FIG. 2 is a block diagram showing a configuration example of a fuel injection system of an engine to which the electronic control unit according to the embodiment is applied.
  • FIG. 2 shows three methods mainly used in the fuel injection system. 2A shows the mass flow method, FIG. 2B shows the speed density method, and FIG. 2C shows the ⁇ -N method.
  • an intake pipe 202 is connected to the engine 203, and a fuel injection device 205 is connected to the intake pipe 202.
  • a throttle chamber 201 is provided upstream of the intake pipe 202.
  • the engine 203 is provided with a rotational speed sensor 106.
  • the fuel injection system is provided with an ECU (Electronic Control Unit) 204 that performs fuel control.
  • the ECU 204 can include the CPUs 100 and 110 of FIG. 1, an execution code storage area in which the execution codes 101 and 111 are stored, the local RAMs 102 and 112, and the shared RAM 120.
  • an air flow meter 103 is provided upstream of the throttle chamber 201. Then, a sensor value for calculating the intake air amount Q is input from the air flow meter 103 and a sensor value for calculating the engine rotational speed Ne is input from the rotational speed sensor 106 to the CPU 100 of the ECU 204. Then, in the CPU 100, the intake air amount Q and the engine speed Ne are calculated from these sensor values and stored in the shared RAM 120.
  • the intake air amount Q and the engine speed Ne are read out from the shared RAM 120. Then, the fuel injection amount q is calculated as q ⁇ Q / Ne.
  • the pressure sensor 104 is provided in the intake pipe 202. Then, a sensor value for calculating the intake pipe pressure P is input from the pressure sensor 104, and a sensor value for calculating the engine rotational speed Ne is input from the rotational speed sensor 106 to the CPU 100 of the ECU 204. Then, in the CPU 100, the intake pipe pressure P and the engine speed Ne are calculated from these sensor values and stored in the shared RAM 120.
  • the intake pipe pressure P and the engine speed Ne are read from the shared RAM 120. Then, the fuel injection amount q is calculated as q ⁇ f 1 (P, Ne).
  • f 1 () is a function determined from the engine characteristics.
  • the throttle sensor 105 is provided in the throttle chamber 201. Then, a sensor value for calculating the throttle opening degree ⁇ is input from the throttle sensor 105, and a sensor value for calculating the engine rotational speed Ne is input from the rotational speed sensor 106 to the CPU 100 of the ECU 204. Then, in the CPU 100, the throttle opening degree ⁇ and the engine speed Ne are calculated from these sensor values and stored in the shared RAM 120.
  • the throttle opening degree ⁇ and the engine rotational speed Ne are read from the shared RAM 120. Then, the fuel injection amount q is calculated as q ⁇ f 2 ( ⁇ , Ne).
  • f 2 () is a function determined from the engine characteristics.
  • the data set ⁇ Q, P, ⁇ , Ne ⁇ calculated by the CPU 100 that performs sensor input processing is used by the CPU 2 that calculates the fuel injection amount q
  • the data set ⁇ Q, P, ⁇ , Ne ⁇ It is important that each value of is data obtained from sensor values measured at almost the same time. This relationship is called data set synchronization. Synchronization between data in this data set is called macroscopic synchronization. If the simultaneity of this data set is broken, the calculation accuracy of the fuel injection amount q according to the data set ⁇ Q, P, ⁇ , Ne ⁇ is reduced.
  • the CPU 110 reads the intake air amount Q of the CPU disclosure data 121
  • the CPU 100 arbitrarily sets the engine rotation speed Ne of the CPU disclosure data 121 to another value. Rewriting causes the CPU 110 to lose the simultaneousness of the intake air amount Q and the engine speed Ne. At this time, the fuel injection amount q calculated as q ⁇ Q / Ne becomes incorrect control data. Therefore, in a multi-core system, it is necessary to ensure the simultaneousness of data sets and to be careful not to break the simultaneousness of data sets.
  • FIG. 3A shows the data structure of a single precision floating point number applicable to the data transfer apparatus according to the embodiment
  • FIG. 3B is applicable to the data transfer apparatus according to the embodiment
  • FIG. 3C is a diagram showing a data structure of a double precision floating point number
  • FIG. 3C is a diagram showing a method of assigning bits of the data structures of FIG. 3A and FIG. 3B.
  • the ascending order of address is taken on the vertical axis.
  • the data is stored in the big endian format in the order of data storage, and conforms to the IEEE 754 standard (IEEE Standard for Floating-Point Arithmetic (ANSI / IEEE Std 754-2008)).
  • IEEE 754 standard IEEE Standard for Floating-Point Arithmetic (ANSI / IEEE Std 754-2008)
  • FIG. 3A shows 4-byte single precision data 301.
  • FIG. 3B shows 8-byte double precision data 302.
  • s represents a sign bit
  • e represents a bit of the exponent
  • f represents a bit of the mantissa.
  • single precision data 301 (or double precision data 302) is a single numerical value
  • rewriting of the numerical value is performed for each byte mapped to an address. Therefore, if single precision data 301 (or double precision data 302) is accessed while part of single precision data 301 (or double precision data 302) is partially rewritten, it makes sense as data. There are no numbers taken.
  • Data in a data structure that spans multiple bytes must be fetched after rewriting of all bytes of data. Also, while the reader is reading the data, do not rewrite some bytes of that data. Consistent synchronization between bytes in one piece of data that has a data structure that spans multiple bytes is called microscopic synchronization.
  • FIG. 4 is a flowchart showing a spin lock control method according to a comparative example of the embodiment.
  • FIG. 4 shows the case where the spin lock control method is used to perform inter-CPU exclusive control.
  • the CPU reads a lock variable (S401).
  • S401 lock variable
  • the lock variable is secured on the shared memory in the same manner as the exclusive control shared resource.
  • this lock variable is tested and it is checked whether it is released (whether the value is zero) (S402). If the lock variable is released, the CPU acquires the lock variable and writes a value to the lock variable (S403). If the lock variable is not released, the process returns to S401, the CPU reads the lock variable again, and repeats the test.
  • This operation is called a spin lock because the loop operation reads the variable and continues testing while waiting until the lock variable is released.
  • the series of operations of S401, S402 and S403 are implemented using an atomic instruction B400 such as a test and set instruction.
  • An atomic instruction is an indivisible complex instruction set in which one CPU can not interfere with another CPU while executing an instruction.
  • FIG. 5 is a flowchart showing the relationship between spin lock control and interrupt prohibition according to a comparative example of the embodiment.
  • FIG. 5 shows the nesting relationship between the spin lock control and the interrupt disabled section shown in FIG.
  • the in-processor exclusive control section B500 is provided with interrupt prohibition (S501) and interrupt permission (S505).
  • the section sandwiched by the interrupt prohibition (S501) and the interrupt permission (S505) is an interrupt prohibition section.
  • the interprocessor exclusive control section B510 is provided in this interrupt prohibited section. In the interprocessor exclusive control section B510, when the CPU acquires a lock (S502), the CPU accesses a shared resource (S503), and then the CPU releases the lock (S504).
  • the interprocessor exclusive control B510 is included in the in-processor exclusive control B500, and this nesting relationship is maintained. By maintaining this nesting relationship, the CPU can not perform interrupt control until a certain CPU acquires the lock and then releases the lock. This is because interrupt control is performed at the convenience of the CPU, and therefore should not be included in the quantitative relationship between lock execution time and waiting time between multiple CPUs.
  • the lock waiting time increases as the number of CPUs waiting for the lock increases.
  • This lock latency increases proportionally to the number of CPUs waiting for locks in the best way and exponentially in the worst case.
  • a method for making the increase in lock latency proportional to the number of CPUs is called a scalable method for the number of CPUs. In this approach, CPU requests waiting for locks are stored in a queue, and lock rights are granted in the order of requests.
  • the inter-processor exclusive control B 510 that performs lock waiting is located in the intra-processor exclusive control B 500 that prohibits an interrupt. Therefore, when the lock waiting time (S502 to S504) increases, the interrupt prohibiting time (S501 to S505) also inevitably increases.
  • the interrupt prohibition time also increases as the number of CPUs increases.
  • the increase in interrupt disable time leads to the failure of hard real-time control in automotive applications. If the number of CPUs is limited in order to prevent the failure of hard real-time control, it becomes difficult to increase the processing performance of the ECU 204.
  • FIG. 6 is a block diagram showing an example of the configuration of the data transfer apparatus according to the embodiment.
  • the CPU can be used as a processor.
  • the processor may be a micro processing unit (MPU) or a digital signal processor (DSP).
  • the data transfer apparatus includes five bank memories B [1] to B [5] and a write core 601 and a read core 602 capable of accessing these bank memories B [1] to B [5]. -1, 602-2, 602-3 are provided.
  • the write core 601 can be provided in a CPU used for writing.
  • the read cores 602-1, 602-2 and 602-3 can be provided in a CPU used for reading.
  • the bank memories B [1] to B [5] can be provided in the shared memory 610.
  • the shared memory 610 is accessible from the write core 601 and the read cores 602-1, 602-2, 602-3.
  • the bank memories B [1] to B [5] can be configured to have the same variable contents and the same offset address from the beginning.
  • Bank numbers # 1 to # 5 are added to the bank memories B [1] to B [5] as identification information for specifying the bank memories B [1] to B [5].
  • the scratch pad memory 611 can be configured by putting together the bank memories B [1] to B [5].
  • the scratch pad memory 611 can be used to temporarily transfer data.
  • the scratch pad memory 611 is a name when referring to a bank memory group, that is, bank memories B [1] to B [5] collectively.
  • an access control unit 603 is provided in the data transmission device.
  • the access control unit 603 generates the banks from the write core 601 and the read cores 602-1, 602-2, and 602-3 based on the bank numbers # 1 to # 5 specifying the bank memories B [1] to B [5]. Control access to the memories B [1] to B [5]. At this time, the access control unit 603 can manage using the bank numbers # 1 to # 5 in which the target bank memories B [1] to B [5] are associated.
  • the access control unit 603 allocates only one write core 601 to the bank memories B [1] to B [5] to which writing is performed.
  • One or more read cores 602-1, 602-2 and 602-3 are allocated to the bank memories B [1] to B [5] to be read.
  • the bank memory B [1] is set so that the bank memories B [1] to B [5] being written to are not identical to the bank memories B [1] to B [5] being read.
  • the access to ⁇ B [5] can be controlled exclusively.
  • the access control unit 603 when the CPU provided with the write core 601 or the read cores 602-1, 602-2, 602-3 executes a program related to access control, the software or firmware of each CPU is executed. Can be distributed and realized.
  • an execution code for realizing the read operation and a function including the execution code are held locally. Then, the CPU provided with the read cores 602-1, 602-2, and 602-3 realizes an access control unit 603 by executing an execution code for realizing a read operation and a function including the execution code. it can.
  • a counter array area 612 and registers 613 and 614 are provided in the shared memory 610.
  • the counter array area 612 stores count values UBC [1] to UBC [5] of the current access numbers from the read cores 602-1, 602-2, and 602-3 to the bank memories B [1] to B [5].
  • Bank memories B [1] to B [5] are stored correspondingly.
  • the UBC [1] to UBC [5] in the counter array area 612 are called bank-in-use counters.
  • the register 613 stores bank numbers # 1 to # 5 specifying the bank memories B [1] to B [5] for which writing was last performed by the write core 601.
  • the bank memories B [1] to B [5] indicated by the register 613 are referred to as the latest data banks.
  • the register 614 is any one of the read cores 602-1, 602-2, 602-other than the bank memory B [1] to B [5] (ie, the bank memory indicated by the register 613) to which writing was last performed.
  • Bank numbers # 1 to # 5 specifying bank memories B [1] to B [5] which are not accessed from 3 are stored.
  • Bank memories B [1] to B [5] indicated by the register 614 are referred to as free banks.
  • the write core 601 and the read cores 602-1, 602-2, 602-3 are stored in the count values UBC [1] to UBC [5] stored in the counter array area 612 and the registers 613, 614.
  • Bank numbers # 1 to # 5 can be referenced or changed.
  • the other write cores 601 and read cores 602- Atomic instructions can be used to eliminate interference (contention) from 1, 602-2, 602-3.
  • the access control unit 603 When there is a read request from the read cores 602-1, 602-2 and 602-3, the access control unit 603 refers to the bank numbers # 1 to # 5 stored in the register 613. Then, based on the reference result, the bank memories B [1] to B [5] to which writing was last performed are identified, and the bank numbers # 1 to # 5 are read out, and the cores 602-1 and 602-2 are obtained. Notify 602-3. Furthermore, the access control unit 603 sets the count values UBC [1] to UBC [5] of the bank memories B [1] to B [5] corresponding to the bank numbers # 1 to # 5 stored in the register 613 to one only. Increment.
  • the access control unit 603 recognizes the bank memories B [1] to B.
  • the count values UBC [1] to UBC [5] of [5] are decremented by one.
  • count values UBC [1] to UBC [5] of the bank memories B [1] to B [5] are 0, and the bank numbers # 1 to # 5 are stored in the register 613. If it does not match 5, the bank numbers # 1 to # 5 of the bank memories B [1] to B [5] are registered in the register 614.
  • the access control unit 603 refers to the bank numbers # 1 to # 5 stored in the register 614. Then, based on the reference result, any read core 602-1, 602 other than the bank memory B [1] to B [5] (ie, the bank memory indicated by the register 613) for which writing was last performed. -2, Identify bank memories B [1] to B [5] which are not used also for reading by 602-3. Then, the access control unit 603 notifies the write core 601 of the bank numbers # 1 to # 5 of the identified bank memories B [1] to B [5]. Further, the access control unit 603 deletes the bank numbers # 1 to # 5 notified to the write core 601 from the register 614.
  • the bank memories B [1] to B which hold the latest data. [5] ie, the bank memory indicated by the register 613
  • the write core 601 can rewrite only the difference whose value has changed since the previous write.
  • the bank numbers # 1 to # 5 stored so far in the register 613 write the latest data. It is rewritten to bank numbers # 1 to # 5 of the bank memories B [1] to B [5].
  • the count values UBC [1] to UBC [5] of the bank memories B [1] to B [5] corresponding to the bank numbers # 1 to # 5 stored so far in the register 613 are 0, the bank memory B Bank numbers # 1 to # 5 of [1] to B [5] are registered in the register 614.
  • the operation of the write core 601 and the read cores 602-1, 602-2, 602-3 will be described below in chronological order.
  • the values of the bank memories B [1] to B [5] are updated (written) in the order of the suffixed W numbers described at the lower left of the respective bank memories B [1] to B [5]. I assume. At this time, count values UBC [1] to UBC [5] are set corresponding to the numbers of references from read cores of bank memories B [1] to B [5].
  • the count value UBC [2] of the bank memory B [2] which was written twice by W- 2 is two. At this time, the two read cores 602-1 and 602-2 are accessing the bank memory B [2].
  • the count value UBC [3] of the bank memory B [3] written three times in W- 3 is one. At this time, one read core 602-3 is accessing the bank memory B [3].
  • the count value UBC [4] of the bank memory B [4] previously written as the latest data in W- 1 is 0, and no read cores 602-1 to 602-3 have been read yet.
  • the bank number # 4 of the bank memory B [4] is registered in the register 613.
  • the count value UBC [5] of the unwritten bank memory B [5] is 0 in the time zone focused on at least W- ⁇ , and any read core 602-1 to 602-3 is accessed. Absent. At this time, the bank memory B [5] is a free bank, and the bank number # 5 is registered in the register 614.
  • the read cores 602-1 to 602-3 perform writing by referring to the bank numbers # 1 to # 5 registered in the register 613.
  • the latest data can be read from the bank memories B [1] to B [5] without conflict with the writing by the core 601.
  • the write core 601 accesses the bank memories B [1] to B [5]
  • the write core 601 refers to the bank numbers # 1 to # 5 registered in the register 614 so that the read cores 602-1 to 602-3 can operate.
  • the latest data can be written to the bank memories B [1] to B [5] without conflict with reading.
  • the operation timings of the write core 601 and the read cores 602-1 to 602-3 are asynchronous. If the write cycle is earlier than the read cycle, data can be read appropriately on the read side, and if the read cycle is earlier than the write cycle, the same data can be appropriately read. Therefore, it is not necessary to make the write cycle and the read cycle of the multi-core system coincide with each other, and the flexibility of the data input / output period to each core can be improved.
  • FIG. 7 is a flowchart showing the read procedure of the data transfer apparatus according to the embodiment.
  • the read cores 602-1 to 602-3 call the Get_Bank function f710 and acquire the accessible bank number id from the return value (step S710).
  • the bank number id is set to any one of # 1 to # 5.
  • Step S720 can be repeatedly executed until all desired variable values data are read.
  • the read cores 602-1 to 602-3 call the Release_Bank function f730, and return the bank secured by the Get_Bank function f710 (step S730).
  • the data of the bank memory B [id] secured by the Get_Bank function f710 is captured and is not changed by other factors. For this reason, the simultaneousness of the data set used for arithmetic processing etc. is securable.
  • the series of read procedures S700 have been described on the premise that they are used in one place for each core, but may be used in multiple places of another task that can be preempted in the same core.
  • the number of read cores is increased by the number corresponding to a plurality of read locations, and the number of bank memories can be increased.
  • the Get_Bank function f 710 acquires from the register 613 the bank numbers # 1 to # 5 of the bank memories B [1] to B [5] in which the latest data exists. At this time, assuming that the bank numbers # 1 to # 5 of the bank memories B [1] to B [5] in which the latest data are present are LIBR (Latest Information Bank Register), LIBR is set to a variable x.
  • LIBR Test Information Bank Register
  • step S711 the count value UBC [x] of the bank memory B [1] to B [5] is incremented by 1 (step S711). Since the register 613 and the count values UBC [1] to UBC [5] exist on the shared memory 610, these operations are executed by atomic instructions.
  • step S712 With the variable x specifying the bank numbers # 1 to # 5 of the bank memories B [1] to B [5] where the latest data exists, the process returns to the main routine (step S712).
  • the count value UBC [id] of the bank memory B [id] is decremented by 1 prior to the return of the bank memory B [id] specified by the bank number id (step S731). Since the count value UBC [id] exists on the shared memory 610, this operation is executed by an atomic instruction.
  • the bank number id when the count value UBC [id] becomes 0 and the bank number id does not match the bank numbers # 1 to # 5 registered in the register 613 (ie, not the latest data), it is designated by the bank number id.
  • the bank memory B [id] is regarded as a free bank, and the bank number id is registered in the register 614 (step S732). Since the registers 613 and 614 and the count values UBC [1] to UBC [5] exist on the shared memory 610, these operations are executed by atomic instructions.
  • FIG. 8 is a flow chart showing a write procedure of the data transfer apparatus according to the embodiment.
  • the write core 601 calls the Reserve_Bank function f810, and acquires the accessible bank number id from the return value (step S810).
  • the bank number id is set to any one of # 1 to # 5.
  • Step S820 can be repeatedly executed until all of the requested variable values data are rewritten.
  • the latest data of the previous time is copied in advance by the Reserve_Bank function f810, and no operation is necessary.
  • the Put_Bank function f830 is called, and the bank memory B [id] secured by the Reserve_Bank function f810 is released (step S830).
  • the data of bank memory B [id] secured by Reserve_Bank function f810 is protected from access by read cores 602-1 to 602-3, and other factors It will not be referenced in. For this reason, from the viewpoint of the read cores 602-1 to 602-3, it is possible to ensure the simultaneousness of data sets used for arithmetic processing and the like.
  • the Reserve_Bank function f810 acquires the bank numbers # 1 to # 5 of the free bank from the register 614, and deletes the bank numbers # 1 to # 5 from the register 614 (step S811).
  • the register 614 is represented as FBR (Free Bank Register), one bank number is selected from FBR, and is set as a variable x. The bank number selected and extracted from the FBR is deleted from the FBR itself. Because the registers 614 reside on shared memory 610, these operations are performed on atomic instructions.
  • step S812 data is copied from the bank memory B [LIBR] where the latest data is secured to the bank memory B [x] secured by the Reserve_Bank function f810 (step S812).
  • step S813 With the variable x specifying the bank number # 1 to # 5 of the free bank as a return value, the main routine is returned (step S813).
  • the value of the LIBR up to now is called and temporarily stored in the variable old (step S831).
  • the variable old does not need to use an atomic instruction because it is stored in the local RAM (102, 112) of the write core 601.
  • step S832 the value of LIBR registered in the register 613 is rewritten with the bank number id of the bank memory B [id] to be released this time (step S832).
  • the register 613 is located on the shared memory 610, since only the Put_Bank function f 830 is a function that rewrites a value, it is not necessary to use an atomic instruction. Also, at this point, since the latest data is ready, values can be referenced from any of the read cores 602-1 to 602-3.
  • step S833 the count value UBC [old] of the bank memory B [old] for which the latest data one before is secured is checked.
  • the count value UBC [old] is 0, the bank memory B [old] is not referred to by any of the read cores 602-1 to 602-3, and the data is old. Therefore, the bank memory B [old] is regarded as a free bank, and this variable old is registered in the register 614 (denoted as FBR in FIG. 8). Since the register 614 and the count values UBC [1] to UBC [5] exist on the shared memory 610, these operations are executed by atomic instructions.
  • the fuel injection system of the engine of FIG. 1 is taken as an example.
  • the CPU 100 of FIG. 1 can be provided with the write core 601 of FIG.
  • the CPU 110 of FIG. 1 can be provided with the read core 602-1 of FIG.
  • the shared RAM 120 of FIG. 1 is provided with the bank memories B [1] to B [3] of FIG. 6 (the reason why three bank memories are required is shown in FIG. 12) and the registers 613 and 614. 1] to UBC [3] can be stored.
  • the scratch pad memory 611 can be configured by bundling the bank memories B [1] to B [3].
  • the Reserve_Bank function f810 and the Put_Bank function f830 can be implemented in an execution code storage area in which the execution code 101 is stored.
  • the Get_Bank function f710 and the Release_Bank function f730 can be implemented in an execution code storage area in which the execution code 111 is stored.
  • FIG. 9 is a flowchart showing a data transmission procedure when the data transmission device according to the embodiment is applied to a fuel injection system of an engine.
  • FIG. 9 shows the case where the mass flow system of FIG. 2A is applied to the fuel injection system of the engine of FIG.
  • a real time OS (Operating System) 900 is mounted on the CPU 100.
  • the CPU 100 can periodically execute tasks of 5 ms and 10 ms under the command of the OS 900.
  • the OS 900 can be implemented in the executable code 101 of FIG.
  • the task execution time of 5 ms can be set based on the sampling period of the digital filter used for the calculation 901 of the intake air amount Q.
  • the execution time of the task of 10 ms can be set based on the sampling period of the digital filter used for calculation 902 of the engine rotational speed Ne.
  • the CPU 100 is mainly in charge of input processing from the sensor.
  • calculation 901 of the intake air amount Q is performed.
  • calculation 902 of the engine speed Ne is performed.
  • the instantaneous values of the data set of ⁇ Q, Ne ⁇ are determined.
  • the calculation 901 of the intake air amount Q and the calculation 902 of the engine rotational speed Ne are performed using the memory resources of the local RAM 102 using the execution code 101.
  • the CPU 100 executes the write procedure S800 of FIG. 8 to write the latest ⁇ Q, Ne ⁇ data set in the bank memories B [1] to B [3] provided in the shared RAM 120. Yes (903).
  • the CPU 100 refers to and updates the values of the count values UBC [1] to UBC [3] and the registers 613 and 614 by calling the Reserve_Bank function f810 and the Put_Bank function f830 in the write procedure S800 and writing bank
  • the memories B [1] to B [3] can be secured, and the bank memories B [1] to B [3] can be released.
  • the processing of the Reserve_Bank function f810 and the Put_Bank function f830 uses the execution code 101 to refer to and update the values of the count values UBC [1] to UBC [3] and the registers 613 and 614, and the scratch pad on the shared RAM 120.
  • the operation is performed on the memory 611. Extending the preparation time and transmission time (time taken for the write procedure S800) of the latest ⁇ Q, Ne ⁇ data set does not cause an operation delay of the other read core.
  • a real time OS 910 is implemented in the CPU 110.
  • the CPU 110 can periodically execute a task of 15 ms under the command of the OS 910.
  • the OS 910 can be implemented in the executable code 111 of FIG.
  • the execution time of the task of 15 ms can be set based on the operation time of the output actuator (the required time resolution).
  • the CPU 110 is mainly in charge of calculation and command value calculation of the output actuator. In the task of 15 ms, reading of the scratch pad memory 611 and calculation 912 of the fuel injection amount q are performed. The calculation 912 of the fuel injection amount q is performed using the memory resources of the local RAM 112 using the execution code 111.
  • the CPU 110 executes the read procedure S700 of FIG. 7 to obtain the latest ⁇ Q, Q from the bank memories B [1] to B [3] provided in the shared RAM 120.
  • the data set of Ne ⁇ can be read out (911).
  • the CPU 110 refers to and updates the values of the count values UBC [1] to UBC [3] and the registers 613 and 614 by calling the Get_Bank function f710 and the Release_Bank function f730 in the read procedure S700.
  • the memories B [1] to B [3] can be secured, and the bank memories B [1] to B [3] can be returned.
  • the processing of the Get_Bank function f710 and the Release_Bank function f730 uses the execution code 111 to refer to and update the values of the count values UBC [1] to UBC [3] and the registers 613 and 614, and the scratch pad on the shared RAM 120. The operation is performed on the memory 611.
  • FIG. 10 is a sequence diagram showing a data transmission method in time series when the data transmission device according to the embodiment is applied to a fuel injection system of an engine.
  • the intake air amounts Q 1 to Q 10 are calculated every 5 ms.
  • Ne calculation 902 of the CPU 100 engine rotational speeds Ne 1 to Ne 5 are calculated every 10 ms.
  • the bank output 903 the Reserve_Bank function f 810 and the Put_Bank function f 830 are called every 10 ms, and the data set of ⁇ Q, Ne ⁇ is written to the bank memories B [1] to B [3].
  • the Q calculation 901 is every 5 ms, and the Ne calculation 902 is every 10 ms. For this reason, from the bank output 903, the intake air amounts Q 1 to Q 10 according to the Q calculation 901 appear to be read out once every two times.
  • the output of Q calculation 901 is the output value of the digital filter.
  • the calculation period of Q calculation 901 is determined by the sampling time of the digital filter, and the intake air amounts Q 2 , Q 4 , Q 6 , Q 8 and Q 10 according to Q calculation 901 are not adopted as bank output 903.
  • the Q calculation 901 of the intake air amounts Q 2 , Q 4 , Q 6 , Q 8 , and Q 10 is not wasted.
  • the Get_Bank function f710 and the Release_Bank function f730 are called every 15 ms, and the latest ⁇ Q, Ne ⁇ data set is read out from the bank memories B [1] to B [3].
  • the q calculation 912 of the CPU 110 calculates the fuel injection amount q 1 to q 3 every 15 ms based on the latest ⁇ Q, Ne ⁇ data set.
  • CPU 100 when the CPU 100 is the bank memory B [3] when calculating the intake air quantity Q 1 and the engine speed Ne 1 assumed to be a free bank, CPU 100 may ensure the bank memory B [3] at Reserve_Bank function f810 And write the data set of ⁇ Q 1 , Ne 1 ⁇ to the bank memory B [3]. Then, the bank memory B [3] is released by the Put_Bank function f830. At this time, the bank number # 3 of the bank memory B [3] in which the latest data is registered is indicated by LIBR (register 613).
  • the CPU 110 secures the bank memory B [3] by the Get_Bank function f710, and reads the data set of ⁇ Q 1 , Ne 1 ⁇ from the bank memory B [3]. Then, CPU 110, based on the data set ⁇ Q 1, Ne 1 ⁇ to calculate the fuel injection quantity q 1, to return the bank memory B [3] at Release_Bank function F730.
  • CPU110 is before returning the bank memory B [3]
  • CPU100 calculates the intake air quantity Q 3 and the engine speed Ne 2.
  • the CPU 100 secures the bank memory B [2] with the Reserve_Bank function f810 without waiting for the return of the bank memory B [3], ⁇
  • the data set of Q 3 , Ne 2 ⁇ is written to the bank memory B [2].
  • the bank memory B [2] is released by the Put_Bank function f830.
  • the bank number # 2 of the bank memory B [2] in which the latest data is registered is indicated by LIBR (register 613).
  • the CPU 110 secures the bank memory B [2] with the Get_Bank function f710, and reads the data set of ⁇ Q 3 , Ne 2 ⁇ from the bank memory B [2]. Then, CPU 110, based on the data set ⁇ Q 3, Ne 2 ⁇ to calculate the fuel injection quantity q 2, to return the bank memory B [2] at Release_Bank function F730.
  • CPU110 is before returning the bank memory B [2]
  • CPU100 calculates the intake air quantity Q 5 and the engine rotational speed Ne 3.
  • the CPU 100 secures the bank memory B [1] with the Reserve_Bank function f810 without waiting for the return of the bank memory B [2], ⁇
  • the data set of Q 5 , Ne 3 ⁇ is written to the bank memory B [1].
  • the bank memory B [1] is released by the Put_Bank function f830.
  • the bank number # 1 of the bank memory B [1] in which the latest data is registered is indicated by LIBR (register 613).
  • Ne 2 ⁇ can continue the calculation of the fuel injection quantity q 2 on the basis of the data set.
  • the CPU 100 is the bank memory B [3] when calculating the intake air quantity Q 7 and the engine speed Ne 4 assumed to be a free bank
  • CPU 100 is a bank memory B [3] at Reserve_Bank function f810 Secure and write the data set of ⁇ Q 7 , Ne 4 ⁇ to the bank memory B [3].
  • the bank memory B [3] is released by the Put_Bank function f830.
  • the bank number # 3 of the bank memory B [3] in which the latest data is registered is indicated by LIBR (register 613).
  • the CPU 110 secures the bank memory B [3] by the Get_Bank function f710, and reads the data set of ⁇ Q 7 , Ne 4 ⁇ from the bank memory B [3]. Then, CPU 110 is a fuel injection amount q 3 calculated on the basis of the data set ⁇ Q 7, Ne 4 ⁇ , returns the bank memory B [3] at Release_Bank function F730.
  • the data set of ⁇ Q 5 , Ne 3 ⁇ written to the bank memory B [1] is older than the data set of ⁇ Q 7 , Ne 4 ⁇ written to the bank memory B [3] . Therefore, the CPU 110 reads the data set of ⁇ Q 7 , Ne 4 ⁇ from the bank memory B [3] without reading the data set of ⁇ Q 5 , Ne 3 ⁇ written in the bank memory B [1]. be able to. At this time, it is possible to skip the reading 1001 of the data set of ⁇ Q 5 , Ne 3 ⁇ .
  • the bank output 903 performed by the CPU 100 to the scratch pad memory 611 is executed in a cycle of 10 ms.
  • the bank input 911 from the scratch pad memory 611 to the CPU 110 is executed in a cycle of 15 ms.
  • the reading of the data set to the bank input 911 can be skipped only once every time the bank output 903 is performed only three times.
  • the receiver can always obtain at least the latest data set if required. Also, the sender can concentrate on updating the latest value without considering the convenience of the receiver. Therefore, since the sender and receiver of the data are loosely coupled and the other operation is not dragged at the timing of one operation, robustness can be ensured.
  • FIG. 11A is a diagram showing the occupancy relationship between the write core and the scratch pad memory of the data transmission device according to the embodiment.
  • scratch pad memories P1 to P4 and four cores C1 to C4 capable of accessing these scratch pad memories P1 to P4 are provided.
  • the number of scratch pad memories P1 to P4 and the number of cores C1 to C4 can be equal.
  • Each scratch pad memory P1 to P4 can be provided with five bank memories.
  • the scratch pad memory P1 can be configured similar to the scratch pad memory 611 of FIG.
  • the number of banks of each scratch pad memory P1 to P4 can be set to the total number of cores + 1.
  • the scratch pad memories P1 to P4 can be arranged in the shared memory 610.
  • the cores C1 to C4 can be provided in a CPU used for writing and reading. At this time, each of the cores C1 to C4 can operate as a write core or operate as a read core according to the scratch pad memories P1 to P4 to be accessed.
  • the core C1 can operate as a write core for the scratch pad memory P1 and can operate as a read core for the scratch pad memories P2 to P4.
  • the core C2 can operate as a write core for the scratch pad memory P2 and can operate as a read core for the scratch pad memories P1, P3 and P4.
  • the core C3 can operate as a write core for the scratch pad memory P3 and can operate as a read core for the scratch pad memories P1, P2 and P4.
  • the core C4 can operate as a write core for the scratch pad memory P4 and can operate as a read core for the scratch pad memories P1 to P3.
  • each of the cores C1 to C4 is the write core 601 with respect to the scratch pad memories P1 to P4 of which it is the write owner, and scratch pads memory P1 to P4 of which the other cores C1 to C4 are the write owners. , And a relationship which is one of the read cores 602-1 to 602-3 is established.
  • FIG. 11B is a diagram showing a method of assigning an operation function to the scratch pad memory for each core of the data transmission device according to the embodiment. These operation functions can be stored in the local execution code storage area of each core.
  • the write related functions Reserve_Bank_P () and Put_Bank_P () are implemented for the scratch pad memory of which the user is the write owner, and the read related functions Get_Bank_P () and Release_Bank_P () are implemented for the other scratch pad memories.
  • P is a memory number of the scratch pad memories P1 to P4.
  • the data can be transmitted between the cores C1 to C4 by using the scratch pad memories P1 to P4 so that data transfer between cores is asynchronously performed even in a multi-core.
  • FIG. 12 is a diagram showing the relationship between the number of banks and the number of cores of the scratch pad memory of the data transfer apparatus according to the embodiment.
  • FIG. 12 shows a state where the bank memories B [1] to B [5] are maximally used by the write core 601 and the read cores 602-1, 602-2, and 602-3 of FIG.
  • the bank memories B [1] to B [5] are maximally used by the write core 601 and the read cores 602-1, 602-2, and 602-3 of FIG.
  • the Get_Bank () function is called from the read cores 602-1, 602-2, and 602-3 to the bank memories B [3] to B [5], and the read cores 602-1 and 602-2 are obtained.
  • 602-3 are using separate bank memories B [3] to B [5].
  • (N ⁇ 1) bank memories B [3] to B [5] are occupied at the maximum only by reading.
  • the write core 601 continuously writes twice. That is, while the read cores 602-1, 602-2, and 602-3 use separate bank memories B [3] to B [5], the write to the bank memory B [2] by the write core 601 is completed. It shall be done. At this time, the bank number # 2 of the bank memory B [2] in which the latest data is written is registered in the register 613.
  • the bank memory B [1] can be registered as a free bank.
  • the write core 601 returns the bank memories B [3] to B [5] from the read cores 602-1, 602-2, and 602-3 after the writing to the bank memory B [2] is completed. It is possible to call the Reserve_Bank () function to the bank memory B [1] and write to the bank memory B [1] without waiting.
  • the read cores 602-1, 602-2, 602-3 return one of the bank memories B [3] to B [5] while writing to the bank memory B [1], and make a new read request Can provide the latest data bank B [2].
  • the number of CPU cores is not limited to two and four as described in the embodiment, and may be N (N is an integer of 2 or more) multi-cores.
  • each configuration, function, processing unit, etc. can be realized as hardware by designing all or part of them with, for example, an integrated circuit, or a processor executes a program that realizes each function. It can be implemented as software, or as a device control language or firmware closely associated with the integrated circuit.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Chemical & Material Sciences (AREA)
  • Combustion & Propulsion (AREA)
  • Mechanical Engineering (AREA)
  • Multi Processors (AREA)
  • Combined Controls Of Internal Combustion Engines (AREA)
  • Executing Machine-Instructions (AREA)
  • Memory System (AREA)

Abstract

マルチコアシステムにおけるコアが非同期に動作する場合おいても、コアによる処理のリアルタイム性を向上させつつ、同時性が確保されたデータセットをコア間で伝達する。バンクメモリB[1]~B[5]と、これらのバンクメモリB[1]~B[5]にアクセス可能な書き込みコア601および読み出しコア602-1、602-2、602-3が設けられ、アクセス制御部603は、書き込みが行われるバンクメモリB[1]~B[5]には、1個の書き込みコア601のみを割り当て、読み出しが行われるバンクメモリB[1]~B[5]には、1以上の読み出しコア602-1、602-2、602-3読を割り当て、書き込みが行われているバンクメモリB[1]~B[5]と読み出しが行われているバンクメモリB[1]~B[5]とが同一にならないようにバンクメモリB[1]~B[5]へのアクセスを排他的に制御する。

Description

車載マルチコア制御用データ伝達装置および電子制御装置
 本発明は、エンジンの燃料制御などに適用可能な車載マルチコア制御用データ伝達装置および電子制御装置に関する。
 高性能化への要求に応えるため、組込みシステムではこれまでCPU(Central Processing Unit)のクロック周波数を高めることで処理能力の向上を図ってきた。しかしその結果、CPUの消費電力、発熱量およびノイズなどの増加を招いていた。これに対して近年注目されているのが、CPUのコアをチップ内に複数実装し、各コアの負荷を減少させるマルチコアシステムである。
 マルチコアシステムでは、今までシングルコアで実行してきた制御をコアごとに分割・分散し、並列処理を行うことによって処理スループットを向上させる。しかしながら、シングルコアの制御で行われていたOS(Operationg System)によるタスク間排他制御および割込み禁止によるクリティカル区間の割込み禁止制御がマルチコアにおいては成立しない。マルチコアシステムにおいて、同時性を確保しつつデータの組(データセット)を送り手CPUから受け手CPUに伝達する場合がある。この時、何らかの保護機構を設定しないと、受け手のCPUがデータセットの一部のデータを読みだしている最中に、送り手のCPUがそのデータセットの他のデータを書き換える現象が起こり得る。これは複数のCPUが各々独自の実行コードを保有し、基本的に非同期で動作を行うためである。
 このような現象を排除する手法として、従来からロック変数によるスピンロック制御が知られている。これはテスト・アンド・セット命令のようなアトミック(不可分)な変数チェック&書き込み命令を用いて、特定のロック変数に使用中を示す鍵をかけ、鍵をかけ得たCPUのみが特定メモリ領域にアクセスできるプロセッサ間排他制御システムである。
 しかしながら、スピンロック制御でプロセッサ間排他制御を行う資源に関わる実行区間は、マルチコアにとって並列実行区間ではなく、直列実行区間となる。従って、この直列実行時間が長くなればなるほど、アムダールの法則によってマルチコア全体として見た場合の並列実行性能が低下する。なお、アムダールの法則とは、複数のプロセッサを使い、並列計算によってプログラムの高速化を図る場合、そのプログラムの中で逐次的に実行しなければならない部分の時間によって、高速化が制限される現象を記述したものである。
 スピンロックを行うメモリ粒度を大きく取り、複数のCPUが関与すればするほど、ロック待ちに要する時間が増加(スケーラブル性に考慮したスピンロック機構の場合はCPU数に比例)し、CPUによる処理のリアルタイム性を損なう。
 一方、メモリ粒度を下げ、ロック変数(および該当排他資源)の個数を増加させると、管理が煩雑になって各CPUの制御に対する最悪実行時間を見積もること(および仕様変更に対する波及効果を予測すること)が困難になる。
 実際にはメモリ粒度を下げる方法はモチベーションが逆で、システムやマルチコアOSの制約上、設定できるロック変数の上限数が決められていることと、同一変数で異なるロック向けに値をコピーする等の管理が煩雑になるため、設計的にロック粒度が大きくなりがちである。極論すれば、細粒度ロックを多用するより、グローバル変数を丸ごとロック単位として扱った方が設計の見通し良くなる。(これをジャイアントロックと称する。)従って、この手法の帰結としてロックを取り合うCPUの個数が増え、ロック待ち時間が見過ごせなくなる傾向にある。
 以上の観点からハードリアルタイム性を重視する車載制御用のマルチコアでは、スピンロック制御を採用しないことが好ましい。特に、マルチコアシステムでは、CPU数を増やすと、ロック待ち時間が程度の良い方式(これはスケーラブルな方式と呼ばれる)においても比例的に増加する。
 そのためには、以下の先行技術で示すようなスピンロックを用いないCPU間データ伝達方式が考案されている。
特開2009-217721号公報
 しかしながら、特許文献1に開示された技術は、データの送り手のCPUをサーバ、受け手のCPUをクライアントとみなして、サーバ-クライアント・モデルによるデータの授受を図るものである。
 受け手のCPUは通知領域(共有メモリ)にデータ要求の指令を書き、送り手のCPUは、その指令を解釈して受け手の割り当て領域(共有メモリ)に要求されたデータを書込み、その指令を完了済みの値に書き換える。
 すなわち、完全なハンドシェーク動作であって、受け手のCPUの要求頻度と送り手のCPUのデータ生成頻度が完全に同期しないと、方式が破綻する。受け手の要求頻度が大きい時に適度に同一データを重ね読みしたり、送り手のデータ生成頻度が大きい時に受け手は適度にデータを読み飛ばしたりすることができない。これは、非同期のCPU間データ授受システムおいて負担になる。(データの授受が疎結合でない。)
 また、サーバ-クライアント・モデルは、操作対象のオブジェクトが所属するCPU(送り手のCPU)に対する遠隔呼び出し法である。このため、データを生成するCPU(送り手のCPU)の動作を阻害し、操作を依頼したCPU(受け手のCPU)も操作完了通知を待つ必要があるため、送り手のCPUも受け手のCPUもリアルタイム性が悪くなる。
 本発明は、上記事情に鑑みなされたものであり、その目的は、マルチコアシステムにおけるコアが非同期に動作する場合おいても、コアによる処理のリアルタイム性を向上させつつ、同時性が確保されたデータセットをコア間で伝達することが可能な車載マルチコア制御用データ伝達装置および電子制御装置を提供することにある。
 上記目的を達成するため、第1の観点に係る車載マルチコア制御用データ伝達装置は、M(Mは2以上の整数)個のバンクメモリと、前記バンクメモリにアクセス可能なN(Nは2以上の整数)個のプロセッサとが設けられた車載マルチコア制御用データ伝達装置であって、前記M個のバンクメモリが配置され、前記N個のプロセッサからアクセス可能な共有メモリと、前記バンクメモリを特定する識別情報に基づいて、前記プロセッサから前記バンクメモリへのアクセスを制御するアクセス制御部とを備える。
 本発明によれば、マルチコアシステムにおけるコアが非同期に動作する場合おいても、コアによる処理のリアルタイム性を向上させつつ、同時性が確保されたデータセットをコア間で伝達することができる。
図1は、実施形態に係るマルチコア制御装置のハードウェア構成を示すブロック図である。 図2は、実施形態に係る電子制御装置が適用されるエンジンの燃料噴射系の構成例を示すブロック図である。 図3の(a)は、実施形態に係るデータ伝達装置に適用可能な単精度浮動小数点数のデータ構造を示す図、図3の(b)は、実施形態に係るデータ伝達装置に適用可能な倍精度浮動小数点数のデータ構造を示す図、図3の(c)は、図3の(a)および図3の(b)のデータ構造のビットの割り当て方法を示す図である。 図4は、実施形態の比較例に係るスピンロック制御方法を示すフローチャートである。 図5は、実施形態の比較例に係るスピンロック制御と割込み禁止の関係を示すフローチャートである。 図6は、実施形態に係るデータ伝達装置の構成例を示すブロック図である。 図7は、実施形態に係るデータ伝達装置の読み出し手続きを示すフローチャートである。 図8は、実施形態に係るデータ伝達装置の書き込み手続きを示すフローチャートである。 図9は、実施形態に係るデータ伝達装置がエンジンの燃料噴射系に適用された時のデータ伝達手順を示すフローチャートである。 図10は、実施形態に係るデータ伝達装置がエンジンの燃料噴射系に適用された時のデータ伝達方法を時系列的に示すシーケンス図である。 図11(a)は、実施形態に係るデータ伝達装置の書き込みコアとスクラッチパッド・メモリとの占有関係を示す図、図11(b)は、実施形態に係るデータ伝達装置のスクラッチパッド・メモリごとのコアへの関数の割り当て方法を示す図である。 図12は、実施形態に係るデータ伝達装置のスクラッチパッド・メモリのバンク数とコア数との関係を示す図である。
 実施形態について、図面を参照して説明する。なお、以下に説明する実施形態は特許請求の範囲に係る発明を限定するものではなく、また実施形態の中で説明されている諸要素及びその組み合わせの全てが発明の解決手段に必須であるとは限らない。また、実施例開示分野の一例としてエンジン制御を挙げているが、エンジン制御に限らず変速機制御などのドライブトレイン制御、防振やダンパーに関連するシャーシ制御、アンチロックブレーキシステムや衝突安全などのアクティブセーフティ、トラクションコントロールシステムなどの駆動力制御、および自動走行制御など車載用リアルタイム制御が要求される各分野に適用可能であることは言うまでもない。
 図1は、実施形態に係るマルチコア制御装置のハードウェア構成を示すブロック図である。なお、図1では、エンジンの燃料制御装置を2コアにて実現した構成を例にとった。
 図1において、この燃料制御装置には、CPU(Central Processing Unit)100、110、実行コード101、111が格納された実行コード格納領域、ローカルRAM(Random Access Memory)102、112および共有RAM120が設けられている。
 CPU100にはセンサ入力として、エアフローメータ103、圧力センサ104、スロットルセンサ105、回転数センサ106が接続されている。エアフローメータ103は、空気吸入量Qを計算するためのセンサ値を出力する。圧力センサ104は、吸気管圧力Pを計算するためのセンサ値を出力する。スロットルセンサ105は、スロットル開度αを計算するためのセンサ値を出力する。回転数センサ106は、エンジン回転数Neを計算するためのセンサ値を出力する。
 CPU110にはアクチュエータ出力として、燃料噴射量指示装置113が接続されている。燃料噴射量指示装置113は、エンジンの燃料噴射量qを出力する。
 CPU100は主にセンサ入力の処理を担当し、実行コード101およびローカルRAM102を用いて処理を実行する。ローカルRAM102は、CPU100のみからアクセスできるメモリ資源である。
 CPU110は主に数値演算と出力アクチュエータ操作を担当し、実行コード111およびローカルRAM112を用いて処理を実行する。ローカルRAM112は、CPU110のみからアクセスできるメモリ資源である。
 CPU100、110には、共通してアクセス可能な資源として共有RAM120がバス107を介して接続されている。共有RAM120上には、全体としての制御を成立させる上で一方のCPU100、110から他方のCPU110、100に開示することが必要なデータの格納領域が設けられている。この格納領域には、CPU開示データ121、122が格納される。CPU開示データ121には、空気吸入量Q、吸気管圧力P、スロットル開度αおよびエンジン回転数Neを設定することができる。CPU開示データ122には、燃料噴射量qを設定することができる。
 図2は、実施形態に係る電子制御装置が適用されるエンジンの燃料噴射系の構成例を示すブロック図である。図2では、燃料噴射系で主に用いられている3方式を示した。図2の(a)ではマスフロー方式、図2の(b)ではスピードデンシティ方式、図2の(c)ではα-N方式を示した。
 図2の(a)~(c)において、エンジン203には吸気管202が接続され、吸気管202には燃料噴射装置205が接続されている。吸気管202の上流には、スロットルチャンバ201が設けられている。エンジン203には回転数センサ106が設けられている。さらに、燃料噴射系には、燃料制御を行うECU(Electronic Control Unit)204が設けられている。ECU204は、図1のCPU100、110、実行コード101、111が格納された実行コード格納領域、ローカルRAM102、112および共有RAM120を備えることができる。
 また、図2の(a)に示すように、マスフロー方式では、エアフローメータ103がスロットルチャンバ201の上流に設けられる。
 そして、ECU204のCPU100には、吸入空気量Qを計算するためのセンサ値がエアフローメータ103から入力されるとともに、エンジン回転数Neを計算するためのセンサ値が回転数センサ106から入力される。そして、CPU100において、これらのセンサ値から吸入空気量Qおよびエンジン回転数Neが計算され、共有RAM120に格納される。
 次に、CPU110において、吸入空気量Qおよびエンジン回転数Neが共有RAM120から読み出される。そして、燃料噴射量qがq∝Q/Neとして計算される。
 一方、図2の(b)に示すように、スピードデンシティ方式では、圧力センサ104が吸気管202に設けられる。
 そして、ECU204のCPU100には、吸気管圧力Pを計算するためのセンサ値が圧力センサ104から入力されるとともに、エンジン回転数Neを計算するためのセンサ値が回転数センサ106から入力される。そして、CPU100において、これらのセンサ値から吸気管圧力Pおよびエンジン回転数Neが計算され、共有RAM120に格納される。
 次に、CPU110において、吸気管圧力Pおよびエンジン回転数Neが共有RAM120から読み出される。そして、燃料噴射量qがq∝f(P,Ne)として計算される。なお、f()はエンジン特性より決定される関数である。
 一方、図2の(c)に示すように、α-N方式では、スロットルセンサ105がスロットルチャンバ201に設けられる。
 そして、ECU204のCPU100には、スロットル開度αを計算するためのセンサ値がスロットルセンサ105から入力されるとともに、エンジン回転数Neを計算するためのセンサ値が回転数センサ106から入力される。そして、CPU100において、これらのセンサ値からスロットル開度αおよびエンジン回転数Neが計算され、共有RAM120に格納される。
 次に、CPU110において、スロットル開度αおよびエンジン回転数Neが共有RAM120から読み出される。そして、燃料噴射量qがq∝f(α,Ne)として計算される。なお、f()はエンジン特性より決定される関数である。
 ここで、センサ入力処理を行うCPU100で計算されたデータセット{Q,P,α,Ne}が、燃料噴射量qを計算するCPU2で使われる場合、データセット{Q,P,α,Ne}の各値が、ほとんど同時刻に計測されたセンサ値から得られたデータであることが重要である。この関係をデータセットの同時性と言う。このデータセット内のデータ間の同時性を巨視的な同時性と言う。このデータセットの同時性が崩れると、データセット{Q,P,α,Ne}に応じた燃料噴射量qの算出精度が低下する。
 例えば、図2の(a)のマスフロー方式において、CPU110がCPU開示データ121の吸入空気量Qを読み出している間に、CPU100がCPU開示データ121のエンジン回転数Neを別時刻の値に勝手に書き換えると、CPU110にとって吸入空気量Qとエンジン回転数Neの同時性が崩れる。この時、q∝Q/Neとして計算された燃料噴射量qは間違った制御データとなる。このため、マルチコアシステムでは、データセットの同時性を確保し、データセットの同時性が崩れないように注意する必要がある。
 図3の(a)は、実施形態に係るデータ伝達装置に適用可能な単精度浮動小数点数のデータ構造を示す図、図3の(b)は、実施形態に係るデータ伝達装置に適用可能な倍精度浮動小数点数のデータ構造を示す図、図3の(c)は、図3の(a)および図3の(b)のデータ構造のビットの割り当て方法を示す図である。なお、図3の(a)および図3の(b)では、アドレス昇順を縦軸にとった。
 図3の(a)および図3の(b)の例では、ビッグエンディアン形式のデータ格納順とし、IEEE754規格(IEEE Standard for Floating-Point Arithmetic (ANSI/IEEE Std 754-2008))に準拠した。
 図3の(a)には、4バイトの単精度データ301を示した。図3の(b)には、8バイトの倍精度データ302を示した。単精度データ301および倍精度データ302において、sは符号ビットを、eは指数部のビットを、fは仮数部のビットを示す。
 図3の(c)に示すように、単精度データ301では、符号ビットに1ビット、指数部に8ビット、仮数部に23ビットが割り当てられる。倍精度データ302では、符号ビットに1ビット、指数部に11ビット、仮数部に52ビットが割り当てられる。
 単精度データ301(または倍精度データ302)が1つの数値であるといっても、その数値の書き換えはアドレスにマッピングされたバイトごとに行われる。このため、単精度データ301(または倍精度データ302)の一部が部分的に書き換わっている最中に、その単精度データ301(または倍精度データ302)にアクセスすると、データとして意味をなさない数値が取り込まれる。
 複数バイトにまたがるデータ構造のデータは、すべてのバイトのデータの書き換えが終わってから取り込まなければならない。また、読み手がデータを読んでいる最中に、そのデータの一部のバイトを書き換えてはならない。複数バイトにまたがるデータ構造を持つ1つのデータの中のバイト間の一貫した同時性を微視的な同時性と言う。
 マルチコアシステムにおいて取り込まれるデータが意味を持つためには、巨視的な同時性だけでなく、微視的な同時性も確保する必要がある。
 以上述べたようなデータの同時性の破壊は、複数のCPUによる同一メモリ領域への読み書きの競合に起因する。このような競合を回避するために、複数のCPUが同一メモリ領域に同時にアクセスできないCPU間排他制御を行うことがある。
 図4は、実施形態の比較例に係るスピンロック制御方法を示すフローチャートである。
 図4では、CPU間排他制御を行うために、スピンロック制御方法を用いる場合を示した。図4において、CPUはロック変数を読み込む(S401)。ロック変数は、排他制御される共有資源と同様に共有メモリ上に確保される。
 次に、このロック変数がテストされ、解放されているか(値がゼロか)がチェックされる(S402)。ロック変数が解放されていれば、CPUはロック変数を取得し、ロック変数へ値を書き込む(S403)。ロック変数が解放されていなければ、S401へ戻り、CPUはロック変数を再び読み込み、テストを繰り返す。
 次に、CPUはロック変数を取得すると、共有資源にアクセスする(S404)。その後、CPUはロック変数を解放する(S405)。
 この動作は、ロック変数が解放されるまで、ループ操作によって変数を読み込み、テストを続行しつつ待ちを続けるのでスピンロックと呼ばれる。
 S401、S402およびS403の一連の動作はテスト・アンド・セット命令のようなアトミック命令B400を用いて実装される。アトミック命令とは、あるCPUが命令実行中に他のCPUが干渉できない不可分な複合命令セットのことである。
 図5は、実施形態の比較例に係るスピンロック制御と割込み禁止の関係を示すフローチャートである。図5では、図4で示したスピンロック制御と割込み禁止区間とのネスト関係を示した。
 図5において、プロセッサ内排他制御区間B500には、割込み禁止(S501)と割込み許可(S505)とが設けられている。割込み禁止(S501)と割込み許可(S505)とで挟まれた区間は、割込み禁止区間である。プロセッサ間排他制御区間B510は、この割込み禁止区間に設けられている。プロセッサ間排他制御区間B510では、CPUがロックを取得すると(S502)、そのCPUが共有資源へアクセスし(S503)、その後、CPUはロックを開放(S504)する。
 この時、あるCPUが共有資源へアクセスしている間は、他のCPUから共有資源へのアクセスが禁止される。また、プロセッサ内排他制御B500の中にプロセッサ間排他制御B510が入り、このネスト関係が維持される。
 このネスト関係を維持することにより、あるCPUがロックを取得してからロックを開放するまでは、そのCPUは割込み制御ができなくなる。割込み制御は、そのCPU独自の都合で行われるので、複数CPU間のロック実行時間・待ち時間の量的関係に含ませるべきではないからである。
 したがって、あるCPUのロック取得中の割込み制御を禁止することにより、その割込み制御によって、そのCPUからロックが解放されるまでの時間が延びるのを防止することができる。このため、他のCPUのロック待ち時間の増加を抑制することができ、リアルタイム制御の実効性を確保することができる。また、ロック待ちのCPUは、ロック待ち時間の最悪値を正しく見積もることができる。逆に、CPUのロック取得中の割込み制御を許すと、ロック待ち時間を管理することが困難になってしまう。
 図5のネスト関係を維持したまスピンロックを行う方法は、ロック待ちをするCPUが増加すると、ロック待ち時間が増加する。このロック待ち時間は、最善手法でロック待ちをするCPU数に対して比例的に増加し、最悪手法で指数関数的に増加する。ロック待ち時間の増加をCPU数に比例的にする手法は、CPU数に対してスケーラブルな手法と呼ばれる。この手法では、ロック待ちをするCPUの要求が待ち行列で記憶され、要求順にロック権利が与えられる。
 ここで、図5に示すように、ロック待ちを行うプロセッサ間排他制御B510は、割込みを禁止するプロセッサ内排他制御B500の中に位置している。このため、ロック待ち時間(S502~S504)が増加すると、割込み禁止時間(S501~S505)も必然的に増加する。
 すなわち、ECU204の処理性能を上げるために、マルチコア化されたCPU100、110を用いると、スピンロック制御では、CPU数の増加に従って割込み禁止時間も増加する。割込み禁止時間の増加は、車載用途におけるハードリアルタイム制御の破綻を招く。ハードリアルタイム制御の破綻を防止するため、CPU数を制限すると、ECU204の処理性能を上げるのが困難となる。
 CPU数を制限することなく、ハードリアルタイム制御の破綻を防止するため、ロック変数を用いた待ち合わせが生じないロックレス方式が望ましい。
 図6は、実施形態に係るデータ伝達装置の構成例を示すブロック図である。なお、以下の説明では、5個のバンクメモリと、これらのバンクメモリにアクセス可能な4個のCPUとが設けられた構成を例にとる。CPUは、プロセッサとして用いることができる。プロセッサは、MPU(Micro Processing Unit)またはDSP(Digital Signal Processor)などであってもよい。
 図6において、データ伝達装置には、5個のバンクメモリB[1]~B[5]と、これらのバンクメモリB[1]~B[5]にアクセス可能な書き込みコア601および読み出しコア602-1、602-2、602-3が設けられている。書き込みコア601は、書き込みに使われるCPUに設けることができる。読み出しコア602-1、602-2、602-3は、読み出しに使われるCPUに設けることができる。
 バンクメモリB[1]~B[5]は共有メモリ610に設けることができる。共有メモリ610は、書き込みコア601および読み出しコア602-1、602-2、602-3からアクセス可能である。バンクメモリB[1]~B[5]は、同一の変数内容および先頭から同一オフセットアドレスを持つように構成することができる。バンクメモリB[1]~B[5]には、バンクメモリB[1]~B[5]を特定する識別情報としてバンク番号#1~#5がそれぞれ付加されている。
 バンクメモリB[1]~B[5]をまとめることでスクラッチパッド・メモリ611を構成することができる。スクラッチパッド・メモリ611は、データの一時的な受け渡しに使うことができる。スクラッチパッド・メモリ611は、バンクメモリ群すなわちバンクメモリB[1]~B[5]をまとめて指し示す時の呼称である。
 さらに、データ伝達装置には、アクセス制御部603が設けられている。アクセス制御部603は、バンクメモリB[1]~B[5]を特定するバンク番号#1~#5に基づいて、書き込みコア601および読み出しコア602-1、602-2、602-3からバンクメモリB[1]~B[5]へのアクセスを制御する。この時、アクセス制御部603は、対象のバンクメモリB[1]~B[5]を対応付けたバンク番号#1~#5を用いて管理することができる。
 具体的には、アクセス制御部603は、書き込みが行われるバンクメモリB[1]~B[5]には、1個の書き込みコア601のみを割り当てる。読み出しが行われるバンクメモリB[1]~B[5]には、1以上の読み出しコア602-1、602-2、602-3を割り当てる。そして、書き込みが行われているバンクメモリB[1]~B[5]と読み出しが行われているバンクメモリB[1]~B[5]とが同一にならないようにバンクメモリB[1]~B[5]へのアクセスを排他的に制御することができる。
 なお、アクセス制御部603は、書き込みコア601または読み出しコア602-1、602-2、602-3が設けられたCPUがアクセス制御に関するプログラムを実行することにより、各々のCPUのソフトウェア上またはファームウェア上で分散して実現することができる。
 この時、書き込みコア601が設けられたCPUに対し、書き込み操作を実現する実行コードおよびこの実行コードを含む関数がローカルに保持される。そして、書き込みコア601が設けられたCPUが、書き込み操作を実現する実行コードおよびこの実行コードを含む関数を実行することでアクセス制御部603を実現することができる。
 また、読み出しコア602-1、602-2、602-3が設けられたCPUに対し、読み出し操作を実現する実行コードおよびこの実行コードを含む関数がローカルに保持される。そして、読み出しコア602-1、602-2、602-3が設けられたCPUが、読み出し操作を実現する実行コードおよびこの実行コードを含む関数を実行することでアクセス制御部603を実現することができる。
 さらに、共有メモリ610には、カウンタ配列領域612およびレジスタ613、614が設けられている。カウンタ配列領域612は、読み出しコア602-1、602-2、602-3からバンクメモリB[1]~B[5]への現在のアクセス数のカウント値UBC[1]~UBC[5]をバンクメモリB[1]~B[5]ごとに対応して記憶する。カウンタ配列領域612のUBC[1]~UBC[5]をバンク使用中カウンタと呼ぶ。
 レジスタ613は、書き込みコア601によって最後に書き込みが行われたバンクメモリB[1]~B[5]を特定するバンク番号#1~#5を記憶する。レジスタ613で示されるバンクメモリB[1]~B[5]を最新データバンクと言う。レジスタ614は、最後に書き込みが行われたバンクメモリB[1]~B[5](すなわちレジスタ613で示されるバンクメモリ)以外で、かついずれの読み出しコア602-1、602-2、602-3からもアクセスされていないバンクメモリB[1]~B[5]を特定するバンク番号#1~#5を記憶する。レジスタ614で示されるバンクメモリB[1]~B[5]をフリーバンクと言う。
 この時、書き込みコア601および読み出しコア602-1、602-2、602-3は、カウンタ配列領域612に記憶されたカウント値UBC[1]~UBC[5]およびレジスタ613、614に記憶されたバンク番号#1~#5を参照したり、変更したりすることができる。
 カウンタ配列領域612に記憶されたカウント値UBC[1]~UBC[5]およびレジスタ613、614に記憶されたバンク番号#1~#5を変更する場合、他の書き込みコア601および読み出しコア602-1、602-2、602-3からの干渉(競合)を排除できるようにアトミック命令を使用することができる。
 読み出しコア602-1、602-2、602-3からの読み出し要求があると、アクセス制御部603は、レジスタ613に記憶されたバンク番号#1~#5を参照する。そして、その参照結果に基づいて、最後に書き込みが行われたバンクメモリB[1]~B[5]を特定し、そのバンク番号#1~#5を読み出しコア602-1、602-2、602-3に通知する。さらに、アクセス制御部603は、レジスタ613に記憶されたバンク番号#1~#5に対応するバンクメモリB[1]~B[5]のカウント値UBC[1]~UBC[5]を1だけインクリメントする。
 次に、読み出しコア602-1、602-2、602-3からバンクメモリB[1]~B[5]の返却要求があると、アクセス制御部603は、そのバンクメモリB[1]~B[5]のカウント値UBC[1]~UBC[5]を1だけデクリメントする。そして、そのバンクメモリB[1]~B[5]のカウント値UBC[1]~UBC[5]が0、かつバンク番号#1~#5がレジスタ613に記憶されたバンク番号#1~#5と不一致の場合、そのバンクメモリB[1]~B[5]のバンク番号#1~#5をレジスタ614に登録する。
 一方、書き込みコア601からの書き込み要求があると、アクセス制御部603は、レジスタ614に記憶されたバンク番号#1~#5を参照する。そして、その参照結果に基づいて、最後に書き込みが行われたバンクメモリB[1]~B[5](すなわちレジスタ613で示されるバンクメモリ)以外で、かついずれの読み出しコア602-1、602-2、602-3による読み出しにも使用されていないバンクメモリB[1]~B[5]を特定する。そして、アクセス制御部603は、その特定されたバンクメモリB[1]~B[5]のバンク番号#1~#5を書き込みコア601に通知する。さらに、アクセス制御部603は、書き込みコア601に通知したバンク番号#1~#5をレジスタ614から削除する。
 書き込みが行われるバンクメモリB[1]~B[5]のバンク番号#1~#5が書き込みコア601に通知される前に、最新のデータを保持しているバンクメモリB[1]~B[5](すなわちレジスタ613で示されるバンクメモリ)のデータが、書き込みコア601に通知されるバンク番号#1~#5に対応したバンクメモリB[1]~B[5]にコピーされる。この時、書き込みコア601は、前回の書き込み時から値が変化した差分のみを書き換えることができる。
 書き込みコア601が最新のデータを書いたバンクメモリB[1]~B[5]を公開する場合、レジスタ613に今まで記憶されたバンク番号#1~#5が、最新のデータが書かれたバンクメモリB[1]~B[5]のバンク番号#1~#5に書き換えられる。レジスタ613に今まで記憶されたバンク番号#1~#5に対応するバンクメモリB[1]~B[5]のカウント値UBC[1]~UBC[5]が0の場合、そのバンクメモリB[1]~B[5]のバンク番号#1~#5がレジスタ614に登録される。
 以下、書き込みコア601および読み出しコア602-1、602-2、602-3の動作について時系列順に説明する。各バンクメモリB[1]~B[5]の左下に表記した添え字付きのWの数字の順番でバンクメモリB[1]~B[5]の値が更新された(書き込まれた)ものとする。この時、バンクメモリB[1]~B[5]の読み出しコアからの被参照数に対応してカウント値UBC[1]~UBC[5]が設定される。
 W-2で2回前に書き込まれたバンクメモリB[2]のカウント値UBC[2]は2である。この時、2個の読み出しコア602-1、602-2がバンクメモリB[2]にアクセス中である。W-3で3回前に書き込まれたバンクメモリB[3]のカウント値UBC[3]は1である。この時、1個の読み出しコア602-3がバンクメモリB[3]にアクセス中である。
 W-1で前回に最新のデータとして書き込まれたバンクメモリB[4]のカウント値UBC[4]は0であり、まだどの読み出しコア602-1~602-3も読み出していない。この時、バンクメモリB[4]のバンク番号#4はレジスタ613に登録される。
 W-∞で少なくとも注目している時間帯では、書き込まれていないバンクメモリB[5]のカウント値UBC[5]は0であり、どの読み出しコア602-1~602-3からもアクセスされていない。この時、バンクメモリB[5]はフリーバンクとなり、そのバンク番号#5はレジスタ614に登録される。
 ここで、書き込みコア601からの書き込み要求があると、それまでレジスタ614に登録されていたバンク番号#1のバンクメモリB[1]が書き込み用に予約バンクとして確保され、書き込みコア601に提供される。この時、バンクメモリB[1]のカウント値UBC[1]は0である。バンクメモリB[1]が書き込みコア601に提供する前に、それまでの最新のデータが記憶されていたバンクメモリB[4](すなわちレジスタ613で示されるバンクメモリ)のデータがバンクメモリB[1]にコピーされる(615)。
 書き込みコア601からバンクメモリB[1]への書き込みが終わり、そのバンクメモリB[1]が読み出しコア602-1~602-3に公開されると、レジスタ613にそれまで登録されていたバンク番号#4がバンク番号#1に書き換えられる。前回までの(一段古い)最新のデータが格納されていたバンクメモリB[4]のカウント値UBC[4]は0であり、どの読み出しコア602-1~602-3からも読み出し中ではない。このため、バンクメモリB[4]はフリーバンクとなり、バンクメモリB[4]のバンク番号#4がレジスタ614に登録される。すなわち、レジスタ614に登録されたバンク番号は{#1,#5}から{#4,#5}に変化する。
 ここで、読み出しコア602-1~602-3は、バンクメモリB[1]~B[5]にアクセスする時に、レジスタ613に登録されたバンク番号#1~#5を参照することにより、書き込みコア601による書き込みと競合することなく、バンクメモリB[1]~B[5]から最新のデータを読み出すことができる。書き込みコア601は、バンクメモリB[1]~B[5]にアクセスする時に、レジスタ614に登録されたバンク番号#1~#5を参照することにより、読み出しコア602-1~602-3による読み出しと競合することなく、バンクメモリB[1]~B[5]に最新のデータを書き込むことができる。
 この時、バンクメモリB[1]~B[5]に書き込める書き込みコア601を1個のみに制限することにより、バンクメモリB[1]~B[5]に書きこまれたデータセットの同時性を確保しつつ、最新のデータが書き込まれたバンクメモリB[1]~B[5]を正確に指定することが可能となる。
 これにより、ロックレスで書き込みコア601と読み出しコア602-1~602-3との間でのデータ伝達の最新性および同時性を保証することができる。すなわち、マルチコアシステムによる処理のリアルタイム性を向上させつつ、同時性が確保された最新データセットをコア間で伝達することが可能となる。読み出しコアの個数が増加しても、スクラッチパッド・メモリ611内のメモリバンクの個数を増加させることで対処できる。したがって、スピンロックによる待ち時間を必要としない1対nの同報データ伝達装置を実現することができる。
 書き込みコア601と読み出しコア602-1~602-3の動作タイミングは非同期である。読み出し周期より書き込み周期の方が早ければ、読み出し側で適宜データを読み飛ばすことができ、書き込み周期より読み出し周期の方が早ければ、同一データを適宜重ね読みすることができる。このため、マルチコアシステムの書き込み周期と読み出し周期とを一致させる必要がなくなり、各コアに対するデータ入出力期間の柔軟性を向上させることができる。
 図7は、実施形態に係るデータ伝達装置の読み出し手続きを示すフローチャートである。
 図7において、読み出し手続きS700が開始されると、読み出しコア602-1~602-3は、Get_Bank関数f710を呼び、戻り値よりアクセス可能なバンク番号idを取得する(ステップS710)。なお、図6の例では、バンク番号idは、#1~#5のいずれかの値に設定される。
 次に、読み出しコア602-1~602-3は、read(id,offset)を実行する。この時、そのバンク番号idで指定されるバンクメモリB[id]の先頭よりのオフセットアドレスoffsetで所望の変数値dataを読み出す(ステップS720)。ステップS720は、所望の変数値dataをすべて読み出すまで繰り返し実行することができる。
 次に、読み出しコア602-1~602-3は、Release_Bank関数f730を呼び出し、Get_Bank関数f710で確保したバンクの返却を行う(ステップS730)。Get_Bank関数f710のコールとRelease_Bank関数f730のコールとの間では、Get_Bank関数f710で確保されたバンクメモリB[id]のデータはキャプチャされ、他の要因で変更されることはない。このため、演算処理などに使われるデータセットの同時性を確保することができる。
 上述した実施形態では、一連の読み出し手続きS700が、コアごとに1か所で使われる前提で説明したが、同一コアのプリエンプション可能な別タスクの複数個所で使われてもよい。その場合は、読み出し複数個所に相当する分読み出しコア数が増えたものと見なし、バンクメモリの数を増加させて対応することができる。ただし、メモリ資源の節約の観点から、同一コアの主たる1か所のタスクがアクセスし、値はローカル変数にコピーして複数のタスクで使いまわす方がよい。この[1外部入力インターフェース/1コア]の手法により、管理上の煩雑さの低減、デバッグおよび変更の容易化を図ることができる。
 Get_Bank関数f710では、レジスタ613より最新のデータが存在するバンクメモリB[1]~B[5]のバンク番号#1~#5を取得する。この時、最新のデータが存在するバンクメモリB[1]~B[5]のバンク番号#1~#5をLIBR(Latest Information Bank Register)とすると、変数xにLIBRを設定する。
 そして、そのバンクメモリB[1]~B[5]のカウント値UBC[x]を1だけインクリメントする(ステップS711)。レジスタ613およびカウント値UBC[1]~UBC[5]は共有メモリ610上に存在しているため、これらの操作はアトミック命令で実行される。
 次に、最新のデータが存在するバンクメモリB[1]~B[5]のバンク番号#1~#5を特定する変数xを戻り値として、メインルーチンにリターンを行う(ステップS712)。
 Release_Bank関数f730では、バンク番号idで指定されるバンクメモリB[id]の返却に先立って、そのバンクメモリB[id]のカウント値UBC[id]を1だけデクリメントする(ステップS731)。カウント値UBC[id]は共有メモリ610上に存在しているため、この操作はアトミック命令で実行される。
 次に、カウント値UBC[id]が0となり、かつバンク番号idがレジスタ613に登録されたバンク番号#1~#5とが一致しない(すなわち最新データではない)場合、バンク番号idで指定されるバンクメモリB[id]をフリーバンクとみなし、そのバンク番号idをレジスタ614に登録する(ステップS732)。レジスタ613、614およびカウント値UBC[1]~UBC[5]は共有メモリ610上に存在しているため、これらの操作はアトミック命令で実行される。
 次に、メインルーチンにリターンし、一連の読み出し手続きS700を終了する(ステップS733)。
 図8は、実施形態に係るデータ伝達装置の書き込み手続きを示すフローチャートである。
 図8において、書き込み手続きS800が開始されると、書き込みコア601は、Reserve_Bank関数f810を呼び、戻り値よりアクセス可能なバンク番号idを取得する(ステップS810)。なお、図6の例では、バンク番号idは、#1~#5のいずれかの値に設定される。
 次に、書き込みコア601は、write(id,offset,data)を実行する。この時、そのバンク番号idで指定されるバンクメモリB[id]の先頭よりのオフセットアドレスoffsetで所望の変数値dataを書き換える(ステップS820)。ステップS820は、要求する変数値dataをすべて書き換えるまで繰り返し実行することができる。
 値に変化のない変数は、Reserve_Bank関数f810で前回の最新のデータがあらかじめコピーされており、何も操作を行う必要がない。
 次に、Put_Bank関数f830を呼び出し、Reserve_Bank関数f810で確保したバンクメモリB[id]の公開を行う(ステップS830)。Reserve_Bank関数f810のコールとPut_Bank関数f830のコールとの間では、Reserve_Bank関数f810で確保したバンクメモリB[id]のデータは、読み出しコア602-1~602-3のアクセスから保護され、他の要因で参照されることはない。このため、読み出しコア602-1~602-3の視点で、演算処理などに使われるデータセットの同時性を確保することができる。
 Reserve_Bank関数f810では、レジスタ614よりフリーバンクのバンク番号#1~#5を取得し、そのバンク番号#1~#5をレジスタ614から削除する(スステップS811)。図8では、レジスタ614をFBR(Free Bank Register)として表し、FBRからバンク番号を1つ選択して変数xに設定している。FBRから選択して取り出したバンク番号は、FBR自体からは削除される。レジスタ614は共有メモリ610上に存在しているため、これらの操作はアトミック命令で実行される。
 次に、最新データが確保されているバンクメモリB[LIBR]から、Reserve_Bank関数f810で確保されたバンクメモリB[x]にデータのコピーを行う(ステップS812)。
 次に、フリーバンクのバンク番号#1~#5を特定する変数xを戻り値として、メインルーチンにリターンを行う(ステップS813)。
 Put_Bank関数f830では、バンク番号で指定されるバンクメモリB[id]の公開に先立って、今までのLIBRの値を呼び出し、変数oldに一旦保存する(ステップS831)。変数oldは、書き込みコア601のローカルRAM(102、112)に格納するため、アトミック命令を使わなくてよい。
 次に、レジスタ613に登録されているLIBRの値を今回公開するバンクメモリB[id]のバンク番号idで書き換える(ステップS832)。レジスタ613は共有メモリ610上に位置しているが、値を書き換える関数はこのPut_Bank関数f830しか存在しないため、アトミック命令を使わなくてもよい。また、この時点では、最新のデータの準備が完了しているため、任意の読み出しコア602-1~602-3から値を参照することができる。
 次に、一つ前の最新データが確保されていたバンクメモリB[old]のカウント値UBC[old]がチェックされる(ステップS833)。このカウント値UBC[old]が0であった場合、そのバンクメモリB[old]は、どの読み出しコア602-1~602-3からも参照されておらず、データが古くなっている。このため、バンクメモリB[old]をフリーバンクとみなし、この変数oldをレジスタ614(図8ではFBRと表記)に登録する。レジスタ614およびカウント値UBC[1]~UBC[5]は共有メモリ610上に存在しているため、これらの操作はアトミック命令で実行される。
 次に、メインルーチンにリターンし、一連の書き込み手続きS800を終了する(ステップS834)。
 以下、図6から図8で説明した実施形態をマルチコア組み込み制御ソフトに適用した例を示す。この適用例として、図1のエンジンの燃料噴射系を例にとる。この時、図1のCPU100には、図6の書き込みコア601を設けることができる。図1のCPU110には、図6の読み出しコア602-1を設けることができる。図1の共有RAM120には、図6のバンクメモリB[1]~B[3](なぜ3つのバンクメモリが必要かは図12で示す)およびレジスタ613、614を設けるとともに、カウント値UBC[1]~UBC[3]を記憶することができる。バンクメモリB[1]~B[3]を束ねることでスクラッチパッド・メモリ611を構成することができる。
 Reserve_Bank関数f810およびPut_Bank関数f830は、実行コード101が格納された実行コード格納領域に実装することができる。Get_Bank関数f710およびRelease_Bank関数f730は、実行コード111が格納された実行コード格納領域に実装することができる。
 図9は、実施形態に係るデータ伝達装置がエンジンの燃料噴射系に適用された時のデータ伝達手順を示すフローチャートである。なお、図9では、図1のエンジンの燃料噴射系に図2の(a)のマスフロー方式が適用された場合を示した。
 図9において、CPU100には、リアルタイムOS(Operating System)900が実装されている。CPU100は、このOS900の指揮下のもとに5msと10msのタスクを周期的に実行することができる。OS900は、図1の実行コード101に実装することができる。なお、5msというタスクの実行時間は、吸入空気量Qの計算901に用いられるデジタルフィルタのサンプリング周期に基づいて設定することができる。10msというタスクの実行時間は、エンジン回転数Neの計算902に用いられるデジタルフィルタのサンプリング周期に基づいて設定することができる。
 CPU100は、主にセンサからの入力処理を担当する。5msのタスクでは、吸入空気量Qの計算901を行う。10msのタスクでは、エンジン回転数Neの計算902を行う。この計算901、902の結果として、{Q,Ne}のデータセットの瞬時値が確定する。吸入空気量Qの計算901およびエンジン回転数Neの計算902は、実行コード101を用いてローカルRAM102のメモリ資源を利用しつつ行われる。
 次に、CPU100は、図8の書き込み手続きS800を実行することにより、共有RAM120に設けられたバンクメモリB[1]~B[3]に最新の{Q,Ne}のデータセットを書き込むことができる(903)。
 この時、CPU100は、書き込み手続きS800においてReserve_Bank関数f810およびPut_Bank関数f830を呼び出すことにより、カウント値UBC[1]~UBC[3]およびレジスタ613、614の値の参照や更新を行いつつ、書き込みバンクメモリB[1]~B[3]を確保したり、バンクメモリB[1]~B[3]を公開したりすることができる。Reserve_Bank関数f810およびPut_Bank関数f830の処理は、実行コード101を用いて、カウント値UBC[1]~UBC[3]およびレジスタ613、614の値の参照や更新を行いつつ、共有RAM120上のスクラッチパッド・メモリ611に対して行われる。最新の{Q,Ne}のデータセットの準備時間および送信時間(書き込み手続きS800にかかる時間)を延長しても、他の読み出しコアの動作遅延を引き起こすことはない。
 CPU110には、リアルタイムOS910が実装されている。CPU110は、このOS910の指揮下のもとに15msのタスクを周期的に実行することができる。OS910は、図1の実行コード111に実装することができる。なお、15msというタスクの実行時間は、出力アクチュエータの動作時間(要求される時間分解能)に基づいて設定することができる。
 CPU110は、主に演算と出力アクチュエータの指示値計算を担当する。15msのタスクでは、スクラッチパッド・メモリ611の読み出しと、燃料噴射量qの計算912を行う。燃料噴射量qの計算912は、実行コード111を用いてローカルRAM112のメモリ資源を利用しつつ行われる。
 燃料噴射量qの計算912を行うために、CPU110は、図7の読み出し手続きS700を実行することにより、共有RAM120に設けられたバンクメモリB[1]~B[3]から最新の{Q,Ne}のデータセットを読み出すことができる(911)。
 この時、CPU110は、読み出し手続きS700においてGet_Bank関数f710およびRelease_Bank関数f730を呼び出すことにより、カウント値UBC[1]~UBC[3]およびレジスタ613、614の値の参照や更新を行いつつ、読み出しバンクメモリB[1]~B[3]を確保したり、バンクメモリB[1]~B[3]を返却したりすることができる。Get_Bank関数f710およびRelease_Bank関数f730の処理は、実行コード111を用いて、カウント値UBC[1]~UBC[3]およびレジスタ613、614の値の参照や更新を行いつつ、共有RAM120上のスクラッチパッド・メモリ611に対して行われる。
 Get_Bank関数f710の処理と、Release_Bank関数f730の処理との間は、バンクメモリB[1]~B[3]の内容がそのまま保持されるので、そのバンクメモリB[1]~B[3]上の任意の変数を任意の回数だけ読み出すことができる。
 また、この保持時間(読み出し手続きS700にかかる時間)をどれだけ延長しても、他の書き込みコアおよび読み出しコアの動作遅延を引き起こすことはない。
 図10は、実施形態に係るデータ伝達装置がエンジンの燃料噴射系に適用された時のデータ伝達方法を時系列的に示すシーケンス図である。
 図10において、CPU100のQ計算901では、吸入空気量Q~Q10が5msごとに計算される。CPU100のNe計算902では、エンジン回転数Ne~Neが10msごとに計算される。バンク出力903では、Reserve_Bank関数f810およびPut_Bank関数f830が10msごとに呼び出され、バンクメモリB[1]~B[3]に{Q,Ne}のデータセットが書き込まれる。
 スクラッチパッド・メモリ611のバンクメモリB[1]~B[3]に最新の{Q,Ne}のデータセットが書き込まれると、この最新の{Q,Ne}のデータセットが書き込まれたバンクメモリB[1]~B[3]のバンク番号#1~#3がレジスタ613に登録される。図10ではレジスタ613がLIBRと表現されている。この最新データによるバンク内容のデータ変化を1000で示す。
 Q計算901は5msごとであり、Ne計算902は10msごとである。このため、バンク出力903からは、Q計算901による吸入空気量Q~Q10は2回に1回読み飛ばしが起こっているように見える。しかしながら、実際には、Q計算901の出力はデジタルフィルタの出力値である。このため、デジタルフィルタのサンプリングタイムでQ計算901の計算周期が決定され、Q計算901による吸入空気量Q、Q、Q、Q、Q10はバンク出力903として採用されなくても、バンク出力903として採用される吸入空気量Q、Q、Q、Q、Qに影響を与えるサンプル値である。このため、吸入空気量Q、Q、Q、Q、Q10のQ計算901は無駄ではない。
 バンク入力911では、Get_Bank関数f710およびRelease_Bank関数f730が15msごとに呼び出され、バンクメモリB[1]~B[3]から最新の{Q,Ne}のデータセットが読み出される。CPU110のq計算912では、最新の{Q,Ne}のデータセットに基づいて燃料噴射量q~qが15msごとに計算される。
 例えば、CPU100が吸入空気量Qおよびエンジン回転数Neを計算した時にバンクメモリB[3]がフリーバンクであるものとすると、CPU100は、Reserve_Bank関数f810にてバンクメモリB[3]を確保し、{Q,Ne}のデータセットをバンクメモリB[3]に書き込む。そして、Put_Bank関数f830にてバンクメモリB[3]を公開する。この時、最新のデータが登録されたバンクメモリB[3]のバンク番号#3がLIBR(レジスタ613)で示される。
 次に、CPU110は、Get_Bank関数f710にてバンクメモリB[3]を確保し、{Q,Ne}のデータセットをバンクメモリB[3]から読み出す。そして、CPU110は、{Q,Ne}のデータセットに基づいて燃料噴射量qを計算し、Release_Bank関数f730にてバンクメモリB[3]を返却する。
 CPU110がバンクメモリB[3]を返却する前に、CPU100は吸入空気量Qおよびエンジン回転数Neを計算する。この時、バンクメモリB[2]がフリーバンクであるものとすると、CPU100は、バンクメモリB[3]の返却を待つことなく、Reserve_Bank関数f810にてバンクメモリB[2]を確保し、{Q,Ne}のデータセットをバンクメモリB[2]に書き込む。そして、Put_Bank関数f830にてバンクメモリB[2]を公開する。この時、最新のデータが登録されたバンクメモリB[2]のバンク番号#2がLIBR(レジスタ613)で示される。
 次に、CPU110は、Get_Bank関数f710にてバンクメモリB[2]を確保し、{Q,Ne}のデータセットをバンクメモリB[2]から読み出す。そして、CPU110は、{Q,Ne}のデータセットに基づいて燃料噴射量qを計算し、Release_Bank関数f730にてバンクメモリB[2]を返却する。
 CPU110がバンクメモリB[2]を返却する前に、CPU100は吸入空気量Qおよびエンジン回転数Neを計算する。この時、バンクメモリB[1]がフリーバンクであるものとすると、CPU100は、バンクメモリB[2]の返却を待つことなく、Reserve_Bank関数f810にてバンクメモリB[1]を確保し、{Q,Ne}のデータセットをバンクメモリB[1]に書き込む。そして、Put_Bank関数f830にてバンクメモリB[1]を公開する。この時、最新のデータが登録されたバンクメモリB[1]のバンク番号#1がLIBR(レジスタ613)で示される。
 この時、CPU110は、最新のデータが登録されたバンクメモリB[1]がLIBRで示されている場合においても、CPU110は、バンクメモリB[2]を返却する前に、それより古い{Q,Ne}のデータセットに基づいて燃料噴射量qの計算を続行することができる。
 次に、CPU100が吸入空気量Qおよびエンジン回転数Neを計算した時にバンクメモリB[3]がフリーバンクであるものとすると、CPU100は、Reserve_Bank関数f810にてバンクメモリB[3]を確保し、{Q,Ne}のデータセットをバンクメモリB[3]に書き込む。そして、Put_Bank関数f830にてバンクメモリB[3]を公開する。この時、最新のデータが登録されたバンクメモリB[3]のバンク番号#3がLIBR(レジスタ613)で示される。
 次に、CPU110は、Get_Bank関数f710にてバンクメモリB[3]を確保し、{Q,Ne}のデータセットをバンクメモリB[3]から読み出す。そして、CPU110は、{Q,Ne}のデータセットに基づいて燃料噴射量qを計算し、Release_Bank関数f730にてバンクメモリB[3]を返却する。
 この時、バンクメモリB[1]に書き込まれた{Q,Ne}のデータセットは、バンクメモリB[3]に書き込まれた{Q,Ne}のデータセットより古くなっている。このため、CPU110は、バンクメモリB[1]に書き込まれた{Q,Ne}のデータセットを読み出すことなく、{Q,Ne}のデータセットをバンクメモリB[3]から読み出すことができる。この時、{Q,Ne}のデータセットの読み飛ばし1001を行うことができる。
 すなわち、CPU100がスクラッチパッド・メモリ611に対して行うバンク出力903は10msの周期で実行される。スクラッチパッド・メモリ611からCPU110へのバンク入力911は15msの周期で実行される。この時、スクラッチパッド・メモリ611のデータ変化1000に着目すると、バンク出力903が3回だけ行われるごとに、バンク入力911に対するデータセットの読み飛ばし1001を1回だけ行うことができる。
 このように、送り手と受け手が非同期でデータの授受を可能とすることで、受け手は要求すれば少なくとも最新のデータセットを常時取得することができる。また、送り手は受け手の都合を考慮せずに最新値の更新に専念できる。したがって、データの送り手と受け手とが疎結合であり、一方の動作のタイミングに他方の動作が引きずられることがないので、ロバスト性を確保することができる。
 図11(a)は、実施形態に係るデータ伝達装置の書き込みコアとスクラッチパッド・メモリとの占有関係を示す図である。
 図11(a)において、4個のスクラッチパッド・メモリP1~P4と、これらのスクラッチパッド・メモリP1~P4にアクセス可能な4個のコアC1~C4が設けられている。この時、スクラッチパッド・メモリP1~P4の個数と、コアC1~C4の個数とは等しくすることができる。各スクラッチパッド・メモリP1~P4には、5個のバンクメモリを設けることができる。例えば、スクラッチパッド・メモリP1は、図6のスクラッチパッド・メモリ611と同様に構成することができる。各スクラッチパッド・メモリP1~P4のバンク数は、総コア数+1に設定することができる。スクラッチパッド・メモリP1~P4は、共有メモリ610に配置することができる。
 コアC1~C4は、書き込みにおよび読み出し使われるCPUに設けることができる。この時、各コアC1~C4は、アクセスするスクラッチパッド・メモリP1~P4に応じて書き込みコアとして動作したり、読み出しコアとして動作したりすることができる。
 ここで、コアC1は、スクラッチパッド・メモリP1に対しては書き込みコアとして動作し、スクラッチパッド・メモリP2~P4に対しては読み出しコアとして動作することができる。コアC2は、スクラッチパッド・メモリP2に対しては書き込みコアとして動作し、スクラッチパッド・メモリP1、P3、P4に対しては読み出しコアとして動作することができる。コアC3は、スクラッチパッド・メモリP3に対しては書き込みコアとして動作し、スクラッチパッド・メモリP1、P2、P4に対しては読み出しコアとして動作することができる。コアC4は、スクラッチパッド・メモリP4に対しては書き込みコアとして動作し、スクラッチパッド・メモリP1~P3に対しては読み出しコアとして動作することができる。
 すなわち、各コアC1~C4は、自分がライト・オーナーであるスクラッチパッド・メモリP1~P4に関しては書き込みコア601であり、他のコアC1~C4がライト・オーナーであるスクラッチパッド・メモリP1~P4に関しては読み出しコア602-1~602-3の一つである関係が成立する。
 図11(b)は、実施形態に係るデータ伝達装置の各コアごとのスクラッチパッド・メモリへの操作関数の割り当て方法を示す図である。これらの操作関数は、各コアのローカルな実行コード格納領域に格納することができる。
 自分がライト・オーナーであるスクラッチパッド・メモリに関しては書き込み系関数Reserve_Bank_P()およびPut_Bank_P()が実装され、その他のスクラッチパッド・メモリに関しては読み出し系関数Get_Bank_P()およびRelease_Bank_P()が実装される。ただし、Pはスクラッチパッド・メモリP1~P4のメモリ番号である。
 ここで、スクラッチパッド・メモリP1~P4を複数設け、スクラッチパッド・メモリP1~P4の個数とコアC1~C4の個数とを等しくすることにより、一つのスクラッチパッド・メモリに書き込みコアが一つしか割り当てられないシステムを構成すると、複数のコアC1~C4が同時に書き込み動作を実行することが可能となる。
 また、自分がライト・オーナーであるスクラッチパッド・メモリP1~P4以外についての書き込み系関数Reserve_Bank_P()およびPut_Bank_P()を保持しないことにより、ライト・オーナーでないスクラッチパッド・メモリに間違って書き込むことを防ぐことができる。
 また、自分がライト・オーナーであるスクラッチパッド・メモリP1~P4については読み出し系関数Get_Bank_P()およびRelease_Bank_P()を保持しないことによって、誤読み出しを防止する(読み出しバンクの勘違いを防ぐ)ことができる。
 以上のように、上述した実施形態によれば、スクラッチパッド・メモリP1~P4を用いてコアC1~C4間でデータ伝達可能とすることで、マルチコアにおいても、非同期でコア間のデータの授受を図ることができる。スクラッチパッド・メモリP1~P4の操作においては、スピンロック方式を用いる必要がなくなり、ロック待ち時間なしにデータ伝達の高速化を図ることができる。
 また、例示したコア数より、コア数をもっと増加させたマルチコアに関しても、スクラッチパッド・メモリを増加させるだけで対応可能であり、実行遅延の発生を防止することができる。
 スクラッチパッド・メモリ内のバンク数を設計する指針として、スクラッチパッド・メモリにアクセス可能なコアの個数がN個(そのうち1個がライト・オーナーである)であるとすると、合計N+1個のバンクメモリを設けることができる。
 図12は、実施形態に係るデータ伝達装置のスクラッチパッド・メモリのバンク数とコア数との関係を示す図である。なお、図12は、図6の書き込みコア601と読み出しコア602-1、602-2、602-3とで、バンクメモリB[1]~B[5]が最大限使用されている状態を示した。
 図12において、読み出しコア602-1、602-2、602-3からバンクメモリB[3]~B[5]に対してGet_Bank()関数がそれぞれ呼び出され、読み出しコア602-1、602-2、602-3がそれぞれ別個のバンクメモリB[3]~B[5]を使用中である。この時、読み出しだけで最大で(N-1)個のバンクメモリB[3]~B[5]が占有される。
 この状態で、書き込みコア601が連続して二度書きを行う場合を想定する。すなわち、読み出しコア602-1、602-2、602-3がそれぞれ別個のバンクメモリB[3]~B[5]を使用中に、書き込みコア601によるバンクメモリB[2]への書き込みが終了したものとする。この時、レジスタ613には、最新のデータが書き込まれたバンクメモリB[2]のバンク番号#2が登録される。
 ここで、コアの個数よりも、バンクメモリの個数を1個だけ多くすることにより、バンクメモリB[2]に最新のデータが書き込まれ、かつ読み出しコア602-1、602-2、602-3がバンクメモリB[3]~B[5]を使用中である場合においても、バンクメモリB[1]をフリーバンクとして登録することがきる。
 このため、書き込みコア601は、バンクメモリB[2]への書き込みの終了後に、読み出しコア602-1、602-2、602-3からのバンクメモリB[3]~B[5]の返却を待つことなく、バンクメモリB[1]に対してReserve_Bank()関数を呼び出し、バンクメモリB[1]に書き込みを行うことができる。バンクメモリB[1]に書き込み中に、読み出しコア602-1、602-2、602-3がバンクメモリB[3]~B[5]のいずれかを返却し、新たな読み出し要求をした場合は、最新のデータバンクB[2]を提供することができる。
 この時、前回と今回の書き込み用に1バンクずつ必要なため、書き込み用に2バンクが必要となる。すなわち、読み出しだけで最大で(N-1)個のバンクが必要なので、全体として合計で(N-1)+2=(N+1)バンクが必要であることが分かる。
 書き込みコア601がバンクメモリB[1]に書き込んでいる間に、新たに読み出し要求が来た時に備えて、バンクメモリB[1]への書き込みが終了し、バンクメモリB[1]が公開される(Put_Bank()関数が呼び出される)まで、バンクメモリB[2]の状態を保持する。これ以降、読み出しコア602-1、602-2、602-3のバンクメモリB[3]~B[5]の占有状態に変化がなく、新たな書き込み要求が発生した場合には、レジスタ613にて示されるバンクメモリと、書き込みコア601がReserv_Bank()関数で占有するバンクメモリとを交互に切り替えて、読み出し用最新データの保持と書き込み要求の実行とを両立させることができる。
 以上述べたように、上述した実施形態によれば、ロック待ち時間なく、かつデータセットの同時性を破綻させることなく、コア間のデータ伝達を行うことができる。また、コア数を増加させたマルチコアにおいても、バンク数を増やすことで、2コアの時とほとんど同等な伝達時間を維持しつつ、コア間のデータ伝達を行うことができ、遅延時間増加によるマルチコアシステムの破綻を防止することができる。
 以上、本発明に係る実施形態について具体的に説明したが、本発明は、上述した実施形態に限定されるものではなく、その要旨を逸脱しない範囲で種々変更可能である。特に、CPUのコア数は、実施形態で述べたような2個および4個に限定するものではなく、N(Nは2以上の整数)個のマルチコアであってもよい。
 また、上記各構成、機能、処理部などは、それらの全部または一部を、例えば集積回路で設計することによりハードウェアとして実現することもできるし、プロセッサがそれぞれの機能を実現するプログラムを実行することによりソフトウェアとして実現することもできるし、集積回路と密接に関連したデバイス制御言語もしくはファームウェアとして実現することもできる。
100、110…CPU、101、111…実行コード、102、112…ローカルRAM、120…共有RAM、601…書き込みコア、602-1、602-2、602-3…読み出しコア、610…共有メモリ、611…スクラッチパッド・メモリ、612…カウンタ配列領域、UBC[1]~UBC[5]…カウント値、613、614…レジスタ、B[1]~B[5]…バンクメモリ

Claims (10)

  1.  M(Mは2以上の整数)個のバンクメモリと、前記バンクメモリにアクセス可能なN(Nは2以上の整数)個のプロセッサとが設けられた車載マルチコア制御用データ伝達装置であって、
     前記M個のバンクメモリが配置され、前記N個のプロセッサからアクセス可能な共有メモリと、
     前記バンクメモリを特定する識別情報に基づいて、前記プロセッサから前記バンクメモリへのアクセスを制御するアクセス制御部とを備える車載マルチコア制御用データ伝達装置。
  2.  前記アクセス制御部は、
     書き込みが行われるバンクメモリには、書き込みに使われる1個のプロセッサのみを割り当て、
     読み出しが行われるバンクメモリには、読み出しに使われるK(Kは1以上N-1以下の整数)個のプロセッサを割り当て、
     書き込みが行われているバンクメモリと読み出しが行われているバンクメモリとが同一にならないように前記バンクメモリへのアクセスを排他的に制御する請求項1に記載の車載マルチコア制御用データ伝達装置。
  3.  前記アクセス制御部は、
     前記プロセッサによる読み出し時には、最後に書き込みが行われたバンクメモリの識別情報を返し、
     前記プロセッサによる書き込み時には、最後に書き込みが行われたバンクメモリ以外で、かついずれのプロセッサによる読み出しにも使用されていないバンクメモリの識別情報を返す請求項2に記載の車載マルチコア制御用データ伝達装置。
  4.  前記プロセッサによる書き込みが行われるバンクメモリは、前記プロセッサに前記バンクメモリが割り当てられる前に、最後に書き込みが行われたバンクメモリの内容がコピーされる請求項2に記載の車載マルチコア制御用データ伝達装置。
  5.  書き込みに使われるプロセッサの個数は1、読み出しに使われるプロセッサの個数はN-1、前記バンクメモリの個数MはN+1に設定される請求項2に記載の車載マルチコア制御用データ伝達装置。
  6.  前記バンクメモリをM個のごとにまとめたN個のスクラッチパッド・メモリを備え、
     書き込みに使われるN個のプロセッサと前記N個のスクラッチパッド・メモリとは1対1に対応づけられている請求項1に記載の車載マルチコア制御用データ伝達装置。
  7.  前記スクラッチパッド・メモリに対して行われる書き込み操作および読み出し操作を実現する実行コードおよびこの実行コードを含む関数は、各プロセッサに対してローカルに設けられた実行コード格納領域に保持される請求項6に記載の車載マルチコア制御用データ伝達装置。
  8.  前記スクラッチパッド・メモリに対して対応づけられた書き込みに使われるプロセッサに関しては書き込みコードおよび書き込み関数のみを実装し、前記スクラッチパッド・メモリに対して対応づけられた読み出しに使われるプロセッサに関しては読み出しコードおよび読み出し関数のみを実装する請求項7に記載の車載マルチコア制御用データ伝達装置。
  9.  前記共有メモリに配置されたカウンタ配列領域と第1レジスタと第2レジスタを備え、
     前記カウンタ配列領域は、読み出しに使用されるプロセッサから前記バンクメモリへのアクセス数を前記バンクメモリごとに記憶し、
     前記第1レジスタは、最後に書き込みが行われたバンクメモリを特定する識別情報を記憶し、
     前記第2レジスタは、前記カウンタ配列領域および前記第1レジスタの参照結果に基づいて、最後に書き込みが行われたバンクメモリ以外で、かつどのプロセッサからもアクセスされていないバンクメモリを特定する識別情報を記憶し、
     前記アクセス制御部は、前記カウンタ配列領域に記憶されたアクセス数および前記第1レジスタに記憶された識別情報および前記第2レジスタに記憶された識別情報に基づいて、前記プロセッサから前記バンクメモリへのアクセスを制御する請求項1に記載の車載マルチコア制御用データ伝達装置。
  10.  M(Mは2以上の整数)個のバンクメモリと、前記バンクメモリにアクセス可能なN(Nは2以上の整数)個のプロセッサとが設けられた電子制御装置であって、
     前記M個のバンクメモリが配置され、前記N個のプロセッサからアクセス可能な共有メモリと、
     前記バンクメモリを特定する識別情報に基づいて、前記プロセッサから前記バンクメモリへのアクセスを制御するアクセス制御部とを備え、
     前記アクセス制御部は、
     書き込みが行われるバンクメモリには、書き込みに使われる1個のプロセッサのみを割り当て、
     読み出しが行われるバンクメモリには、読み出しに使われるK(Kは1以上N-1以下の整数)個のプロセッサを割り当て、
     書き込みが行われているバンクメモリと読み出しが行われているバンクメモリとが同一にならないように前記バンクメモリへのアクセスを排他的に制御し、
     前記書き込みに使われるプロセッサは、車載制御の制御量の算出に用いられる1以上複数の入力値を計算し、その入力値を前記バンクメモリに書き込み、
     前記読み出しに使われるプロセッサは、前記書き込みが行われたバンクメモリから前記入力値を読み出し、前記入力値に基づいて車載制御の制御量を算出する電子制御装置。
PCT/JP2018/034137 2017-09-27 2018-09-14 車載マルチコア制御用データ伝達装置および電子制御装置 WO2019065302A1 (ja)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2019544584A JP6873256B2 (ja) 2017-09-27 2018-09-14 車載マルチコア制御用データ伝達装置および電子制御装置
US16/647,807 US11836547B2 (en) 2017-09-27 2018-09-14 Data transmission device including shared memory having exclusive bank memories for writing and reading

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2017-185977 2017-09-27
JP2017185977 2017-09-27

Publications (1)

Publication Number Publication Date
WO2019065302A1 true WO2019065302A1 (ja) 2019-04-04

Family

ID=65901443

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2018/034137 WO2019065302A1 (ja) 2017-09-27 2018-09-14 車載マルチコア制御用データ伝達装置および電子制御装置

Country Status (3)

Country Link
US (1) US11836547B2 (ja)
JP (1) JP6873256B2 (ja)
WO (1) WO2019065302A1 (ja)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006301894A (ja) * 2005-04-20 2006-11-02 Nec Electronics Corp マルチプロセッサシステム、及びマルチプロセッサシステムのメッセージ伝達方法
JP2010501951A (ja) * 2007-02-07 2010-01-21 ローベルト ボッシュ ゲゼルシャフト ミット ベシュレンクテル ハフツング 管理モジュール、生産者及び消費者プロセッサ、その構成、共有メモリを介したインタープロセッサ通信方法
JP2014078239A (ja) * 2012-10-11 2014-05-01 Samsung Electronics Co Ltd マルチコアプロセッサで行われるプログラムのコンパイル方法、マルチコアプロセッサのタスクマッピング方法及びタスクスケジューリング方法

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE4129809C2 (de) * 1991-01-28 2000-08-17 Bosch Gmbh Robert Mehrrechnersystem
KR950031600A (ko) * 1994-04-27 1995-12-18 가나이 쯔도무 자동변속기의 제어장치 및 제어방법
US20020112100A1 (en) * 1999-08-19 2002-08-15 Myron Zimmerman System and method for data exchange
US8095727B2 (en) * 2008-02-08 2012-01-10 Inetco Systems Limited Multi-reader, multi-writer lock-free ring buffer
JP5213485B2 (ja) 2008-03-12 2013-06-19 株式会社トヨタIt開発センター マルチプロセッサシステムにおけるデータ同期方法及びマルチプロセッサシステム
US9176872B2 (en) * 2013-02-25 2015-11-03 Barco N.V. Wait-free algorithm for inter-core, inter-process, or inter-task communication
US10203995B2 (en) * 2013-11-22 2019-02-12 Excalibur Ip, Llc Method or system for access to shared resource

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006301894A (ja) * 2005-04-20 2006-11-02 Nec Electronics Corp マルチプロセッサシステム、及びマルチプロセッサシステムのメッセージ伝達方法
JP2010501951A (ja) * 2007-02-07 2010-01-21 ローベルト ボッシュ ゲゼルシャフト ミット ベシュレンクテル ハフツング 管理モジュール、生産者及び消費者プロセッサ、その構成、共有メモリを介したインタープロセッサ通信方法
JP2014078239A (ja) * 2012-10-11 2014-05-01 Samsung Electronics Co Ltd マルチコアプロセッサで行われるプログラムのコンパイル方法、マルチコアプロセッサのタスクマッピング方法及びタスクスケジューリング方法

Also Published As

Publication number Publication date
US11836547B2 (en) 2023-12-05
US20200218542A1 (en) 2020-07-09
JPWO2019065302A1 (ja) 2020-04-02
JP6873256B2 (ja) 2021-05-19

Similar Documents

Publication Publication Date Title
US10210092B1 (en) Managing cache access and streaming data
US8438341B2 (en) Common memory programming
US20210019263A1 (en) Method and system for low latency data management
JPH1165863A (ja) 共有資源管理方法
EP3489815B1 (en) Method and system for low latency data management
US20110265093A1 (en) Computer System and Program Product
Hascoët et al. Asynchronous one-sided communications and synchronizations for a clustered manycore processor
JP5213485B2 (ja) マルチプロセッサシステムにおけるデータ同期方法及びマルチプロセッサシステム
US20080134187A1 (en) Hardware scheduled smp architectures
Cataldo et al. Subutai: distributed synchronization primitives in NoC interfaces for legacy parallel-applications
Aboulenein et al. Hardware support for synchronization in the Scalable Coherent Interface (SCI)
JP6873256B2 (ja) 車載マルチコア制御用データ伝達装置および電子制御装置
JP7346649B2 (ja) 同期制御システムおよび同期制御方法
Wu et al. A hardware platform for exploring predictable cache coherence protocols for real-time multicores
Peccerillo et al. IXIAM: ISA EXtension for Integrated Accelerator Management
Hassan Disco: Time-compositional cache coherence for multi-core real-time embedded systems
France-Pillois et al. Implementation and evaluation of a hardware decentralized synchronization lock for MPSoCs
Campoy et al. Schedulability analysis in EDF scheduler with cache memories
Zhang et al. Check for updates The Optimization of IVSHMEM Based on Jailhouse
CN117370042A (zh) 用于核间远程调用的方法、嵌入式多核系统和存储介质
Rox et al. System Level Performance Analysis for Real-Time Multi-Core and Network Architectures
Lumetta Design and evaluation of multiprotocol communication on a cluster of SMP's
JP2000235553A (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: 18863786

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019544584

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18863786

Country of ref document: EP

Kind code of ref document: A1