RISC-V Secure SoC Verification and Evaluation Method Based on Virtual Platform
Through the RISC-V secure SoC verification and evaluation method based on the virtual platform, the problem of inefficient RISC-V secure SoC simulation verification and performance evaluation in the prior art is solved, and fast and effective design verification and performance evaluation are achieved, improving design efficiency and system security.
Patent Information
- Application Number
- CN202510607196.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-13
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-05-13
AI Technical Summary
The prior art is difficult to quickly and efficiently perform analog verification and performance evaluation of RISC-V secure SoCs, especially inefficient when dealing with complex security functions and multi-core architectures, resulting in time-consuming and costly architectural design and analog verification in early chip design.
The RISC-V secure SoC verification and evaluation method based on the virtual platform is adopted. By establishing processor behavior patterns, building transaction-level models of bus and peripheral modules, designing a security module library, performing circuit-level design, and using EDA tools to analyze the power consumption, timing and area indicators of the module, and simulate and evaluate it on the virtual platform.
It realizes rapid verification and performance evaluation of RISC-V secure SoC, improves design efficiency, ensures high efficiency and optimization of the system, simplifies the development and verification process, comprehensively covers security testing scenarios, and ensures the correctness and reliability of the design.
Smart Images

Figure CN120124043B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of SoC design and verification, and particularly relates to a method for verifying and evaluating a RISC-V secure SoC based on a virtual platform, which is particularly suitable for efficient modeling, simulation, and performance analysis of a RISC-V secure SoC. Background Art
[0002] With the rapid development of the Internet of Things and intelligent devices, the improvement of system integration and the increase in design complexity, virtual platforms play an important role in the integrated circuit design and verification process. Traditional hardware verification methods usually rely on physical prototypes, which are not only time-consuming and costly but also difficult to meet the requirements of rapid iteration and verification. In addition, existing simulation tools often face the problem of low efficiency when dealing with complex security functions and multi-core architectures. The process from RTL hardware design and simulation to software development and chip performance evaluation is extremely time-consuming. Once the chip performance fails to meet market demands, all the long-term efforts will be in vain. Therefore, architecture design and simulation verification in the early stage of chip design are extremely important.
[0003] The open-source instruction set architecture, namely the RISC-V architecture, has become the first choice for the design of many system-on-chip (SoC) due to its open-source nature and flexibility. In the design process of an SoC, simulation verification is a crucial link, which is not only used to verify the functional correctness of the design but also to evaluate the performance metrics of the SoC. With the rapid development of technologies such as the Internet of Things and cloud computing, the application scenarios of SoCs are becoming increasingly widespread, and the security threats they face are also becoming more diverse and complex, which poses higher requirements for the security design of SoCs. Building an efficient and secure SoC has become an urgent need in the industry. In order to accelerate the design of a RISC-V secure SoC, it is very important to effectively evaluate and select the most suitable high-performance security modules. Although electronic system level (ESL) simulators can provide hardware modeling and verification, they have limitations in quickly and accurately evaluating the performance of different security modules and are difficult to meet the growing security and performance requirements. In this context, how to effectively achieve rapid verification and performance evaluation of secure SoC design has become particularly important. Summary of the Invention
[0004] The purpose of the present invention is to propose a method for verifying and evaluating a RISC-V secure SoC based on a virtual platform, aiming to improve the speed of simulation verification and comprehensively evaluate the performance metrics such as power consumption, area, and timing of each key module (such as the processor core, security module, etc.) in the RISC-V secure SoC design, reduce design risks, and provide a powerful and flexible virtual verification environment for designers.
[0005] To achieve the above object, the present invention adopts the following technical solutions:
[0006] A method for verifying and evaluating a RISC-V secure SoC based on a virtual platform, comprising the following steps:
[0007] Step 1. According to the target design requirements of the RISC-V secure SoC, establish a processor behavior model, configure the optional RISC-V instruction set, and complete the conversion logic modeling from instructions to transaction processing;
[0008] Step 2. Establish a transaction-level model of the bus and peripheral modules, including abstracting the functional characteristics of the peripheral modules and defining the interfaces and transaction types of the bus;
[0009] Step 3. Establish a transaction-level model of the security module library, including constructing security modules and a security management unit to handle bus transactions, and designing a configuration file to achieve dynamic switching of security modules;
[0010] Step 4. Use a hardware description language to perform circuit-level design on each module, namely the processor, security module library, bus, and peripheral modules, and analyze the power consumption, timing, and area metrics of each module through EDA tools;
[0011] Step 5. Define timing, area, and power consumption models for each module according to the obtained performance metric data;
[0012] Step 6. According to the target design requirements of the RISC-V secure SoC, confirm different combinations of security modules, adjust the configuration file settings of the security module library to determine the security modules to be enabled, integrate the processor, security modules, and peripheral modules to build a SoC virtual platform, and complete the communication between each module through bus mapping;
[0013] Step 7. Calculate the area of the designed secure SoC according to the constructed SoC virtual platform;
[0014] Step 8. Compile test cases for platform simulation and record the timing and power consumption data of the virtual platform simulation;
[0015] Step 9. Compare the simulation results with the expected area, timing, and power consumption data, and comprehensively evaluate whether the design of the SoC virtual platform meets the performance requirements of the secure SoC design;
[0016] Step 10. If the result of the comprehensive evaluation does not meet the target design requirements, return to Step 6; otherwise, use the SoC virtual platform constructed in this round as the final design solution, that is, construct a secure SoC virtual platform that meets the design requirements.
[0017] The present invention has the following advantages:
[0018] The present invention relates to a method for verifying and evaluating a RISC-V secure SoC based on a virtual platform. By specifically adapting the virtual platform, a virtual simulation platform compatible with the verified secure SoC is provided, ensuring high system performance and optimization, balancing performance and resource consumption, and simplifying the development and verification processes of the verified processor. Using the virtual platform for simulation verification can comprehensively cover various security test scenarios, ensuring the correctness and reliability of the secure SoC design. The clock and delay mechanisms are used to simulate the cycle accuracy and delay characteristics on actual hardware, ensuring the accuracy of the timing model. Power consumption and area attributes are added to the interfaces of each module, and synchronization between different modules is achieved through event passing, ensuring the coordination of each module during the simulation process. By comparing the performance metrics (delay, power consumption, area) of each module on the secure SoC virtual platform, the performance of the secure SoC virtual platform is evaluated and the overall design is optimized. A transaction-level model of the security module library is constructed, and the dynamic switching of each security module is managed through a configuration file, making the system structure clear and easy to expand. Communication between modules is completed through the bus ports of the transaction-level bus, improving the flexibility and interoperability of the system. The present invention effectively realizes the rapid verification and performance evaluation of the RISC-V secure SoC design, improving the design efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is the operation flowchart of the method for verifying and evaluating a RISC-V secure SoC based on a virtual platform in the present invention.
[0020] Figure 2 is the architecture diagram of the SoC virtual platform built in the embodiment of the present invention.
[0021] Figure 3 is the structural block diagram of the security module library built in the embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0022] The present invention will be further described in detail below in conjunction with the drawings and specific embodiments:
[0023] Embodiment 1
[0024] This embodiment describes a method for verifying and evaluating a RISC-V secure SoC based on a virtual platform, which realizes efficient modeling, simulation, and performance analysis of the RISC-V secure SoC by establishing a SoC virtual platform.
[0025] The inventive concept of this method is as follows: Based on the verified RISC-V secure SoC, a fully functional virtual platform is constructed. First, the behavior mode of the processor is established, and the processor core with the optional RISC-V instruction set is integrated into the virtual platform to complete the logic modeling of the conversion from instructions to transaction processing. A security module library is established. The security management unit is responsible for receiving and processing bus transactions and passing the transactions to the corresponding security modules for processing. Different security modules are dynamically switched through a configuration file, and the performance of different security modules is evaluated and analyzed to optimize the security and performance of the system. A transaction-level model of the bus and peripherals is established. Circuit-level design is carried out, and EDA tools are called to comprehensively analyze and define the timing constraints and area-power consumption models to construct a complete virtual platform for the secure SoC. Monitoring and optimizing the performance of the SoC in real time during the design phase helps to achieve a more energy-efficient SoC design.
[0026] As Figure 1 shown, the method for verifying and evaluating the RISC-V secure SoC based on the virtual platform includes the following steps:
[0027] Step 1. According to the target design requirements of the RISC-V secure SoC, establish the behavior mode of the processor, configure the optional RISC-V instruction set, complete the interface definition, and implement the logical conversion from instructions to transaction processing.
[0028] Define the behavior mode of the processor, and use the sc_module class to create the processor core module; implement the arithmetic logic unit and program counter components as independent sc_module instances; model the internal state of the processor, including the update logic of register values and the program counter, and use sc_signal to store the current state of the register. When an instruction is executed, the PC value is updated according to the length of the current instruction.
[0029] Use the event-driven mechanism to manage the execution process of the processor. By defining sc_event and sc_process, corresponding events are triggered when the processor reads instructions from memory, undergoes state changes, or receives external signals. Each event activates the corresponding sc_process to complete the decoding and execution of the instruction. The instruction simulation of the processor is based on the event-triggered state transition logic, and the instruction is converted into the corresponding transaction.
[0030] By defining boolean flags for optional instruction sets, different instruction sets can be dynamically enabled or disabled in a virtual platform; enabling different instruction sets adds new instructions, and during the execution process of the processor, the instruction decoding and execution processes perform corresponding processing logic according to the enabled instruction sets; encapsulate the processing logic of different instruction sets in independent modules; by selecting different instruction sets, the performance of the processor under different configurations can be tested, the instruction set most suitable for the current design requirements can be determined, and the best hardware design can be found. For example, vector instruction sets can accelerate the processing of large-scale data computations and are suitable for high-performance computing; compressed instruction sets can reduce the size of program code and improve instruction cache efficiency.
[0031] Define the interface module required for the processor to interact with the transaction-level bus, and perform data interaction with the security module library and peripheral modules through the bus. This interface module integrates the functions of instruction and data memory access and is responsible for processing and forwarding the processor's memory read and write requests.
[0032] Step 2. According to the functional requirements of the bus and peripheral modules of the verified RISC-V secure SoC and the interaction methods with other modules, select the bus architecture and determine the functional characteristics and interfaces of the peripheral modules that need to be built; build the transaction-level models of the bus and peripheral modules, perform high-level abstractions on the functional characteristics and interfaces of the peripheral modules, and define the transaction interfaces and transaction types of the bus.
[0033] Establish target sockets for each peripheral module to receive the transactions transmitted by the bus, create the register mapping tables of each peripheral module, allocate addresses and corresponding register objects for each register, and define the read and write operations of the register and the processing process of the control signals of the data in the register access processing function; define the bus signals, including address, data pointer, data length, transaction command, and response signal; define the processing function of the transaction-level bus to implement basic bus interactions. In the processing function, obtain the transmission information of the transaction, find the register through the address, and perform the read and write operations according to the command.
[0034] Step 3. Build the transaction-level model of the security module library, design the configuration file to define the parameters and enabled status of each security module, and manage the dynamic switching between security modules; build the security management unit responsible for receiving and processing bus transactions, select the security module according to the configuration file, and pass the transaction to the corresponding security module for processing; design the security algorithms required for each security module to implement processing such as encrypting, decrypting, and signature verification of the input data.
[0035] Adopt a modular design concept, use the sc_module class to create a security management unit and different security modules. The security management unit processes the transmission of transactions in the security module library. The processor accesses the control registers and status registers of the security module library through memory address mapping to obtain the status of the security module. The control data input register is responsible for receiving transactions, and the data output register stores the results of transaction processing. The synchronization between the security module and the security management unit is achieved through an event-driven synchronization mechanism.
[0036] The security management unit receives processor requests through the blocking transmission callback function of the target socket. The requests contain the required data types, status, and control information; create a register mapping table, assign addresses and corresponding register objects to each register; set the register access processing function, which will be called when there is a register access request, perform the storage and reading of register data, and update the register status information; call the thread functions: rxpush is responsible for receiving data and storing it in the register, txpull is responsible for reading data from the register and transmitting it into the security module, and use the semaphore mechanism to ensure data synchronization between threads, waiting for the data ready notification from the rxpush thread.
[0037] During the data processing of the security module, call the sending thread of the security management unit to obtain register information. According to the obtained control register information, determine the current processing type to be executed (such as encryption, decryption, hash calculation, etc.), and the required relevant parameters (such as keys, data lengths, etc.), and call the security algorithms of different security modules to process the data according to the data in the input register. Update the internal state of the security module according to the processing results. The security management unit stores the data processing results and the updated status information in the corresponding registers by calling the receiving thread.
[0038] The process of dynamic switching of each security module and the design of security algorithms are as follows:
[0039] Define the names, types, algorithms, and required parameters (key lengths, encryption modes) of each security module in the configuration file. Each security module has an independent configuration item in the configuration file, supporting the independent enabling and configuration of the module; enable or disable a certain security module by setting a flag bit, such as AES, PUF, SHA-1, SHA-256, SM1, SM2, SM3, SM4, DES, MD5, RSA, DSA, ECC, etc. When the virtual platform starts simulation, it will first parse the configuration file and initialize the corresponding security modules and security algorithms according to the parameters of the configuration file.
[0040] Each security module needs to implement specific security algorithms. According to the functions of the security module, different security algorithms are designed and implemented. For example, the design of the SHA-256 hash algorithm focuses on data compression and digest generation. First, the input data is padded to meet the condition that the length has a remainder of 448 bits when modulo 512 bits. Then, the data is processed in blocks. In the processing of each block, the intermediate state values are continuously updated through a series of logical functions (such as Ch, Maj, Σ0, Σ1, etc.) and circular shift operations. Finally, these intermediate state values are combined to obtain a hash value of a fixed length; for the symmetric AES algorithm, the round function is designed first. The byte substitution operation performs a non-linear substitution on the data by defining a lookup table S-box, converting the input bytes into output bytes to achieve data confusion. The row shift and column confusion operations perform linear permutations on the data to spread the data information. The round key addition operation combines the round key with the data through exclusive-or operation. The entire encryption process is multiple rounds of iteration of these operations, increasing the degree of data confusion and diffusion in each round to ensure data security.
[0041] All security algorithms are encapsulated through corresponding transaction interfaces to ensure that the data interaction between security modules does not affect the independence of the security algorithms.
[0042] Step 4. Use a hardware description language to perform circuit-level design on each module, namely the processor, security module library, bus, and peripheral modules, and analyze the power consumption, timing, and area metrics of each module through EDA tools.
[0043] Based on the processor behavior model defined in Step 1, the security module library defined in Step 2, and the transaction-level models of the bus and peripheral modules defined in Step 3, the processor, security module library, bus, and peripheral modules are divided into actual hardware circuit blocks and gradually transformed into the target hardware structure; for the processor module, the instruction set architecture and processor execution process described in a high-level language are transformed into a specific hardware circuit structure, including an instruction decoder, execution unit, data path, etc. When the functional model of the security module library is transformed into hardware implementation, according to different security algorithms and protocols, the corresponding hardware circuit structures are designed, such as the hardware implementation of encryption algorithms, the hardware circuits of authentication protocols, etc. When the transaction-level models of the bus and peripheral modules are transformed into hardware structures, considering the arbitration mechanism of the bus, data transfer protocols, and the functional requirements of the peripheral modules, the hardware parts such as the bus controller and peripheral interface circuits are designed.
[0044] Define specific interfaces and timing requirements for each module. According to the performance requirements and working frequency needs of the verified RISC-V secure SoC, define clock signals, timing paths, synchronous logic, and asynchronous logic to ensure that the circuit meets the timing constraints. When defining interfaces, clarify the data transfer protocol and signal types between each module, and realize communication between modules through signal lines; clarify the hardware resources required by each module (such as memories, multipliers, etc.), and define the connection relationships between these modules and the hardware resources.
[0045] Call the EDA synthesis tool for synthesis analysis, including logic synthesis, placement and routing, to generate the gate-level netlist of the target hardware, and perform power consumption and area analysis on the gate-level netlist of the target hardware, calculate the static power consumption, dynamic power consumption, and the total area of the design, and generate power consumption and area reports; then call the timing analysis tool of EDA, by extracting the gate-level netlist of the target hardware, according to the propagation path of the clock signal in the secure SoC hardware architecture, determine the clock path of the generated secure SoC hardware architecture; and according to the timing constraints, analyze the entire hardware architecture, identify the critical paths of the generated secure SoC hardware architecture, and calculate the delays of each critical path and clock path.
[0046] According to the results of the synthesis analysis and timing analysis by the EDA tool, record the key power consumption, timing, and area metrics of the generated secure SoC hardware architecture, which include the delays of critical paths and clock paths, power consumption distribution, and area occupancy information.
[0047] Step 5. Define timing, area, and power consumption models for each module according to the obtained performance metric data.
[0048] According to the key performance metric data determined in Step 4, define data transfer delays and data processing delays for each module of the virtual platform, namely the processor, peripheral modules, bus, and secure module library; combine the structural types and state information changes of the modules to define area and power consumption models for each module library.
[0049] Based on the key metric data determined in Step 4, use the clock and delay mechanisms to simulate the cycle-accurate and delay characteristics on actual hardware; for the processor timing model, use the sc_clock class to define the clock signal, clarify the number of time cycles required for each instruction in each stage of the pipeline, and trigger the signal and state changes through event-driven, that is, each instruction will trigger different events in sequence to drive the state changes of the instruction in each pipeline stage. For the bus timing model, simulate the data transfer delay through the delay mechanism of transaction-level modeling, use the sc_time class to control the event time interval, and adjust the transmission delay of the transaction according to the local time. For the timing models of the peripheral module and the security module library, use timestamps to mark the time from receiving the request to starting the response and the time required for the module to process the request, including data processing and internal data transfer time within the module; and achieve clock synchronization between different modules through event passing. After the module receives the signal request, it will trigger the corresponding event to ensure that each module executes synchronously at the correct moment.
[0050] Add power consumption and area attributes to the interfaces of each module, namely the processor, peripheral module, bus, and security module library; include the static power consumption, dynamic power consumption, and area information of the module in the defined module structure; during the initialization process of each module, add the static power consumption and area attributes of the corresponding module, set a status variable for the module to represent the active state of the module. And within the clock cycle, monitor the changes in the module status variable and update the dynamic power consumption. After the module finishes processing a transaction, create a status interface inside the module, which contains the acquisition of timing, power consumption, and area information. After each transaction ends, update and record the power consumption, area, and timing data of the module.
[0051] Step 6. According to the design requirements of the RISC-V secure SoC target, confirm different combinations of security modules, and adjust the settings of the security module library configuration file to determine the security modules to be enabled. Integrate the processor, security modules, and peripheral modules to build a virtual SoC platform, and complete the communication between each module through bus mapping.
[0052] According to the performance requirements of the target SoC, and based on the timing, area, and power consumption models established in Step 5, select different combinations of security modules, and modify the flag bits of each security module in the configuration file defined in Step 2 to enable or disable different security modules. Each security module has its specific functions and parameter configurations, and it is decided whether to enable or disable each security module according to specific requirements. Different configurations of these security modules will affect the security, timing, and power consumption of the system.
[0053] Create the top-level module of the system, which is responsible for the initialization of the entire system, configuring the address spaces of each module, instantiating modules, and establishing the connection relationships between modules. Through the method of bus port mapping, map the addresses of each module to the transaction-level bus; bind the target socket interfaces of each module to the initiating socket interface of the bus; start the program simulation and wait for the system to complete running.
[0054] In the top-level module of the system, call the status interfaces created by each module, traverse each module and extract its timing, power consumption, and area information. At the end of the simulation, print the status information of each module. This is for subsequent overall performance evaluation of the virtual platform.
[0055] When the RISC-V processor initiates a transaction request, the bus will forward the request to the peripheral module at the corresponding address through the socket interface. After receiving the request, the peripheral module processes it and returns the response data to the bus through the same socket interface. The bus then forwards the response data to the RISC-V processor to complete the entire transaction process.
[0056] Step 7. Calculate the area of the designed secure SoC based on the constructed SoC virtual platform. According to the area model defined in Step 5, calculate the area of the designed secure SoC by weighted summation of the areas of each module in the virtual platform.
[0057] Step 8. Use the RISC-V toolchain to compile multiple standard test cases for platform simulation, and record the results of each simulation of the virtual platform and the timing and power consumption data of the SoC virtual platform during the simulation process.
[0058] Step 9. Compare the simulation results with the expected area, timing, and power consumption data, and comprehensively evaluate whether the design of the SoC virtual platform meets the performance requirements of the secure SoC design.
[0059] Step 10. If the result of the comprehensive evaluation does not meet the target design requirements, return to Step 6; otherwise, use the SoC virtual platform constructed in this round as the final design solution, that is, construct a secure SoC virtual platform that meets the design requirements.
[0060] Through the above steps, the RISC-V secure SoC verification and evaluation method provided by the present invention can achieve rapid verification of the secure SoC on the virtual platform and comprehensively evaluate its performance. Taking the processor with the RISC-V32IMAC instruction set as an example, construct the expected secure SoC virtual platform, and combine Figure 2 and Figure 3 to list a specific example of the RISC-V secure SoC verification and evaluation method based on the virtual platform of the present invention.
[0061] For the RISC-V secure SoC verification and evaluation method based on a virtual platform, it includes the following steps:
[0062] Step 1. Establish the processor behavior model in this instance, configure the optional RISC-V instruction set, and create a processor core module.
[0063] Use an event-driven mechanism to manage the execution process of the processor. By defining boolean flags for the optional instruction set, which includes I (integer), M (integer multiply / divide), A (atomic operation), F (single-precision floating point), C (compressed), S (secure encryption), P (predicted computation), enable the IMAC instruction set according to the design requirements.
[0064] Define the memory interface module required for the processor to interact with external components, integrate instruction and data memory access functions, and based on the event-triggered state transition logic, convert instructions into corresponding transactions.
[0065] Step 2. According to the performance requirements of the system, construct a transaction bus model, define bus signals, including address, data pointer, data length, transaction command, and response signals. Define the processing function of the transaction-level bus to achieve basic bus interactions.
[0066] Construct the transaction-level model of the memory, which is implemented as a peripheral on the SoC virtual platform. Establish a target socket for the memory module to receive the transactions transmitted by the bus, respond according to the transmission requirements of the bus transactions (such as read / write, address, data length, etc.), create a register mapping table, allocate addresses and corresponding register objects for each register of the memory module, and define the read / write operations of the registers and the processing process of the control signals of the data in the register access processing function.
[0067] Construct a peripheral interrupt module, which is responsible for managing and scheduling the interrupt requests of each peripheral module. Create a thread for processing priorities through the SC_THREAD method and set the priority register. After the peripheral module completes the operation, it sends an interrupt request through the transaction-level bus. After receiving the interrupt signal, the interrupt controller processes and updates the interrupt status, notifies the processor, and the processor completes the corresponding interrupt handling program. After completing the interrupt handling, the processor updates the status register of the security module.
[0068] Step 3. Construct the transaction-level model of the security module library, including constructing a security management unit and multiple security modules, designing the security algorithms required for each security module, and performing algorithm processing on the data; modify the flag bits in the configuration file to determine the enabled status of each security module.
[0069] Such as Figure 3As shown, in this example, the created security module library, where each security module inherits from the security management unit. During the data processing of the security module, the sending thread of the security management unit is called to obtain register information. Based on the obtained control register information, the type of processing to be performed currently (such as encryption, decryption, hash calculation, etc.) and the required relevant parameters (such as encryption keys, data lengths, etc.) are determined. Then, according to the data in the input register obtained, the security algorithms of different security modules are called to process the data, and the internal state of the security module is updated according to the processing results. The security management unit stores the processing results of the data and the updated state information into the control register by calling the receiving thread.
[0070] Step 4. Use a hardware description language to describe each module of the virtual platform, including the RISC-V processor, the security module library, the peripheral interrupt controller, and the transaction-level bus. Ensure that the interface definitions and internal logics of each module described by the hardware description language are consistent with those of each module of the virtual platform.
[0071] Call the EDA tool vivado for synthesis analysis to generate the gate-level netlist of the target hardware, and perform power consumption and area analysis on the netlist of the target hardware. Calculate the static power consumption, dynamic power consumption, and the total area of the design, and generate power consumption and area reports. Then, through the timing analysis tool of EDA, by extracting the gate-level netlist of the target hardware and analyzing according to the timing constraints, identify the critical paths (the longest signal propagation paths that determine the maximum delay of the circuit) of the generated secure SoC hardware architecture, and calculate the delays of each critical path and clock path.
[0072] According to the results of the synthesis analysis and timing analysis of the EDA tool, record the power consumption, timing, and area key metrics of the generated target SoC hardware architecture.
[0073] Step 5. According to the key performance indicator data determined in Step 4, define the data transfer delay and data processing delay for each module of the virtual platform (processor, memory module, peripheral interrupt module, security module library, bus); combine the structural type and state information changes of the module to define the area and power consumption models for each module library.
[0074] Define the timing constraints, power consumption, and area models for each module of the virtual platform. According to the key metric data determined in Step 4, use the clock and delay mechanisms to simulate the cycle accuracy and delay characteristics on the actual hardware. For the processor timing model, use the sc_clock class to define the clock signal, clarify the number of time cycles required for each instruction in each stage of the pipeline, and use event-driven to trigger signal and state changes; for the bus timing model, use the transaction delay mechanism to simulate the delay during data transmission; adopt the quantization time control mechanism, adjust the delay of transaction sending through the local time obtained by the get_local_time() method of tlm_quantumkeeper, and pass the time parameter through tlm::tlm_generic_payload; for the timing models of the peripheral interrupt module, memory module, and security module library, use the sc_core::sc_time method of the timestamp to mark the time from receiving the request to starting the response and the time required for the module to process the request, including data preparation, data transmission, etc.; and different modules are synchronized between simulated clocks through event passing.
[0075] Add power consumption and area attributes to each module (processor, memory module, peripheral interrupt module, security module library, bus). Include dynamic power consumption, static power consumption, and area information in the defined module structure; during the module initialization process, set its corresponding power consumption and area attributes. During the clock cycle, trigger the power consumption update logic by listening to the changes of the module status register, create a callback function and call it when the status of the status register changes. When the status register changes, record and analyze the time points before and after the status change in real time through the callback function, and calculate the power consumption during the status change. Create a status interface inside each module, which includes obtaining timing, power consumption, and area information. After each transaction ends, update and record the power consumption, area, and timing data of the module.
[0076] Step 6. According to the performance requirements of the target SoC and based on the timing, area, and power consumption models established in Step 5, select different combinations of security modules, confirm the enabling of the AES module and SHA-1 module in the security module library, modify the flag bits of the SHA-1 module and AES module in the configuration file of the security module library to enable these two security modules, and disable other security modules. Integrate the processor, SHA-1 module, AES module, memory module, and peripheral interrupt module, connect them through the bus, and build a virtual SoC platform; in the top-level module, map the addresses of each module to the transaction-level bus through the bus port mapping method. The target socket interface of each module needs to be bound to the initiating socket interface of the bus. Call the status interfaces created by each module, traverse each module (processor, memory module, peripheral interrupt module, security module library, bus), and extract their timing, power consumption, and area information. At the end of the simulation, print the status information of each module to facilitate the subsequent overall performance evaluation of the virtual SoC platform.
[0077] When the RISC-V processor initiates a transaction request, the bus forwards the request to the module at the corresponding address through the socket interface. After receiving the request, the module processes it and returns the response data to the bus through the same socket interface. The bus then forwards the response data to the RISC-V processor to complete the entire transaction process.
[0078] As Figure 2 shown, in this example, the virtual SoC platform includes a processor that selects the RISC-V32 IMAC instruction set, an interface that is compatible with the processor core, a transaction-level bus, a main memory, and a security module library.
[0079] The security module library includes a security management unit, an AES module, a DES module, a SHA-1 module, a PUF module, an RSA module, an SM3 module, an RC4 module, an SM2 module, an MD5 module, and a SHA-256 module.
[0080] Step 7. Calculate the area of the designed secure SoC based on the constructed virtual SoC platform.
[0081] According to the area model defined in Step 5, calculate the area of the designed secure SoC by weighted summing the areas of each module in the virtual platform.
[0082] The application program for data encryption is compiled through the RISC-V toolchain to generate an executable RISC-V ELF file. Use the ELF loader to load the segments (such as the.text segment and.data segment) in the ELF file into the specified address space in the system's memory. Conduct simulations on the virtual platform and record the results of each system simulation and the timing and power consumption data of the virtual SoC platform during the simulation process.
[0083] During the simulation of the virtual platform, the processor sends a transaction to the security management unit of the security module library. The SHA-1 module is called and reads the data in the registers of the security module library, processes the data, generates an encryption key and stores it in the transaction, and then transmits it to the registers of the security module library through the bus. Then, the processor and the AES module work together. The AES module reads the bus transaction stored in the register, encrypts the plaintext data using the designed AES symmetric encryption algorithm, and converts it into ciphertext. After the encryption is completed, a peripheral interrupt is triggered to generate a bus transaction signal to notify the system that the encryption process is completed.
[0084] The execution process of program encryption involves a large amount of data reading, writing and arithmetic operations. Collect the timing data and power consumption data of each module during the system execution process, especially the execution latency and power consumption of the AES module and the SHA-1 module, and the impact of the processor on the execution time and power consumption under specific instruction sets.
[0085] Step 9. By comparing the expected results with the results of the simulation run in Step 8, check whether the AES module and the SHA-1 module correctly process all transactions as expected during the encryption process; compare the simulation results with the expected area, timing and power consumption data to evaluate whether the design of the SoC virtual platform meets the performance requirements of the secure SoC design.
[0086] Step 10. If the comprehensive evaluation result does not meet the target design requirements, return to Step 6 to adjust the combination of security modules to be enabled in the security module library; otherwise, use the SoC virtual platform constructed in this round as the final design solution, that is, construct a secure SoC virtual platform that meets the design requirements.
[0087] The present invention provides an efficient virtual verification environment by combining RISC-V instruction set simulation and performance evaluation techniques. In this environment, not only the functional verification of the RISC-V processor, memory and security modules is realized, but also the simulation and analysis of key indicators such as timing behavior, power consumption and area can be carried out, so as to discover and correct potential problems in the early stage of design. In addition, the present invention also has high flexibility and scalability, and can adjust the parameters and configurations of security modules and instruction sets according to actual needs to adapt to different security design scenarios and performance requirements. The present invention also supports the simulation and testing of multiple peripheral interfaces to comprehensively evaluate the overall performance of the secure SoC system.
[0088] Of course, the above description is only a preferred embodiment of the present invention. The present invention is not limited to listing the above embodiments. It should be noted that all equivalent substitutions and obvious deformation forms made by any person skilled in the art under the teaching of this specification fall within the substantial scope of this specification and should be protected by the present invention.
Claims
1. A method for verifying and evaluating a RISC-V secure SoC based on a virtual platform, characterized in that The steps are as follows: Step 1. According to the design requirements of the RISC-V secure SoC target, establish the processor behavior mode, configure the optional RISC-V instruction set, and complete the conversion logic modeling from instructions to transaction processing; Step 2. Establish the transaction-level models of the bus and peripheral modules, including abstracting the functional characteristics of the peripheral modules and defining the interfaces and transaction types of the bus; Step 3. Establish the transaction-level model of the security module library, including constructing security modules and a security management unit to handle bus transactions, and designing configuration files to achieve dynamic switching of security modules; Step 4. Use a hardware description language to perform circuit-level design on each module, namely the processor, security module library, bus, and peripheral modules, and analyze the power consumption, timing, and area metrics of each module through EDA tools; Step 5. Define the timing, area, and power consumption models for each module based on the obtained performance metric data; Step 6. According to the design requirements of the RISC-V secure SoC target, confirm different combinations of security modules, and adjust the settings of the security module library configuration file to determine the security modules to be enabled. Integrate the processor, security modules, and peripheral modules to build a SoC virtual platform, and complete the communication between modules through bus mapping; Step 7. Calculate the area of the designed secure SoC based on the constructed SoC virtual platform; Step 8. Compile test cases for platform simulation and record the timing and power consumption data of the virtual platform simulation; Step 9. Compare the simulation results with the expected area, timing, and power consumption data, and comprehensively evaluate whether the design of the SoC virtual platform meets the performance requirements of the secure SoC design; Step 10. If the result of the comprehensive evaluation does not meet the target design requirements, return to Step 6; Otherwise, use the SoC virtual platform constructed in this round as the final design solution, that is, construct a secure SoC virtual platform that meets the design requirements.
2. The RISC-V secure SoC verification and evaluation method based on a virtual platform according to claim 1, wherein Specifically, Step 1 is as follows: Define the behavior mode of the processor, and use the sc_module class to create the processor core module; implement the arithmetic logic unit and program counter components as independent sc_module instances; model the internal state of the processor, including the update logic of register values and the program counter, and use sc_signal to store the current state of the registers. When an instruction is executed, update the PC value according to the length of the current instruction; Use an event-driven mechanism to manage the execution process of the processor. By defining sc_event and sc_process, trigger corresponding events when the processor reads an instruction from memory, undergoes a state change, or receives an external signal; each event will activate the corresponding sc_process, thereby completing the decoding and execution of the instruction; the instruction simulation of the processor is based on the event-triggered state transition logic, and convert the instruction into the corresponding transaction; By defining boolean flags for optional instruction sets, different instruction sets can be dynamically enabled or disabled in the virtual platform; enabling different instruction sets adds new instructions. During the execution process of the processor, the instruction decoding and execution processes perform corresponding processing logics according to the enabled instruction sets; encapsulate the processing logics of different instruction sets in independent modules; by selecting different instruction sets, the performance of the processor under different configurations can be tested, the most suitable instruction set for the current design requirements can be determined, and the best hardware design can be found. Define the interface module required for the processor to interact with the transaction-level bus. Through the bus, data interaction is carried out with the security module library and peripheral modules. The interface module integrates instruction and data memory access functions and is responsible for processing and forwarding the processor's memory read and write requests.
3. The RISC-V secure SoC verification and evaluation method based on a virtual platform according to claim 1, characterized in that In step 2, the process of constructing the transaction-level models of the bus and peripheral modules is as follows: Establish a target socket for each peripheral module to receive the transactions transmitted by the bus, create a register mapping table for each peripheral module, assign addresses and corresponding register objects to each register, and define the read and write operations of the register and the processing process of data control signals in the register access processing function. Define bus signals, including address, data pointer, data length, transaction command, and response signals; define the processing function of the transaction-level bus to implement basic bus interaction. In the processing function, obtain the transmission information of the transaction, find the register through the address, and perform the read and write operations according to the command.
4. The RISC-V secure SoC verification and evaluation method based on a virtual platform according to claim 1, wherein In step 3, the process of constructing the transaction-level model of the security module library is as follows: Adopt the modular design concept, use the sc_module class to create a security management unit and different security modules. The security management unit processes bus transactions. The processor accesses the control registers and status registers of the security module library through memory address mapping to obtain the status of the security module. The control data input register is responsible for receiving transactions, and the data output register stores the results of transaction processing. The synchronization between the security module and the security management unit is achieved through an event-driven synchronization mechanism. The security management unit receives processor requests through the blocking transmission callback function of the target socket. The requests contain the required data types, status, and control information; create a register mapping table, assign addresses and corresponding register objects to each register; set the register access processing function. When there is a register access request, the function will be called to store and read register data and update the register status information; call the thread functions, rxpush is responsible for receiving data and storing it in the register, txpull is responsible for reading data from the register and transmitting it into the security module, and a semaphore mechanism is used to ensure data synchronization between threads, waiting for the data ready notification from the rxpush thread. During the data processing of the security module, the sending thread of the security management unit is called to obtain register information. According to the obtained control register information, the processing type to be executed currently and the required parameters are determined. And according to the data of the input register obtained, the security algorithms of different security modules are called to process the data. According to the processing result, the internal state of the security module is updated. The security management unit stores the processing result of the data and the updated status information into the corresponding registers by calling the receiving thread.
5. The RISC-V secure SoC verification and evaluation method based on a virtual platform according to claim 4, characterized in that In step 3, the process of dynamic switching of each security module is as follows: Define the names, types, algorithms and required parameters of each security module in the configuration file. Each security module has an independent configuration item, supporting the independent enabling and configuration of the module; Enable or disable a certain security module by setting a flag bit; when the virtual platform starts simulation, the configuration file will be parsed first, and the corresponding security modules and security algorithms will be initialized according to the parameters of the configuration file; Each security module is configured with a corresponding security algorithm according to its function, and all security algorithms are encapsulated through corresponding transaction interfaces.
6. The RISC-V secure SoC verification and evaluation method based on a virtual platform according to claim 1, wherein Specifically, step 4 is as follows: Based on the processor behavior mode defined in step 1, the security module library defined in step 2, and the transaction-level model of the bus and peripheral modules defined in step 3, the processor, the security module library, the bus and peripheral modules are divided into actual hardware circuit blocks and gradually transformed into the target hardware structure; for the processor module, the instruction set architecture and the processor execution process described in high-level language are transformed into a specific hardware circuit structure; when the security module library is transformed into hardware implementation, corresponding hardware circuit structures are designed according to different security algorithms and protocols; When the transaction-level model of the bus and peripheral modules is transformed into a hardware structure, the hardware parts of the bus controller and the peripheral interface circuit are designed; specific interfaces and timing requirements are defined for each module. According to the performance requirements and working frequency requirements of the verified RISC-V security SoC, the clock signal, the timing path, the synchronous logic and the asynchronous logic are defined to ensure that the circuit meets the timing constraints. When defining the interface, the data transfer protocol and signal type between each module are clarified, and the communication between modules is realized through signal lines; the hardware resources required by each module are clarified, and the connection relationship between each module and the hardware resources is defined; Call the EDA synthesis tool for synthesis analysis, including logic synthesis, placement and routing, to generate the gate-level netlist of the target hardware, and perform power consumption and area analysis on the gate-level netlist of the target hardware, calculate the static power consumption, dynamic power consumption and the total area of the design, and generate a power consumption and area report; then call the timing analysis tool of EDA. By extracting the gate-level netlist of the target hardware, according to the propagation path of the clock signal in the security SoC hardware architecture, determine the clock path of the generated security SoC hardware architecture; and according to the timing constraints, analyze the entire hardware architecture, identify the critical path of the generated security SoC hardware architecture, and calculate the delay of each critical path and clock path; According to the results of comprehensive analysis and timing analysis by EDA tools, record the key power consumption, timing, and area metrics of the generated secure SoC hardware architecture, including the delays of critical paths and clock paths, power consumption distribution, and area occupancy information.
7. The RISC-V secure SoC verification and evaluation method based on a virtual platform according to claim 1, characterized in that Specifically, step 5 is as follows: Based on the key metric data determined in step 4, use clock and delay mechanisms to simulate the cycle accuracy and delay characteristics on actual hardware; for the processor timing model, use the sc_clock class to define the clock signal, clarify the number of time cycles required for each instruction in each pipeline stage, and use the event-driven mechanism to trigger signal and state changes, that is, each instruction will trigger different events in sequence to drive the state changes of the instruction in each pipeline stage; for the bus timing model, simulate the data transfer delay through the delay mechanism of transaction-level modeling, use the sc_time class to control the event time interval, and adjust the transmission delay of the transaction according to the local time; for the timing models of peripheral modules and the secure module library, use timestamps to mark the time from receiving a request to starting to respond and the time required for the module to process the request, including data processing and internal data transfer time within the module; and clock synchronization is achieved through event passing between different modules. After receiving a signal request, the module will trigger the corresponding event to ensure that each module executes synchronously at the correct moment; Add power consumption and area attributes to the interfaces of each module; include the static power consumption, dynamic power consumption, and area information of the module in the defined module structure; during the initialization process of each module, add the static power consumption and area attributes of the corresponding module, set a status variable for the module to represent the active state of the module; and during the clock cycle, monitor the changes in the module status variable and update the dynamic power consumption; when the module finishes processing a transaction, create a status interface inside the module, which contains timing, power consumption, and area information. After each transaction ends, update and record the power consumption, area, and timing data of the module.
8. The RISC-V secure SoC verification and evaluation method based on a virtual platform according to claim 1, wherein In step 6, according to the design requirements, confirm different combinations of secure modules, and adjust the secure module library configuration file settings to determine the secure modules to be enabled. The process of connecting the processor, secure modules, and peripheral modules through a transaction-level bus to build the SoC virtual platform is as follows: According to the performance requirements of the target SoC and based on the timing, area, and power consumption models established in step 5, select different combinations of secure modules, and then modify the flag bits of each secure module in the secure module library configuration file defined in step 2 to enable or disable different secure modules; each secure module has its corresponding functions and parameter configurations, and the enabling or disabling of the secure module is controlled through the configuration file; Create the top-level module of the system, which is responsible for the initialization work of the entire system, configuring the address spaces of each module, module instantiation, and establishing the connection relationships between modules; Map the addresses of each module to the transaction-level bus through the bus port mapping method; bind the target socket interface of each module to the initiating socket interface of the bus; start the program simulation and wait for the system to finish running; In the top-level module of the system, call the status interfaces created by each module, traverse each module and extract its timing, power consumption, and area information. At the end of the simulation, print the status information of each module to facilitate the overall performance evaluation of the SoC virtual platform; When the RISC-V processor initiates a transaction request, the bus will forward the request to the peripheral module at the corresponding address through the socket interface. After receiving the request, the peripheral module processes it and returns the response data to the bus through the same socket interface. The bus then forwards the response data to the RISC-V processor to complete the entire transaction process.
9. The RISC-V secure SoC verification and evaluation method based on a virtual platform according to claim 1, characterized in that Specifically, step 7 is as follows: According to the area model defined in step 5, calculate the area of the designed secure SoC by weighted summation of the areas of each module in the constructed SoC virtual platform.
10. The RISC-V secure SoC verification and evaluation method based on a virtual platform according to claim 1, characterized in that In step 9, the comprehensive evaluation includes timing, power consumption, and area performance evaluations; For the timing evaluation, analyze the timing data obtained from the simulation run, compare it with the processing delay and transmission delay in the expected performance metrics, and evaluate whether the timing performance of the virtual platform meets the design requirements; For the power consumption evaluation, compare the power consumption data of the simulation run with the expected power consumption metrics to determine whether the energy consumption of the virtual platform is within an acceptable range; For the area evaluation, compare the total area of the virtual platform obtained from the simulation run with the expected SoC area to evaluate whether the area occupancy meets the design goals.
Citation Information
Patent Citations
Method for designing SoC core system and realizing inter-core task communication
CN110545319A
Secure deployment and operation of a virtual platform system
CN113260993A