Get Started With FPGAs and Verilog in 13 Minutes!

Поділитися
Вставка
  • Опубліковано 6 чер 2024
  • FPGAs are not commonly used by makers due to their high cost and complexity. However, low-cost FPGA boards are now available on the market. This video provides a brief introduction to the Tang Nano 9K board and demonstrates how to program it using Verilog.
    Thank you to PCBWay for sponsoring this video. Get PCBs, 3D printing and sheet metal works: www.pcbway.com/?from=Doctor%2...
    Consider supporting this channel on Patreon and get updates about ongoing projects and ad-free preview videos!
    / docvolt
    Tools:
    Gowin EDA: www.gowinsemi.com/en/support/...
    Items used in this video:
    Tang Nano 9K: amzn.to/3PJiPHA
    Please use these links for your order to support the channel. It's the same price for you, but I'll get a small commission.
    00:00 - Intro
    00:38 - How do FPGAs function?
    03:55 - Introduction into Verilog
    06:06 - Verilog constraints
    09:55 - Sequential logic
    10:29 - always @ Blocks
    12:57 - Verilog examples
  • Наука та технологія

КОМЕНТАРІ • 89

  • @rieduciumaratonas
    @rieduciumaratonas Місяць тому +3

    At last after so many years and unused modules I managed to do something with FPGA. Thank you for this breakthrough!

  • @VorpalForceField
    @VorpalForceField 2 місяці тому +7

    I have wanted for years to dive into FPGA's ... Excellent demo ..!! Thank You for sharing ... Cheers :)

  • @float32
    @float32 2 місяці тому +22

    I started as a software person and went to verilog. The first thing I learned is that abstraction uses up all the LUTs and routing. My friend works for an FPGA company and said they never use abstractions, for the core IP stuffs. Makes sense.

    • @goodn1051
      @goodn1051 2 місяці тому +2

      just curious, what example of a company is an "FPGA company"

    • @float32
      @float32 2 місяці тому

      @@goodn1051 Altera, Xilinx, etc.

    • @vitalyl1327
      @vitalyl1327 2 місяці тому +3

      Abstraction can be zero-cost. I generate pipeline register chains and FSMs from a high level code all the time, and the result is usually better than what I'd write manually. Same goes for things like AXI bus handling, arithmetic ops scheduling on a long pipeline, etc.

    • @vitalyl1327
      @vitalyl1327 2 місяці тому

      ​​@@goodn1051e.g., quite a few HFT shops are FPGA-first..Though now there are some ASIC firsr ones as well.

    • @stickyfox
      @stickyfox 2 місяці тому +1

      Everything in industry is licensed, and you're lucky if you ever get a peek inside the code. Most designers never do any actual coding.

  • @pkraveendranath4081
    @pkraveendranath4081 22 дні тому

    Very helpful video for a beginner! Thank you very much. Please continue and let us have more practical examples that use the GPIO pins too!!

  • @JoaoCarlos-df1zw
    @JoaoCarlos-df1zw 2 місяці тому +18

    The explanation of FPGA was great! Still find they are pure magic though

    • @OneMilian
      @OneMilian 2 місяці тому +4

      Same here, maybe houses are full of fpgas who build all the hardware you own in the future, like you bought a sound system, bahm its build right into your house

    • @poisonouspotato1
      @poisonouspotato1 2 місяці тому +8

      ​@@OneMilianI had a stroke trying to read this

    • @poisonouspotato1
      @poisonouspotato1 2 місяці тому

      You are contradicting yourself. He explained FPGAs like he expected us to already know how they work.

    • @OneMilian
      @OneMilian 2 місяці тому +1

      @@poisonouspotato1 get well & healthy soon!!

    • @poisonouspotato1
      @poisonouspotato1 2 місяці тому

      @@OneMilian it took me a day to figure out what you meant. Also, no, you can't make speaker membranes from fpga chips without some sci-fi tech magic ooze.
      Fix your grammar.

  • @ClintTheriault
    @ClintTheriault 27 днів тому +1

    This dev board looks like a cool board to use as a base to make a ISA CGA 2 HDMI graphics card for old 1980's era PCs. I've been looking at something like this for my final Electronics Engineering project.

  • @svofski
    @svofski 2 місяці тому +3

    neat, I have this exact board waiting to get used

  • @ProfessorLinux
    @ProfessorLinux 2 місяці тому

    Very informative. Thank you.

  • @alicewyan
    @alicewyan 2 місяці тому +1

    This is exactly the video I needed, at the exact moment I needed it, as I have the smaller 1k version on its way from China :)

  • @IoanFesteu
    @IoanFesteu 8 днів тому +1

    Thank you for your intro to FPGA! Another great video! I am wondering if one can implement an 1D or even 2D Cellular Automata with this board?

  • @treideme
    @treideme Місяць тому

    Really good video. Thanks.

  • @lutfijd
    @lutfijd 2 місяці тому +4

    Just got my tang nano 9k yesterday, perfect timing for this video!! it does suck how they connect lines to low instead of high.

    • @enginerdy
      @enginerdy 2 місяці тому +1

      It’s common for digital outputs to have more ground drive current capability than high drive current. This is because the low side N FET in the IO pin is easier to drive.

    • @conorstewart2214
      @conorstewart2214 2 місяці тому

      How does it suck? What difference does it actually make in practice? Very little, once you know about it and you can figure it out just from looking at the schematic.
      Active low vs active high is a very easy concept to understand.

    • @lutfijd
      @lutfijd 2 місяці тому +1

      @@conorstewart2214 yes it is a simple concept and as enginerdy pointed it makes sense to make it so. I guess what i was trying to convey is that its annoying to have to set a pin to 0 for something to turn on and 1 to turn off, conventionally its the other way around. as you said, not a biggy.

  • @theforthdoctor7872
    @theforthdoctor7872 2 місяці тому +1

    Outstanding

  • @ukwebb
    @ukwebb Місяць тому

    Love your little nod to the awesome BBC micro with its schematic :)

  • @erichpoly4434
    @erichpoly4434 2 місяці тому +2

    I don't know if you have a video about Analog FPGA. However, it would be cool

    • @DoctorVolt
      @DoctorVolt  2 місяці тому

      I have never heard of Analog FPGAs..

    • @erichpoly4434
      @erichpoly4434 2 місяці тому

      @@DoctorVolt I confused it with FPAA. However, the question is whether you are making or have made videos about it.

    • @conorstewart2214
      @conorstewart2214 2 місяці тому

      @@erichpoly4434 there are no commonly used or available FPAA. They just don’t really exist yet (in any usable or accessible capacity) so how do you expect him to make a video on it?

  • @thanatosor
    @thanatosor 21 день тому +1

    Yes FPGA... the Excel of Hardware.

  • @Promilus1984
    @Promilus1984 2 місяці тому +2

    Have been wondering about Tang Nano 9k to house FT816 softcore modified to work in Commodore and Atari range of machines in place of original 6502 (and variants) but to use on-board PSRAM as real 16b local memory in 16b mode. Basically trying to do *slightly* improved SuperCPU ... Original device was based on WDC 65C816 processor @ up to 20MHz iirc, but 65C816 uses 8bit data bus anyway (much like 68008 or 8808) and also uses it to get address bits 16 through 23 (kind of like 8051 does multiplex data and address on one port for external memory interface). Which is ok from as close pin compatibility as possible, but is messy. With FPGA I can route all extended memory (24b space save first 64K) to PSRAM exposing only regular 6502 interface to GPIOs (obviously with level translators) and that also means I can get real 16b data interface to provide better performance in 16b mode.

    • @thanatosor
      @thanatosor 21 день тому

      have you tried with Tang Nano 20k + NESTang on it ?

  • @davemorphling7432
    @davemorphling7432 2 місяці тому

    where do you set the clock rate and thus the sensitivity of the button? I mean, what's stopping the counter to be increased by 1000 times after one press? is the logic only triggered on edge transitions?

    • @DoctorVolt
      @DoctorVolt  2 місяці тому

      Yes, always @(posedge btn1) begin...

  • @kuro68000
    @kuro68000 2 місяці тому +1

    Thanks for this. I'm going to try this FPGA. I've looked at stuff like Quartus but it's just gigabytes of proprietary crap.

  • @Dudleymiddleton
    @Dudleymiddleton 2 місяці тому +1

    Field Programmable Gate Array

  • @lutfijd
    @lutfijd 2 місяці тому +1

    how did you access the schematic of 9ktang at @6:43? is it in the gowin program?

    • @DoctorVolt
      @DoctorVolt  2 місяці тому +1

      With a quick search on Google

    • @lutfijd
      @lutfijd 2 місяці тому +1

      @@DoctorVolt lol ok ;(, found them first link on google ;)

    • @conorstewart2214
      @conorstewart2214 2 місяці тому

      All schematics, examples and other information are on the sipeed wiki or their GitHub.

  • @powerHungryMOSFET
    @powerHungryMOSFET 2 місяці тому +1

    Can you make some projects for beginners?

  • @DisgruntledPigumon
    @DisgruntledPigumon Місяць тому

    Can these cheap FPGAs do the same as the expensive ones that are used for emulating old game consoles?

    • @DoctorVolt
      @DoctorVolt  Місяць тому +1

      Yes, of course. I am currently working on this.

  • @johanneswack4017
    @johanneswack4017 2 місяці тому +1

    Just watched your video. During watching, made my Aliexpress order... Looks like fun, but what can this device, what an Arduino can't do?

    • @DoctorVolt
      @DoctorVolt  2 місяці тому +1

      On an FPGA, everything is done in parallel, like on an actual circuit. On a Microcontroller, the steps are done one after the other. So FPGAs are much faster and there are less timing issues.

    • @conorstewart2214
      @conorstewart2214 2 місяці тому +2

      An arduino is just a microcontroller, it executes code an instruction at a time. An FPGA in comparison can implement digital logic, you can make digital circuits inside of it, you can even make processors like the one found in an arduino within an FPGA.
      A major advantage of using an FPGA instead of a microcontroller is that you can have multiple things happening at once with precise timing. Each thing you want to do can be implemented as its own block and they can all operate simultaneously since they are all separate circuits. You could have one section driving a motor, another reading from a sensor, another driving a display and they all work at the same time, so latency is minimised (only the latency of that block) and timing can be very precise and no task can interfere with each other since they are separate circuits.
      Compare that with a microcontroller where it can only do one thing at once and the processing power is split between everything it is trying to do. If you want to control a motor, read a sensor and drive a display, then the arduino can only do one thing at once, so you have to either do each task in sequence or split them up, so you do a bit of each task at a time and keep on switching what task you do. This does work but it does mean that precise timing is difficult and latency is higher. A common way to let microcontrollers do multiple things is by using a Real Time Operating System (RTOS) but this is just organising how the processors time is split up, it can still only do one thing at once. This generally leads to variable latency, since if there are a lot of higher priority tasks needing done then lower priority tasks can be waiting a while until they get done.
      A related example of advantages of FPGAs is that everything can be done in parallel. In an arduino you can only do one addition at a time. On an FPGA you can set up multiple adders and have them perform many additions at once in parallel, the same applies to any other thing you want to do. So if you had 6 sensors and you needed to calculate something based on the sensor reading, the arduino would have to read each sensor and then calculate it one at a time whereas an FPGA can be set up with an individual circuit for each so that they are all done simultaneously.
      An important use of FPGAs is that they can implement any digital protocol if the FPGA is fast enough. So if you need to use an uncommon protocol and no common microcontrollers support it in hardware then you can implement it in an FPGA instead. Or if you implement a processor (maybe a RISC-V processor) in an FPGA then the peripherals are very modular, you can design custom peripherals or you can add any you need, so if your application needs 6 uart (serial) but no SPI or I2C then you just attach 6 uart blocks to it, or if you need to control 10 stepper motors then you can just add on 10 individual stepper motor control blocks. You only need to add what you need so you can basically create the ideal microcontroller for your application. Another advantage of most FPGAs is that they have a lot of available pins.
      You can find FPGAs in things like reconfigurable accelerator cards for computers or networking equipment. They are also used for testing chip designs before they are made. Often it is better to get an Application Specific Integrated Circuit (ASIC) made as they run faster and with lower power and they are cheaper in bulk amounts, like hundreds of thousands if not millions of chips but they are very expensive if you just need a small amount which is why people use FPGAs. FPGAs are often used in robotics. FPGAs are also often used in oscilloscopes or logic analysers as they can handle and process the measurements at high speeds. As another example each channel on an oscilloscope or logic analyser can be handled separately with its own circuit if you wanted.
      FPGAs do have some disadvantages though. They are generally considerably more expensive than microcontrollers, they aren’t very fast (compared to a classic arduino they are fast, but not compared to most STM32 microcontrollers for example) but their speed is rarely an issue since they can do everything in parallel, also more expensive FPGAs are faster generally. They also tend to use more power than doing the same thing on a microcontroller would use but again that depends on the use case, it is possible to simplify some tasks on an FPGA so they use very little hardware which doesn’t use much power especially if the task doesn’t need a processor in the first place.
      As a hobbyist the cost of FPGAs isn’t much of an issue, especially if you only need small ones. The cheap FPGA dev boards aren’t much more expensive than microcontrollers. Also as a hobbyist you will only be making a small amount of something (likely only one) so again the cost of FPGAs isn’t much of an issue. They are definitely worth learning and using though and can actually save you money too, instead of buying an expensive microcontroller of SBC just so it can do everything you need you could just use an FPGA instead and make it do everything you need.
      As for FPGA development boards sipeed are very good, they have everything from tiny ones with ~1000 LUTs and very little else to reasonably sized ones like the 138k with 138k LUTs and can plug into a PCs PCIe connectors and has DDR3 RAM built into the board with a built in processor too. A good middle ground is the 20k and 25k ones, they are big enough to implement decent processors on or a lot of logic and they have memory built in, like DDR3 or SRAM. The 9k is enough to implement processors on too though.
      For getting started you should start with learning digital logic first and then learn how to use the FPGA.

  • @timc3600
    @timc3600 2 місяці тому +1

    Is it bad that I recognised the BBC Micro Circuit Diagram within a second of it being put on screen.

    • @DoctorVolt
      @DoctorVolt  2 місяці тому

      Yes, it was the BBC Micro.

    • @timc3600
      @timc3600 2 місяці тому +1

      @@DoctorVolt I spent many days looking at that circuit diagram when I was young. I learned so much from that platform.
      Nice work on the Dev board.

  • @SurvivalSquirrel
    @SurvivalSquirrel 2 місяці тому +2

    1:33 3 primary modes? I count 5 ;-)

  • @hval9085
    @hval9085 Місяць тому

    build an oscilloscope based on Tang Nano 9k

    • @DoctorVolt
      @DoctorVolt  Місяць тому

      That's not possible, because the Tang Nano has no analog inputs.

  • @jaapjethee
    @jaapjethee 2 місяці тому +2

    You asked what you can make, how about making the 1 bit cpu UE-1 that Usagi electric is working on in his channel. It should de simple enough i think... Well not for me.

    • @MechanicaMenace
      @MechanicaMenace 2 місяці тому +1

      In HDLs it's not really any harder making a 64 bit processor compared to a 1 bit one. I think something like the SAP-1 (what Ben Eater made on breadboards) would be cool and more capable. And would leave plenty of room to implement peripherals like say sprite based video...
      Not shitting on what Usagi is doing btw.

    • @jaapjethee
      @jaapjethee 2 місяці тому +1

      @@MechanicaMenace true but is it easier to understand. For me i dont even understand how usagi's cpu works but i thought this might help. But why not do both to show the difference;)

    • @MechanicaMenace
      @MechanicaMenace 2 місяці тому +1

      @@jaapjethee it's not really easier to understand, just easier to build out of the building blocks (i.e. valves/tubes) Usagi is using. Whereas the SAP-1 was specifically designed to be easy to understand.

    • @conorstewart2214
      @conorstewart2214 2 місяці тому +1

      @@jaapjethee a 1 bit cpu isn’t really easier to understand, it is very easy to understand basic 8 or 32 bit processors once you break it down and look at what the individual sections do.

    • @conorstewart2214
      @conorstewart2214 2 місяці тому

      @@MechanicaMenace one of my first FPGA projects was following Ben’s videos and implementing his processor on a lattice FPGA. It was definitely worthwhile and it was good to figure out how you need to implement things differently on an FPGA vs with chips on a breadboard. For example the fact that you can’t use tristate buffers within an FPGA and you need to use multiplexers instead.
      Similarly “Nand to Tetris” is good although you use their own hdl and only simulate it, but after doing it that way it should be easy to implement it on an FPGA.

  • @vincanityl
    @vincanityl 2 місяці тому +2

    MCU do not emulate circuits. MCU are a processor (usually RISC) that have peripherals built into them. They do not emulate circuits. FPGA emulate circuits. They have these gates that based on programming set a logic operator to them. Also based on programming, they chain together. Hence the programmable gate array part. MCU is pure hardware. FPGA is basically hybrid hardware simulator. You can program an MCU on a FPGA but not the other way. Hence why there are SoC designs with both. Typically the FPGA reconfigures the MCU

    • @thanatosor
      @thanatosor 21 день тому

      Yeah, this is why FPGA is interesting. People tend to mistake MCU with it because they share the same level of hardware.

  • @poisonouspotato1
    @poisonouspotato1 2 місяці тому +4

    0:20 you say this like its some inherently bad thing.
    Also people should stop normalizing being forced to create an account to use an IDE without good alternatives

    • @alexcrouse
      @alexcrouse 2 місяці тому +1

      And they don't tell you how big the download is, and it's like 200k/s download... Not doing that on my wifi hotspot right now, guess i have to wait till i get home!

  • @Atmatan_Kabbaher
    @Atmatan_Kabbaher Місяць тому

    Yeahhhhhhh.
    I'm going to leave this to the people it actually makes sense to.
    Nice pipe dream but I comprehend very little of this.
    Thanks though.