Re:How a CPU works: Bare metal C on my RISC-V toy CPU
by codepoet on Thursday January 26, 2023 @11:21AM
(#34533753)
I always wanted to understand how a CPU works, how it transitions from one instruction to the next and makes a computer work. So I thought: let's implement one and run a C program on it.
[ Parent
| on HN ]
Re:How a CPU works: Bare metal C on my RISC-V toy CPU
by HappyJoy on Thursday January 26, 2023 @01:11PM
(#34535946)
Check out some videos by Ben Eater on Youtube
Re:How a CPU works: Bare metal C on my RISC-V toy CPU
by rickstanley on Thursday January 26, 2023 @01:25PM
(#34536216)
+1 to Ben Eater! His videos helped me so much during university, it was like finding real gold between fool's gold.
Re:How a CPU works: Bare metal C on my RISC-V toy CPU
by jchw on Thursday January 26, 2023 @02:37PM
(#34537539)
Ben Eater routinely makes me feel ashamed of how awful my breadboard wiring looks. Fantastic videos.
Re:How a CPU works: Bare metal C on my RISC-V toy CPU
by LoganDark on Thursday January 26, 2023 @08:14PM
(#34541243)
To be fair, all the wires he uses are pre-cut / pre-shaped for the video. The videos are meticulously planned and marvelously executed. Normally hobby projects do not have nearly as much thought put into them.
Re:How a CPU works: Bare metal C on my RISC-V toy CPU
by koromak on Sunday January 29, 2023 @10:33AM
(#34568984)
I've been taking the time to perfectly measure out all the wires on my 8-bit because I don't mind the monotony, its kind of peaceful. But holy hell it takes a long time.
Its like 95% measuring and cutting, 5% thinking, testing and debugging.
Its a bit of a welcome relief from software, which is 95% thinking and 5% typing. A bit of monotony might be good for the brain.
Re:How a CPU works: Bare metal C on my RISC-V toy CPU
by moffkalast on Thursday January 26, 2023 @03:39PM
(#34538462)
Unless your name is Ben, in which case I'd advise caution.
Re:How a CPU works: Bare metal C on my RISC-V toy CPU
by codepoet on Thursday January 26, 2023 @11:58PM
(#34542660)
yes, these are great!
Re:How a CPU works: Bare metal C on my RISC-V toy CPU
by erichocean on Thursday January 26, 2023 @05:22PM
(#34539717)
This is written for young people, but still accurate: Code: The Hidden Language of Computer Hardware and Software by Charles Petzold
Link: https://www.amazon.com/Code-Language-Computer-Hardware-Softw...
It's got a very slow, methodical onramp with a lot of diagrams and a light, breezy style. You end up building a (very simple) computer in the end, including instruction processing.
Re:How a CPU works: Bare metal C on my RISC-V toy CPU
by jasonwatkinspdx on Thursday January 26, 2023 @06:20PM
(#34540261)
The textbooks by Hennessy and Patterson are the definitive ones.
Re:How a CPU works: Bare metal C on my RISC-V toy CPU
by jasonwatkinspdx on Thursday January 26, 2023 @06:20PM
(#34540268)
The textbooks by Hennessy and Patterson are the definitive ones. I think every programmer would be very well served reading them. There's older editions available online for free that are perfectly adequate for understanding the big picture.