fabiensanglard / gebbdoom

Game Engine Black Book: Doom

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jaguar RISC engines couldn't execute code from main memory

fonic opened this issue · comments

commented

In the Game Engine Black Book v1.1, chapter 6.1.2, page 305, John Carmack is quoted stating this:

The little RISC engines were decent processors. I was surprised that they
didn’t use off the shelf designs, but they basically worked ok. They had some
design hazards (write after write) that didn’t get fixed, but the only thing truly
wrong with them was that they had scratchpad memory instead of caches, and
couldn’t execute code from main memory. I had to chunk the DOOM renderer
into nine sequentially loaded overlays to get it working (with hindsight, I would
have done it differently in about three...).

This is closely related to a previous paragraph on page 301/302:

gebbdoom_page_301_302

While not wrong per se, I think this could use some clarification. The Jaguar's RISC engines could in fact execute code from main memory (DRAM) and were designed/meant to do so, BUT another one of those design hazards prevented this in practice:

jaguar_technical_reference_manual_rev8_page_137

So code could indeed be executed from main memory, but jump instructions were unreliable. Since jumps are an essential part of almost every algorithm, this practically renders code execution from main memory useless.


I think this is worth pointing out since it further explains why the Jaguar was so hard to deal with for developers (which in turn highlights what a genius John Carmack was back then to be able to pull it off). This was not just another minor design hazard that could be easily worked around, but instead a major deal-breaker. Even though execution from the RISCs' local scratchpad memory was much faster and the preferred choice, being able to execute code from main memory would have made development A LOT easier (i.e. simply use main memory during development, then chunk the FINAL code for use in scratchpad memory as an optimization step late in the development cycle).

Fixed in ac69b84

commented

I'd suggest changing the text to:

Jumps could fail when executed from main memory (see Jaguar Tech Reference Manual Rev. 8, p137)

as the actual instructions are named JUMP/JR (not jmp) and as there are multiple of these tech references around (I found three different versions myself).

There is not enough space to change the sentence as you suggested.

commented

Yeah, that's what I thought - I compiled the book and noticed that there doesn't seem to be lots of space left down there.