TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

What happens when a CPU starts

452 点作者 nowandlater超过 2 年前

24 条评论

billti超过 2 年前
Amongst the first sentences...<p>&gt; It may be thought of as what happens when a whole computer starts, since the CPU is the center of the computer and the place where the action begins.<p>I thought that too. Last year I spent a while getting as low-level as I could and trying to understand how to write a boot loader, a kernel, learn about clocks and pins and interrupts, etc. I thought, &quot;I know, I&#x27;ll get a Raspberry Pi! That way even if I brick it I didn&#x27;t waste too much money&quot;.<p>Turns out the Raspberry Pi (and I&#x27;m guessing many other systems) are pretty confusing to understand at boot time. For one, it&#x27;s the GPU that actually does the initial boot process, and much of that is hard to find good info on. (<a href="https:&#x2F;&#x2F;raspberrypi.stackexchange.com&#x2F;questions&#x2F;14862&#x2F;why-does-the-raspberry-pis-gpu-control-the-first-stages-of-the-boot-process" rel="nofollow">https:&#x2F;&#x2F;raspberrypi.stackexchange.com&#x2F;questions&#x2F;14862&#x2F;why-do...</a>)<p>I spent many many hours reading various specs &amp; docs and watching tons of low-level YouTube videos. Compared to software development higher up the stack (my usual area), I found the material surprisingly sparse and poor for the most part. (Maybe that&#x27;s reflective of the size of the audience and the value in producing it).
评论 #34334002 未加载
评论 #34334273 未加载
评论 #34334434 未加载
评论 #34334233 未加载
评论 #34334011 未加载
评论 #34337973 未加载
评论 #34336349 未加载
评论 #34344591 未加载
评论 #34335057 未加载
评论 #34336209 未加载
评论 #34339756 未加载
评论 #34335903 未加载
评论 #34344395 未加载
评论 #34349896 未加载
评论 #34335622 未加载
评论 #34349887 未加载
评论 #34334527 未加载
评论 #34334739 未加载
评论 #34335104 未加载
评论 #34336443 未加载
santadakota超过 2 年前
Ben Eater&#x27;s fantastic video series on building a breadboard 6502 based computer and an 8-bit breadboard computer from scratch might be appreciated in this thread.<p>6502 playlist: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=LnzuMJLZRdU&amp;list=PLowKtXNTBypFbtuVMUVXNR0z1mu7dp7eH">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=LnzuMJLZRdU&amp;list=PLowKtXNTBy...</a><p>8-bit build playlist: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=HyznrdDSSGM&amp;list=PLowKtXNTBypGqImE405J2565dvjafglHU">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=HyznrdDSSGM&amp;list=PLowKtXNTBy...</a><p>He also sells kits if one is interested in playing along.
评论 #34335897 未加载
评论 #34336854 未加载
kens超过 2 年前
If anyone is interested in what happens with an older CPU, I&#x27;ve written up how the IBM 1401 from 1959 starts up: <a href="https:&#x2F;&#x2F;www.righto.com&#x2F;2021&#x2F;02&#x2F;an-ibm-1401-mainframe-computer-at.html" rel="nofollow">https:&#x2F;&#x2F;www.righto.com&#x2F;2021&#x2F;02&#x2F;an-ibm-1401-mainframe-compute...</a><p>Among other things, since it uses magnetic core memory, you can run the program that was loaded when you shut it off.
评论 #34335306 未加载
saagarjha超过 2 年前
&gt; The Z80&#x27;s system, although simpler, creates a &quot;hole&quot; in the memory, because the bottom of the memory space is used by ROM and therefore you cannot use the beginning of the memory space for normal RAM work.<p>Gameboy actually does a funny thing where the boot ROM gets mapped at the bottom of the address space, and then it writes to a MMIO address to unmap the ROM overlay and restore the first 256 bytes of the cartridge there instead. It’s quite amusing!<p>&gt; On some computer platforms, the instruction pointer is called the &quot;program counter&quot;, inexplicably abbreviated &quot;PG&quot;<p>Typo, maybe? Typically it’s called “pc”.
评论 #34343445 未加载
als0超过 2 年前
&gt; Regardless of where the CPU begins getting its instructions, the beginning point should always be somewhere in a ROM chip. The computer needs startup instructions to perform basic hardware checking and preparation, and these are contained in a ROM chip on the motherboard called the BIOS. This is where any computer begins executing its code when it is turned on.<p>I can&#x27;t see any date on this, but this is a bit antiquated. For security and reliability, modern CPUs have an on-chip ROM, which is executed first. That on-chip ROM will tend do basic things like check clock, power, memory etc. Once that&#x27;s complete it will then securely load firmware from the motherboard flash. Even modern cheapo microcontrollers are shipping with on-chip ROM these days.
pclmulqdq超过 2 年前
&quot;It starts at 0 and executes instructions&quot; is a funny, but mostly true way to express this. Some people are shocked that no magic happens before the instructions start.
评论 #34334369 未加载
评论 #34334080 未加载
评论 #34334025 未加载
评论 #34334122 未加载
评论 #34334426 未加载
评论 #34335086 未加载
hackan超过 2 年前
Is it me or the article seems incomplete? It kinda finishes for me after:<p>&gt; The following are the memory ranges you get with a 2-to-4 converter on an 8-bit address bus:<p>And that&#x27;s it. It looks truncated, or incomplete :thinking:
评论 #34334655 未加载
squokko超过 2 年前
Now there&#x27;s a domain I haven&#x27;t seen in a very long time.
评论 #34337937 未加载
broast超过 2 年前
Amazing to see that tripod sites are still around.
评论 #34334195 未加载
评论 #34335833 未加载
评论 #34334585 未加载
Rimintil超过 2 年前
&gt; The memory chips respond by sending the contents of the selected memory cell over the data bus to the CPU.<p>What does that ROM memory cell _physically look like_? How do we physically manipulate it to contain a 1 or a 0 (absence of something)?
评论 #34334390 未加载
评论 #34334465 未加载
评论 #34334346 未加载
评论 #34343988 未加载
评论 #34334687 未加载
评论 #34334644 未加载
评论 #34336385 未加载
atomjames超过 2 年前
the nand2tetris course is a nice primer for understanding this kind of stuff:<p>nand2tetris.org&#x2F;
ruslan超过 2 年前
Starting procedure on MOS6502 is not that simple as it is told in the article. It spends some 7 clocks on doing internal initialization and only then fetches address of first jump from reset vector (0xFFFC&#x2F;0xFFFD). I find Ben Eater&#x27;s series on building simple 8-bit breadboard computer using 6502 CPU very educating and entertaining.<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=HyznrdDSSGM">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=HyznrdDSSGM</a>
tim_hutton超过 2 年前
One route to understanding how CPUs work is to explore the computers that have been made in cellular automata. Golly (<a href="https:&#x2F;&#x2F;golly.sourceforge.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;golly.sourceforge.net&#x2F;</a>) has several, including one by John von Neumann, one by Edgar Codd and another by John Devore. The advantage of course is that the physics is trivial and you can see everything that happens and step backwards and forwards.<p>Example:<p><a href="https:&#x2F;&#x2F;timhutton.github.io&#x2F;2010&#x2F;03&#x2F;10&#x2F;30984.html" rel="nofollow">https:&#x2F;&#x2F;timhutton.github.io&#x2F;2010&#x2F;03&#x2F;10&#x2F;30984.html</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;GollyGang&#x2F;ruletablerepository&#x2F;wiki&#x2F;CoddsDesign">https:&#x2F;&#x2F;github.com&#x2F;GollyGang&#x2F;ruletablerepository&#x2F;wiki&#x2F;CoddsD...</a>
sanatgersappa超过 2 年前
Honestly, I had no idea tripod was still around.
fzliu超过 2 年前
&gt; This is because when the power supply is first powering up, even if it only takes a second or two, the CPU has already received &quot;dirty&quot; power, because the power supply was building up a steady stream of electricity. Digital logic chips like CPUs require precise voltages, and they get confused if they receive something outside their intended voltage range.<p>This is only partially true. When digital chips boot up, gate outputs are in an indeterminate state. The reset sets them to know initial (and valid) values&#x2F;bits.
评论 #34335111 未加载
storklathe超过 2 年前
Could anybody clarify for me the purpose of the NOP opcode that the article refers to? I would think that something like a &quot;do nothing&quot; instruction would want to be optimized away as much as possible, but maybe there&#x27;s some hidden facet of the instruction protocol I&#x27;m not familiar with that necessitates it?
评论 #34340409 未加载
miga超过 2 年前
It describes old 8-bit machines. New machines start by executing instructions firmware ROM or in cache memory before RAM is tested and initialized.<p>Additionally the reset registers differ by the platform. (Some platforms expect software to initialize and reset some registers.)
snvzz超过 2 年前
A tangent, but I thought worth mentioning:<p>If you like this sort of plain text technical document, you might enjoy browsing the net with Gopher.<p>I recommend Gopherus[0] as a modern implementation that&#x27;s cross-platform.<p>0. <a href="https:&#x2F;&#x2F;gopherus.sourceforge.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;gopherus.sourceforge.net&#x2F;</a>
fennecfoxy超过 2 年前
I think this is traditional for this topic: <a href="https:&#x2F;&#x2F;nandgame.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;nandgame.com&#x2F;</a><p>Say goodbye to a couple hours!
charcircuit超过 2 年前
I thought it started by executing microcode from ROM.
评论 #34335129 未加载
评论 #34335328 未加载
DotaFan超过 2 年前
Last week I&#x27;ve tried to understand how Chip8 worked, and it did help me understand this article a bit more.
dirtyid超过 2 年前
Somewhere out there is a company specializing in selling tripods patiently waiting for the domain to free up.
Wolfenstein98k超过 2 年前
What a delightful article to read. Thanks for sharing!
bandrami超过 2 年前
Tripod still exists?