Home Artists Posts Import Register

Content

Hi everyone,

I want to report to you after a huge milestone was reached.

As mentioned in the last post, i was working on 3 major topics in the last days:

- TLB in the CPU

- PAL timing

- save memory

Let's look at it in detail:

PAL timing was really no big issue in the end. Mostly the dots per line and the lines per frame are different. This alone did allow for a large amount of PAL games to also boot now.

Save memory was another door opener: games that depend on initializing the cartridge save memory(Flash or SRAM) have been stuck in an infinite loop or went into some exception handling because of this interface not being implemented before. Now, both save types being added, a good bunch of them boots up.


The largest change however was the added TLB.

TLB stands for Translation Lookaside Buffer and is a way for programs or operating systems to handle their memory management. It allows programs to use virtual memory addresses, independent from the real address in physical memory.

The CPU supports this with a table of 32 entries that translates virtual addresses to physical addresses on the fly with every memory access.

So over the last week I added the whole handling of this functionality to my emulator:

- adding/removing entries to the table

- probing the table entries

- conversion of virtual to physical address for instruction reads as well as data reads and writes

- exception handling in case the virtual address is not in the table

This allowed another bunch of games to boot up. Some examples are Bomberman, Mario Tennis, Goldeneye or Castlevania.


It was also the last puzzle piece for getting the N64 systemtest to fully pass, which you can see in the screenshot above.

You can find the N64 systemtest here: https://github.com/lemmy-64/n64-systemtest

But what is it? 

A compilation of thousands of single tests made by homebrew and emu devs over the last years. This testsuite covers so much of the functionality of the system, it's unbelievable. Things covered are:

Basic CPU instructions, Memory access, Floating Point calculations, Exception handling, all kind of low level RSP tests and many, many more. The last part that was still failing in my emulator: the TLB tests.

You can imagine that fulfilling this testsuite will be one of the major goals of the FPGA core.  

But why not work on getting games running instead? Well, it's easy: I only found about 10 serious issues that were not covered by the testsuite yet. This is an insanely low number. Of course I'm not at the final goal to have every game running perfect, but this testsuite is a kickstart that I cannot praise enough.


So what parts are still missing before starting FPGA work?

- The RSP still needs to be pipelined. The RSP is basically another MIPS CPU with additional Vector Unit (8 x 16 bit). My implementation currently fulfills all tests, but is a single stage interpreter emulation, which cannot be implemented into the FPGA, but must first be converted to the 5 stage pipeline the real RSP has

- CPU still has some shortcuts that lead to timing inaccuracies. I will not get the CPU highly accurate now(that would cost way too much time), but I want to at least clean up the most important things.

- I want to write a DDR3 test core for MiSTer. The RDRAM of the N64 will find it's place in the DDR3 of MiSTer and I need to investigate on some implementation details of the DDR3 access scheme to allow the core to be as close as possible to the real RDRAM interface. This test core will very probably be open for you to play with if you like.


That's it for today.  Have fun!


Full progress(emulator):

- CPU: 80%, some timing accuracy features missing only

- RDP(Graphics): 60%, most features implemented, rarely used features and known bugs remain

- Memory: 80%, all DMAs and Memory areas implemented and working so far

- FPU: 80%, all features implemented and tests fulfilled so far

- RSP(second CPU): 60%, all features implemented and tests fulfilled but not pipelined yet

- Inputs: 50%, no change, works in games (normal controller only, no rumble)

- Sound: 50%, no change, works in games

- Saving: Cartirdge saves done, Controllerpak saving missing

Files

Comments

David Moylan

Loving the dedication you are putting into this and the detailed posts you have been doing. Awesome work :-)

Anonymous

Nice! :) Could you contribute your findings of not-covered-issues to n64-systemtest? :)

FPGAzumSpass

I shared it with the developers, but i'm not really comfortable writing good Rust code currently, sorry.