What's new

beginner question about tlb

cufunha

New member
I was reading that r4300i rev 0.3 pdf to make the tlb emulation... when I was doing that funtion that compares vpn to translate virt-phis address, I got two questions that are poorly explained there:

when comparing the vpn's, how can I compare a 19-bit number (vpn2 on tlb) with a number that may have 7-19bits (depending of the pagemask). I mean, if the page mask is 1111 1111 1111b the vpn2 on virtual address has 7 bits... how will I compare, using the highest 7bits of the vpn on the tlb entry or the lowest 7 bits?

when I get the physical address properly translated, am I supposed to use it with that memory map provided by the n64 opcodes 1.1 doc? I mean, the adresses there are virtual or physical?

whats the maximum of computer memory used to emulate the n64 memory map?

the last question is:
do I HAVE to emulate tlb, since the full memory map of n64 is known?
 
Last edited:
OP
C

cufunha

New member
another little one

I forgot oen question! the address that enters on tlb must have 40bits, where the higher 8bits are the virtual address ASID. My question is, from where this ASID come when you're performing (1) a load/store instruction (acessing jTLB) and (2) when you're performing a instruction data address translation (micro-TLB)?
 

BGNG

New member
That's a beginner question? I should probably work my way up to beginner one of these days... My realm of experience is limited to NES and the Game Boy series, so I can't be of much help... (Perfect way to reply in an internet forum, eh?)

But what may be able to help you is http://www.dextrose.com, which has just about everything known about N64 emulation. There is also a forum there, but I'm not sure how many of its members will be of much service. Worth a shot, though.
 

zenogais

New member
Why not truncate the longer one then compare it the other one is shorter? (i.e. VPN2 &= 0x7F - if its seven bits). Yes for the N64 you have to emulate the TLB, for the Playstation though you do not.
 
OP
C

cufunha

New member
that's what i'm doing... i can't see if it will work by now, but soon I will have the answer.
 

WildNinji

New member
Yeah, TLB is somehow hard to figure out, but less hard that one can think.

cufunha said:
when comparing the vpn's, how can I compare a 19-bit number (vpn2 on tlb) with a number that may have 7-19bits (depending of the pagemask). I mean, if the page mask is 1111 1111 1111b the vpn2 on virtual address has 7 bits... how will I compare, using the highest 7bits of the vpn on the tlb entry or the lowest 7 bits?
Page 63 (section 4.2) is your friend. Only the TAG is compared, the offset of the virtual address is not. And remember that the current ASID is stored in the COP0 processor, in the EntryHi reg IIRC.

cufunha said:
when I get the physical address properly translated, am I supposed to use it with that memory map provided by the n64 opcodes 1.1 doc? I mean, the adresses there are virtual or physical?
All the addresses on anarko docs are virtual. Some translate to phys via substraction (the kernel spaces), other via tlb (the cardrige domains).
But don't rely on this info, my memories are vague.

whats the maximum of computer memory used to emulate the n64 memory map?
??? the virtual memory don't need any space (otherwise you would need 4GB of mem). All you need to emulate is the phys mem and it can be 4 or 8 MB wide, depends if you emulate or not the expansion pak.

do I HAVE to emulate tlb, since the full memory map of n64 is known?
AFAIK yes. The OS is free to map much of the space as it like.
 
OP
C

cufunha

New member
what "current" ASID is stored in the entryhi reg, the virtual address asid or the tlb entry asid? I thought each tlb entry had its own asid.
 
OP
C

cufunha

New member
wildninji: you didn't answered my question. I know that the offset is not compared, but the question wasn't that. the tag has a variable number of bits (7-19 bits) depending on the mask...
 

WildNinji

New member
Let's put it in this way, every process has its own ASID (the OS runs on ASID 0). Every time a process is run, the OS set the current ASID (in EntryHi) to the process' ASID. In the TLB there can be associations like

ASID, VIRT, PHYS
3, 1000, 0004
4, 1000, 0026
4, 1200, 0026

When the TLB is used by process 4 to translate an address like 1000xxx (notice that both process 3 and process 4 uses the same vaddr, but points to a different paddr. This is common), the processor says "Which entry should I use?".
He can't use the 1st (EntryHi != TLBEntry.ASID), he can't use the 3rd entry (vaddr != searchedVADDR), but the 2nd is ok!

I don't understand what you don't get about variable addr masks. Explain better plz.
 

Top