Loosely inspired by how much people seemed to enjoy a similar question I asked on Games about unappreciated titles. But answers don’t have to be media related (they still can be though).

  • funnystuff97@lemmy.world
    link
    fedilink
    arrow-up
    35
    ·
    1 year ago

    FPGAs, love the damn things. They’re circuits that you can re-program at will after they’ve been manufactured! If you build, like, a 2-input AND gate, that’s all it will ever be. It can only take in 2 inputs and AND them together. But with an FPGA, they’re manufactured to be versatile; you “program” the circuit you want to achieve onto the chip, and it will achieve that functionality! You can make a 2-input AND gate, slap it onto a bread board, and have yourself that nifty little AND gate, but if you later decide you wanted it to be a NAND gate, just reprogram the chip and like magic, what was once an AND gate is now a NAND gate. They’re great!

    • UnlimitedRumination [he/him]@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      8
      ·
      1 year ago

      I wanted to get into FPGAs when I was making some custom boards with MCUs but I really had a hard time finding a good idea for a starter project with them. How did you get started? Any recommendations?

      • funnystuff97@lemmy.world
        link
        fedilink
        arrow-up
        13
        ·
        1 year ago

        The “print hello world” equivalent of FPGAs is to make an LED blink. That teaches you how to use an FPGA’s clock, divide it down to a frequency the human eye can actually see, and route it out to a pin (the LED on your board). Then you can experiment with your catalog of digital circuit building blocks using buttons, switches, LEDs, and 7-segment displays. You can make your own custom logic of ANDs and ORs to display different logic.

        Some super beginner projects I found fun back in college:

        • Create a counter, and increment the counter every time you press a button. That’s the easy part. Then display the value on a 4-digit 7-segment display. It’s harder than it sounds, because you have to learn about time multiplexing! (At any one instance in time, only one digit is on, and the other three are off. Human persistence of vision makes us believe all 4 digits are being shown at once, but in reality, the system cycles through each digit, flashing one on for a few milliseconds, then turning it off and moving to the next one. Implementing this takes effort!)

        • Learning Finite State Machines and then implementing your own is fun. I made a “vending machine” state machine once, where different buttons corresponded to inserting different coins, and then once a certain amount of money was put in, you could select which beverage you wanted, the machine would “vend” (an LED would flash), and then change is administered. Another fun and classic FSM is the pattern detector, where you input a series of 1s and 0s, and the machine will blink an LED if it detects a certain pattern in the sequence, say, 11010. This one is a lot harder than it sounds, because it requires a lot of thinking of the different edge cases! If I input 111, for example, the system shouldn’t be like, “well he inputted 111 but I was expecting 110…, so I’m gonna start over”, because I could input “111111010” and the pattern is there, just at the end. This one teaches you how to draw state diagrams and Mealy/Moore machines!

        • Then you can get into using peripherals, like RGB LEDs, gyroscopes, graphics on a screen, ethernet connections, etc. You just need to learn the protocols and follow the correct logic in your own logic. It’s a lot of copy and pasting at first, but if you put in the effort to understand what you’re copying, you’ll pick up on it fast.

        Really, the world’s your oyster, all you need is a development kit and a program that will synthesize/place&route your Verilog or VHDL.

        And if you’d like to start at the very, very beginning, HDLBits is an amazing resource to learn Verilog: https://hdlbits.01xz.net/wiki/Main_Page

        Let me know if I can ever be of any assistance :)

      • funnystuff97@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        1 year ago

        I’m so glad Analog Pocket is popularizing FPGAs, a lot of people are discovering them because of it.

        CYCLE ACCURATE HARDWARE RECREATION. IT’S INCREDIBLE.

    • slackassassin@sh.itjust.works
      link
      fedilink
      arrow-up
      4
      ·
      1 year ago

      I’ve been working with fpgas for about 15 years. In that time, the projects have gone from pld style logic as you’ve described, to process algorithms, and now we’re implementing machine learning trained neural nets in hardware and running Linux on board.

      It’s really wild. They are pretty neat.

      • funnystuff97@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        edit-2
        1 year ago

        Man, no kidding. We’ve got SoCs, we’ve got processors running on the FPGA fabric, we’ve got communications to Ethernet, PCIe, any AXI you like really. They can talk to RAM, storage, other processors, output graphics, kiss me on the forehead, and tuck me in at night. (I think.)

        A coworker was telling me about the big shots in New York trading companies that are starting to implement FPGA architectures into their high-frequency trading algorithms, as the blazing high speed and great parallelization helps them squeeze out a couple extra microseconds in their algorithms. I think that’s a good sign of people wising up to this potential here.

        I don’t know of any ML training on FPGAs, but I have no doubt that it can be / it is being done.

        Edit: I just remembered the other day, I was shown a module that could take in a grey scale image, do edge dection, and output the edges as a new image file. Which isn’t that hard, it’s convolution on a sliding window, but what baffled me is that it was done in fewer cycles than could be compiled through C code, and the pipeline wasn’t even that deep. It’s crazy!

        • slackassassin@sh.itjust.works
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          Ya, it’s fun stuff. We’re using ML for particle identification and tracking in high-energy physics. It’s magnitudes faster than anything a CPU/GPU can do…

        • DeVaolleysAdVocate@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          do edge detection, and output the edges as a new image file.

          your eyes do this, the cells in your eyes do a variety of edge detection and orientation detection before passing on this preprocessed image to the brain where the brain processes it further

    • Sharpie@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      For anyone reading this that is wondering what FPGA stands for, it’s Field Programmable Gate Array. Just figured I’d save some people the trouble of looking it up.