Some Assembly Required: An approachable introduction to assembly
61–70 of 131 posts
Re: Some Assembly Required: An approachable introduction to assembly
#62So probably a really dumb question, but given that assembly has a limited number of operations and a limited number of registers, what are processors doing with the ever growing number of transistors added to them? What is processed with billions of transistors that can't be done with thousands?
Re: Some Assembly Required: An approachable introduction to assembly
#63very nice! I wouldnt give this to a programming novice but its very nice for people who know their stuff and just havent done asm yet.
Re: Some Assembly Required: An approachable introduction to assembly
#64So probably a really dumb question, but given that assembly has a limited number of operations and a limited number of registers, what are processors doing with the ever growing number of transistors added to them? What is processed with billions of transistors that can't be done with thousands?
2. Modern CPUs have a very complicated instruction reordering mechanism and data dependency analysis mechanism that allows CPUs to execute multiple instructions in parallel, when it's possible.
3. A lot of transistors are used for caches (instruction and data caches, and other kinds of buffers like the one used for branch prediction etc).
4. Even a single core has multiple copies of the execution units which allow to execute some instructions in parallel (see above).
Re: Some Assembly Required: An approachable introduction to assembly
#65Re: Some Assembly Required: An approachable introduction to assembly
#66So probably a really dumb question, but given that assembly has a limited number of operations and a limited number of registers, what are processors doing with the ever growing number of transistors added to them? What is processed with billions of transistors that can't be done with thousands?
Just off the top of my head, some possibilities are:
* More cores
* More numerous/powerful execution units that can do e.g. vectorized math
* Architectural features such as virtualization and security defenses
* Bigger and more flexible caches
* Complex pipelining/out-of-order/speculation logic that allows more instructions to be executed (on average) per clock cycle
* Special-purpose functional units that dramatically accelerate particular applications (e.g. AES encryption, video encoding/decoding) and are idle the rest of the time
* Replacing "deep" networks of logic gates with equivalent "wider" ones, which occupy more die area but have a shorter critical path, enabling faster clock speeds
Re: Some Assembly Required: An approachable introduction to assembly
#67So probably a really dumb question, but given that assembly has a limited number of operations and a limited number of registers, what are processors doing with the ever growing number of transistors added to them? What is processed with billions of transistors that can't be done with thousands?
And I'm sure I've barely scratched the surface.
Re: Some Assembly Required: An approachable introduction to assembly
#68I was worried this was only going to be a discussion of x86 assembly. Pleasantly surprised it included 6502 and RISC-V. It's worth reading even if you're not a teenager.
I'm glad you liked it! By a teenagers' guide I meant it was written by teens (including me: I'm 17). What do you think of the warehouse analogy?
Re: Some Assembly Required: An approachable introduction to assembly
#69Pardon, but the assembly code on the "Loop de Loop" chapter currently seems broken. "rax" is acting as all three variables somehow.
Nice catch! Just to be clear, it was that we were incrementing our exponent but not our counter, is that right? I pushed up a fix, but let me know if there were other issues.
mul rcx, rax ; multiply our result by our base, save into rcx
This should probably be using rbx, since that's the designated base, not rax, which is the exponent.In the explanation just above, there's a 2*8 step missing, while this one is incorrect:
4. result = 16 * 2, result is now 16
Since 2*16 is not 16.Re: Some Assembly Required: An approachable introduction to assembly
#70Earlier quoted context omitted.
Nice catch! Just to be clear, it was that we were incrementing our exponent but not our counter, is that right? I pushed up a fix, but let me know if there were other issues.
It's a bit more involved than that. mul rcx, rax ; multiply our result by our base, save into rcx This should probably be using rbx, since that's the designated base, not rax, which is the exponent. In the explanation just above, there's a 2*8 step missing, while this one is incorrect: 4. result = 16 * 2, result is now 16 Since 2*16 is not 16.