Live data from Hacker News

Here's to the systems programmers – Writing Hello World on a home brew CPU

medium.com

11–20 of 32 posts

Re: Here's to the systems programmers – Writing Hello World on a home brew CPU

#12
post #5

Does it do pipelining, branch prediction and (hyper)threading? How is its memory hierarchy (cache levels) organized? Does it support a privileged mode? Does it support hardware page faults? Did you implement floating-point operations? > In order to be able to program it at all, I wrote a very simple compiler (strictly speaking it’s actually an assembler) Does that compiler/assembler run on your hardware?

Why should it?

Re: Here's to the systems programmers – Writing Hello World on a home brew CPU

#13
post #8
post #5

Does it do pipelining, branch prediction and (hyper)threading? How is its memory hierarchy (cache levels) organized? Does it support a privileged mode? Does it support hardware page faults? Did you implement floating-point operations? > In order to be able to program it at all, I wrote a very simple compiler (strictly speaking it’s actually an assembler) Does that compiler/assembler run on your hardware?

In a word: no. Processors this simple don't implement any of the features you mention, including multi-level memory hierarchies, and I doubt the author had any inclination to make the assembler self-hosting.

I'm not saying one should expect or demand it in a project like this, but minimalistic pipelining should be doable; both the 6502 (http://www.6502.org/users/andre/65k/arch.html#pipelining) and (IIRC) the 8080 started fetching the next instruction before finishing execution of the current one, where possible.

Re: Here's to the systems programmers – Writing Hello World on a home brew CPU

#14
post #11
post #6

Any idea where I could go about learning to do this myself? A few google searches mainly led me to things saying it was impossible.

I think you'll like this then: http://www.nand2tetris.org/

It's a wonderful, in fact an astonishing course. I hope that when they come out with part 2, it really does go all the way to Tetris. The "nand" bit is a slight fudge (they actually start you off with both nand and a flip-flop, which is still amazing), but we can grant them a bit of poetic license on that. But not on the Tetris!

Re: Here's to the systems programmers – Writing Hello World on a home brew CPU

#15
> Built from simple logic chips, it runs at a blistering 4MHz, has 32kb of RAM

I know that the author was being sarcastic, but really, 4MHz with 32kb of RAM is like state of the art 80's technology. The fact that we are even able to get to this point with protoboards and discrete off-the-shelf logic chips is impressive.

I mean, I learned how to program back in 1988 in a computer not much more powerful than that.

Re: Here's to the systems programmers – Writing Hello World on a home brew CPU

#16
post #4

I really wish he'd document even the barest scraps of the CPU architecture. Is it microcoded? There's 7400 series like 7402 or 7473, and there's 7400 series like 74154, 74181, etc. "hey kid, I built one of these too, back in the day, and it was damn hard and time consuming, but oh a labor of love. I had no internet, nor any schooling. I read articles in Popular Electronics and I read the TI 7400 series databook. Then…

That reminds me of my favorite project of all time, the 7400 FPGA:

http://blog.notdot.net/2012/10/Build-your-own-FPGA

Re: Here's to the systems programmers – Writing Hello World on a home brew CPU

#17
post #13
post #8

Earlier quoted context omitted.

In a word: no. Processors this simple don't implement any of the features you mention, including multi-level memory hierarchies, and I doubt the author had any inclination to make the assembler self-hosting.

I'm not saying one should expect or demand it in a project like this, but minimalistic pipelining should be doable; both the 6502 ( http://www.6502.org/users/andre/65k/arch.html#pipelining ) and (IIRC) the 8080 started fetching the next instruction before finishing execution of the current one, where possible.

Do you have an example of a case where this provided a performance benefit to 6502 code?

Re: Here's to the systems programmers – Writing Hello World on a home brew CPU

#18
post #3
post #2

Fantastic achievement. Would love to know some more details about the project and hardware design.

Agreed, this is super cool. I've read the book "Code" a few times, so I understand a lot of this stuff in theory, but I sure don't understand the practice. Awesome work.

I read code a couple of times and did Nand2Tetris. I also found the edX 6.004 mit course[1] to be extremely useful to fill in some of the gaps. I'm waiting for part three to start in a couple of weeks.

[1]: https://www.edx.org/course/computation-structures-part-1-dig...

Re: Here's to the systems programmers – Writing Hello World on a home brew CPU

#19
post #4

I really wish he'd document even the barest scraps of the CPU architecture. Is it microcoded? There's 7400 series like 7402 or 7473, and there's 7400 series like 74154, 74181, etc. "hey kid, I built one of these too, back in the day, and it was damn hard and time consuming, but oh a labor of love. I had no internet, nor any schooling. I read articles in Popular Electronics and I read the TI 7400 series databook. Then…

That reminds me of my favorite project of all time, the 7400 FPGA: http://blog.notdot.net/2012/10/Build-your-own-FPGA

Never saw that one. Wild stuff. Here's the latest on open FPGA's:

http://www.eecs.berkeley.edu/Pubs/TechRpts/2014/EECS-2014-43...

Re: Here's to the systems programmers – Writing Hello World on a home brew CPU

#20
post #14
post #11

Earlier quoted context omitted.

I think you'll like this then: http://www.nand2tetris.org/

It's a wonderful, in fact an astonishing course. I hope that when they come out with part 2, it really does go all the way to Tetris. The "nand" bit is a slight fudge (they actually start you off with both nand and a flip-flop, which is still amazing), but we can grant them a bit of poetic license on that. But not on the Tetris!

I wonder if this had something to do with someone I countered a day or two ago thinking all you needed was a NAND gate to do anything. I said you need memory and some other things for most hardware. Maybe that commenter got the idea from this project's name...
Post reply on HN