Hardware SPI Continued - IO from Scratch - Part 7

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

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

  • @weirdboyjim
    @weirdboyjim  7 หลายเดือนก่อน +2

    Join us on Discord: discord.gg/jmf6M3z7XS
    Follow me on Twitter: twitter.com/WeirdBoyJim
    Support the channel on Patreon: www.patreon.com/JamesSharman

  • @MuhamedUsman
    @MuhamedUsman 7 หลายเดือนก่อน +6

    you are the most consistent engineer i have ever seen

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +2

      Very kind of you to say that!

  • @peter.stimpel
    @peter.stimpel 7 หลายเดือนก่อน +16

    Cannot wait to see what your are introducing after this cliffhanger.

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

      Thanks Peter! I hope it doesn't disappoint!

    • @lawrencemanning
      @lawrencemanning 7 หลายเดือนก่อน +4

      Yep that’s a tease James! I’m gonna guess at an SDCard reader. The other, less likely, option is some kind of PCM sound output involving I2S. But I’m leaning towards an SDcard interface because you mentioned dataflows in both directions.

    • @edgeeffect
      @edgeeffect 7 หลายเดือนก่อน +2

      ​@@lawrencemanningyeah... that's what I thought too... we'll have to wait and see. :)

    • @Schwuuuuup
      @Schwuuuuup 7 หลายเดือนก่อน +1

      @@lawrencemanning Or one of these ENC28J60 Ethernet modules

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

    hmmm... I am betting on a Little flash storage chip - Winbond beastie or maybe an LCD panel with touch...
    Excellent vid btw, I love the way we get the "brain ticking" and the typing, not edited out like others do. It still blows my gourd that this is a complete CPU (and now computer system) of your own design - it must be great to know everything on such an intimate scale - Grab yourself an ice cream.

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +1

      Very generous! I’m in Rome for a few days so it may have to be Gelato! The spi is definitely moving towards storage, I occasionally just let it run slowly to watch the led’s!

  • @RealEngineer
    @RealEngineer 7 หลายเดือนก่อน +4

    Man I wish I had your asm skills. Great video as always 🎉

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

      😊 thank you

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

    At this point I'd be looking at buffering SPI output, so multiple bytes can be read without the CPU needing to consume them on exact clock boundaries, and a WAIT input on the CPU so the SPI subsystem can block execution until data is ready without needing lots of explicit NOPs with super precise timing.
    This build truly never ceases to amaze me. Really need to have a go at doing stuff like this myself someday 🙂

    • @weirdboyjim
      @weirdboyjim  6 หลายเดือนก่อน +1

      It's always a balance on circuit verses code complexity. My tightest loop here is 3 cycles of action verses 5 cycles of delay, so I would only gain 5 cycles of parallelism for each byte of fifo (minus any management code). My sense is that I'm probably at the sweet spot for this build, but it's easy to see how that balance can shift rapidly.

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

    It's always nice to see one of your videos pop up on TH-cam.

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +1

      Good to hear you are enjoying!

  • @erniecamhan
    @erniecamhan 7 หลายเดือนก่อน +2

    Love watching what you do...but haven't a clue what you did 😊

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

      Thanks Lol, Glad you are enjoying anyway.

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

    a lot of what you do is well above my head but still very interesting 🙂

    • @weirdboyjim
      @weirdboyjim  6 หลายเดือนก่อน

      Good to hear you are enjoying it!

  • @pipsqueak2009
    @pipsqueak2009 7 หลายเดือนก่อน +2

    Fascinating progress . Thanks for sharing

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

      Thanks for watching!

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

    Great video again James! Cant wait to see what the device is.

  • @teknifix
    @teknifix 7 หลายเดือนก่อน +5

    SD card? It's what I would like to add to my SBC so I don't have to load everything over a serial connection. Considering the demos you've created so far you may want to add bankable RAM, so the SD card would allow for a lot more assets in future demos.

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +3

      SD Card, I couldn't possible comment 😅. I'm not 100% sure about bankable ram, while it would be nice to have more memory none of my plans really need it. I'd rather save a larger memory pool for a future architecture that's designed to be able to make use of it.

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

    I can see you are still working on and expanding the architecture and continuing to improve its ISA. When you finally complete this stage of the project where you feel it's completed, do you have any plans on taking it to the next step or level of abstraction? In other words do you have any intentions on implementing your own compiler - higher level language and do you intend to build your own operating system on top of it?

    • @weirdboyjim
      @weirdboyjim  6 หลายเดือนก่อน +1

      A compiler would be an interesting thing to have, but code generation for 8-bit architectures tends to be pretty inefficient. I'm expecting future builds to achieve more in this regard.

  • @Minikahn1
    @Minikahn1 7 หลายเดือนก่อน +1

    Can't wait to see the next step!

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +1

      Hope it doesn’t disappoint!

  • @johncochran8497
    @johncochran8497 7 หลายเดือนก่อน +1

    Why are you using 2 shift registers? If memory serves, the SPI protocol sends bits in both directions at the same time. So you only need 1 shift register along with the capability to read and write the contents of the shift register in parallel. Algorithm is:
    1. Store value to transmit in shift register.
    2. Toggle clock 8 times while shifting register. This both output's 1 bit at a time from the shift register /and/ shifts in 1 bit of data from the client device into the same shift register.
    3. Read value in shift register to get data from client.
    Effectively, you have a 16 bit circular shift register with 8 bits on your side and 8 bits on the client side. After clocking 8 times, the values in each register are exchanged with each other.

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +1

      You can indeed do it with just one shift register, but you need one of the more complex parts that can handle parallel read and write. The circuit logic is not any simpler and I felt it was easier to explain the separate functionality by handling shift in/out separately.

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

      @@weirdboyjim 🤔so that's why 299 wasn't used

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

    Are you going to look at an interrupt driven handler, instead of all those nop?

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +1

      Interrupts rarely work with low enough latency, you would want some buffering as well.

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

    Hi James!
    Did you consider making all the IO hardware memory-mapped? In this case the CPU would not depend on peripherals and would be a general-purpose CPU with simpler general-purpose ISA instructions.
    Why did you decide to make IO a part of the CPU and ISA? Is it for better performance?
    Thanks for the videos!

    • @weirdboyjim
      @weirdboyjim  6 หลายเดือนก่อน +1

      This is a discussion that almost needs a video on it's own. Memory Mapped IO (I do a little of this in the vga circuit) is really just IO implemented as memory operations without additional support from the cpu. Processors like the z80 have dedicated IO circuitry which still works very much like memory but separates the address space out. But those two are not the only way to do it, the "IO Ports" on my build work more like some microcomputers. The bus is the internal main bus and those "port's" are just otherwise unused addresses for main bus devices, reading or writing to a port is exactly the same as asserting or loading one of the 8-bit registers. There is no hardware at all to support the IO in the core cpu, the only things it costs me is the instruction space. In this particular architecture the IO is indeed faster since it never touches the memory system so it doesn't cause a fetch stall.

  • @jensschroder8214
    @jensschroder8214 7 หลายเดือนก่อน +1

    When the programmer inserts NOP code to move forward.

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +5

      Far more common at the low level than many people realize!

  • @andrewwatts1997
    @andrewwatts1997 7 หลายเดือนก่อน +1

    Congrats! A great milestone ;)

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +1

      Thank you very much!

  • @OscarSommerbo
    @OscarSommerbo 7 หลายเดือนก่อน +2

    Oh, I think I know what is coming...

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +1

      Ha! I expect you probably do. What you don't know is the first big demo that's going to use it! 😉

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

      @@weirdboyjim Well, removing bit banging serial did evoke some memories. And I know one thing that use spi almost exclusively.
      Ohhh, demos are always fun, all parts of them. 😉

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

    I think now would be a good time to add a DMA Engine so that SPI and UART can do bulk data Trasfere.

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +1

      Dma would require support on the cpu side that I don’t have, you may need to wait for the next cpu build for that.

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

      @@weirdboyjim something simmilar would still be posible, as it's own devices with it's own memory. Essentially an autonomous buffer which could opperate at different speeds from the cpu and would remove the nops with a flag check. But this only makes sense when you plan on adding multi-theading.

  • @wChris_
    @wChris_ 7 หลายเดือนก่อน +1

    Are you going to interface with an SD-Card? because this is the only thing i can imagine that is not only useful, but can also saturate the Interface.

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +2

      The ability of SD cards to talk SPI is indeed an interesting possibility...

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

      Remember the first few iterations of the MIPS architecture had a branch delay slot that was invariably filled with a NOP by the compiler, let alone the programmer 😂
      What you have will no doubt work for you, but possibly it's worth an auto clock counter so that you can trigger it and it just pumps the 8 bits. Could be triggered by the control line that currently controls the mux.
      Then you can overlap writing the Rx data to ram while the next byte is being clocked in, without having to be 100% cycle count accurate in the 'filler' code.
      Only worth it if the equivalent of *pointer++ = register takes more than 5 cycles or is nondeterministic.

  • @mikehibbett3301
    @mikehibbett3301 7 หลายเดือนก่อน +1

    Great progress!

    • @weirdboyjim
      @weirdboyjim  7 หลายเดือนก่อน +1

      Thanks! Glad you liked it!

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

    The best

    • @weirdboyjim
      @weirdboyjim  6 หลายเดือนก่อน +1

      Thanks TwoBob!

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

    Just a random thought, but your assembler might need some form of macros if you keep unrolling loops etc.

    • @weirdboyjim
      @weirdboyjim  6 หลายเดือนก่อน +1

      Indeed, macros have been on the "todo list" for a while, but as I'm sure you can imagine my backlog of things that would be handy is pretty large. It's difficult to prioritize sometimes.

    • @ecosta
      @ecosta 6 หลายเดือนก่อน

      @@weirdboyjim I have the same type of issue. I guess that's part of the joy of solo projects... 😃

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

    SPI display?? :D

    • @weirdboyjim
      @weirdboyjim  6 หลายเดือนก่อน

      Nice idea, but that would overlap with the vga project.

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

    What’s your “bus tester”?

    • @weirdboyjim
      @weirdboyjim  6 หลายเดือนก่อน

      It started out as a few bits of common circuit I used on a breadboard. It has a d-type latch, a couple of line drivers and some debounced buttons. I was using that a lot of test bits of the circuit. I converted it to pcb for reliability. th-cam.com/video/aru482FfXlk/w-d-xo.html