Earlier quoted context omitted.
I think both are useful, but designing a modern CPU from the gate level is out of reach for most folks, and I think there's a big gap between the sorts of CPUs we designed in college and the sort that run real code. I think creating an emulator of a modern CPU is a somewhat more accessible challenge, while still being very educational even if you only get something partially working.
When I was at Caltech, another student in the dorm had been admitted because he'd designed and implemented a CPU using only 7400 TTL. Woz wasn't the only supersmart young computer guy at the time :-) (I don't know how capable it was, even a 4 bit CPU would be quite a challenge with TTL.)
Things I learned while writing an x86 emulator (2023)
81–90 of 135 posts
Re: Things I learned while writing an x86 emulator (2023)
#82> Writing a CPU emulator is, in my opinion, the best way to REALLY understand how a CPU works Hard disagree. The best way is to create a CPU from gate level, like you do on a decent CS course. (I really enjoyed making a cut down ARM from scratch)
Seconded. A microcoded, pipelined, superscalar, branch-predicting basic processor with L1 data & instruction caches and write-back L2 cache controller is nontrivial. Most software engineers have an incomplete grasp of data hazards, cache invalidation, or pipeline stalls.
Re: Things I learned while writing an x86 emulator (2023)
#83Earlier quoted context omitted.
When I was at Caltech, another student in the dorm had been admitted because he'd designed and implemented a CPU using only 7400 TTL. Woz wasn't the only supersmart young computer guy at the time :-) (I don't know how capable it was, even a 4 bit CPU would be quite a challenge with TTL.)
I think the key word above was modern. I felt able to design a simple CPU when I finished my Computer Architecture course in university. I think I forgot most of it by now ;) There are a few basic concepts to wrap your head around but once you have them a simple CPU is doable. Doing this with TTL or other off the shelf components is mostly minimizing/adapting/optimizing to those components (or using a lot of chips ;)…
In the early 70s, before the internet, even finding the information needed would be a fair amount of work.
I learned how flip flops worked, adders, and registers in college, and that could be extended to an ALU. But still, that was in college, not high school.
I've read some books on computer history, and they are frustratingly vague about how the machines actually worked. I suspect the authors didn't actually know. Sort of the like the books on the history of Apple that gush over Woz's floppy disk interface, but no details.
Re: Things I learned while writing an x86 emulator (2023)
#84Re: Things I learned while writing an x86 emulator (2023)
#85What a cool person. I really enjoy writing assembly, it feels so simple and I really enjoy the vertical aesthetic quality. The closest I've ever come to something like OP (which is to say, not close at all) was when I was trying to help my JS friend understand the stack, and we ended up writing a mini vm with its own little ISA: https://gist.github.com/darighost/2d880fe27510e0c90f75680bfe... This could have gone much…
You should leverage that into your friend teaching you JS, maybe.
Re: Things I learned while writing an x86 emulator (2023)
#86Earlier quoted context omitted.
I think the key word above was modern. I felt able to design a simple CPU when I finished my Computer Architecture course in university. I think I forgot most of it by now ;) There are a few basic concepts to wrap your head around but once you have them a simple CPU is doable. Doing this with TTL or other off the shelf components is mostly minimizing/adapting/optimizing to those components (or using a lot of chips ;)…
He probably used off-the-shelf RAM chips, after all, RAM is not part of the CPU. In the early 70s, before the internet, even finding the information needed would be a fair amount of work. I learned how flip flops worked, adders, and registers in college, and that could be extended to an ALU. But still, that was in college, not high school. I've read some books on computer history, and they are frustratingly vague abo…
I never heard this story...
Re: Things I learned while writing an x86 emulator (2023)
#87> Writing a CPU emulator is, in my opinion, the best way to REALLY understand how a CPU works Hard disagree. The best way is to create a CPU from gate level, like you do on a decent CS course. (I really enjoyed making a cut down ARM from scratch)
I think both are useful, but designing a modern CPU from the gate level is out of reach for most folks, and I think there's a big gap between the sorts of CPUs we designed in college and the sort that run real code. I think creating an emulator of a modern CPU is a somewhat more accessible challenge, while still being very educational even if you only get something partially working.
And the sort that are commercially viable in today's marketplace. The nature of the code has nothing to do with it. The types of machines we play around with today surpass the machines we used to land men on the moon. What's not "real code" about that?
Re: Things I learned while writing an x86 emulator (2023)
#88Intel architecture is loaded with historical artifacts. The switch in how segment registers were used as you went from real mode to protected mode was an incredible hardware hack to keep older software working. I blame Intel for why so many folks avoid assembly language. I programmed in assembly for years using TI's 84010 graphics chips and the design was gorgeous -- simple RISC instruction set, flat address space, a…
> I blame Intel for why so many folks avoid assembly language. x86 (the worst assembly of any of the top 50 most popular ISAs by a massive margin) and tricky MIPS branch delay slots trivia questions at university have done more to turn off programmers from learning assembly than anything else and it's not even close. This is one reason I'm hoping that RISC-V kills off x86. It actually has a chance of once again allow…
Otherwise your statement might amount down to "I hope there is an ISA that intentionally wastes performance and energy in deference to human standards of beauty."
It's why the annals of expertise rarely makes for good dinner table conversation.
Re: Things I learned while writing an x86 emulator (2023)
#89The 68k disassembler we wrote in college was such a Neo “I know kung fu” moment for me. It was the missing link that let me reason about code from high-level language down to transistors and back. I can only imagine writing a full emulator is an order of magnitude more effective. Great article!
Re: Things I learned while writing an x86 emulator (2023)
#90> Writing a CPU emulator is, in my opinion, the best way to REALLY understand how a CPU works Hard disagree. The best way is to create a CPU from gate level, like you do on a decent CS course. (I really enjoyed making a cut down ARM from scratch)