Is the MIPS CPU cycle-accurate?

Discuss any unrelated topics here.
Post Reply
User avatar
asiga
Posts: 24
Joined: Fri May 30, 2014 5:35 pm

Is the MIPS CPU cycle-accurate?

Post by asiga » Sat Jul 04, 2015 6:54 pm

I'm wondering if the current CEN64 version implements the 100% of the instruction set of the N64 MIPS CPU (including 64bit addressing ABI) and if it's cycle accurate or a hack.

I'm asking this because I was an SGI developer quite a few years ago, and I remember it wasn't easy to predict exact execution times because the MIPS CPUs were relatively complex (well, maybe I'm thinking in the R10K which had predictive branching and related stuff... The R4K family was simpler, but also had caches, which I guess would complicate a cycle-accurate emulation).

User avatar
MarathonMan
Site Admin
Posts: 692
Joined: Fri Oct 04, 2013 4:49 pm

Re: Is the MIPS CPU cycle-accurate?

Post by MarathonMan » Sun Jul 05, 2015 10:17 am

Not 100% cycle-accurate - I'm still missing some of the slips and stalls.

But largely, yes. The model is quite solid and things like multi-cycle operations, use-after-load stalls, etc. are all implemented. The memory system is fixed-delay right now (until I figure out a better way to simulate the RDRAM and bus activity), so CACHE and memory-operations do stall as they should, but only for a constant delay, which isn't entirely correct.

The R4k (and in particular, the R4200/R4300i - the runts of the family) are particularly easy to simulate compared to the pipelines that you speak of. The pipelines are a simple 5 stage design straight out of Hennessy and Patterson - fetch/decode/execute/memory/writeback. There's no branch prediction to worry about and the caches are quite small (and direct-mapped - not even set-associative), so you can count on most commercial ROMs generating quite a few stalls.

EDIT: Thanks, this post got me thinking about a slip that I haven't implemented yet, but would be quite easy to add in and will help improve performance with most commercial carts. :)

EDIT 2: Didn't result in a speed-up, but at least things are more accurate now. DCM, DCB, LDI, MCI, ICB, and a few more are all implemented. Really, the only thing that's left is micro-TLB stalls (ITM), and CP0I -- others like BRPT, IBE, DBE, etc. are not implemented either, but aren't timing-related, just raised on events that don't happen in an ordinary ROM.

User avatar
asiga
Posts: 24
Joined: Fri May 30, 2014 5:35 pm

Re: Is the MIPS CPU cycle-accurate?

Post by asiga » Sun Jul 05, 2015 4:21 pm

I'm happy my curiosity was of help :D

User avatar
Breadwinka
Posts: 54
Joined: Fri Oct 04, 2013 11:35 pm

Re: Is the MIPS CPU cycle-accurate?

Post by Breadwinka » Mon Jul 06, 2015 1:07 pm

Will the build bot put up new builds on the site any time soon?

User avatar
MarathonMan
Site Admin
Posts: 692
Joined: Fri Oct 04, 2013 4:49 pm

Re: Is the MIPS CPU cycle-accurate?

Post by MarathonMan » Wed Jul 08, 2015 5:36 pm

Breadwinka wrote:Will the build bot put up new builds on the site any time soon?
The build bot isn't building the Windows binaries correctly (they compile and functionally execute OK, but there's a performance regression).

For now, I've been doing it manually, which means less-frequent update cycles until I track down the issue.

I'll try to push a build relatively soon, though.

User avatar
MarathonMan
Site Admin
Posts: 692
Joined: Fri Oct 04, 2013 4:49 pm

Re: Is the MIPS CPU cycle-accurate?

Post by MarathonMan » Thu Jul 16, 2015 9:47 am

Breadwinka wrote:Will the build bot put up new builds on the site any time soon?
Bump. Pushed new builds.

User avatar
Breadwinka
Posts: 54
Joined: Fri Oct 04, 2013 11:35 pm

Re: Is the MIPS CPU cycle-accurate?

Post by Breadwinka » Fri Jul 17, 2015 8:53 pm

MarathonMan wrote:
Breadwinka wrote:Will the build bot put up new builds on the site any time soon?
Bump. Pushed new builds.
awesome, also looks like google is flagging your http://downloads.cen64.com/ as malware.

User avatar
MarathonMan
Site Admin
Posts: 692
Joined: Fri Oct 04, 2013 4:49 pm

Re: Is the MIPS CPU cycle-accurate?

Post by MarathonMan » Fri Jul 17, 2015 10:57 pm

Breadwinka wrote:awesome, also looks like google is flagging your http://downloads.cen64.com/ as malware.
Yeah, I already filed a report about that.

User avatar
wareya
Posts: 16
Joined: Tue May 19, 2015 5:44 pm

Re: Is the MIPS CPU cycle-accurate?

Post by wareya » Sat Jul 18, 2015 12:46 am

I had the same problem with firefox on some other legitimate site. People are going around flagging legit sites for malware. It's annoying.

User avatar
MarathonMan
Site Admin
Posts: 692
Joined: Fri Oct 04, 2013 4:49 pm

Re: Is the MIPS CPU cycle-accurate?

Post by MarathonMan » Sat Jul 18, 2015 9:50 am

Should be cleared up now on all browsers.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest