This verification task will further explore the L2TLB-bitmap module, experience the memory isolation design philosophy through verification practice, and deepen the understanding of TLB and RISC-V instruction set architecture. You are welcome to sign up (registration form here, QQ group: 600480230)!

Bitmap is responsible for dynamic memory isolation in M-mode, to protect the confidentiality and integrity of data currently in use. The bitmap module is coupled with L2TLB. After L2TLB performs address translation to obtain the physical address, it obtains the permissions of that physical address to determine whether isolation is needed. This task only requires verifying the interaction between bitmap and L2TLB, as well as the bitmap itself. The L2TLB module itself has been fully verified and can be considered reliable. The new bitmap portion is marked with the TAG “HasBitmapCheck” in the Chisel source code.

The Chisel files involved in this verification include:

  • cache/mmu/L2TLB.scala
  • cache/mmu/BitmapCheck.scala
  • cache/mmu/PageTableWalker.scala
  • cache/mmu/PageTableCache.scala
  • cache/mmu/MMUBundle.scala
  • cache/mmu/MMUConst.scala
  • backend/fu/NewCSR/NewCSR.scala

The assigned task is verification of the Bitmap module. All tasks will be assigned through issues on XS-MLVP/XiangShan Processor.

Participation

Please complete the verification work based on the verification framework provided by UnityChipForXiangShan and submit a PR to that repository.

Submitting Results

Please fork the UnityChipForXiangShan repository above, complete the verification code and documentation, and submit a PR when ready.

Bug Reports

Please directly use the bug report template to file an issue under the UnityChipForXiangShan repository, or click here for a quick shortcut.

When submitting a bug, please select the “bug need to confirm” label first. Then choose the label that best matches your assessment from the four bug severity levels (minor, normal, serious, critical) provided by the label. Finally, select the module where you found the bug. Since this verification is for the bitmap module in memblock’s L2TLB, you can uniformly apply the ut_memblock.bitmap label.

Deliverable Requirements

Each subtask requires submission of the following:

  1. Verification environment + API: The verification environment and API are code deliverables that encapsulate the data responsibilities (pins) and behavioral responsibilities (logic) of the Design Under Test (DUT). They need to provide specific reusable interfaces, test suites, test coverage definitions, etc. For setting up the verification environment, please refer to the Verification Environment Setup Tutorial. For documentation related to test coverage, please refer to these two articles: Line Coverage, Functional Coverage.
  2. Test cases: Test cases are code deliverables that define the input combinations used for testing and the expected output combinations. For building test cases, please refer to the Test Case Addition Tutorial
  3. Verification report: The verification report is a written deliverable that includes introductions to the environment, test points, and test cases, the environment and instructions required to reproduce the code, and reports on metrics such as test coverage.
  1. Other notes: If your project requires additional dependencies, please note them in the test report or PR

This session’s task has already provided an initial environment in the UnityChipForXiangShan verification framework. Everyone is also welcome to build their own verification environment and refine the APIs.

Task Difficulty

Task difficulty is comprehensively determined based on factors such as comprehension difficulty and workload. Generally, tasks with difficulty 1-3 are simple tasks, tasks with difficulty 4-7 are of moderate difficulty, possibly with large workloads or requiring a certain amount of time to understand hidden task information, and tasks with difficulty 8-10 are more difficult, generally with both large workloads and high comprehension difficulty.

Reward Information

Ultimately, based on the difficulty of the tasks and everyone’s completion status, you will be able to receive varying amounts of bonus payments. Additionally, if you find and confirm a bug in the Bitmap module, you have the opportunity to receive more bonus payments.

Task Details

Since the module verified in this session is coupled with L2TLB and contains a large number of interactive parts, dividing it into multiple submodules has no practical significance. Therefore, it is necessary to build a verification environment for the entire Bitmap and L2TLB module. We will grade based on test completeness (coverage, etc.). During the verification process, you will need to divide test points based on self-selected functional points. For detailed functional point descriptions, please refer to L2TLB-Bitmap Documentation. Functional points involving the bitmap module itself and those involving L2TLB interaction will be marked separately. The bitmap module’s functional points are relatively independent, and priority verification is recommended. All functional points and their corresponding difficulties are as follows:

Function IdentifierFunctional PointDescriptionDifficulty
BITMAP_001Bitmap Cache hit/miss scenario verificationDesign test cases covering hit and miss scenarios
Combination: Cross bitmap cache line, i.e., both miss and hit occur
1/10
BITMAP_002Bitmap check function verificationVerify the correctness of bitmap check
Combination: Cross 256K physical address space, i.e., always miss
1/10
BITMAP_003Cross bitmap cache line scenario verificationTest the access behavior across cache lines
Combination: Cross bitmap cache line + cross 256K physical address space
1/10
BITMAP_004BITMAP flushTest whether csr.mbmc.BCLEAR works correctly1/10
Function IdentifierFunctional PointCoverage Method DescriptionCombination DescriptionDifficulty
TLB_001ITLB hit/miss scenario verificationDesign test cases covering ITLB hit and miss4K/2M/1G/512G page sizes3/10
TLB_002DTLB hit/miss scenario verificationDesign test cases covering DTLB hit and miss4K/2M/1G/512G page sizes3/10
TLB_003L2TLB hit/miss scenario verificationDesign test cases covering L2TLB hit and replacement4K/2M/1G/512G page sizes3/10
TLB_004L2TLB compression function verification
Note: Only supports first-stage address translation compression, up to 8 entries
Test whether Bitmap query results are correct under TLB compression scenariosTLB compression enabled + 4K page size4/10
Function IdentifierFunctional PointCoverage Method DescriptionCombination DescriptionDifficulty
TLB_BITMAP_001Bitmap and TLB mixed hit scenario verificationCombine Bitmap hit with TLB hits at all levels to verify multi-level cache coordinationBitmap hit + ITLB/DTLB/L2TLB all hit3/10
TLB_BITMAP_002Full miss extreme scenario verificationDesign full miss test cases for first access after cold start or cache flushBitmap miss + ITLB/DTLB/L2TLB all miss + trigger page table walk3/10
TLB_BITMAP_003Bitmap cross-line and TLB replacement scenario verificationForce Bitmap cross-cache-line access and trigger TLB replacement (such as duplicate access or page table update)Bitmap cross-line + DTLB miss + L2TLB replacement3/10
TLB_BITMAP_004Repeated access and Cache/TLB interaction verificationVerify Bitmap/TLB repeated access optimization through repeated access to the same addressBitmap repeated hit + ITLB repeated hit + no replacement
Bitmap repeated Miss + ITLB repeated Miss + replacement
4/10

Function IdentifierFunctional PointCoverage Method DescriptionCombination DescriptionDifficulty
PTW_001PTW/HPTW/LLPTW priority verificationTest the priority of multi-level page table walksPTW + HPTW concurrent4/10
PTW_002PTW return exception (access fault) verificationSimulate scenarios where PTW returns an exceptionPTW return af + cross Page4/10
PTW_003PTE legality verificationTest the handling of illegal PTEsIllegal PTE + PMP check4/10

Exception and Replay Function Verification

Function IdentifierFunctional PointCoverage Method DescriptionCombination DescriptionDifficulty
REPLAY_001Scalar replay scenario verificationTest the replay behavior of scalar instructionsScalar replay + access fault5/10
REPLAY_002Vector memory access replay scenario verificationTest the replay behavior of vector instructionsVector replay + cross MMO5/10
EXCEPT_001Exception priority verification (access/page fault/guest page fault)Verify the priority of exception triggeringpage fault/guest page fault
PMP/bitmap detection failure during page table walk
PMP detection failure on translated physical address
5/10

Privilege Level and Extension Function Verification

Function IdentifierFunctional PointCoverage Method DescriptionCombination DescriptionDifficulty
PRIV_001U/S/M privilege level switch verificationTest access permissions under different privilege levelsU/S/M + 4K/2M page sizes4/10
EXT_001H-extension function verificationTest H-extension enable and disable scenariosH-extension + cross tlb entry4/10
PMP_001PMP check function verificationTest PMP permission check within bitmapPMP Y/N + cross Page4/10

Fence Verification

Function IdentifierFunctional PointCoverage Method DescriptionCombination DescriptionDifficulty
MISC_001Fence operation verificationTest the synchronization effect of fence instructionsFence + switch Cmode3/10

Registration

Please fill out the registration form to participate in this session’s task. You are also welcome to join the official QQ group: 600480230.

If you have any questions, you can contact the group owner in the QQ group, or contact the UnityChip official email: unitychip@bosc.ac.cn.