Access method, device, electronic device, storage medium and program product of custom attribute class
By mapping the pointer address of the target circuit data to the target lock among the preset multiple locks, the problem of slow data access speed in a multi-threaded environment is solved, and local locking of data to be accessed in the class inheritance relationship is achieved, which improves data access efficiency and system concurrency and stability.
Patent Information
- Application Number
- CN202411595468.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-11
AI Technical Summary
In a multi-threaded environment, data access speed is slow in the prior art, and it is difficult to improve data access efficiency, mainly because in the case of multi-threaded access, the entire dictionary container needs to be locked to avoid thread conflicts.
By mapping the pointer address of the target circuit data to the target lock among the preset multiple locks, the current thread holds the target lock, thereby locking the target circuit data. In the case of locking data, access the target custom attribute class by calling the interface of the target custom attribute class in the management class of the target function module.
It realizes local locking of data to be accessed in a class inheritance relationship in a multi-threaded environment to avoid locking all data, thereby improving data access speed and efficiency and enhancing the concurrency and stability of the system.
Smart Images

Figure CN119105877B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of integrated circuit design, and in particular to a method, device, electronic device, storage medium and program product for accessing a custom attribute class. Background Art
[0002] With the advancement of manufacturing technology and design technology, the design methods of electronic systems have undergone profound changes, from Computer Aided Design (CAD), Computer Aided Engineering (CAE) to Electronic Design Automation (EDA). The degree of design automation is getting higher and higher, and the complexity of design is also getting stronger and stronger.
[0003] Integrated circuit EDA refers to the design method that uses electronic design automation software to complete the functional design, synthesis, verification, physical design (including layout, wiring, layout, design rule checking, etc.) of ultra-large-scale integrated circuit chips. At present, EDA technology has become a powerful tool for modern electronic design. Without the support of EDA technology, it is unimaginable to complete the design and manufacture of ultra-large-scale integrated circuits. Integrated circuit designers need to use EDA tools to design complex integrated circuits with hundreds of thousands to tens of billions of transistors to reduce design deviations, improve the success rate of tape-out and save tape-out costs.
[0004] As an important part of electronic design automation, EDA software can help designers quickly design and analyze complex electronic functional modules such as circuit diagrams, chips and systems. However, EDA software usually needs to process a large amount of data, such as library, cell, netlist, net, instance, port, port reference (PortRef) and other circuit data attribute data. These data contain various attributes and parameter information of electronic functional modules, which are crucial for design and analysis. Therefore, an efficient data attribute management mechanism is crucial for the normal operation and efficient performance of EDA software.
[0005] In the related art, attribute data of each circuit data can be saved by adding a dictionary container, and the attribute data can be accessed by a key. However, for the dictionary container, in the case of multi-threaded access, in order to avoid thread conflicts, the entire dictionary container needs to be locked until the current lock is released, which makes data access slow and difficult to improve data access efficiency. Summary of the invention
[0006] The present application provides a method, device, electronic device, storage medium and program product for accessing a custom attribute class, so as to at least solve the problem in the related art that data access speed is slow and it is difficult to improve data access efficiency. The technical solution of the present application is as follows:
[0007] According to a first aspect of the present application, a method for accessing a custom attribute class is provided, the method for accessing a custom attribute class being applied to integrated circuit electronic design automation software, the integrated circuit electronic design automation software comprising a plurality of functional modules, wherein the method for accessing a custom attribute class comprises: determining a target custom attribute class to be accessed in a current thread, wherein the target custom attribute class is a user-defined data class in target circuit data of a target functional module among the plurality of functional modules; mapping a pointer address storing the target circuit data to a target lock among a plurality of preset locks, so that the current thread holds the target lock to lock the target circuit data using the target lock; in the case of locking the target circuit data using the target lock, accessing the target custom attribute class in the target circuit data by calling an interface of the target custom attribute class in a management class of the target functional module in the current thread, wherein the management class of the target functional module comprises interfaces for accessing each custom attribute class of the target functional module.
[0008] According to a second aspect of the present application, there is provided a device for accessing a custom attribute class, the device for accessing a custom attribute class being applied to integrated circuit electronic design automation software, the integrated circuit electronic design automation software comprising a plurality of functional modules, wherein the device for accessing a custom attribute class comprises: a determination unit configured to determine a target custom attribute class to be accessed in a current thread, wherein the target custom attribute class is a user-defined data class in target circuit data of a target functional module among the plurality of functional modules; a mapping unit configured to map a pointer address storing the target circuit data to a target lock among a plurality of preset locks in response to the integrated circuit electronic design automation software currently running in a multi-threaded environment, so that the current thread holds the target lock to lock the target circuit data using the target lock; an access unit configured to access the target custom attribute class in the target circuit data by calling an interface of the target custom attribute class in a management class of the target functional module in the current thread when the target circuit data is locked using the target lock, wherein the management class of the target functional module comprises interfaces for accessing each custom attribute class of the target functional module.
[0009] According to a third aspect of the present application, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions, wherein the processor-executable instructions, when executed by the processor, prompt the processor to execute the access method of the custom attribute class described in the present application.
[0010] According to a fourth aspect of the present application, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for accessing the custom attribute class described in the present application.
[0011] According to a fifth aspect of the present application, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the method for accessing the custom attribute class described in the present application.
[0012] The technical solution provided by this application brings at least the following beneficial effects:
[0013] The present application can obtain the pointer address of the target circuit data to be accessed stored in the current thread when the integrated circuit electronic design automation software is currently running in a multi-threaded environment, and map the pointer address to the target lock in the preset multiple locks, so that the current thread holds the target lock to lock the target circuit data using the target lock. In this way, when the target circuit data is locked, the target custom attribute class can be accessed by calling the interface of the target custom attribute class in the management class of the target function module in the current thread. In this way, by introducing a lock mapping mechanism that maps the pointer address of the target circuit data to the lock, in a multi-threaded operating environment, the pointer address can be mapped to the lock to achieve partial locking of the target circuit data to be accessed in the entire class inheritance relationship, avoiding locking all the data in the class inheritance relationship and affecting the speed and efficiency of data access, and improving the concurrency and stability of the system.
[0014] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application, and do not constitute an improper limitation on the present application.
[0016] Figure 1 It is a diagram showing the class inheritance relationship in object-oriented programming.
[0017] Figure 2It is a schematic flow chart of a method for accessing a custom attribute class according to an exemplary embodiment of the present application.
[0018] Figure 3 It is a schematic flowchart of the steps of mapping a pointer address to a target lock in an access method of a custom attribute class according to an exemplary embodiment of the present application.
[0019] Figure 4 It is a schematic diagram of the inheritance relationship between management classes in the access method of a custom attribute class according to an exemplary embodiment of the present application.
[0020] Figure 5 It is a schematic flowchart of the steps of registering a target function module in a method for accessing a custom attribute class according to an exemplary embodiment of the present application.
[0021] Figure 6 It is a schematic diagram of the inheritance relationship between factory classes in the access method of a custom attribute class according to an exemplary embodiment of the present application.
[0022] Figure 7 It is a schematic diagram of the class inheritance relationship of the custom attribute class of the library data of each functional module in the method for accessing the custom attribute class according to the exemplary embodiment of the present application.
[0023] Figure 8 It is a schematic diagram of a class inheritance tree of a custom attribute class in an access method of a custom attribute class according to an exemplary embodiment of the present application.
[0024] Fig. 9 It is a schematic flow chart of an example of a registration function module in an access method of a custom attribute class according to an exemplary embodiment of the present application.
[0025] Fig.10 It is a schematic flow chart of an example of accessing data in a method for accessing a custom attribute class according to an exemplary embodiment of the present application.
[0026] Fig.11 is a block diagram of a data access device according to an exemplary embodiment of the present application.
[0027] Fig.12 is a block diagram of an electronic device according to an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to enable ordinary persons in the art to better understand the technical solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0029] It should be noted that the steps in the specification and drawings of the present application are not limited to the specific order or sequential order described. It should be understood that the steps used in this way can be interchanged where appropriate, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. The implementation methods described in the following exemplary embodiments do not represent all implementation methods consistent with the present application. On the contrary, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0030] As mentioned above, in the related art, in the presence of multi-threaded access, operations on the dictionary container need to lock the entire container, resulting in slow data access and difficulty in improving data access efficiency.
[0031] Specifically, for EDA software, processing a large amount of circuit data (DataBase, such as Library, Cell, Netlist, Net, Instance, Port, PortRef, etc.) is a common challenge. To efficiently manage this data, many EDA software developed in C++ usually add a map or unordered_map dictionary container to each data to save user-defined attribute (UserData) data and access these attribute data through keys.
[0032] In the dictionary container std::map, data is stored in a red-black tree, and the time complexity of insertion and search is O(logn), where n is the size of the data. In contrast, std::unordered_map is implemented using a hash table, which usually has a constant time complexity of O(1), but hash collisions may cause the complexity to degenerate to O(n). Therefore, the insertion and search time complexity of std::unordered_map is between O(1) and O(n).
[0033] It can be seen that no matter which dictionary container is used, in scenarios with high-frequency access and fast response, the speed of insertion and search may become a performance bottleneck. In a multi-threaded environment, data competition between threads makes operations more complicated, and usually requires locking the entire container, which significantly affects the speed and efficiency of data access.
[0034] In view of the above problems, exemplary embodiments of the present application provide a method, device, electronic device, computer-readable storage medium, and computer program product for accessing a custom attribute class, which can solve or at least alleviate the above problems.
[0035] In a first aspect of the exemplary embodiment of the present application, a method for accessing a custom attribute class is provided, which will be referred to below. Figures 1 to 10 Describe in detail.
[0036] According to an exemplary embodiment of the present application, the access method of the custom attribute class is applicable to integrated circuit electronic design automation (EDA) software. The user terminal can load the EDA software, which includes multiple functional modules.
[0037] The user terminal receives a target custom attribute class to be accessed, wherein the target custom attribute class is a user-defined data class of a target function module in a plurality of function modules in target circuit data. When the EDA software runs in a multi-threaded environment, the user terminal maps the pointer address of the target circuit data to a target lock in a plurality of preset locks, so that the current thread holds the corresponding target lock, thereby locking the target circuit data. In the case of locking the data, the current thread can access the target custom attribute class by calling the interface of the target custom attribute class in the target function module management class.
[0038] This method allows the target custom attribute class to be created or obtained by calling the interface of the target custom attribute class in the management class of the target functional module when locking the target circuit data. The mechanism of mapping the pointer address of the target circuit data with the lock is introduced. In a multi-threaded operating environment, the target circuit data to be accessed in the class inheritance relationship can be partially locked, thereby avoiding locking all data, improving data access speed and efficiency, and enhancing the concurrency and stability of the system.
[0039] The above-mentioned user terminal can be, for example, a tablet computer, a laptop computer, a digital assistant, a wearable device, etc. However, the implementation scenario of the above custom attribute class access method is only an example scenario. The custom attribute class access method according to the exemplary embodiment of the present application can also be applied to other application scenarios. For example, the user can request access to the target custom attribute class from the server through the network on the user terminal (for example, a mobile phone, a desktop computer, a tablet computer, etc.). The server can access the data and return it to the user terminal by executing the custom attribute class access method according to the exemplary embodiment of the present application. Here, the server can be an independent server, a server cluster, a cloud computing platform or a virtualization center.
[0040] In order to better understand the embodiments of the present application, before describing the access method of the custom attribute class according to the embodiments of the present application, the concepts involved in the embodiments of the present application are described here.
[0041] Regarding the concept of class, in EDA software development, C++ is the preferred language for building underlying algorithms and data processing modules. C++ adds object-oriented programming on the basis of C. Class is the core feature of C++ and is used to specify the form of an object. It is a user-defined data type that encapsulates a combination of data and functions. The data in a class is called member variables, and the functions are called member functions. A class can be seen as a template that can be used to create multiple objects with the same properties and behaviors.
[0042] To define a class, you need to use the keyword "class" and specify the name of the class, such as "classname". The body of the class is contained in a pair of curly braces "{}", and the body contains the class's member variables and member functions. The following is a sample code for defining a class:
[0043] class classname
[0044] {
[0045] Access specifiers: / / Access modifier: private / public / protected
[0046] Date members / variables; / / variables
[0047] Member functions(){} / / Method
[0048] }; / / Semicolon ends a class.
[0049] Defining a class is essentially defining a blueprint for a data type, which defines what an object of the class includes and what operations can be performed on this object. The class provides the blueprint for the object, so basically, objects are created based on the class. Declaring an object of a class is similar to declaring a variable of a primitive type.
[0050] The concept of inheritance is one of the most important concepts in object-oriented programming. Inheritance allows you to define another class based on one class to reuse code functions and improve execution efficiency. When creating a class, you do not need to rewrite new data members and member functions. You only need to specify that the new class inherits the members of an existing class. The existing class is called the base class (or parent class), and the new class is called the derived class (or child class).
[0051] Inheritance can be expressed as an "is-a" relationship, where "is-a" means that a derived class inherits from a base class. For example, when the relationship is "B is-a A", it means that class B inherits from class A, class B is a derived class, and class A is a base class.
[0052] Inheritance can be divided into single inheritance and multiple inheritance. Single inheritance means that a derived class is derived from only one base class, and the hierarchy formed by its inheritance relationship is a tree structure (i.e., inheritance tree), with arrows indicating the direction of inheritance, from the derived class to the base class. Figure 1 An example of a class inheritance tree in single inheritance is shown in , where A is the base class, A1, A2 and A3 are derived classes of class A, and classes A11 and A12 are derived classes of class A1, classes A21 and A22 are derived classes of class A2, and classes A31, A32 and A33 are derived classes of class A3. Multiple inheritance means that a derived class has two or more base classes, and a derived class can be derived not only from one base class, but also from multiple base classes.
[0053] Regarding the concept of multi-threading, when a C++ program (such as EDA software) is started, the operating system will create a new process for the program. A process is an execution instance of a program, which has its own memory space, resources, and execution environment. In this newly created process, the operating system will automatically create a main thread for the program, and the execution of this thread will start from the main function of the program. Here, the main thread is responsible for executing the main logic of the program, including initialization, running the main functions of the program, and cleanup.
[0054] To solve the real-time response problem of multi-tasking, the program can create additional threads to handle other tasks during the execution of the main thread. These threads can perform different tasks in parallel, such as processing user input, performing background tasks, or responding to network requests.
[0055] In general, a thread is a subdivision of a process. Usually in a real-time operating system, a process is divided into multiple subtasks that can run independently. These subtasks are executed by different threads, so that multiple threads cooperate to complete the tasks of a process. Although a process contains multiple threads, these threads share the memory address space and resources occupied by the process. The process is the basic unit for resource allocation in the operating system (processes do not interfere with each other), and the thread is the basic unit for the operating system to schedule the central processing unit (CPU) (switching between threads).
[0056] The lock mechanism is used to manage access to shared resources in a multi-threaded environment. When multiple threads access shared resources concurrently and perform destructive operations (such as adding, deleting, and modifying), data corruption may occur. To ensure safe access to shared resources, the C++ language introduces a lock mechanism. When multiple threads need to access shared resources, locks can prevent simultaneous access. When a thread holds a lock, other threads must wait until the lock is released before they can compete for the lock again. This mechanism effectively avoids data contention and conditional contention.
[0057] Commonly used lock mechanisms in C++ language include mutual exclusion lock (std::mutex), recursive lock (std::recursive_mutex), shared lock (std::shared_mutex), condition variable (std::condition_variable), atomic operation (std::atomic) and spin lock.
[0058] Mutex is the most basic type of lock, used to protect shared data and ensure that only one thread can access the data at the same time. You can use lock and unlock methods, or use std::lock_guard and std::unique_lock to simplify lock management.
[0059] Recursive locks allow the same thread to lock the same mutex multiple times without deadlock, which is suitable for recursive functions or scenarios where recursive calls may occur.
[0060] A shared lock (std::shared_mutex) is a read-write lock that allows multiple threads to read shared data simultaneously, but requires exclusive access when writing. You can use std::shared_lock when reading and std::unique_lock when writing.
[0061] Condition variables are used for inter-thread synchronization, allowing one or more threads to wait until a certain condition is true. Condition variables are often used with std::unique_lock for waiting and notification.
[0062] Atomic operations provide a mechanism to ensure the atomicity of operations without locks. They are applicable to simple data types and are often used to implement lock-free programming.
[0063] Spin locks are used to protect shared resources like mutex locks, but unlike mutex locks, spin locks acquire locks through atomic operations. When the shared resource is occupied, the current thread will not block, but spin wait until the lock becomes available.
[0064] The following will refer to Figure 2The specific steps of a method for accessing a custom attribute class according to an exemplary embodiment of the present application are described. The method for accessing a custom attribute class can be applied to integrated circuit electronic design automation software, which can include multiple functional modules. Figure 2 As shown, the access method of the custom attribute class may include the following steps:
[0065] In step S210, a target custom attribute class to be accessed in the current thread may be determined.
[0066] Here, the target custom attribute class can be a user-defined data class of the target functional module in the target circuit data of the multiple functional modules. The access to the target custom attribute class described in this article can include creating a new target custom attribute class or obtaining a created target custom attribute class, and can also include other uses or operations on the target custom attribute class.
[0067] In EDA software, each functional module may have various types of circuit data, and each type of circuit data may contain data of a custom attribute class. These custom attribute classes (ie, UserData classes) are used to store relevant information of the functional modules.
[0068] As an example, the target functional module can be one of a unified power format (UPF) module, a power management (PWR) module, a testability function (DFT) module, a clock domain crossing (CDC) module, and a static code analysis (LINT) module, and the target circuit data can be one type of data among a library (Library), a cell (Cell), a netlist (Netlist), a net (Net), an instance (Instance), a port (Port), and a port reference (PortRef).
[0069] Each type of circuit data can have its own custom attribute class. Taking the UPF module as an example, the custom attribute classes in the various types of circuit data in the UPF module may include the custom attribute class upfLibraryUserData of Library type circuit data, the custom attribute class upfCellUserData of Cell type circuit data, the custom attribute class upfNetlist type circuit data, the custom attribute class upfNetlistUserData of Net type circuit data, the custom attribute class upfNetUserData of Net type circuit data, the custom attribute class upfInstanceUserData of Instance type circuit data, the custom attribute class upfPortUserData of Port type circuit data and the custom attribute class upfPortRefUserData of PortRef type circuit data. These classes can all inherit from the common base class genUserData of all circuit data.
[0070] In step S220, in response to the integrated circuit electronic design automation software currently running in a multi-threaded environment, the pointer address storing the target circuit data can be mapped to a target lock among a plurality of preset locks, so that the current thread holds the target lock to lock the target circuit data using the target lock.
[0071] In a multi-threaded environment, to ensure the thread safety of class inheritance tree operations, locks need to be defined to ensure that only one thread performs modification operations at the same time when multiple threads access a node (i.e. a custom attribute class) of the tree at the same time. For example, when a thread needs to create a new custom attribute class instance, it must first acquire a lock to ensure that other threads cannot operate on the node before the operation is completed.
[0072] Specifically, according to the embodiments of the present application, it can be determined whether the current operating environment of the EDA software is a multi-threaded environment. In response to currently running in a multi-threaded environment, the current thread needs to map the pointer address storing the target circuit data to a lock to prevent the data from being accessed by other threads while the current thread is accessing the target circuit data; in response to not currently running in a multi-threaded environment, that is, running in a single-threaded environment, the current thread can directly access the target custom attribute class in the target circuit data.
[0073] Here, the pointer address storing the target circuit data can be obtained, for example, when the target custom attribute class to be accessed is determined in step S210. Specifically, in the circuit, the pointer address of the circuit data can be obtained by default. When the target custom attribute class to be accessed is determined, the pointer address of the target circuit data where the target custom attribute class is located can be obtained. The pointer address can be input as a parameter to specify the target custom attribute class to be accessed.
[0074] As an example, a lock array may be preset, and the multiple locks mentioned above may be stored in the lock array. A fixed number of locks may be preset in the lock array.
[0075] Here, the number of locks can be set according to actual needs, for example, it can be slightly larger than the maximum number of threads that the server can provide. However, in order to improve multi-threading performance, the number of locks can be the same as the number of bytes of the memory page. For example, if the memory page size is 4096 bytes, 4096 locks can be predefined; similarly, if the memory page size is 8192 bytes, 8192 locks can be predefined. In addition, the lock here can be, for example, a spin lock.
[0076] In this example, if Figure 3 As shown, the pointer address can be mapped to the target lock in the following way:
[0077] In step S310, the value of the pointer address may be moved by a preset memory alignment amount to obtain an absolute pointer address value after removing the memory alignment amount.
[0078] Here, the memory alignment is an offset of a pointer address set to store data on the address boundary of the memory.
[0079] In memory, data is usually stored on specific address boundaries to improve access efficiency. This is achieved through memory alignment, which adjusts the storage address of the data to an integer multiple of a preset number of bytes. The preset number of bytes can be a variety of values, such as 32 bytes. Therefore, in a 64-bit operating system, if the pointer needs to be aligned to 32 bytes, all aligned pointer addresses must be multiples of 32, which means that the last 5 bits of the address will be 0 (i.e. invalid bits), so that these bits do not affect the validity of the address.
[0080] For example, taking the four pointer addresses 0x1e4b000, 0x1e4b020, 0x1e4b040, and 0x1e4b060 as examples, since they all use 32-byte alignment, their current pointer addresses are as follows:
[0081] 0x1e4b000: 0001 1110 0100 1011 0000 0000 0000
[0082] 0x1e4b020: 0001 1110 0100 1011 0000 0010 0000
[0083] 0x1e4b040: 0001 1110 0100 1011 0000 0100 0000
[0084] 0x1e4b060: 0001 1110 0100 1011 0000 0110 0000
[0085] It can be seen that since these four pointers use 32-byte memory alignment, the last 5 bits of the four pointer addresses are all 0.
[0086] In step S310, taking the above four pointer addresses as an example, the memory alignment is 5, and the values of the above pointer addresses are moved by the memory alignment to obtain the pointer address values after removing the memory alignment: 0000 0000 1111 0010 0101 1000 0000 0000 0000 1111 0010 0101 1000 0001 0000 0000 1111 0010 0101 1000 0010 0000 0000 1111 0010 0101 1000 0011
[0091] For the aligned pointer address, if the de-alignment process is not performed, it is difficult to obtain continuous values when searching for the target index later, so that some locks in the lock array can never be mapped.
[0092] Specifically, in step S320, the absolute pointer address value may be mapped to a target index among a plurality of indexes in the lock array.
[0093] Here, each index in the lock array can identify a lock, and these indexes can be consecutive, such as 0, 1, 2, 3, etc.
[0094] In one example, the target index may be determined in the following manner: performing a bitwise AND operation on the absolute pointer address value and a preset value to determine the target index.
[0095] Here, the preset value can be used to limit the absolute pointer address value to a value range where the index in the lock array is located.
[0096] For example, in the above example, the preset value can be 0xfff. The continuous pointer address is shifted right by the memory alignment amount, that is, 5 bits, which can be considered as dividing by 32 to obtain the absolute pointer address value; the absolute pointer address data is then ANDed with 0xfff to obtain continuous values, that is, 0, 1, 2, 3, etc.
[0097] In this way, when the number of pointer addresses of circuit data far exceeds the number of preset locks (such as the number of locks in the lock array), multiple pointer addresses can correspond to the same lock, and when accessing these pointer addresses, the thread can lock the pointer address by acquiring the lock.
[0098] However, the method of determining the target index is not limited to the above example. In another example, the target index corresponding to the current absolute pointer address value can also be determined by presetting the correspondence between the absolute pointer address value and each index in the lock array.
[0099] In step S330, the pointer address may be mapped to the target lock identified by the target index.
[0100] In this step, a mapping relationship between the pointer address and the target lock represented by the target index may be established, so that the target circuit data may be locked using the target lock.
[0101] In the above manner, by defining a fixed number of locks in advance and mapping the locks to specific pointer addresses, frequent creation and destruction of locks can be avoided, thereby improving the efficiency and performance of the system.
[0102] Although example steps for obtaining a target lock are described above, embodiments of the present application are not limited thereto. As another example, a lock corresponding to each pointer address may be pre-defined. When mapping the pointer address to the lock, the lock corresponding to the pointer address storing the target circuit data may be used as the target lock to lock the target circuit data.
[0103] The following is a pseudo code example of getting the target lock GetDesignUserDataLocker() from the lock array, taking the spin lock utSpinLock and the pointer address pDB as an example:
[0104] / / utSpinLock is a spin lock, get the spin lock mapped by the circuit data (pDB) pointer
[0105] utSpinLock&GetDesignUserDataLocker(void pDB)
[0106] {
[0107] / / Shift the pointer address right by 5 bits (because when the malloc or new function allocates memory, the returned pointer is usually aligned to 32 bytes)
[0108] / / Perform a bitwise AND operation with 0xfff to get the index of the spin lock array, which ranges from 0x0 to 0xFFF (hexadecimal)
[0109] / / Get the spin lock of the corresponding index from _designUserDataLockArr
[0110] uintptr_t n = reinterpret_cast<uintptr_t> (pDB)>>5;
[0111] size_t i = n&0xfff;
[0112] return _designUserDataLockArr[i];
[0113] }.
[0114] In the above pseudocode example, the value of the pDB pointer address is shifted right by 5 bits to obtain the absolute pointer address value n after the pDB pointer removes the memory alignment; the absolute pointer address value n is then bitwise ANDed with the preset value 0xfff to obtain the target index i of the spin lock array; the spin lock corresponding to the target index i is taken out from the lock array designUserDataLockArr.
[0115] In addition, as an example, before executing the step of mapping the pointer address storing the target circuit data to the target lock in the preset multiple locks, the current thread can determine multiple locks, such as the above-mentioned lock array, by calling the interface of the preset unified management class. Here, the unified management class can be preset, which may include an interface for obtaining multiple locks (such as a lock array). However, the embodiments of the present application are not limited to this, and the unified management class may also include other interfaces. In the embodiments of the present application, the preset unified management class can provide a unified access interface to the outside, so as to conveniently access the specific classes of each functional module.
[0116] As an example, a lock array may be defined in a unified management class. Taking 4096 predefined spin locks as an example, the sample code for defining the lock array may be as follows:
[0117] {
[0118] / / Assuming the memory page size is 4096 bytes, 4096 spin locks are predefined
[0119] std::array<utSpinLock, PAGE_SIZE> _designUserDataLockArr{};
[0120] std::array<utSpinRWLock, PAGE_SIZE> _portRefUserDataRWLockArr{};
[0121] }.
[0122] In this sample code, "utSpinLock" represents a spin lock, and "utSpinRWLock" represents a spin read-write lock. Here, since the PortRef data is stored in the Instance data, a read-write lock is required when accessing the PortRef data, while other types of data can use a spin lock.
[0123] Through the above method, a fixed number of locks can be pre-defined when defining a unified management class. The lock indexes (or lock IDs (Identity documents)) corresponding to these locks are stored in a lock array (such as the above-mentioned designUserDataLockArr). When a thread calls the unified management class to access the target custom attribute class of a functional module (for example, to create or obtain (Goc) a UserData class instance of a functional module), it must first obtain the pointer address (i.e., pDB address) of the corresponding type of DataBase data of the functional module, and then, after obtaining the lock mapped to the pointer address in the lock array, execute the step of accessing the target custom attribute class, i.e., the following step S230.
[0124] In step S230, the target custom attribute class in the target circuit data can be accessed by calling the interface of the target custom attribute class in the management class of the target functional module in the current thread while locking the target custom attribute class with the target lock.
[0125] Here, the management class of the target functional module may include interfaces for accessing each custom attribute class of the target functional module.
[0126] As an example, in this step, in response to the current thread accessing the target custom attribute class, a pointer to the target custom attribute class may be returned, and the target lock may be released.
[0127] For example, the current thread can access the target custom attribute class by calling the interface of the target custom attribute class in the management class of the target functional module. Taking the above upf module as the target functional module and the target circuit data as PortRef type data as an example, the current thread can access the target custom attribute class by calling the interface of the target custom attribute class upfPortRefUserData in the management class upfUserDataMgr of the upf module (for example, "upfPortRefUserData GocUpfPortRefUserData(PortRef pDB) override") to access the target custom attribute class upfPortRefUserData in the target circuit data. The examples of the management classes of each functional module will be referred to below. Figure 4 Detailed description.
[0128] As an example, in this step, the interface of the management class of the target functional module can be obtained by calling the unified management class, and then the interface of the management class can be called to obtain the interface of the custom attribute class (UserData class) of the function module in the unified management class to access the custom attribute class. Specifically, in the unified management class, the sample code for creating or obtaining the interface of the UserData class of each functional module can be as follows:
[0129] “ / / Create or obtain the UserData class of each functional module
[0130] template <uint8_t factory_type, std::derived_from <genuserdata>T,typename U>
[0131] T GocUserData(U pDB)
[0132] {
[0133] if constexpr (std::is_same_v<Instance, U>) {
[0134] return GocDesignObjUserData<factory_type, genUserData::INSTANCE, T>(pDB);
[0135] } else if constexpr (std::is_same_v<Net, U>) {
[0136] return GocDesignObjUserData<factory_type, genUserData::NET, T>(pDB);
[0137] } else if constexpr (std::is_same_v<Port, U>) {
[0138] return GocDesignObjUserData<factory_type, genUserData::PORT, T>(pDB);
[0139] } else if constexpr (std::is_same_v<Netlist, U>) {
[0140] return GocDesignObjUserData<factory_type, genUserData::NETLIST, T>(pDB);
[0141] } else if constexpr (std::is_same_v<Library, U>) {
[0142] return GocDesignObjUserData<factory_type, genUserData::LIBRARY, T>(pDB);
[0143] } else if constexpr (std::is_same_v<Cell, U> ) {
[0144] return GocDesignObjUserData<factory_type, genUserData::CELL, T> (pDB);
[0145] } else if constexpr (std::is_same_v<PortRef, U> ) {
[0146] return GocPortRefUserData<factory_type, genUserData::PORTREF, T> (pDB);
[0147] } else {
[0148] return nullptr;
[0149] }
[0150] }".
[0151] On the other hand, in response to the current thread not accessing the target custom attribute class, the factory class of the pre-registered target function module can be obtained, and the target custom attribute class can be created based on the factory class of the target function module. Here, the factory class of the target function module is used to create instances of each custom attribute class of the target function module.
[0152] In the above process of accessing the custom attribute class, you can first try to directly obtain the target custom attribute class. If it is not obtained, then create the custom attribute class to avoid multiple creation of the custom attribute class in a multi-threaded situation.
[0153] The above describes an example process of a thread accessing a target custom attribute class of a target functional module. As an example, the functional module can be registered based on an existing registration method. As another example, in an exemplary embodiment of the present application, a method of registering the above functional module based on a class inheritance line is also proposed.
[0154] Specifically, if Figure 5 As shown, the target function module can be registered in the following ways:
[0155] In step S510, a management class of a target functional module may be created by calling a preset unified management class interface.
[0156] Here, the unified management class may include an interface for creating or acquiring a management class of a functional module, and the management class of a target functional module may be created by calling the interface.
[0157] In order to facilitate understanding of the operation of this step, the management class of the functional module is first described in detail below.
[0158] The management class of each functional module can be used to manage the life cycle of the specific class of the corresponding functional module, including operations such as creation, destruction, and access, so as to ensure that the specific class of each functional module can be managed and destroyed correctly. Here, the specific class of the functional module can generally refer to the custom attribute class, factory class, and management class of the functional module.
[0159] For example, when the management class of the UPF module needs to use the corresponding custom attribute class, it can call the factory class corresponding to the UPF module (which will be described in detail below) to create the corresponding specific class instance, and can destroy the instance when it is not needed.
[0160] Each functional module corresponds to a management class. For example, the UPF module corresponds to the management class upfUserDataMgr, the PWR module corresponds to the management class pwrUserDataMgr, etc. The management classes of all functional modules can inherit from a common base class genUserDataMgr. The inheritance relationship of the management class can be Figure 4 As shown, the management class upfUserDataMgr of the UPF module, the management class pwrUserDataMgr of the PWR module, the management class cdcUserDataMgr of the cdc module, and the management class lintUserDataMgr of the lint module all inherit from the common base class genUserDataMgr.
[0161] Reference Figure 4 When defining the management class of each functional module, you can first define the management class to inherit from the common base class genUserDataMgr to provide an interface for creating or obtaining a specific class of the functional module, and then define a function process in the main part of the management class so that the interface provided by the management class can be used to create or obtain different types of specific classes of the functional module. Taking the UPF module as an example, the pseudo code example of its management class can be as follows:
[0162] {
[0163] / / The management class of the upf module, inherited from the public base class genUserDataMgr, provides an interface for obtaining the specific class of the upf module
[0164] class upfUserDataMgr : public genUserDataMgr {
[0165] public:
[0166] upfPortRefUserData GocUpfPortRefUserData(PortRef pDB) override;
[0167] upfInstanceUserData GocUpfInstanceUserData(Instance pDB) override;
[0168] upfNetUserData GocUpfNetUserData(Net pDB) override;
[0169] upfPortUserData GocUpfPortUserData(Port pDB) override;
[0170] upfNetlistUserData GocUpfNetlistUserData(Netlist pDB) override;
[0171] upfLibraryUserData GocUpfLibraryUserData(Library pDB) override;
[0172] upfCellUserData GocUpfCellUserData(Cell pDB) override;
[0173] }.
[0174] The above describes the management class of the functional module. Now let's return to Figure 5 As described above, in step S510, the unified management class can provide a unified access interface to the outside world, so as to conveniently access the specific classes of each functional module. Here, for the management class of the functional module, the interface of the management class of the functional module can be provided by the unified management class.
[0175] As an example, the unified management class may include an interface for creating or obtaining a management class of a functional module. Before accessing the target custom attribute class, the management class of the target functional module may be obtained by calling a preset unified management class interface.
[0176] Specifically, the main body of the unified management class defines a function process, so that other modules can easily call the custom attribute class of each functional module. As an example, the sample code for obtaining the interface of the management class of the functional module can be as follows:
[0177] / / genUserDataApi contains the creation and acquisition interfaces of specific classes of all functional modules
[0178] class genUserDataMgr : public genUserDataApi {
[0179] public:
[0180] / / Get the management class of the corresponding functional module
[0181] template <typename T = genUserDataMgr, typename = typename std::enable_if_t<std::is_base_of_v<genUserDataMgr, T> >>
[0182] static std::unique_ptr <genuserdatamgr>&GocUserDataMgr()
[0183] {
[0184] std::call_once(_flag, [&] { _genUserDataMgrPtr.reset(new T());});
[0185] return _genUserDataMgrPtr;
[0186] }.
[0187] In the above sample code, T represents an input parameter, which is used to specify the function module of the management class to be obtained. The management class of the function module specified by T can be obtained through GocUserDataMgr(), such as the above upfUserDataMgr.
[0188] Return to reference Figure 5 In step S520, the factory class of the target functional module can be registered by calling the interface of the unified management class, and the factory class of the target functional module can be bound to the class inheritance line of the target functional module.
[0189] Here, the factory class of the target functional module can be used to create instances of each custom attribute class of the target functional module, and the unified management class can also include an interface for registering the factory class of the functional module. Each functional module in the integrated circuit electronic design automation software can be preset with a class inheritance line, and the class inheritance line can represent the inheritance relationship of all classes from the custom attribute class of the corresponding functional module to the base class.
[0190] To facilitate understanding of the operation of this step, the factory class of the functional module is first described in detail below.
[0191] In order to dynamically create custom attribute class instances for each functional module, it is necessary to define the factory class for each functional module. A function procedure is defined in the factory class so that each factory class is used to create a custom attribute class instance for the corresponding functional module and return a pointer to the instance. For example, the factory class of the UPF module can create instances of the custom attribute classes upfLibraryUserData, upfCellUserData, upfNetlistUserData, upfNetUserData, upfInstanceUserData, upfPortUserData, and upfPortRefUserData.
[0192] Each functional module corresponds to a factory class. For example, the UPF module corresponds to the factory class upfUserDataFactory, the PWR module corresponds to the factory class pwrUserDataFactory, etc. The factory classes of all functional modules can inherit from a common base class genUserDataFactory. The inheritance relationship of the factory class can be as follows: Figure 6 As shown, the factory class upfUserDataFactory of the UPF module, the factory class pwrUserDataFactory of the PWR module, the factory class cdcUserDataFactory of the cdc module, and the factory class lintUserDataFactory of the lint module all inherit from the common base class genUserDataFactory of each factory class.
[0193] When defining the factory class of each functional module, you can first define the factory class to inherit from the common base class genUserDataFactory class of the factory class, and then define a function process in the main part of the factory class, so that the factory class can create a corresponding specific class instance according to the type identifier (ID) of the custom attribute class of the input circuit data DataBase, and return a pointer to the instance. Here, the way of inputting the type identifier of the custom attribute class into the circuit data will be described below when describing the example of step S510.
[0194] Taking the UPF module as an example, the pseudo code example of the factory class of the UPF module can be as follows:
[0195] / / Define the factory class of the upf module, inheriting from the public base class genUserDataFactory
[0196] class upfUserDataFactory : public genUserDataFactory {
[0197] public:
[0198] / / Create different specific classes of the upf module according to the type identifier of the custom attribute class passed into the Database
[0199] genUserData CreateUserData(uint8_t type) override
[0200] {
[0201] switch (type) {
[0202] case genUserData::INSTANCE:
[0203] return new pwr InstanceUserData();
[0204] case genUserData::NET:
[0205] return new pwr NetUserData();
[0206] case genUserData::PORT:
[0207] return new upfPortUserData();
[0208] case genUserData::NETLIST:
[0209] return new upfNetlistUserData();
[0210] case genUserData::LIBRARY:
[0211] return new upfLibraryUserData();
[0212] case genUserData::PORTREF:
[0213] return new upfPortRefUserData();
[0214] case genUserData::CELL:
[0215] return new upfCellUserData();
[0216] default:
[0217] return nullptr;
[0218] }
[0219] }
[0220] }。
[0221] In the above sample code, type represents the type identifier of the custom attribute class of the input circuit data Database, which is used to specify the custom attribute class to be created by the functional module. The custom attribute class can be created by the method new. For example, the custom attribute class upfPortUserData can be created by the statement "new upfPortUserData()".
[0222] The factory class of the functional module is explained above. Now let’s return to the reference Figure 5 In step S520, the factory class of the target functional module can be registered by calling the interface of the unified management class, and the factory class of the target functional module can be bound to the class inheritance line of the target functional module.
[0223] As an example, in the unified management class, the sample code of the interface of the factory class of the registration function module can be as follows:
[0224] / / Register the factory class of the corresponding functional module
[0225] template <uint8_t factory_type, std::derived_from <genuserdatafactory>T>
[0226] void RegisterUserDataFactory()
[0227] {
[0228] if constexpr (factory_type <genUserDataFactory::MAX_FACTORY_TYPE_NUM){
[0229] userDataFactoryPtrArr[factory_type].reset(new T());
[0230] }
[0231] }.
[0232] In the above sample code, T represents an input parameter, which is used to specify the function module of the factory class to be obtained. The statement RegisterUserDataFactory() can be used to register the factory class of the function module specified by the parameter T, such as the above upfUserDataFactory.
[0233] In the above registration process, the factory class of the target functional module may also be bound to the class inheritance line of the target functional module.
[0234] To facilitate understanding of the operation of this step, the class inheritance line of the functional module is first described in detail below.
[0235] Specifically, the hierarchical relationship from a base class to its subclasses can be called a class inheritance line, and the hierarchical depth of the inheritance relationship between classes can be called the length of the class inheritance line. Multiple class inheritance lines with a common base class together form a class inheritance tree. The distance from a leaf node to its root node of the class inheritance tree, that is, the number of generations of inheritance relationship between a leaf node and its root node, can be called the maximum length of the class inheritance line of this leaf node.
[0236] The class inheritance line of the functional module can be represented by a preset inheritance line identifier, which can be an enumeration value, for example. Different class inheritance lines can correspond to different inheritance line identifiers. For example, the class inheritance line of functional module 1 can be defined as "enumeration value 1: derived class 1->derived class 2->...->base class", and the class inheritance line of functional module 2 can be defined as "enumeration value 2: derived class 3->derived class 4->...->base class."
[0237] As an example, for the UPF module, PWR module, DFT module, CDC module and LINT module, their respective class inheritance lines can be expressed as:
[0238] upf_line:upfUserData->genUserData
[0239] pwr_line:pwrUserData->upfUserData->genUserData
[0240] dft_line:dftUserData->upfUserData->genUserData
[0241] cdc_line:cdcUserData->upfUserData->genUserData
[0242] lint_line:lintUserData ->genUserData
[0243] Among them, xxx_line is a custom inheritance line identifier, which is used to identify the class inheritance line of each functional module, so as to facilitate the subsequent code search and use. In the class inheritance line upf_line, genUserData is the base class, and the derived class upfUserData inherits from the base class genUserData; in the class inheritance line pwr_line, the derived class pwrUserData inherits from the derived class upfUserData, and the derived class upfUserData inherits from the base class genUserData, that is, the class inheritance line upf_line and the class inheritance line pwr_line have a common base class genUserData. These class inheritance lines are used to describe the relationship between each functional module, so that these relationships can be easily handled in the subsequent code implementation.
[0244] The definition of the specific class of each functional module can be carried out according to the requirements of the corresponding class inheritance line to ensure that each functional module can correctly inherit and use the custom attribute class of the common type of circuit data. Taking Library data as an example, the corresponding UserData class inheritance relationship of each functional module is as follows: Figure 7 shown.
[0245] exist Figure 7 In the example, the custom attribute classes upfLibraryUserData, lintLibraryUserData, pwrLibraryUserData, dftLibraryUserData, and cdcLibraryUserData are custom attribute classes of each functional module on the circuit data dimension of the Library type, and genLibraryUserData is the common base class of each functional module on the circuit data of the Library type. Similarly, each functional module has a corresponding common base class on each type of circuit data, for example, the common base classes of each functional module on the circuit data of the Library type, Cell type, Netlist type, Net type, Instance type, Port type, and PortRef type are genLibraryUserData, genCellUserData, genNetlistUserData, genNetUserData, genInstanceUserData, genPortUserData, and genPortRefUserData, respectively. In addition, in order to facilitate code writing, the base classes such as genLibraryUserData, genCellUserData, genNetlistUserData, genNetUserData, genInstanceUserData, genPortUserData, genPortRefUserData can be inherited from an empty base class genUserData. The UserData class inheritance relationship of all functional modules can be as follows Figure 8 shown.
[0246] The class inheritance line is explained above. Based on the class inheritance line, in step S520, the step of binding the factory class of the target functional module to the class inheritance line of the target functional module includes: registering the factory class of the target functional module to the target element position in the preset factory class array.
[0247] Here, the factory class array may include an element position corresponding to each class inheritance line, and the target element position may be an element position corresponding to the class inheritance line of the target functional module.
[0248] The factory class array is used to save the registered factory classes. The factory class array can be preset with element positions corresponding to each class inheritance line. When registering the factory class of the target functional module, it can be bound to the element position corresponding to the class inheritance line of the target functional module, so that the mapping relationship between the factory class of the target functional module and the class inheritance line can be established. This mapping relationship is stored in the factory class array. Here, only the factory class registered in the factory class array is valid, and the factory class can be used to create an instance of the custom attribute class during subsequent access.
[0249] As an example, a factory class array can be preset in the above-mentioned unified management class, which can call the corresponding function module factory class to create a custom attribute class instance according to the enumeration value of the function module class inheritance line, and return the pointer of the instance to the caller of the unified management class.
[0250] The following is a code example of a factory class array preset in a unified management class:
[0251] " / / Function module factory class array (ie userDataFactoryPtrArr), used to save all registered function module factory classes
[0252] std::array <std::shared_ptr <genuserdatafactory>, genUserDataFactory::MAX_FACTORY_TYPE_NUM>_userDataFactoryPtrArr{};".
[0253] In the example of registering a functional module in the above manner, in step S230, the factory class of the pre-registered target functional module can also be obtained in the following manner: based on the identification of the target functional module, the class inheritance line of the target functional module is searched in the factory class array; the factory class corresponding to the class inheritance line of the target functional module in the factory class array is used as the factory class of the target functional module.
[0254] Here, the identifier of the target functional module can be, for example, the name of the target functional module, and the class inheritance line of the target functional module can be searched in the factory class array based on the identifier. Since the factory class array stores the mapping relationship between each factory class and the corresponding class inheritance line, the factory class corresponding to the class inheritance line of the target functional module can be found.
[0255] In the above example, by binding the factory class to the class inheritance line, the factory class can create a custom attribute class instance according to the preset class inheritance line relationship, so that data can be accessed in units of each node (i.e. class) on the line or tree for the class inheritance line or the class inheritance tree formed by the class inheritance line. The time complexity of accessing the custom attribute class of the circuit data corresponding to each functional module through the class inheritance line or tree is O(1). Compared with the dictionary container std::map storing data through a red-black tree and the dictionary container std::unordered_map using a hash table, the class inheritance relationship line or tree allows direct access to node data without having to search for data layer by layer, and the access efficiency is very high.
[0256] Through the above-mentioned method of registering function modules, since each function module is preset with a class inheritance line, when registering a function module, the factory class can be bound to the class inheritance line, and when creating any class in the class inheritance relationship of the custom attribute class, a leaf node class on the maximum length class inheritance line of this class can be created, so that when accessing any node class in the class inheritance relationship, the leaf node class on the maximum length class inheritance line of this class is accessed. In this way, a data management mechanism that replaces the dictionary container can be provided, avoiding the operation of data by comparing keys, providing the ability to directly operate data, and improving the efficiency of operating data.
[0257] It is described above that the preset unified management class may include at least one of an interface for acquiring multiple locks, an interface for acquiring a management class of a functional module, an interface for registering a factory class of a functional module, and an interface for creating or acquiring a custom attribute class of a functional module. Here, in order to facilitate the understanding of the unified management class, an example of the unified management class is described based on the example codes of the above-mentioned interfaces. In this example, it may include all of the above-mentioned interfaces. However, the embodiments of the present application are not limited to this, and only part of them may be set as needed.
[0258] When defining a unified management class, you can first define the unified management class to inherit from the genUserDataApi class, so that the unified management class inherits the creation and acquisition interfaces of all specific classes of functional modules, and then define a function process in the main part of the unified management class. The core operations implemented by this function process include: obtaining the management class of the corresponding functional module; registering the factory class of the corresponding functional module; creating or obtaining the UserData class of the corresponding functional module.
[0259] In this regard, based on the sample codes of the above interfaces, a pseudo code example of a unified management class including all the above interfaces can be as follows:
[0260] " / / genUserDataApi contains the creation or acquisition interface of all functional module specific classes
[0261] class genUserDataMgr : public genUserDataApi {
[0262] public:
[0263] / / Create or obtain the corresponding functional module management class
[0264] template <typename T = genUserDataMgr, typename = typename std::enable_if_t<std::is_base_of_v<genUserDataMgr, T> >>
[0265] static std::unique_ptr <genuserdatamgr>&GocUserDataMgr()
[0266] {
[0267] std::call_once(_flag, [&] { _genUserDataMgrPtr.reset(new T());});
[0268] return _genUserDataMgrPtr;
[0269] }
[0270] / / Register the corresponding function module factory class
[0271] template <uint8_t factory_type, std::derived_from <genuserdatafactory>T>
[0272] void RegisterUserDataFactory()
[0273] {
[0274] if constexpr (factory_type <genUserDataFactory::MAX_FACTORY_TYPE_NUM){
[0275] _userDataFactoryPtrArr[factory_type].reset(new T());
[0276] }
[0277] }
[0278] / / Create or obtain the UserData class of the corresponding functional module
[0279] template <uint8_t factory_type, std::derived_from <genuserdata>T,typename U>
[0280] T GocUserData(U pDB)
[0281] {
[0282] if constexpr (std::is_same_v<Instance, U>) {
[0283] return GocDesignObjUserData<factory_type, genUserData::INSTANCE, T>(pDB);
[0284] } else if constexpr (std::is_same_v<Net, U>) {
[0285] return GocDesignObjUserData<factory_type, genUserData::NET, T>(pDB);
[0286] } else if constexpr (std::is_same_v<Port, U>) {
[0287] return GocDesignObjUserData<factory_type, genUserData::PORT, T>(pDB);
[0288] } else if constexpr (std::is_same_v<Netlist, U>) {
[0289] return GocDesignObjUserData<factory_type, genUserData::NETLIST, T>(pDB);
[0290] } else if constexpr (std::is_same_v<Library, U>) {
[0291] return GocDesignObjUserData<factory_type, genUserData::LIBRARY, T>(pDB);
[0292] } else if constexpr (std::is_same_v<Cell, U> ) {
[0293] return GocDesignObjUserData<factory_type, genUserData::CELL, T> (pDB);
[0294] } else if constexpr (std::is_same_v<PortRef, U> ) {
[0295] return GocPortRefUserData<factory_type, genUserData::PORTREF, T> (pDB);
[0296] } else {
[0297] return nullptr;
[0298] }
[0299] }
[0300] private:
[0301] / / The role is to maintain the class as a singleton class
[0302] inline static std::once_flag _flag;
[0303] / / Function module management base class pointer (ie genUserDataMgrPtr)
[0304] inline static std::unique_ptr <genuserdatamgr>_genUserDataMgrPtr;
[0305] / / Function module factory class array (ie userDataFactoryPtrArr), used to save all registered function module factory classes
[0306] std::array <std::shared_ptr <genuserdatafactory>, genUserDataFactory::MAX_FACTORY_TYPE_NUM>_userDataFactoryPtrArr{};
[0307] / / Assuming the memory page size is 4096 bytes, 4096 spin locks are predefined
[0308] std::array<utSpinLock, PAGE_SIZE> _designUserDataLockArr{};
[0309] std::array<utSpinRWLock, PAGE_SIZE> _portRefUserDataRWLockArr{};
[0310] };".
[0311] The core operations of the unified management class have been described in detail above, so they will not be repeated here.
[0312] The following will refer to Fig. 9 An example process of registering a function module in an access method of a custom attribute class according to an exemplary embodiment of the present application is described.
[0313] When the EDA software program starts, it is necessary to register the function modules that need to be used so that the program can correctly call the functions of each function module. This can be done by specifying the enumeration value of the class inheritance line of the function module in the program's configuration file. Specifically, when the program starts, the factory class and management class of each function module will be initialized according to the settings in the configuration file, and registered with the unified management class. In this way, during the program running process, the custom attribute class of each function module can be accessed as needed.
[0314] For example, if the program needs to use the custom property class of the DataBase corresponding to the UPF module, the custom property class of the DataBase corresponding to the UPF module can be accessed through the interface of the unified management class without directly accessing the factory class and management class of the UPF module.
[0315] Specifically, the unified management class described above can be used to create or obtain the UserData class of the corresponding functional module. As an example, the program can receive a first instruction, in which a target functional module can be specified, so that the program calls the interface of the unified management class according to the first instruction, creates the management class of the corresponding functional module, and registers the factory class of the corresponding functional module.
[0316] Taking the UPF module as an example, an example of the first instruction in a production environment may be as follows:
[0317] " / / 1. Call the GocUserDataMgr function interface in the main function of the program to create the UPF module management class upfUserDataMgr, so that subsequent use will use the upfUserDataMgr management class
[0318] / / 2. Register the factory class upfUserDataFactory of the UPF module, and use the upfUserDataFactory factory class in subsequent uses
[0319] genUserDataMgr::GocUserDataMgr <upfuserdatamgr>()->RegisterUserDataFactory<genUserDataFactory:: pwr_line, pwr UserDataFactory> ();".
[0320] Fig. 9 An example of a registration function module is given, such as Fig. 9 As shown, in step S910, a management class of a target functional module may be created. In step S920, a factory class of a target functional module may be created. In step S930, a preset class inheritance line corresponding to the target functional module may be bound to the created factory class, and a mapping relationship between the class inheritance line and the factory class may be saved in a unified management class, for example, in a factory class array of the unified management class.
[0321] The following will refer to Fig.10 An example process of accessing data in an access method of a custom attribute class according to an exemplary embodiment of the present application is described.
[0322] After creating a custom attribute class in the above manner, the custom attribute class can be accessed. As an example, the program can receive a second instruction, and the data to be accessed can be specified in the second instruction, such as the type of the target custom attribute class described by the data, so that the program can call the interface of the unified management class again according to the second instruction, obtain the management class of the corresponding functional module, and create or obtain the data of the corresponding functional module on the target custom attribute class through the interface of the target custom attribute class provided by the management class of the corresponding functional module.
[0323] Specifically, in the second instruction, the target custom attribute class may be specified by a type identifier (ID) of the custom attribute class, where the type identifier is, for example, library, cell, netlist, net, instance, port, portref, etc.
[0324] Taking the attribute port of the UPF module as an example, an example of the second instruction can be as follows:
[0325] " / / Get the management class of the UPF module through the interface GocUserDataMgr() of the management class genUserDataMgr, and then create or get the custom attribute class upfPortUserData in the specific class of the UPF function module on the port through GocUpfPortUserData
[0326] / / You can directly operate the data of upfPortUserData when using it
[0327] upfPortUserData pUserData = genUserDataMgr::GocUserDataMgr()->GocUpfPortUserData(port);”.
[0328] If in a multi-threaded environment, you can call GetDesignUserDataLocker() to allow the thread to obtain the corresponding lock, then create the corresponding UserData class data and save it on the pDB pointer.
[0329] As an example, a pseudo code example of a thread creating or obtaining a specific class of a corresponding functional module may be as follows:
[0330] " / / Create and obtain the corresponding functional module specific class on the Database
[0331] template<uint8_t factory_type, uint8_t product_type, typename T,typename U>
[0332] T GocDesignObjUserData(U pDB)
[0333] {
[0334] / / Get UserData data. If obtained, return directly
[0335] genUserData pGenUserData = GetDesignObjUserData <genuserdata>(pDB);
[0336] if (pGenUserData == nullptr) {
[0337] if (_isSupportMulti) {
[0338] / / Get the spin lock mapped by the pDB pointer
[0339] utSpinLock&locker = GetDesignUserDataLocker(pDB);
[0340] std::lock_guard <utspinlock>lock(locker);
[0341] / / Get the UserData data in advance to avoid multiple creation of UserData in multi-threaded situations
[0342] pGenUserData = GetDesignObjUserData <genuserdata>(pDB); if(pGenUserData == nullptr) {
[0343] / / Create UserData and save it on the pDB pointer
[0344] pGenUserData = CreateDesignUserData<factory_type, product_type> (pDB);
[0345] }
[0346] } else {
[0347] pGenUserData = CreateDesignUserData<factory_type, product_type> (pDB);
[0348] }
[0349] }
[0350] return static_cast <T >(pGenUserData);
[0351] }".
[0352] Fig.10 An example of accessing data of the UserData class is given, such as Fig.10 As shown, in step S1010, the management class of the corresponding functional module can be created by inputting the pointer address of the target circuit data to be accessed. In step S1020, the corresponding lock can be acquired based on the pointer address. In step S1030, an attempt can be made to directly acquire the target custom attribute class. In response to acquiring the target custom attribute class, in step S1040, the lock can be released to complete the data access. In response to not acquiring the target custom attribute class, in step S1050, the registered factory class of the corresponding functional module can be searched, and in step S1060, the target custom attribute class can be created and saved in the pointer address of the target circuit data.
[0353] It should be noted that although the implementation method or example code is described using specific functional modules or specific classes as examples in the embodiments of the present application, the embodiments of the present application are not limited to the examples described above, and the implementation method or example code described above using specific functional modules or specific classes as examples can also be similarly applied to other functional modules or classes.
[0354] The access method of the custom attribute class according to the embodiment of the present application involves an efficient data management mechanism, especially a method for quickly accessing data in EDA software. Specifically, the embodiment of the present application provides a data management mechanism based on the class inheritance relationship tree, which can directly access data to solve the problem of slow access to data through key-value, and especially provides a mechanism to protect the inheritance tree of multi-threaded operations through a lock mapping method, which can significantly improve the access speed of attribute data of a large amount of DataBase (such as Library, Cell, Netlist, Net, Instance, Port, PortRef, etc.) data in EDA software.
[0355] Specifically, in the lock mapping mechanism of the present application, a fixed number of locks can be defined in advance, and a method of mapping a pointer address to a target lock index can be used to modify data on a class inheritance tree in a multi-threaded situation without locking the entire class inheritance tree. Data contention caused by operating the class inheritance tree becomes rare, and data is locked only when the pointer address is mapped to the same lock index. For operations on dictionary containers, the entire container must be locked.
[0356] In this way, by introducing the lock mapping mechanism, the efficiency problem of locking the entire class inheritance tree when modifying the class inheritance tree in a multi-threaded situation is solved. By mapping the pointer address to the target lock index, local locking of the inheritance tree can be achieved, avoiding problems such as long locking time and deadlock, and improving the concurrency and stability of the system. According to an embodiment of the present application, the performance of accessing data using pointer address lock mapping is basically equal to the number of CPU cores, which is close to the theoretical value corresponding to the theoretical addition of the number of CPU cores.
[0357] In a second aspect of the exemplary embodiment of the present application, a device for accessing a custom attribute class is provided. The device for accessing a custom attribute class is applied to integrated circuit electronic design automation software. The integrated circuit electronic design automation software includes multiple functional modules, such as Fig.11 Therefore, the access device of the custom attribute class may include a determination unit 1110 , a mapping unit 1120 and an access unit 1130 .
[0358] The determining unit 1110 is configured to determine a target custom attribute class to be accessed in the current thread, wherein the target custom attribute class is a user-defined data class of a target functional module among the multiple functional modules in the target circuit data.
[0359] The mapping unit 1120 is configured to map the pointer address storing the target circuit data to a target lock among a plurality of preset locks in response to the integrated circuit electronic design automation software currently running in a multi-threaded environment, so that the current thread holds the target lock to lock the target circuit data using the target lock.
[0360] The access unit 1130 is configured to access the target custom attribute class in the target circuit data by calling the interface of the target custom attribute class in the management class of the target functional module in the current thread when the target circuit data is locked by using the target lock, wherein the management class of the target functional module contains interfaces for accessing each custom attribute class of the target functional module.
[0361] As an example, multiple locks are stored in a lock array, wherein the mapping unit 1120 is further configured to: move the value of the pointer address by a preset memory alignment amount to obtain an absolute pointer address value after removing the memory alignment amount, wherein the memory alignment amount is an offset of the pointer address set for storing data at the address boundary of the memory; correspond the absolute pointer address value to a target index among multiple indexes in the lock array, wherein each index in the lock array identifies a lock; and map the pointer address to a target lock identified by the target index.
[0362] As an example, the mapping unit 1120 is also configured to determine the target index by performing a bitwise AND operation on the absolute pointer address value and a preset value to determine the target index, wherein the preset value is used to limit the absolute pointer address value to a value range within which the index in the lock array is located.
[0363] As an example, the access device of the custom attribute class also includes a lock determination module, which is configured to, before executing the step of mapping the pointer address storing the target circuit data to the target lock among the preset multiple locks, the current thread determines multiple locks by calling the interface of the preset unified management class, wherein the unified management class includes an interface for obtaining multiple locks, wherein the access device of the custom attribute class also includes an acquisition module, which is configured to, before accessing the target custom attribute class, obtain the management class of the target functional module by calling the interface of the preset unified management class, wherein the unified management class includes an interface for obtaining the management class of the functional module.
[0364] As an example, the access device of the custom attribute class also includes a registration module, which is configured to register the target function module in the following manner: by calling the interface of a preset unified management class, a management class of the target function module is created, wherein the unified management class includes an interface for creating a management class of a function module; by calling the interface of the unified management class, a factory class of the target function module is registered, and the factory class of the target function module is bound to the class inheritance line of the target function module, wherein the factory class of the target function module is used to create instances of each custom attribute class of the target function module, wherein the unified management class also includes an interface for registering the factory class of the function module, wherein each function module in the integrated circuit electronic design automation software is preset with a class inheritance line, and the class inheritance line represents the inheritance relationship of all classes from the custom attribute class of the corresponding function module to the base class.
[0365] As an example, the registration module is also configured to: register the factory class of the target functional module to the target element position in a preset factory class array, wherein the factory class array includes an element position corresponding to each class inheritance line, and the target element position is the element position corresponding to the class inheritance line of the target functional module.
[0366] As an example, the access unit 1130 is also configured to: in response to the current thread accessing the target custom attribute class, return a pointer to the target custom attribute class in the target circuit data and release the target lock; in response to the current thread not accessing the target custom attribute class, obtain the pre-registered factory class of the target functional module, and create the target custom attribute class based on the factory class of the target functional module.
[0367] As an example, the access unit 1130 is also configured to obtain the factory class of the target functional module in the following manner: based on the identification of the target functional module, searching for the class inheritance line of the target functional module in the factory class array; and taking the factory class corresponding to the class inheritance line of the target functional module in the factory class array as the factory class of the target functional module.
[0368] As an example, the target functional module is one of a unified power format module, a power management module, a testability functional module, a clock domain crossing module, and a static code analysis module, and the target circuit data is a type of data among libraries, cells, netlists, wire nets, instances, ports, and port references.
[0369] Regarding the device in the above embodiment, the specific manner in which each unit performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0370] In a third aspect of an exemplary embodiment of the present application, an electronic device includes: a processor; a memory for storing processor-executable instructions, wherein the processor-executable instructions, when executed by the processor, prompt the processor to execute the access method of the custom attribute class described in the embodiment of the present application.
[0371] Fig.12 FIG. 1 is a block diagram of an electronic device according to an exemplary embodiment. Fig.12 As shown, the electronic device 10 includes a processor 101 and a memory 102 for storing processor executable instructions. Here, when the processor executable instructions are executed by the processor, the processor is prompted to execute the access method of the custom attribute class according to the exemplary embodiment of the present application.
[0372] As an example, the electronic device 10 is not necessarily a single device, but may be any collection of devices or circuits that can execute the above instructions (or instruction sets) individually or in combination. The electronic device 10 may also be part of an integrated control system or system manager, or may be configured as a server that is interconnected with a local or remote (e.g., via wireless transmission) interface.
[0373] In the electronic device 10, the processor 101 may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller or a microprocessor. As an example and not a limitation, the processor 101 may also include an analog processor, a digital processor, a microprocessor, a multi-core processor, a processor array, a network processor, etc.
[0374] The processor 101 may execute instructions or codes stored in the memory 102, wherein the memory 102 may also store data. Instructions and data may also be sent and received over a network via a network interface device, wherein the network interface device may employ any known transmission protocol.
[0375] The memory 102 may be integrated with the processor 101, for example, by placing RAM or flash memory within an integrated circuit microprocessor or the like. In addition, the memory 102 may include a separate device, such as an external disk drive, a storage array, or any other storage device that can be used by a database system. The memory 102 and the processor 101 may be operatively coupled, or may communicate with each other, such as through an I / O port, a network connection, etc., so that the processor 101 can read files stored in the memory 102.
[0376] In addition, the electronic device 10 may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, a mouse, a touch input device, etc.) All components of the electronic device 10 may be connected to each other via a bus and / or a network.
[0377] In an exemplary embodiment, a computer-readable storage medium may also be provided, and when the instructions in the computer-readable storage medium are executed by the processor of the server, the server is able to execute the access method of the custom attribute class as described in the above exemplary embodiment. The computer-readable storage medium may be, for example, a memory including instructions. Optionally, the computer-readable storage medium may be: read-only memory (ROM), random access memory (RAM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or optical disk storage, hard disk drive (HDD), solid state drive (SSD), card storage (such as, multimedia card, secure digital (SD) card or extreme digital (XD) card), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid state disk and any other device, any other device is configured to store computer programs and any associated data, data files and data structures in a non-transitory manner and provide the computer programs and any associated data, data files and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the above-mentioned computer-readable storage medium can be run in an environment deployed in a computer device such as a client, a host, an agent device, a server, etc. In addition, in one example, the computer program and any associated data, data files and data structures are distributed on a networked computer system, so that the computer program and any associated data, data files and data structures are stored, accessed and executed in a distributed manner by one or more processors or computers.
[0378] According to an exemplary embodiment of the present application, a computer program product may also be provided. The computer program product includes computer executable instructions. When the computer executable instructions are executed by at least one processor, the method for accessing the custom attribute class according to the exemplary embodiment of the present application is implemented.
[0379] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims.
[0380] In addition, it should be noted that although several examples of each step are described above with reference to specific drawings, it should be understood that the implementation methods of the present application are not limited to the combinations given in the examples, and the steps appearing in different drawings may be combined, which are not exhaustively listed here.
[0381] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the claims.< / genuserdata> < / utspinlock> < / genuserdata> < / upfuserdatamgr> < / genuserdatafactory> < / genuserdatamgr> < / genuserdata> < / genuserdatafactory> < / genuserdatamgr> < / genuserdatafactory> < / genuserdatafactory> < / genuserdatamgr> < / genuserdata>
Claims
1. A method for accessing a custom attribute class, characterized in that: The method for accessing the custom attribute class is applied to integrated circuit electronic design automation software, which includes multiple functional modules. The method for accessing the custom attribute class includes: Determining a target custom attribute class to be accessed in the current thread, wherein the target custom attribute class is a user-defined data class of a target functional module among the multiple functional modules in target circuit data; In response to the integrated circuit electronic design automation software currently running in a multi-threaded environment, mapping a pointer address storing the target circuit data to a target lock among a plurality of preset locks, so that the current thread holds the target lock, thereby using the target lock to complete locking of the target circuit data to be accessed in the entire class inheritance relationship; When the target circuit data is locked by using the target lock, the target custom attribute class in the target circuit data is accessed by calling the interface of the target custom attribute class in the management class of the target functional module in the current thread, wherein the management class of the target functional module contains interfaces for accessing each custom attribute class of the target functional module.
2. The method for accessing a custom attribute class according to claim 1, characterized in that: The plurality of locks are stored in a lock array, wherein the step of mapping the pointer address storing the target circuit data to a target lock among the preset plurality of locks comprises: Shifting the value of the pointer address by a preset memory alignment amount to obtain an absolute pointer address value after removing the memory alignment amount, wherein the memory alignment amount is an offset of the pointer address set for storing data at an address boundary of a memory; Mapping the absolute pointer address value to a target index in a plurality of indexes in the lock array, wherein each index in the lock array identifies a lock; The pointer address is mapped to the target lock identified by the target index.
3. The method for accessing a custom attribute class according to claim 2, wherein: The target index is determined by: Performing a bitwise AND operation on the absolute pointer address value and a preset value to determine the target index, wherein the preset value is used to limit the absolute pointer address value to a value range where the index in the lock array is located.
4. The method for accessing a custom attribute class according to any one of claims 1 to 3, characterized in that: The access method of the custom attribute class also includes: Before executing the step of mapping the pointer address storing the target circuit data to a target lock among the preset multiple locks, the current thread determines the multiple locks by calling an interface of a preset unified management class, wherein the unified management class includes an interface for obtaining the multiple locks. The access method of the custom attribute class also includes: Before accessing the target custom attribute class, the management class of the target functional module is acquired by calling a preset unified management class interface, wherein the unified management class includes an interface for acquiring the management class of the functional module.
5. The method for accessing a custom attribute class according to any one of claims 1 to 3, characterized in that: The target function module is registered in the following way: Creating a management class of the target functional module by calling a preset unified management class interface, wherein the unified management class includes an interface for creating a management class of a functional module; By calling the interface of the unified management class, the factory class of the target functional module is registered, and the factory class of the target functional module is bound to the class inheritance line of the target functional module, wherein the factory class of the target functional module is used to create instances of each custom attribute class of the target functional module, wherein the unified management class also includes an interface for registering the factory class of the functional module, Each functional module in the integrated circuit electronic design automation software is preset with a class inheritance line, and the class inheritance line represents the inheritance relationship of all classes from the custom attribute class of the corresponding functional module to the base class.
6. The method for accessing a custom attribute class according to claim 5, characterized in that: The step of binding the factory class of the target functional module to the class inheritance line of the target functional module comprises: Register the factory class of the target functional module to the target element position in a preset factory class array, wherein the factory class array includes an element position corresponding to each class inheritance line, and the target element position is the element position corresponding to the class inheritance line of the target functional module.
7. The method for accessing a custom attribute class according to claim 6, wherein: The access method of the custom attribute class also includes: In response to the current thread accessing the target custom attribute class, returning a pointer to the target custom attribute class in the target circuit data, and releasing the target lock; In response to the current thread not accessing the target custom attribute class, a pre-registered factory class of the target functional module is obtained, and the target custom attribute class is created based on the factory class of the target functional module.
8. The method for accessing a custom attribute class according to claim 7, characterized in that: Get the factory class of the target function module in the following way: Based on the identifier of the target functional module, searching the class inheritance line of the target functional module in the factory class array; The factory class in the factory class array corresponding to the class inheritance line of the target functional module is used as the factory class of the target functional module.
9. The method for accessing a custom attribute class according to claim 1, wherein: The target functional module is one of a unified power consumption format module, a power management module, a testability functional module, a clock domain crossing module and a static code analysis module, and the target circuit data is one type of data among a library, a cell, a netlist, a wire net, an instance, a port and a port reference.
10. A device for accessing a custom attribute class, characterized in that: The access device of the custom attribute class is applied to integrated circuit electronic design automation software, and the integrated circuit electronic design automation software includes multiple functional modules, wherein the access device of the custom attribute class includes: a determining unit configured to determine a target custom attribute class to be accessed in a current thread, wherein the target custom attribute class is a user-defined data class of a target functional module among the multiple functional modules in target circuit data; a mapping unit configured to, in response to the integrated circuit electronic design automation software currently running in a multi-threaded environment, map a pointer address storing the target circuit data to a target lock among a plurality of preset locks, so that the current thread holds the target lock, thereby using the target lock to complete locking of the target circuit data to be accessed in the entire class inheritance relationship; The access unit is configured to access the target custom attribute class in the target circuit data by calling the interface of the target custom attribute class in the management class of the target functional module in the current thread when the target circuit data is locked by the target lock, wherein the management class of the target functional module includes an interface for accessing each custom attribute class of the target functional module.
11. An electronic device, characterized in that: The electronic device comprises: processor; memory for storing processor-executable instructions, When the processor-executable instructions are executed by the processor, they prompt the processor to execute the access method of the custom attribute class according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for accessing a custom attribute class according to any one of claims 1 to 9.
13. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the access method of the custom attribute class according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Frequency budgeting in processor
CN116266142A
Method for allowing exclusive access to shared data
US20100088476A1