Тёмный
No video :(

How Computers Fake Negative Numbers - Superscalar 8-Bit CPU #29 

Fabian Schuiki
Подписаться 2,9 тыс.
Просмотров 1,2 тыс.
50% 1

Опубликовано:

 

29 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 48   
@Chakamatics
@Chakamatics 11 месяцев назад
Criminally underrated channel, man. Really hope you blow up. Keep it up.
@fabianschuiki
@fabianschuiki 11 месяцев назад
Thanks for the kind words 🥳!
@47Mortuus
@47Mortuus 11 месяцев назад
The only thing missing from this is what helped me a ton, trying to understand negative integers (2's complement): The "sign" bit is not a true sign bit, like in floating point numbers; that would imply there's a positive and a negative 0. Mathematically, the "sign" bit is actually interpreted as -(2^n) instead of +(2^n), where n is the bit position. so 1000 in binary is -8 instead of +8. All the other bits' interpretation stays the same: 1011 is 1 + 2 + 0 + (-8) = -5
@fabianschuiki
@fabianschuiki 11 месяцев назад
Treating the value of the sign bit as -(2^n) instead of +(2^n) is very clever! That's a great way of formalizing this in a very streamlined manner. Very cool 😎
@stewartclark3259
@stewartclark3259 11 месяцев назад
always extremely well described. My brain hasn't formally tackled digital electronics in over 25 years but the quality of the descriptions is bringing it all back to the fore.
@fabianschuiki
@fabianschuiki 11 месяцев назад
Thanks! Happy to hear that 😀
@DavidLatham-productiondave
@DavidLatham-productiondave 11 месяцев назад
I've watched many people explain 2s compliment with varying levels of success. This video is now my go-to option if I ever find the need to explain it or just remind myself. Well done!!! 👌
@fabianschuiki
@fabianschuiki 11 месяцев назад
Thanks! 😀 I'm happy to hear that!
@yashsavani
@yashsavani 11 месяцев назад
One of the best explanations of 2s complement I have seen! Great video!
@fabianschuiki
@fabianschuiki 11 месяцев назад
Thank you so much! 😊 Glad it was useful!
@cj09beira
@cj09beira 11 месяцев назад
the production quality is great. 👍
@fabianschuiki
@fabianschuiki 11 месяцев назад
Thank you! 😀
@FranckPoubeau
@FranckPoubeau 11 месяцев назад
Very well done and so inspiring! Best explanation of the 2's complement I've seen so far! Can't wait to see how this CPU evolves!
@fabianschuiki
@fabianschuiki 11 месяцев назад
Thank you! Looking forward to get to the gnarly details of out-of-order and superscalar execution 😀
@3osufdh4rfg
@3osufdh4rfg 7 месяцев назад
Ooh that's some sweet graphics for explaining two's complement.
@fabianschuiki
@fabianschuiki 7 месяцев назад
Thanks! 😀 Took a bit of time to animate 😅
@christophfriedrich5092
@christophfriedrich5092 11 месяцев назад
Thank you for this video! Finally I fully understand the two's complement!
@fabianschuiki
@fabianschuiki 11 месяцев назад
Thanks! Happy to hear that 😀👍
@dparson
@dparson 10 месяцев назад
Hot take, this is the best 2's complement lesson on the internet. This whole series is incredible o7. I'm just a hobbyist but still never knew how straightforward it is to implement subtraction in hardware, this whole series is keeping me in a state of bewildered awe at what is going on inside CPUs. One thing I'm having trouble with is seeing the register value led's...could a small piece of paper or cardboard be taped above them to keep them in shadow so they have better contrast for the camera? The manually added text next to them totally works though, thanks for doing all of that extra work.
@fabianschuiki
@fabianschuiki 10 месяцев назад
Thank you so much for all the praise 😀🙌. Great idea about the LEDs... I could try with a red transparent film that blocks out other light, to make it easier to read. 👍
@dparson
@dparson 10 месяцев назад
@@fabianschuiki Another idea for the leds that I've done is gone to a window tint shop and ask for a scrap of their lightest material. They gave me a huge piece that I cut up and clear-glued overtop of 4 digit 7 segment displays for my Arduino timer projects and they work great no matter the color of the leds. Still no need with the extra text you're adding so thanks again for all the effort you're putting into this series!
@fabianschuiki
@fabianschuiki 10 месяцев назад
Cool approach! 👍👍👍
@andreassteinhauser9508
@andreassteinhauser9508 7 месяцев назад
Thanks for your excellent series! It's perfectly complementary to Ben Eaters SAP-CPU. I already learned so much and can't wait to see the optimisations which makes it superscalar.
@fabianschuiki
@fabianschuiki 7 месяцев назад
Thanks! I'm glad you're enjoying it. We should get around to the first superscalar bits soon. Need to finish the ALU and get some instruction decoding going. Then it's off to the out-of-order races 😃
@LaSchui
@LaSchui 11 месяцев назад
aaaaand he did it again! 😎another fantastic video, keep it up 🙏
@fabianschuiki
@fabianschuiki 11 месяцев назад
Thank you 😊
@user-mr3mf8lo7y
@user-mr3mf8lo7y 11 месяцев назад
Stunning explanation. Much obliged.
@fabianschuiki
@fabianschuiki 11 месяцев назад
Thanks! 🙂 Happy it was useful 👍
@MissTrollwut
@MissTrollwut 11 месяцев назад
wowza! great content! :D
@fabianschuiki
@fabianschuiki 11 месяцев назад
Thanks! 😀
@OscarSommerbo
@OscarSommerbo 8 месяцев назад
I take issue with the description of "fake numbers", what is really happening is that we picked a way to represent negative numbers that exploit a quirk of binary math to simplify the handling of negative numbers and subtraction. There is no rule that says we must use the topmost bit a sign bit, we could use and external flag to do it, which would change the design a bit, but would still not be "fake" negative numbers, just a different way of representing them. Two's compliment is an ingenious way to achieve subtraction with the smallest amount of gates, but it is just a neat trick of how we choose to represent negative numbers in binary.
@fabianschuiki
@fabianschuiki 8 месяцев назад
Yes, you're definitely correct. It's really down to assigning meaning to certain bit patterns, and picking that cleverly to make the most of pre-existing hardware. Nothing fake indeed. An interesting example of an external sign flag are standard floating point numbers, which store the sign bit separately from the actual mantissa. Also, the Apollo guidance computer had an interesting bit of one's complement arithmetic going on, which is pretty fun to see. 🙂
@angeldude101
@angeldude101 3 месяца назад
Modular arithmetic is most definitely _not_ a "neat trick." Seriously ask yourself whether or not it really is one the next time you try to read an analog clock. At the time of me writing this, it looks to be around -5:30 going counterclockwise, or 6:30 going clockwise. The only "neat trick" is using the left-most bit to indicate whether a number is positive or negative, even if it fails in 2 cases, which not coincidentally are the two cases that lie directly on the line of symmetry that gets reflected across when negating. 7 being -9 on the other hand is just a fact of the integers mod 16, because 7 ≡ -9 (mod 16), or "7 is congruent to -9, modulo 16".
@JaenEngineering
@JaenEngineering 11 месяцев назад
That's arguably the best explanation and demonstration of 2's Compliment negative numbers that I've come across. Also, with this addition (or should that be subtraction 😂) are we now not Turin complete?
@fabianschuiki
@fabianschuiki 11 месяцев назад
Thanks! 😀 There's still a bit of work ahead to make this Turing complete. It's lacking a form of conditional execution, like a branch, and some form of memory. (Although the registers technically qualify, but not quite.)
@JaenEngineering
@JaenEngineering 11 месяцев назад
@@fabianschuiki of course, I forgot about the conditional jump. Still pondering how to implement that. There's still a spare input for the PC multiplexers. Maybe have it linked to the step input but with the step size determined by a flag. If it's set we move to the next instruction that contains the jump, it not it doubles the step size, effectively skipping the jump instruction.
@fabianschuiki
@fabianschuiki 11 месяцев назад
That's an interesting approach! Pretty sure that would work. I was thinking about not taking the PC mode select bits directly from bits 1..0 of the instruction, but using a bit of logic to compute them. Regular instructions just leave them at 0, which results in regular stepping mode. Jumps set them to 1 or 2 for relative and absolute jumps. Conditional jumps / branches look at some register or flags, and set the PC mode select to 1 or 2 if the jump condition is true, or leave it at 0 otherwise. That would cause the PC to just step over the jump if the condition doesn't hold, and to jump otherwise.
@JaenEngineering
@JaenEngineering 11 месяцев назад
@@fabianschuiki so basically set the PC select bits to do a standard rel/abs jump and have an additional "if then/else" bit somewhere in the instruction. If a flag is set then the PC select lines are passed through and we jump, otherwise we null them and step.
@fabianschuiki
@fabianschuiki 11 месяцев назад
Yes exactly! And the decision whether to step or jump could be made by looking at a flag register, like in x86. That would allow the CPU to have instructions like branch-if-equal, branch-if-greater-than, etc. 🙂
Далее
Carry Flag - Superscalar 8-Bit CPU #30
52:23
Просмотров 1,5 тыс.
Haaland Showed Me How It's Done.. 😜
00:11
Просмотров 2,8 млн
How Computers Add Numbers - Superscalar 8-Bit CPU #27
50:41
What is the Smallest Possible .EXE?
17:57
Просмотров 373 тыс.
Shifting Bits in my ALU - Superscalar 8-Bit CPU #31
36:38
I built my own 16-Bit CPU in Excel
16:28
Просмотров 1,4 млн
Decoding ALU Micro-Ops - Superscalar 8-Bit CPU #33
45:27
Harder Drive: Hard drives we didn't want or need
36:47