8-bit CPU control logic: Part 3

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 พ.ย. 2024

ความคิดเห็น • 504

  • @harrysvensson2610
    @harrysvensson2610 7 ปีที่แล้ว +406

    This has to be one of the highest quality video series I've seen here on TH-cam.

    • @ollimartikainen
      @ollimartikainen 4 ปีที่แล้ว +13

      It is. Until you see his 6502 cpu series

    • @videogametips5604
      @videogametips5604 4 ปีที่แล้ว +4

      For sure!! I've watched every single video in this playlist from start to end and I understand everything so far 100%! I'm sure by the last video I'll be able to build one of these myself with my own design (I have a different method of doing the display logic, and I have an idea on how to eliminate those wasted clock cycles on shorter instruction sets).

    • @jeetenderkakkar7570
      @jeetenderkakkar7570 3 ปีที่แล้ว

      100

    • @thecrossedtheroadfund4289
      @thecrossedtheroadfund4289 2 ปีที่แล้ว

      Harry,
      There is no way computers are as difficult as he makes them out to be.
      👎

    • @coloringontheline
      @coloringontheline 2 ปีที่แล้ว +5

      @@thecrossedtheroadfund4289 lol, what? "Computers" like all computers? Aren't as complicated as Ben Eater is making them out to be? As he describes his machine language operations on an 8 bit computer attached to a breadboard??
      What does this comment even mean?! 😅😂

  • @revealingfacts4all
    @revealingfacts4all 7 ปีที่แล้ว +184

    I had a microprocessors class in college where we breadboard a MC68000, added memory, and then programmed it to do something but this whole series is immensely more educational than that college course. Thank you for these videos!

    • @fingersmcoy
      @fingersmcoy 7 ปีที่แล้ว +16

      i have learned more from this guy than any prof i had

    • @3631162
      @3631162 6 ปีที่แล้ว +9

      College is a waste of money

    • @BillAnt
      @BillAnt 5 ปีที่แล้ว +6

      Especially nowadays when a semester can cost $5k-20k uhhhh

    • @michaelbauers8800
      @michaelbauers8800 5 ปีที่แล้ว +2

      @@3631162 Not for me it wasn't

    • @DarthZackTheFirstI
      @DarthZackTheFirstI 4 ปีที่แล้ว

      @@michaelbauers8800 you are still writing youtube comments!

  • @thelastofthemartians
    @thelastofthemartians 7 ปีที่แล้ว +250

    I'm glad that when everything didn't go as planned you didn't simply edit it out of the video. I think fault finding is just as important as design and implementation skills. Fantastic video as always. I'm really enjoying this series. Keep up the good work Ben.

    • @virtimus2
      @virtimus2 4 ปีที่แล้ว +6

      For me this is the most appealling aspect of this material. Really goood stuff :)

  • @danweecc
    @danweecc 7 ปีที่แล้ว +256

    Might want to add an additional control line to reset the micro-code clock when the instruction is done so save unused cycles.

    • @MrWilliam932
      @MrWilliam932 7 ปีที่แล้ว +20

      I was thinking the same

    • @btharper1221
      @btharper1221 7 ปีที่แล้ว +44

      That was a suggestion posted in the comments to the last video in the series, I think he was trying to acknowledge the possibility of doing so, without getting into the implementation for now. However he has mentioned adding more to the computer (including more control lines) in the future. I'd guess that he may want to finish the basic version to finish the teaching tool, then address some of the possible optimizations from the comments (adding CE to T1 was one such optimization that did get added already).

    • @LordPhobos6502
      @LordPhobos6502 7 ปีที่แล้ว +22

      There's a spare output line on one of the EEPROMS, that could be used to send a reset pulse to the microinstruction counter :)

    • @carroviejo80
      @carroviejo80 7 ปีที่แล้ว

      Nice idea, Im going to try to implement instructions as an FSM so it will not need that control line.

    • @jonmayer
      @jonmayer 7 ปีที่แล้ว +5

      I notice an output unused as well and thought the same thing.

  • @dankings5326
    @dankings5326 3 ปีที่แล้ว +18

    I know this is 3 years old but just stumbled on this series the past week. Masterful work, so clearly and concisely explained. I've always kinda understood how computers work but seeing it in action really does bring a whole new dimension to that understanding. You really get a feel for how the first computers were programmed using punch cards! Obviously technology has moved on but the fundamental principles remain the same! This series really should be essential viewing for anyone wishing to study computer science! Or people like me that just love to better understand how the world works!

  • @Trogwart
    @Trogwart 7 ปีที่แล้ว +407

    But how to fill the gap between 'Primitive technology' channel and Ben Eater videos?

    • @scitwi9164
      @scitwi9164 7 ปีที่แล้ว +46

      Step 1: invent metallurgy.

    • @coolbionicle
      @coolbionicle 7 ปีที่แล้ว +9

      I think The King Of Random fits the bill!

    • @DarthZackTheFirstI
      @DarthZackTheFirstI 7 ปีที่แล้ว +2

      Maybe with a book written by ben eater! Title: From Transistor to the first PC. All those books (as far as i remember them) which are based on theory (i.e. about ALU) and technicality are horrible for teaching imho. Mostly because they lack a reference to reality and examples. there is for sure some potential.

    • @giantneuralnetwork
      @giantneuralnetwork 7 ปีที่แล้ว +3

      Stand on the shoulders of giants?

    • @Sarioah
      @Sarioah 7 ปีที่แล้ว +11

      Codys Lab and King of Random might be useful for this :)

  • @robmckennie4203
    @robmckennie4203 7 ปีที่แล้ว +27

    This has been a really excellent series, keep it up mate. Prior to watching these videos, I was vaguely aware of the fact that people build homemade computers, but never really had an interest in it, now I'm looking into doing it myself

  • @garydunken7934
    @garydunken7934 7 ปีที่แล้ว +59

    And there's the answer 42 again!
    Thanks for the video, I've been waiting for it.

    • @scitwi9164
      @scitwi9164 7 ปีที่แล้ว +8

      I would be surprised if it would be something different this time :q
      It would mean that something is wrong with this universe :P

    • @BrendaEM
      @BrendaEM 6 ปีที่แล้ว +5

      Now we have to find the question.

    • @cpebud
      @cpebud 6 ปีที่แล้ว +4

      “The answer to the ultimate question of life, the universe and everything is 42.”

    • @jeetenderkakkar7570
      @jeetenderkakkar7570 3 ปีที่แล้ว

      100

  • @ribvicky
    @ribvicky ปีที่แล้ว +3

    This entire series is mind blowing Ben!! More than 15years of wondering on "what exactly happens inside a CPU" ends here! Can't thank you enough for this. Started making my own now. Please try to make a video series on ADC & DAC because there isn't that proper info anywhere, because your teaching way is so beautiful, i believe that could help a lot to understand this topic. Respect 🙏🙏

    • @mineyoucraftube1768
      @mineyoucraftube1768 7 หลายเดือนก่อน

      for the dac you can use resistors and an op amp
      0: 128k (lsb)
      1: 64k
      2: 32k
      3: 16k
      4: 8k
      5: 4k
      6: 2k
      7: 1k (msb)
      i had this hooked up to the output pins of a shift register, the other side of the resistors were all connected together to the input of an op amp in a follower circuit

  • @mandisaplaylist
    @mandisaplaylist 3 ปีที่แล้ว +7

    This is why normally you create a "control panel" with all the buttons you want to operate when not updating the wiring and just run really long wires between that and the places where the signals shall go. Also typically "setup commands" (like register reset or clock select) are placed on a top line and "operational commands" (like single step) on a bottom line. This will prevent the operator (you) from bumping anything. This is how the very first computers (like the Altair) were set up.

  • @howardjones543
    @howardjones543 6 ปีที่แล้ว +11

    These last few videos have finally got it clear in my head what microcode actually is... really excellent!

  • @vijaykumarkanchukommala2183
    @vijaykumarkanchukommala2183 6 ปีที่แล้ว +5

    I think this is the best video to understand, how control unit works in computer architecture

  • @christopherhite9050
    @christopherhite9050 6 ปีที่แล้ว +6

    Ben, You are to be commended! I watched your entire series on building the computer, and I learned more than I learned in 2 years of computer science education at a top engineering school. Great job of teaching!
    I literally got tingles at the end of this video when the computer ran on it's own and halted. Awesome!!

  • @james_halpert
    @james_halpert 3 ปีที่แล้ว +6

    I love the editing in these videos. Speeding up the video in repetitive places while still having matching voice over must be a lot of work. But it makes watching much more pleasant, most times I don't even really notice the editing, which is the best kind of editing. Much appreciated!

  • @kindlin
    @kindlin 7 ปีที่แล้ว +4

    This awesome "thing we could do with this 16th output from the eeprom" is to implement the counter reset so that commands don't have extra wasted cycles. The 16th command (io0 on the right eeprom) could be to made to be 1 to reset the timer when the command is completed. The trick would be to not mess up your program by resetting the step too early.
    You could make this 'reset' its own line on the command table for a given computer command so that it only takes 1 cycle to finish off the current command (versus 2 wasted cycles on the OUT command, or more wasted cycles if we implemented a complicated command later), or, more elegantly, use the off-clock cycle pulse to check if this 16th bit is 1,and if so, then reset the steper to zero instead of incrementing on the clock tick.
    Hope I thought that through properly!
    I love all of your videos, they are amazing. Thank you!

    • @jonyzhu6531
      @jonyzhu6531 5 ปีที่แล้ว

      "not mess up your program by resetting the step too early", that''s the point. A D-register may do the trick with the next clock pulse, if you still have room on the bread board.

  • @jolesco
    @jolesco 7 ปีที่แล้ว +3

    Great video series, thanks for making these. That EEPROM based decoding scheme reminded me of the MOS 6502 decode ROM, showed in Michael Steil's "27C3" - "Reverse engineering the MOS 6502" Also the micro instruction timing was similar.

  • @WarpedFlayme
    @WarpedFlayme 7 ปีที่แล้ว +18

    You could use the last control bit to reset the step counter which would reclaim those lost clock cycles on ops that use less than five cycles.
    (I know the gains would be pretty minimal in this case (Only one cycle on three/one-step (incl/not incl fetch cycle) ops and zero cycles on four/two-step ops since the step-counter-reset micro-instruction itself would have to be a step), but it's something that would have exponentially larger benefits as your architecture gets complex with more steps available for each op. This is actually very interesting because it shows the benefits of a more complex architecture. By having more steps available per op (thereby increasing the complexity of the architecture; the cost), you can have more complex ops that reduce the amount of work the programmer has to do, as well as reducing memory requirements by reducing the number of ops required to accomplish a given task (the benefits).)

    • @thehearth8773
      @thehearth8773 5 ปีที่แล้ว +1

      You could have your microinstruction counter reset take place on the last cycle of the instruction's operation, but that might require additional timing to make sure it worked right... A synchronous reset on the falling clock edge, perhaps, unique to this one control signal.

    • @sly1024
      @sly1024 5 ปีที่แล้ว +1

      Exactly my thoughts!!

  • @gzitterspiller
    @gzitterspiller 4 ปีที่แล้ว +7

    I just downloaded all the videos from this guy, I guess I will keep it for when sociaty ends I will be the new Jack Kilby.

  • @IronRiviera
    @IronRiviera 7 ปีที่แล้ว +1

    Sure brings back memories. We did stuff like this in tech school in 1983. Good Job.

  • @toolstime5136
    @toolstime5136 4 ปีที่แล้ว +1

    This is so cool to see the stuff running. For me it's the first time I understand how to program a cpu. Thanks so much.

  • @Bubu567
    @Bubu567 3 ปีที่แล้ว

    Manually entering in the data as an exercise really gives you an accurate understanding of the purpose of the computer. To automate monotonous tasks like these.

  • @jaxey1631
    @jaxey1631 7 ปีที่แล้ว +1

    Really enjoying this series Ben, many thanks for taking the time to do it. I've been working in IT for a long time (almost 30 years), but never really understood how everything worked 'under the covers' until this series. I've enjoyed it so much I placed an order yesterday for all of the initial components to build one myself, although I'm planning on extending a bit once I get the base working (8+ bit addressing, multi-byte instructions, and maybe even a storage interface of some kind to load RAM from EEPROM or removable media). I had to use some substitutions for some of your parts list as they are hard to find - the 74LS76 (Dual JK Flip-Flop), 74LS189 (64-bit RAM) and 28C16 EEPROM - hoping I've understood enough that these work. Now just waiting for all the bits to arrive (no pun intended) to start playing.

  • @MrWilliam932
    @MrWilliam932 7 ปีที่แล้ว +6

    OMG yes 44 minutes of video

  • @Phroggster
    @Phroggster 7 ปีที่แล้ว

    All this talk of resetting the IPC, hardly a mention of all the other subsystems that could also make good use out of a RST signal. I propose that the operand be a memory address that sets the appropriate control signals to reset individual subsystems. RST 0 = halt and catch fire, 1=halt, 2=IPC, 3=IPC+halt, 4=register A, ..., 8=registerB, 16=memory address, 32=display, etc.
    I've been enjoying the videos. Thank you, and keep up the great work!

  • @meepk633
    @meepk633 6 ปีที่แล้ว +2

    I've learned so much from this. Even things I knew before, I now have a intuitive understanding. Like why computers have to segregate memory for different functions. Thanks a lot. I can't wait to make one myself.

  • @nonamex3052
    @nonamex3052 ปีที่แล้ว +1

    This guy is not only an engineer at this point. He is an artist. This thing just built and operate beautifully

  • @다이아몬드곡괭이
    @다이아몬드곡괭이 2 หลายเดือนก่อน

    Hello Ben, im a 13 years old kid
    Your series is amazing even a kid can understand how it works!!
    thanks for this amazing video, and now im making a computer at home!

  • @gloubiboulgazeblob
    @gloubiboulgazeblob ปีที่แล้ว

    This video serie should be seen and understood by all new computer science students !
    Hats off sir !
    Thank you very much !

  • @gelatinocyte6270
    @gelatinocyte6270 7 ปีที่แล้ว +37

    It'll be nice to add a master reset button.

    • @LordShadow144
      @LordShadow144 7 ปีที่แล้ว +5

      I was just thinking of suggesting to him that plus a command to reset; it could use that remaining bit on the instruction word after jmp.

    • @gelatinocyte6270
      @gelatinocyte6270 7 ปีที่แล้ว +2

      Yeah, That's a great idea!

    • @12345NOU54321
      @12345NOU54321 6 ปีที่แล้ว +3

      Brainyot building new computer to replace BAD PC

  • @Gastel
    @Gastel 2 ปีที่แล้ว

    This series is so very well done. Thank you Ben. I used to be an electrical engineer, but I feel I understand this stuff better after your explanation than I did when in university.

  • @TheBigBigBlues
    @TheBigBigBlues 3 ปีที่แล้ว

    This series is incredible, sad I am coming to the end of it! Thanks so much for putting the massive amount of effort in to make these videos. It isn't easy to explain these things in such an intuitive way, but you have nailed it! I've learnt an incredible amount on topics I've always been afraid of and now feel so much more confident exploring this world. Thanks!

  • @Reevin
    @Reevin 5 ปีที่แล้ว

    I have to say watching you build each piece of this then watching it come together here was real satisfying.

  • @hjups
    @hjups 7 ปีที่แล้ว +11

    Since you mentioned additional functionality, have you thought about expanding the design to support larger memory spaces and instructions?
    You could easily modify the current design to use more cycles per instruction, make the address space 16 bit (by using two special 8 bit registers), and expand the instruction set to either use larger instructions (RISC style sort of like what the PIC16s do - other 8-bit MCUs might do the same thing), or adopt a variable instruction length CISC style with special registers (you are sort of already doing that, and it would mean possibly smaller code size at the expense of more instructions to define), or even adopt an already existing instruction set so that you can use already existing compilers (e.g. 8086, Z80, etc.).
    If you do that, you can then expand this series into memory mapped I/O, and then you also have the ability of taking the memory map and adding a MMU to deal with virtual memory. All of which should be doable using registers and EEPROMs as look-up tables (though it will quickly grow out of control in terms of breadboard space).

    • @MrBluemoon74
      @MrBluemoon74 7 ปีที่แล้ว +4

      hjups that would all be possible but it would defeat the purpose of building the simplest computer possible for educational purposes

    • @hjups
      @hjups 7 ปีที่แล้ว +12

      I disagree. The ability to expand the design without significantly modifying the core "computer" would have significantly more educational impact. If you compare starting off with a more complicated design in mind (which requires a lot of starting knowledge), rather than the ability to transition into a more complicated design, then you would be correct.
      Right now, this model is a "toy" (in the academic sense), and can't really do much (especially with 16 Bytes of RAM). It would be a wasted opportunity to expand its functionality to teach more advanced topics.
      The mindset of keeping it simple for educational purposes is a pitfall that a lot of courses and textbooks encounter, and end up leaving a disconnect between the educational material and real systems. Unfortunately, only one of the courses I ever took broke that paradigm and ended up bringing the theory of operation back to reality (it was an FPGA based software defined radio, which could actually process an IQ stream and play audio).
      Keep in mind that I am not suggesting that the current design be abandoned, or that it should focus on a pipelined, super-scalar, or an out of order execution model, all of those things would defeat the purpose.
      A simple example of what I am talking about..... let the current memory address 0 correspond to main memory. Let memory address 1 correspond to the lower 8 bits of the address, and memory address 2 correspond to the upper 8 bits. Now if you want to read from or write to the 16 bit address space, you set the address by writing to the bus memory address 1 and 2, and then read / write from bus memory address 0. Then the only other step needed is to support a 16 bit program counter, which could be connected to a simple multiplexer switching between the bus memory addresses and the program counter, which is toggled during the instruction fetch phase.
      What has that done differently to this design? It made the program counter 16 bits instead of 4 (an easy extension), removed the program counter address from the internal bus, and changed the way the RAM worked, but not how it appears to the rest of the system.... The ALU doesn't change, if the initial instruction set supports read/write from/to the current RAM, then the instruction set doesn't change, and in fact, the control signals from the micro-instructions don't change. (The jump instruction might changed based on how it's implemented, but you could do the MIPS method and keep the upper n bits). And with all of that, you just expanded your computer from having 16 Bytes of memory to having 65K!
      Anyways, the point that I was trying to make is: the opportunity to teach more advanced topics based on the framework of a simple design is significantly more powerful than saying "here is a simple toy", now here is a real world case study, leaving the students (or in this cause audience) confused on how one went from the first to the second. And believe it or not, many computer engineering professors can't actually answer that question, because they never bothered to study systems outside of the "toy" setting (it took until a special topics graduate course for me to learn about how I/O is actually handled by a computer).

    • @RussellTeapot
      @RussellTeapot 7 ปีที่แล้ว +4

      +hjups I definitely agree with you, and I hope Ben will tackle on the expansion of this CPU.. The book he talks about in the first video (I can't remember the title, it was written by Albert Malvino) does exactly this: it starts from the SAP-1, and adds more and more functionality with the SAP-2 and SAP-3, basicly expanding what was built in the previous step. It's a marvelous idea and I'm glad I found these videos, I'm learning lots of things

  • @ErebuBat
    @ErebuBat 2 ปีที่แล้ว

    This is the FIRST TIME i have actually understood what CPU microcode actually is.

  • @mufaddaldiwan8555
    @mufaddaldiwan8555 8 หลายเดือนก่อน

    Never binged any TV show as much as this
    This video is GOATed

  • @dogtre2283
    @dogtre2283 7 ปีที่แล้ว +42

    But if porn isn't allowed on TH-cam why are Ben's videos still online?

  • @PriyankMandavawala
    @PriyankMandavawala ปีที่แล้ว

    This is the best educational video I've ever watched on youtube. Thank you for putting in so much effort in making these!

  • @riddler2kone
    @riddler2kone 7 ปีที่แล้ว +8

    You are legend, Mr. Eater!

  • @michaelbauers8800
    @michaelbauers8800 5 ปีที่แล้ว

    Edit video to show adding HCF opcode? Halt and Catch Fire. Been loving this whole series, should be mandatory for computer science students to watch this. Been a programmer since the 1980s, and I never learned this level of detail until now. Better late than never!

  • @rabidbigdog
    @rabidbigdog 4 ปีที่แล้ว

    Glorious re-implementation of the PDP-11/6502 PAL.

  • @mistervoldemort7540
    @mistervoldemort7540 7 ปีที่แล้ว +1

    Before I was bored on TH-cam, but that was before I discovered this channel.

  • @KuraIthys
    @KuraIthys 7 ปีที่แล้ว +1

    This has been fascinating so far. It's inspired me to try building something. (I mean I already had that thought, but now I'm considering other things, and trying it on a breadboard rather than a more permanent form. XD)
    If you're continuing with this much I'd be interested to see something like instruction pipelining.
    I have no idea how complex it is, but some rather old CPU designs had some minimal pipelining going on.
    Like the 6502 which loads and decodes one instruction while doing the first part of calculations for a second, and the final parts and data store for a third.
    (it's part of the reason the 6502 can even have some instructions that complete in just 2 cycles.)
    I mean, that may be too complex to sort out for a design like this, but a minimal 2-stage pipeline would be fascinating to see. (maybe those first two operations that repeat for every instruction could be the first stage, and the other stuff could be the second stage - that would not be perfect, but it would probably cut things down to 3 cycles per instruction at most. - and may still be simple enough to be possible to demonstrate on a design like this.)
    Personally, I may take on the idea of building a graphics chip rather than a CPU. XD
    Not a 3d chip obviously, but a basic 2d one.
    Seems fun. Tiles and sprites and stuff. - May have to cheat a little and give it a pair of framebuffers (which a design from that era wouldn't have), because I assume logic made from discrete components would be too slow for video output that monitors expect.
    With a dedicated framebuffer at the output stage, the main logic of the graphics chip could run as slowly as it needs to, and then write to memory, while the video output stage runs at the 25 mhz or so needed to output a 640x480 analogue VGA signal.
    (the system wouldn't be 640x480, but that's the lowest standardised VGA resolution, and is still supported by modern monitors if they have a VGA input. - You may be wondering if you're old enough how a VGA graphics card can deal with a monitor that only accepts 640x480, and yet run at 320x240 (or whatever other resolutions) - well, strictly speaking VGA monitors supported a handful of other modes, but the real trick is the VGA adapter is kinda lying to you. 320x240 is actually 640x480, but it draws every pixel twice, and every line twice. So, it outputs 640x480, but internally only has to do the calculations and use the memory for 320x240).
    Anyway, with the conceit that we have a double-buffered block of memory for the output stage, we could then build any kind of logic on top of that, operating at any speed, and it could switch framebuffers for the output stage whenever it's ready.
    Then we can build an old-style tile and sprite graphics chip (like those found in 8 and 16 bit consoles, and many of the 8 and 16 bit home computers from the 80's too), and however slow it ends up being due to the limitations of using discrete logic, it can still output a stable picture, just perhaps at an extremely low framerate.
    Unlike the 80's, memory, even SRAM (in small quantities anyway) is dirt-cheap, so we can get away with this pretty easily.
    Seems fun, right? XD

  • @ayanarif1
    @ayanarif1 ปีที่แล้ว

    This video is like the Finale we all have been waiting and oh! Boy! what a finale it has been

  • @yufgyug3735
    @yufgyug3735 7 ปีที่แล้ว

    Even though I understand very little of these videos, I still find them extremely interesting and entertaining.

  • @DingleTwit
    @DingleTwit 4 ปีที่แล้ว +4

    I always say “E-PROM” so it cracks me up every time it sounds like you say “EEEEEE-PROM.”

    • @fweephokus
      @fweephokus 4 ปีที่แล้ว +1

      He's saying "EEPROM" (Electronically Erasable Programmable Read Only Memory), which is different from "EPROM" (Erasable PROM). The latter are the kind you erase with UV light.

  • @JesviJonathan
    @JesviJonathan 3 ปีที่แล้ว

    Congrats you have reached the final episode of this build 👏

  • @adrianobueno6984
    @adrianobueno6984 3 ปีที่แล้ว

    These videos are amazing, I can’t stop watching them, thank you!

  • @xXRedTheDragonXx
    @xXRedTheDragonXx 7 ปีที่แล้ว +1

    Seriously dude! I love your videos! They are so awesome and entertaining!!! I'm very curious where you learned all of this information, because this is one thing that I would be interested in doing! Your channel is so under rated. You deserve more subscribers!

  • @davemintz4999
    @davemintz4999 7 ปีที่แล้ว

    Yes! What a joy to see this finally posted, Like waking up on Christmas morning! Thank you.

  • @krokofan4425
    @krokofan4425 7 ปีที่แล้ว +28

    Never clicked on a video faster!

  • @carrotsoup7264
    @carrotsoup7264 5 ปีที่แล้ว +11

    I hope one day i will be in front of this halt LED with a number on my digital display.

  • @PseudoNo
    @PseudoNo 4 ปีที่แล้ว +1

    "Who knows what is it doing now" - Skynet is born.
    Great stuff! Thanks a lot!!!

  • @paulrautenbach
    @paulrautenbach 7 ปีที่แล้ว +6

    Excellent explanation again. Thanks.

  • @guiguinelson
    @guiguinelson 3 ปีที่แล้ว

    Thank you for not using the Arduino this time around. Helps to understand everything from the ground up.

  • @protonjinx
    @protonjinx 7 ปีที่แล้ว +2

    Put in some 74LS138 decoder/demultiplexters, 3-to-8 lines, one for output: RO, IO, AO, ZO, BO, CO, HLT and NONE. The other for input: MI, RI, II, AI, BI, OI, J and NONE. Two extra lines for CE and SU. 8 bits in total. Only one EEPROM needed. Part of the opcode 4 bits could be used to determine the length of the cpu instruction. Eg. all 1XXX instuctions being 3 steps, all 0XXX instructions being two steps.

  • @OfMoachAndMayhem
    @OfMoachAndMayhem ปีที่แล้ว +2

    42! that's the answer - as it should be -
    On the next series of videos, we'll work out what the question is.
    Come back in... 6 million years XD

  • @frognik79
    @frognik79 7 ปีที่แล้ว +20

    Please add a flags register, no cpu is complete without conditional branching.

    • @John_2143
      @John_2143 7 ปีที่แล้ว +13

      he has conditional branching in his other computer via the overflow line on the ALU, and since he already has a jump signal I'm sure the next video will just be programming the rest of the signals and connecting that

  • @SteveMHN
    @SteveMHN 7 ปีที่แล้ว

    I'm amazed how all this works, it's crazy.

  • @philnelson2364
    @philnelson2364 3 ปีที่แล้ว +1

    You did something I've wanted to do since the 1970's. Every programmer should see this. Wonder if you can do a combinational logic cpu instead of a sequential logic version.. Also, the extra time sequence not used like "out" could be used to reset increment the program counter on the last micro instruction and skip t4, t5 etc.

  • @peteroo9962
    @peteroo9962 2 ปีที่แล้ว

    Thank you, so much, Ben! This is what I want to know how the computer and microcontroller works. I was thinking how the microcontrollers are programmed manually without any computers, and I can't figure out with these 1's and 0's, exactly. Now, it is like kind of that I have got all I want to know about basic computer's system. Now, I've got how computer's micro codes are passed through cycle by cycle and step by step. I really appreciate what you built. I would like to learn computer science from you if possible.

  • @cmullins06
    @cmullins06 7 ปีที่แล้ว +3

    Ben, thank you so much for these videos. You're a phenomenal teacher.
    Sort of fiddly question for you -- what kind of wire strippers do you use? Making all of these patch wires can be pretty zen, but it does get kind of exhausting after a while!

  • @utkarshverma1
    @utkarshverma1 3 ปีที่แล้ว

    I think we can also multiplex the EEPROM as we did for the display. We can have a high speed clock(555), a couple of octal d-type latches (74LS273) and have one of the address bits of the EEPROM controlled with the clock. And we can select one of the latches using the clock as well.
    For preventing repeated latching, we can ensure that the clock only runs for a short duration on each rising edge is the step counter.

  • @MrStumpi1
    @MrStumpi1 4 ปีที่แล้ว

    When the clock halts in the end! So freaking cool man!!!

  • @Colecf
    @Colecf 7 ปีที่แล้ว +34

    At around 39:39, the computer starts loading undefined instructions, and starts putting multiple things on the bus. (Sum out and counter out are enabled simultaneously) Won't this cause a short and damage the components if a 1 and a 0 are placed on the bus at the same time?

    • @CJBurkey
      @CJBurkey 6 ปีที่แล้ว +2

      I don't think it should, because the state of the bus when the input is taken should only be either/or, but not both as it's done on the rising edge.

    • @CJBurkey
      @CJBurkey 6 ปีที่แล้ว

      Wait, +MrEdrftgyuji explains why it could a few comments below

    • @barmetler
      @barmetler 5 ปีที่แล้ว +2

      @@CJBurkey well those tristate buffers connect the bus to ground at a 0, and to vcc at a 1. that means if one module has a 0, and another has a 1, one tristate buffer will connect the bus to ground, while another connects the same bus to vcc.

    • @matthewe3813
      @matthewe3813 4 ปีที่แล้ว

      better hope all the magic smoke doesn't escape

    • @PaulKooros
      @PaulKooros 2 ปีที่แล้ว

      You're exactly right, it's driving multiple contending outputs onto the bus (sometimes all five at once!). It's a good thing that these TTL parts are forgiving about "shorts" like this. Of course, TTL outputs have limits on the current they can drive.
      For that same reason, Ben is able to directly connect LEDs to outputs without a resistor (and not blow them up). That kind of thing is "minor abuse for the sake of convenience", and might cause problems like power supply lines being dragged down (and logic levels being lowered to indeterminate levels), but hey...
      FYI, most TTL-ish logic can source (push out a high logic level) much less current than they can sink (push out a low logic level). E.g. a 74LS32 datasheet I'm looking at shows source output current as 0.4mA, and sink output current as 8mA.

  • @MAProsper
    @MAProsper 7 ปีที่แล้ว

    You should add a Micro-instruction for Reset to T0 and Reset Instruction Register, it will save the space of multiple Fetch versions and Time!
    Great Video! ;)

  • @Whatsthegeek
    @Whatsthegeek 7 ปีที่แล้ว

    It will be interesting to see at what sort of clock speeds this thing can run ! Very interesting video !

  • @williefleete
    @williefleete 7 ปีที่แล้ว +3

    My version of this CPU has been upgraded to have 256 bytes of memory about 36 instructions with a max of 63, two conditional lines with jump on (no) carry and (A!=0) A=0. Used the unused output on the 2nd rom for an external input, added a 3rd rom for microcode reset (and maybe further hardware) so shorter instructions only use as many clock cycles as it needs up to 7. The 256 bytes makes it prohibitive to manually program so I came up with a loader to pull a program off a rom on the IO bus so I only need to program 10 bytes manually and it loads a longer program in

  • @amozizzle7566
    @amozizzle7566 7 ปีที่แล้ว +7

    awesome video!

  • @exe.m1dn1ght
    @exe.m1dn1ght 10 หลายเดือนก่อน

    Thank you , it all makes sense now ! May the Universe bless your kind heart !

  • @mikefochtman7164
    @mikefochtman7164 4 ปีที่แล้ว

    19:10, another expansion/optimization (probably someone else has mentioned), have a control signal from the EEPROM go back to the instruction step counter to reset it. Using this, you could have some instructions that require many more steps (your 4-bit counter could have up to 15 substeps) with the last sub-step setting this control line. In this way, different instructions could have a different number of steps. So a complex instruction requiring many substeps wouldn't require all instructions to use the same number of clock cycles. One thing I always noted in older CPU manuals was the number of clock cycles to perform each instruction, so clearly they use a 'variable sub-step' count.

  • @iProgramInCpp
    @iProgramInCpp 6 ปีที่แล้ว

    Ben Eater's computer specs:
    16 Bytes of RAM
    2K EEPROM for Left instr.
    2K EEPROM for Right instr.
    2K EEPROM for Display
    A Register
    B Register
    Out Register
    Sum Register
    Many switches
    8-bit Data Bus
    4-bit Address Bus/Program Counter

  • @peterwilson69
    @peterwilson69 6 ปีที่แล้ว +13

    I’m amused that breadboard wires the exact length and shape are constantly brought out as if pre-prepared : )

    • @benbaselet2026
      @benbaselet2026 4 ปีที่แล้ว +4

      Of course they are prepped. I think he built his computer first and then rebuilt it for the video series. Obviously one prepares presentations like this and does not just faff about for hours "live".

    • @midnightrizer
      @midnightrizer 4 ปีที่แล้ว

      they were.

    • @alshahriar6230
      @alshahriar6230 4 ปีที่แล้ว

      R/whoosh

    • @peterwilson69
      @peterwilson69 4 ปีที่แล้ว

      @@benbaselet2026 Oh... I kind of assumed that anyway - just very amused anyway. Wish I had an automated breadboard wire making machine.

  • @AlJay0032
    @AlJay0032 6 ปีที่แล้ว

    You could make commands with variable number of steps if you let the control unit reset the step counter on the last step the command has. Great series, I have already recommended it to some kids. Actually boys. I don't know any girl who might be interested.

  • @mikestombraidervids8768
    @mikestombraidervids8768 5 ปีที่แล้ว

    Really excellent series. Thank you so much. I have not watched to the end or later videos yet, but ...
    It seems like there will be gaps (wasted space) in the eeprom corresponding to states T5 to T7 on the step address bits.
    If the step address bits are on A4 to A6 (high order bits) then the eeprom table will be (a) shorter and (b) compact with no wasted space.
    Because the op-code bits are a power of two.
    Of course, the disadvantage is the the micro instructions are no longer adjacent.
    This is only a real issue when viewing a dump of the eeprom.
    However, the table could be written as if it were the other way (on the Mac) and a simple program (e.g. python or whatever you are used to)
    could take that as input and generate the 'optimised' layout.
    The OCD in me worries about wasting resources. :)
    Cheers, Mike.

  • @HunterNapier
    @HunterNapier 2 ปีที่แล้ว

    I'm just starting to learn about computers, and I've been able to piece out what is going on slowly, but I wish there was more in depth explanation and looking into some of the components and how they do what they do, and some more breakdown of things like EEPROM and how everything relates in similarity to an actual CPU.
    Originally I found this trying to figure out HOW a command unit actually, commands anything and I think I'm starting to get the basic gist of it, but it would be nice to tie it all together/break it down more for those of us not as computer savvy and wanting to learn more. One thing I had a hard time understanding was high/low, and there weren't a lot of good explanations I could find.

  • @vladtepesch27546
    @vladtepesch27546 5 ปีที่แล้ว +1

    you could wire more than the 4 instruction bits to the eeprom, so you could support more than 16 instructions, because not all require additional parameters (out, halt, nop, ...)

  • @DanielMelendrezPhD
    @DanielMelendrezPhD 5 ปีที่แล้ว

    Ben: you're a FREAKING legend! Period.

  • @isbestlizard
    @isbestlizard 5 ปีที่แล้ว +2

    HEY it'd be pretty fun playing a VR game where you literally plug stuff into breadboards and have a massive bin of vr components you can pick from and they all work like they should and you could build stuff like this :V

  • @DanDart
    @DanDart ปีที่แล้ว +2

    Logisim tells me that just the LDA, ADD and OUT instructions, encoded using pure logic would've needed 7 inverters, 5 3-input AND gates, 4 6-or-more-input AND-gates, 7 7-or-more-input AND-gates, 2 2 OR gates and 2 3-input OR gates. If we had to do it in purely 2-input NANDs, we'd need 149 of them.

    • @Android480
      @Android480 ปีที่แล้ว

      Its funny how quickly the "I'll build it all myself!" mentality goes away. I thought I wanted to do everything with simple logic gates, I know now that I really don't.
      Makes it tough to think about future projects though. Where do I draw the line? If everything needs to be abstracted, why not just go all the way and build an emulator in C++ or something.

    • @DanDart
      @DanDart ปีที่แล้ว +1

      Yes, it looks like it'd be a pain without the EEPROM which makes it significantly easier. What you need to make sure of is "What do I want to experiment with?", "What do I want to know / find out?" and "What do I want to play with physically?".
      You can just build all this stuff with enough patience in something like Logisim-evolution, but it won't help you debug real world electronics like plugging things actually will. I made a small Pi Pico W setup just to try out a shift register and LEDs and learn about things like pull-up and pull-down resistors.
      The real question is what do you want to get out of it? If it's just to emulate this system, then building an emulator is what you'll want to do. If it's to build it for real, then that.
      I also plan to emulate the CPUs used in Ben's videos in a public repository in Haskell, one of the best choices for good parsing.

  • @christophfriedrich5092
    @christophfriedrich5092 7 ปีที่แล้ว

    I would suggest to use the left over bit in the signal word for resetting the instruction counter. So that you can say "with the next clock pulse reset the counter" - useful if not all time steps are used.

  • @SuzanneKowalski
    @SuzanneKowalski 7 ปีที่แล้ว

    Excellent video as always. I'm gonna build this thing this summer! :)

  • @Whatsthegeek
    @Whatsthegeek 7 ปีที่แล้ว

    You could also add a signal to reset the micro instruction counter so that if an instruction doesn't need all 5 cycles, it resets it faster

  • @okgoogle5028
    @okgoogle5028 7 ปีที่แล้ว +1

    Konrad Zuse ( German. Build first programmable computer) would be proud.

  • @shaunnunoo2966
    @shaunnunoo2966 3 ปีที่แล้ว

    I find it fascinatinghow neat his breadboard work it

  • @amconners
    @amconners ปีที่แล้ว

    If you want to use a control line to reset the step counter at the end of each instruction (as many people in the comments have suggested) and still want to have that last control line available for something else, I'm pretty sure you can just continue to invert /T1 to get CE without causing any problems (saving a bit in the control word) because CE is always set during T1 and never set outside of the fetch cycle.

  • @jotaemebee
    @jotaemebee 7 ปีที่แล้ว

    Even Alan Turing would find this awesome!

  • @mouli570
    @mouli570 7 ปีที่แล้ว +12

    Today is my lucky day.

  • @nejaahalcyon
    @nejaahalcyon 7 ปีที่แล้ว

    I think the halt command could just be a 4-way AND gate on the 4 instructions bits. If you somehow initialize the ram to FF everywhere as soon as you exit the memory region where the program is encoded it will output the halt command.
    The same way you could implement a 4-way NAND to trigger a counter reset when the instruction is 0000 with a gate to only trigger the reset on !(T0 || T1), effectively implementing a NOP instruction.
    I'm still waiting on having a bit more of money set aside to be able to start such a project : as a programmer I love to explain to my friends how a computer works and this is a perfect demonstration board :D

  • @Moonbrony
    @Moonbrony 7 ปีที่แล้ว

    This thing is awesome. Now it needs a keypad and some more 7 segment displays to aid in programming. Maybe a master reset switch too.

  • @wintermutevsneuromancer8299
    @wintermutevsneuromancer8299 2 ปีที่แล้ว

    Thank u so much. This series was great.

  • @davidrysdam902
    @davidrysdam902 2 ปีที่แล้ว

    It's interesting that you got yourself into an infinite loop at the end of the program. That requires the random bits in memory to be setting J but also for the PC to be loading the previous address (according to what the video is showing, PC is just toggling between 4 and 5).

  • @patrickelliott2169
    @patrickelliott2169 3 ปีที่แล้ว

    Been watching these and had the thought, when talking about using the instruction to define what things to select, "Wait.. I think everything on a 6502 that dealt with the accumulator used an instruction that started either with An, or Bn... So, does that mean they went way beyond using eeproms to do this, and just built the logic so that instructions that use An, or Bn 1010 and 1011 respectively, automatically cause the chip to select the accumulator as the register to use for the instruction?"
    I mean, it would be a far more elegant solution, for what ever instructions you could do it with (which naturally wouldn't be all of them), and then only have more complex bits to do the ones that *didn't* match this convenient bit of logic.

  • @RxZ95sssPG
    @RxZ95sssPG 3 ปีที่แล้ว

    "42 is the awnser". I see what you did there.

  • @eirbrveirhrhrj
    @eirbrveirhrhrj 7 ปีที่แล้ว

    Awesome as usual, Ben! You have tought me a lot and I thank you very much for it. You inspired me to build a computer myself, only it's 8 bit with a 64kB address space that's split into 8kB ROM and 56kB of RAM. I have seen comments on how much more complex it would be to expand your computer to the same size and I can confirm that! My build is 100x60 cm large! If anyone is interested find me on Twitter (@mynkus) and look at the latest tweet where you can see the address and data bus, ROM, RAM, 4 registers, clock, stepper, instruction register and control logic. The ALU will be built "discrete" with 74xx chips. And I plan to add a 4x20 character LCD. Again, thank you so much Ben for all the inspiration!

  • @wbfaulk
    @wbfaulk 3 ปีที่แล้ว +1

    I feel like a NOR tied to step lines 1 and 2 that pull all the instruction lines low would allow you to avoid duplicate data entry for the two fetch microinstructions.

  • @rarrmonkey
    @rarrmonkey 2 ปีที่แล้ว

    if you consider only 1 signal should output to the bus, you could take 3 output pins and decode them into 7 control signals + 000 = no output to bus.
    I know it's not enough to reduce the required pins to 8 but it would prevent double writing the bus.

  • @patrickleboutillier
    @patrickleboutillier 2 ปีที่แล้ว

    When using EEPROM chips like this, is it possible that the EEPROM sends out the wrong control signals for a very short period of time when the instruction or step changes?

  • @lev746
    @lev746 4 ปีที่แล้ว

    Amazing series! Thank you So much!

  • @beopstek
    @beopstek 7 ปีที่แล้ว

    Alternatively, you can have a halt condition from the RCO output pin on the program counter. This pin is HIGH while on the highest address (0xf), and LOW otherwise. The halt functionality doesn't have to take up opcode space that way: just let the program run to the end of memory, then stop.

  • @StavrosAvramidis42
    @StavrosAvramidis42 6 ปีที่แล้ว

    You can use a NOR (2 basicly ) gate on the output of the 2 EEPROM's to reset instruction decoder counter to 0 so you don't waste clk cycles on instructions with less that 6 sun-intstructions