The following excerpt, "Step fright Core-the interior design and analysis of the soft-core processor," a book1 ImmuStructure
OR1200 implements the The file for span style= "font-family:times new Roman" >immu has or1200_immu_ TOP.V , or1200_immu_tlb.v , OR1200_SPRAM.V , which uses or1200_immu_top.v implements immu module, using OR1200_IMMU_TLB.V The implements the itlb module, OR1200_SPRAM.V is a single-port ram . The use of the itlb is in fact present in the table entry. 10.5 is seen.
This section describes the connection of the Immu module to the rest of the modules, and theITLB structure respectively.
1.1 The connection between the Immu module and the remaining modules
Figure 10.6 The connection between the Immu and other modules. Most of the interfaces are very intuitive.
ImmuAndCPUThe interface between is the instructionWishbonePart of the bus.ImmuAndQmemAlso betweenWishbonePart of the bus, when not configuredImmuWhen you can feelCPUAndQmemis directly connected, and this is the first3is described in the chapter. In additionImmuThere are also interfaces related to the special Register interview:Spr_cs、Spr_write、spr_addr、spr_dat_i、Spr_dat_o, which shows that inImmuSpecial registers are available, and this special register is readable (withSpr_dat_oInterface), writable (withspr_dat_iInterface).
1.2 itlb Structure
the previous article has been described. or1200 mmu The main function of the body is now tlb implementation, to Immu is itlb . So first give the structure of itlb , figure 10.4 The is a general tlb transformation schematic. Each processor implementation tlb will be implemented in a detailed manner, discussed here is or1200 .
in OR1200 itlb The items in the figure 10.4 are stored in two parts, and the identities are stored in the mr_ram table. The data is stored in the tr_ram table, as10.7 sees. From the name can also know that the table here is actually implemented using RAM , the table index corresponding Ram address, the table item corresponding RAM content.
Or in the default configurationTLBYes -As an example, at the same time according toOR1200The virtual address is called a valid address in the custom.Mr_ramEach item in the table accounts for14bit, among them high13bitIt's a valid address.19-31bit, minimumbitForVThat represents whether the table entry is valid.Tr_ramEach item in the table accounts for22bit, among them high19bitIt's a physical address.13-31bit, low-level3bitEach naturallyUxe(User Execute Enable)、SXE(Supervisor Execute Enable)、CI(Cache Inhibit)。 Represents whether the user mode is operational, whether the privileged mode is operational, and whether to disallow caching.ImmuUseUxe、SXEImplements the protection of the instruction page in memory.CIis to indicate whether the processor wants to place the page in the cache, assumingCIFor1。 The page code does not go out of the cache today. Every visit needs to be read from memory. Conversely, it means that the page code can be cached.
itlbThe translation process is: Take advantage of the effective address of the13-18bitQuery at the same time as indexMr_ram、Tr_ramTwo tables. UseMr_ramResults inferred from the tableitlbWhether hit,itlbThe condition of the hit isMr_ramThe "valid address" in the table entry19-31Bit "andCPUProvided in the valid address of the19-31Bits are equal, andVFor1InsteaditlbNot hit. Also known asitlbLoss of Target. WhenitlbWhen hit, will be fromTr_ramTable index Gets the "Physical address of the13-31Bit "andCPUValid address provided is low -Bits are combined as physical addresses.
At the same time get the properties of the page SXE,uxe,CI.
Immu uses the translation results of itlb for next steps in three different situations:
- itlb hit. But SXE is 0. The current processor is in privileged mode. or uxe is 0. And the current processor in user mode, will violate the page protection policy, throw the instruction page failure exception, the processor transferred to the instruction page failure exception processing routines, reference table 1.3 that the corresponding address is 0x400
- itlb hit. And does not violate the page protection policy, the corresponding physical address will be obtained instructions at
- itlb loss of target. Because the OR1200 does not implement the hardware itlb load, so only through the software implementation itlb loading,itlb lost target caused itlb lost target anomaly, the processor transferred to itlb The processing routine of the abnormal loss of target. Refer to the table 1.3 The corresponding address is 0xa00, the user needs to write the exception of the processing routine, in which the required page table entries loaded into the itlb
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
or1200 in Immu analysis