Maker Mind MelD Summit

Jordan Christman – Getting Started with FPGAs

In this presentation, Jordan will describe how FPGAs work, and how you can use them in your projects alongside a microcontroller and microprocessor.

FPGAs is a fascinating topic because it entails the design of an integrated circuit using software tools after it has been manufactured and has left the fabricator.

You can program the FPGA hardware chip on your desk and configure what each one of several millions of gates inside the chip does.

There’s quite a bit of magic that is happening inside an FPGA, and Jordan will introduce us to this engineering magic.

Watch full video below

Click to play

About the speaker

Jordan is a graduate of the University of Dayton with a Bachelor’s degree in Electronic and Computer Engineering Technology. He also graduated from UD with his Master’s degree in Electrical Engineering. He currently has a patent pending for an electronic monitoring device.

He has strong knowledge in FPGA (Field Programmable Gate Array) development, Digital Electronics, Circuit Board design, and VHDL design and modeling of hardware systems.

His focus of study in school was embedded systems, which involve circuit design, firmware development, implementation of computer hardware, and the interfacing of computer operating systems.

His hobbies include mobile application development, layout, and assembly of PCB’s (Printed Circuit Boards), computer application programming, and anything related to electrical engineering.

Transcript

Peter Dalmaris: Hi everyone, and welcome to this session. I'm Peter Dalmaris, an online educator and maker, author of Maker Education Revolution, and founder at Tech Explorations. My mission is to help people learn electronics, programing, printed circuit board design, and lots more, but most important, to help as many people as possible to enjoy the technology education adventures.

Peter Dalmaris: In this session, I'm really excited to introduce you to my guest maker, Jordan Christman. Jordan is a graduate from the University of Dayton with a Bachelor's Degree in Electronic and Computer Engineering Technology and a Master's Degree in Electrical Engineering. Jordan specializes in Field-Programmable Gate Array, digital electronics, circuit board design, VHDL design, and modeling of hardware systems.

Peter Dalmaris: As a university student, Jordan became hooked in embedded systems and specifically in circuit design, firmware development, implementation of computer hardware, and the interfacing of computer operating systems.

Peter Dalmaris: I invited Jordan to be a speaker in this session because of his in-depth knowledge of FPGAs, a topic that fascinates me because it entails the design of an integrated circuit using software tools after the circuit is manufactured and has left the fabricator. You can program the FPGA hardware chip on your desk and configure what each one of several millions of gates inside the chip does.

Peter Dalmaris: There's quite a bit of magic that is happening inside an FPGA, and I'm glad that today I'm talking to Jordan, who will be able to explain what this magic engineering is and how FPGAs work. Jordan, thank you for joining me in this session. How are you today?

Jordan Christman: Good. I'm doing well. Yeah, excited. Thank you very much for having me.

Peter Dalmaris: My pleasure. I really can't wait, of course, to dive into your presentation. But just before we do, I'd like to ask you a quick question. What drew you to FPGAs and how did it start for you?

Jordan Christman: It started for me at university where I was taking a digital electronics course. And previous to that, I took a course in microcontrollers. So, working with microcontrollers, I understood how they worked. But as a new technology that I never worked with before, FPGAs kind of intrigued me. And kind of like you said, where you're able to configure the hardware to do certain things and the flexibility was what really kind of drew me to it. Just kind of getting an understanding of the complexity and everything was just amazing. The capabilities and things you could do, the high performance and things like that just really drew me to it.

Jordan Christman: Then, outside of school, once I graduated from there, I've worked using these things to do different image processing and digital signal processing algorithms. I just really kind of grew to enjoy and appreciate just everything that goes into them. So, it's just kind of some little toys that always intrigued me.

Peter Dalmaris: Yeah. It's really fascinating when I think about it, like I'm used to writing programs, and then you send the program to the CPU and it will execute it instruction by instruction. But the FPGA is very different, right? What's happening inside an FPGA? How does it work?

Jordan Christman: Right. Yeah. And that's kind of the big thing when you first start working with FPGAs, that's one of the things that took me. The biggest learning curve was realizing that when you write the VHDL or the Verilog, your hardware descriptive language, it doesn't execute line by line. You're describing the hardware. And everything's happening in parallel. Or depending upon how you describe it, you can make things happen sequentially, but it's it's more challenging. So, that was kind of the biggest thing.

Jordan Christman: When I first started working with them, I was like, "Okay. Well, this line happens first, this line happens second." And it's like, "No. That's not the case." You're actually describing the physical hardware that's inside of there. So, basically I'm getting inputs and I'm describing how these inputs are processed to get outputs. And it doesn't happen sequentially.

Jordan Christman: I think a lot of people, when they first start working with that FPGAs, the first big hurdle is understanding that the VHDL and the code that you're writing is not happening sequentially. It's not like writing a code for a computer or processor. It's different, which presents challenges, but at the same time also gives you flexibility.

Peter Dalmaris: Yeah. It's totally different technology. And I guess it's got its applications. Again, I use the word fascinating because it really is. Like, I imagine being able on my desk to create a one of a kind highly integrated and condensed chip with millions of gates, which is like transistors that contain transistors, but the logical unit where work happens. And it's a one of a kind and it can work at very high speeds, and I can put it sort of into my circuit and it can replace, essentially, the CPU or the microcontroller. Is that the idea behind FPGAs?

Jordan Christman: Yes, absolutely. So, it depends on the application. Some applications, and most commonly, you'll have a CPU and a FPGA working together. Because depending on what you're trying to do, an application just naturally work better on a CPU or a processor, things that need to happen sequentially. And it's just a lot harder to do that in FPGA. And, also, with FPGAs working with floating point numbers is a challenge. Working with the high -- point or double precision, the FPGAs naturally struggle to do that. It takes up a lot of resources.

Jordan Christman: So, if you have a CPU, it can handle those types of calculations and then feed to the FPGA where it can process it fast. And, really, they have high clock speeds. But, also, there are big advantages. They can do things in parallel. For example, if you're doing like an image processing, you can work on a thousand pixels in one clock. That single clock cycle, you can do one operation, but you're doing it in parallel. And that's really the big game.

Jordan Christman: Where on a CPU, even if you have, say, a quad core CPU or you're running with four different cores, you're FPGA, you might be able to do instead four things in parallel, you can do a thousand things or a couple of hundred things. You can do things in parallel is kind of a big win.

Peter Dalmaris: Well, I can't wait to hear more about it, so the visual floor is yours, as I say. Please tell us about FPGA.

Jordan Christman: Okay. We'll do. So, my slide show here is Introduction to FPGAs, where I'm going to walk through and kind of give a high level overview of what an FPGA is and the design process. And then, at the very end of this presentation, you will see a demonstration where I'll go through and create a very basic, simple project that will put on an FPGA development board. And show you just kind of the process of here's how you create the project, here's how you load it onto the FPGA, and then showing it actually working.

Jordan Christman: So, the first slide here is we're going to talk about what are FPGAs. So, FPGA, it stands for Field-Programable Gate Array. And like Peter mentioned, basically, you have a piece of digital hardware that you're putting on your circuit board that when it leaves the factory, you can reprogram it or you can reconfigure the hardware.

Jordan Christman: Previous to FPGAs, you would have to have this design nailed down or configured with actual integrated circuit chips, physical AND gates, NOT gates, all different types of logic gates on the circuit board where, in order to change that, it would require you to physically remove pieces off your PCB, remove IC components and restore them. Really meaning it's just not feasible.

Jordan Christman: With an FPGA, you can do that. If you want to change your hardware, it doesn't matter. You can change everything. It's a very flexible piece of hardware. And if you think about it, two different ways. You can think of them, basically, it's programable hardware, is number one. Two, an FPGA, it's a piece of digital fabric.

Jordan Christman: So, you kind of have a blank slate when you get an FPGA. If you want a logic gate, if you want a timer, if you want to implement an SPI engine or an I2C communication or UART, you can do all these things, but you just have to program the FPGA to do that, and we'll cover that a little later. But that's kind of the caveat with the FPGA is the complexity goes up, but you have all the flexibility you want. If you want to have multiple SPI engines or I2C engines, you can put as many as you want as long as you have the resources on your specific FPGA for that.

Jordan Christman: And, also, another with FPGAs flexibility they have, is, their pin outs. You can reconfigure pins to go wherever you want. So, when you're doing a board layout, that's really where that becomes advantageous. If you want to implement, for example, an SPI communication, you can pick whatever pins you want to use. You're not limited to, let's say, three or four different pins you can use for that communication. You can go whatever pin is available. And that kind of comes into the whole flexibility, and that's the main game or the main advantage of an FPGA is the flexibility of it.

Jordan Christman: And so, some use examples. I have a picture that kind of shows commonly just depends on what your application is. But a lot of times you will have a CPU or a microcontroller or microprocessor or something on the board with the FPGA, where they kind of work together. And you'll have some sort of communication between them, depending upon what your application is. Because there are certain things that CPUs inherently do better, and one of them I brought up was, like, floating point or double precision calculations. FPGAs traditionally struggle with that. And so, it's just a lot easier to do it on a processor where it can handle those types of calculations and then feed the appropriate data to the FPGA.

Jordan Christman: So, some common use applications where you'll see these FPGAs are if you want to do an image processing type of application. Because, really, when you're doing the image processing, you're taking an algorithm or a mathematical formula and you're applying it to all the pixels on a screen. So, when you have thousands or millions of pixels, you have to apply this to, if you can do it in parallel, you can gain speed or get it done a lot quicker time.

Jordan Christman: Another is ASIC prototyping. When you're trying to develop an ASIC chip, it's very, very costly. And if you make a mistake, you can't really change it. So, an FPGA has an advantage of you can actually prototype that by creating this ASIC prototype effectively, and VHDL or Verilog or your hardware descriptive language, and just run it on the FPGA and verify it works in an actual circuit.

Jordan Christman: And then, software defined radio, they're starting to use FPGAs in those as well, where they have higher end FPGAs that have processors built into them. And so, the reason these become advantageous is you can now change your encryption algorithm on the fly and you can do it really fast. So, if you have communications via radio and you need to change the encryption algorithm, you can do that in your FPGA.

Jordan Christman: And then, all types of digital signal processing, that's just kind of where FPGAs excel at these types of applications. And, really, your FPGA, it's going to come down to what type of application you're running in. If you're going to make that decision of do I want to use an FPGA, or do I want to go microcontroller, or do I need a combination of both?

Jordan Christman: So, any application that requires multiple tasks to occur simultaneously, an FPGA is going to excel at that because you're just limited by your resources. And if you have enough resources, you can do several things all at once independent of each other.

Jordan Christman: And the third point here, FPGAs are commonly used in conjunction with a processor. You'd have like an Arduino or some form of processor depending upon your application, you're going to have something that's typically communicating with the FPGA.

Jordan Christman: And so, for the development process of FPGAs is definitely slightly different than what you would do if you're working on a microcontroller or a computer or any other type of traditional software development. And so, I have two pictures. One that just shows FPGA design flow on the right. And on the left, we have the picture that I captured from Vivado, which is the toolset we use for Xilinx FPGA development. But what you'll see is that in the Project Navigator, they kind of have the steps you'll want to take through the development process.

Jordan Christman: So, the first step is you need to come up with your design, you need to figure out what is it you want to do. Define my design is going to have these inputs and these are the outputs. And so, in order to implement your design, you can do it through IP, which is just like intellectual property. But you can take an IP, which really you'll take a VHDL or Verilog design and you wrap it in a core. And I'll show you that in the demonstration what that looks like when you do that.

Jordan Christman: And then, you have this, they call it the text schematic or FSM, your Functional State Machine. And this is where you're just taking your actual design process of your hardware descriptive language, whether you're using IP cores or you're actually doing a schematic based design, or if you're doing a VHDL/Verilog based design.

Jordan Christman: And that comes into this, you'll have your IP catalog or your IP integrator. You can add files or basically all the stuff that you're using to describe. And if you want to put this in terms of, like, what a software development would be, this would be like your source code. Basically, this would be the same as your dot C files or your sketch in Arduino. Whatever you're using, this is your source code, effectively.

Jordan Christman: Then, the simulation step is the next step you'll take, and that is where you want to go through and just verify your design is working properly. Because when you're working with FPGAs, you don't really have a sort of debugging window per se where you can just stop at a breakpoint. Being we're defining hardware, we don't really have that. It's not executing line by line, so you cannot put a breakpoint in there. So, what you'll have to do is do a simulation to verify that if I give my design these inputs, what do the outputs look like? And that's kind of how you do a lot of the debugging.

Jordan Christman: And then, they have steps over here, the RTL analysis and synthesis. The RTL analysis is where you go through and just verify your design and say, "Okay. Analyze it." And it will estimate you're going to use X amount of resources, basically determine what your design fit on the chip you're targeting.

Jordan Christman: Then, the synthesis and implementation. Synthesis is like you're compiling your code and it's verifying that it's syntactically correct. So, synthesis is going to tell you if you have any syntax errors or if you're doing anything wrong, missing a semicolon, something of that nature. Essentially -- open error. Then, your implementation is where it takes the actual synthesized design and says, "Okay. Syntactically, your design is correct. Will it actually fit on this chip?" And that's going to look at your specified pin locations.

Jordan Christman: For example, you have two inputs tied to the same pin, you're going to fail on implementation because it's going to say, "I have two inputs tied to this pin. There can only be one." You'll get an error there.

Jordan Christman: So, the program and debug on there is actually program that the implemented design onto the FPGA and then it will take hold and run. So, that is kind of just a development process. You set your design, you simulate it, then you want to synthesize it, implement it, and then you program it on the FPGA and verify it's working. Like I said, we'll go through all these steps and the process where I show you the project.

Jordan Christman: Here we have a little table that shows FPGA versus microcontrollers. A lot of times when you're working with embedded designed circuits or anything of that nature, a big question is, What are we going to have be our main source of processing? Is it going to be FPGA or the microcontroller? If you want to add some sort of smarts to your design, you're going to have to have one or the other, something that you have the ability to program or talk to it and tell the circuit what to do, and make intelligent decisions.

Jordan Christman: And so, here I kind of went through some different features to kind of compare them just to see where they fall. Cost-wise, a microcontroller is definitely significantly less cost than FPGA. They've been around for a lot longer. And if you go take a comparable FPGA to a comparable microcontroller, the microcontroller almost always be the more cost effective solution.

Jordan Christman: In terms of power, microcontrollers are very effective in power management. They'll have a lot of these low power microcontrollers or you can put in a sleep mode where you can effectively be drawing micro amps of current. Where, if you're running off a battery powered application, a microcontroller will typically win out. FPGAs, definitely they consume more power, but also they sometimes require multiple power banks. Where, microcontroller, you can, a lot of times, get by on just a single 3.3 volt supply.

Jordan Christman: Whereas, with an FPGA, you might not be able to do that. Some other banks require 2.5 volt power supply, and even some will have an even lower in their core voltage will be like 1.8. So, you might have two or three power supplies who are supplying to the FPGA, which also increases costs. But, also, you're not consuming more power because typically they don't have these power saving solutions that you do in a microcontroller. You can't tell your FPGA to sleep. It's just its own doing its thing.

Jordan Christman: Processing power, depending upon the type of processing you're going to do. If you need to do a lot of things in parallel, the FPGA will definitely win out, you can do a lot of things. And that's kind of the main thing of the FPGA is that, since you're doing hardware, you can do a lot of things in parallel and they don't affect each other. And so, that's where you can gain a lot of processing power over a microcontroller.

Jordan Christman: For design flexibility, your FPGA is more flexible because you're only limited by the number of gates in that specific FPGA. If I have a feature or, let's say, a design, and I know that I need, say, 20 timers, I can put 20 timers on the FPGA as long as I have the allowable number of gates in there to implement that. If I need that in a microcontroller, I have to find a microcontroller that has 20 timers. Which, -- one, then, sure, microcontroller probably wins out. If there's not, then you may say, "Well, I might have to go the FPGA just because there's not a viable microcontroller solution."

Jordan Christman: And then, design time, the microcontrollers definitely win out on design time. If you think about it, the FPGA are starting with a blank slate. If I want a timer, I have to write a timer. If I want an SPI, I have to put that in there. Whereas, with a microcontroller, the timer is already there. You just start writing to a few registers and you're using the timer. So, design time, you definitely take a lot more time in the FPGA.

Jordan Christman: And that's kind of what the table shows. With an FPGA, you have flexibility and you can gain processing power, and the processing power just depends on your application. But if you have something that requires significant processing power and a lot of flexibility, such as custom design, that's where FPGA will typically win out.

Jordan Christman: And so, the development tools, the two main FPGA vendors out there that I've worked with are Xilinx and Altera, which is now purchased by Intel. Xilinx is using Vivado and Intel will use Quartus. And so, those are the two development tools you'll use to create your design, do the synthesis simulation, as well as programing onto your board. You'll use these tools to do that. And for the demonstration, I'll be using Vivado just because I'm using the Xilinx development boards.

Jordan Christman: But, effectively, if you work with Quartus, what you'll notice is it's all the same commands. You'll synthesize, implement, and generate programing file. It's just the buttons are located in different locations, but you're doing design flow for one versus the other.

Jordan Christman: And for debugging, I'm showing a screenshot here of when you're debugging the FPGA is what it kind of looks like. So, you'll have your design - and when I do it, I'll use ModelSim, it's a free tool provided by Mentor Graphics. And what it allows you to do is you take your FPGA design or your VHDL code or Verilog and you tell it what inputs you want to give your design and then plot the outputs. So, you'll say, I'm giving my design an input and what does the output look like?

Jordan Christman: And it's going to look like something you can see on the screen here, where you'll have different outputs that are toggling. You can see I got one that's a clock which is oscillating at a specific frequency. I've got another one that I've set to a number, it's a count, you see two, three, four, five, and it's just counting up. And you can kind of go through.

Jordan Christman: And that's kind of how you troubleshoot, if you see something's not right, your counter is not counting right or a value doesn't look correct, you'll have to simulate it right here. And this is kind of the debugging of an FPGA. And this is where it's a bit more challenging, but they have made leaps and strides as far as their debugging and simulation capabilities with the new tools.

Jordan Christman: So, using Vivado, they have a simulator built in, so you don't have to use ModelSim. The Vivado's cool. You can go ahead and do the simulation as it stands. If you're going with Quartus, you'll have to use ModelSim. But when you download Quartus, ModelSim comes with it.

Jordan Christman: So, here I want to go through just a few different FPGA development boards. These are some ones that I would recommend and these are ones I have as well. So, the first one here, I'm going to talk about just the Basys 3 Development Board. And if you go to Digilant's website and if you check on the speaker bio, I have the URL for that. They have a lot of different FPGA boards you can check out. And each one of the boards, they have a datasheet that they provide and they give really good descriptions as far as what's on that board.

Jordan Christman: So, for this one, I'll quickly kind of go through it and show what they would give you. So, for the Basys 3 board, which is one they recommend for introductory FPGA uses, if you're wanting to kind of cut your teeth on it or get used to it, it's a good board to work with. So, on here, they got side switches and they've got push buttons, and your seven segment display, just kind of standard stuff you can work with, and, like, 16 different LEDs.

Jordan Christman: These are kind of nice little quick projects you can say I just want to light up an LED, or I want to push a button and see an LED come on, or I want to see a counter go across the seven segment display. It's great in that. It allows you to do those types of testing.

Jordan Christman: It also has a VGA controller, so you can do a bit more advanced things. If you want to display images on a screen, you can do that. It's got the capabilities of doing things like that.

Jordan Christman: Also, this is one thing I want to point out, they have the Pmod ports, which is a callout 2. And what that is, it's basically a peripheral board you can add on. So, Arduino has their shields, you can add on top of them. This is just a modular design that you can plug in to these FPGA development boards. So, if you search for Pmod boards, you'll see they have a whole variety of them like Bluetooth, WiFi, GPS, or any other sort of thing you want to interact with, you can plug into there and interface it with your FPGA.

Jordan Christman: And a few other development boards to check out, these are ones I recommend as far as they're good for beginners, but they also provide quite a bit of processing capability and that you can kind of go from beginner to advance. They have lots of small things like LEDs and displays, but they also have powerful things like Ethernet or HDMI or some other more powerful things you can do if you want to take it from start to finish with one board.

Jordan Christman: And so, I have two of them here. The DE Development Board Series, these are provided by Terasic. And these are the Intel Altera FPGAs what they have on their DE Series, the DE1, DE0-Nano, and the DE10-Nano. Then, for the Xilinx Series, they have their Arty Development Board Series. They've got the Arty Z7, A7, and the S7. And the key thing to note with the Arty Series as well as with the DE0 and the DE10, they have headers that fit the standard Arduino Uno Shield add-on. You can just plug them directly into there. So, any shields you have, you can interface with these FPGA development boards.

Jordan Christman: And then, if you go to check it out on the website, they'll kind of explain all the different peripherals they have. But they include the Pmods and other headers you can plug into to interface with external circuitry and components.

Jordan Christman: And so, the next we'll go ahead and I will show you the product demonstrations. I'm going to run through and do a project using the Vivado toolset.

Peter Dalmaris: Awesome.

Jordan Christman: Hello and welcome to the Buttons and LEDs Arty A7 Demonstration. In this lecture, I'm going to show you what the buttons and LED project should look like running on the Arty A7 Development Board.

Jordan Christman: Here, we have a development board which is programed with the completed buttons and LED project. And for this project, what we're trying to do is enable the following, the four LEDs on the Arty A7 Development Board based on when we press a push button from Button 3 down to Button 0.

Jordan Christman: Now, we also have the Enable, which we've tied to our Switch 0. So, when we're enabled, we want to be able to push the button and have the corresponding LED light up. However, if we're disabled or not enabled, we want pressing the button to make nothing actually happen.

Jordan Christman: So, let's start by pressing the button. And we'll notice that when we press Button 0, the LED 0 or the LED on the farthest right turns on. So, if we press, we get the corresponding LDE lights up. If we press the second button, the corresponding LED lights up. And the third corresponding, as well as the fourth button. Now, we can press two buttons at once and get multiple. We can press just various buttons. Any amount of buttons we press should be output on the LEDs.

Jordan Christman: Now, if we disable by pulling the Switch 0 to high, we now go ahead and press the button, nothing happens. And that's because we're saying when we're unenabled, when we're not enabled, we're forcing the LEDs to be zero. So, by disabling them, we're not controlling them at all. These buttons do nothing.

Jordan Christman: So, we'll go ahead and pull back down, and we'll notice again that as soon as we pull the slide switch back down to zero, we enable our design and all of the LEDs light up when the corresponding button has been pressed.

Jordan Christman: And so, that's the demonstration of how the buttons in LED project should look running on the Arty A7 Development Board.

Jordan Christman: Hello and welcome to the Vivado FPGA I/O Placement Lecture. In this lecture, I'm going to show you how to place the I/O that we'll be using for our design on the Arty A7 Development Board within Vivado.

Jordan Christman: So, at this point, our project is completed where we have the VHDL design is completed. Now, we need to specify where the items we have defined in our entity, specifically the LED Out, the Button, and the Enable. We need to define and specify where these are located on the actual FPGA device. So, specifically what I/O pins are tied to the LEDs that we're going to be using.

Jordan Christman: In order to do that, we need to add what we call a constraints file, which has the extension dot xdc. So, if we go into constraints, we can see that once we expand it, that we have no constraints in our project. So, we need to right click and go to Add Sources. And make sure you have the first selection, the Add or Create Constraints, and we'll click next, and then you want to click on the Add Files.

Jordan Christman: At this point, you just want to navigate to the constraints of all that I have provided, it is the master constraints file for the Arty A7 Development Board. So, go ahead and navigate. Click Okay.

Jordan Christman: And then, you want to make sure you have this copy constraints file in the project. And, basically, as it tells you here on the tool tip, "Make a local copy of these files into your project directory." So, we'll go ahead and click Finish. And after it updates, we can now see if we expand our constraints. We have this Arty_A7_master.xdc. So, if we double click it, it'll open up the XDC file, and this has all of the I/O on the Arty A7 board that are defined, and you just have to uncomment the ones you want to use and rename them.

Jordan Christman: So, for example, if we go to our button LED, we know we have this LED Out, so I'm going to copy it and it's going from num buttons minus one down to zero, so it's going to be from three down to zero. And if we go to our Arty A7, we have the RGB LEDs and we have our standard LEDs. Now, the standard LEDs, they named them from three to zero. So, we just have to replace this LED with the LED Out. And that will then map our LED Out to a location.

Jordan Christman: So, if you look at the actual syntax of what's going on here, it says set property package PIN H5. So, we're telling the tool, Vivado, when we go ahead and generate our bit file that we're going to use to program the board, we're telling it to make package PIN H5 to an I/O standard of 3.3 volts, and we're setting the ports to LED Out.

Jordan Christman: Now, this I/O standard LVCMOS 3.3, you will not change this because this is already defined by the board and it's defined by which banks are powered on the actual FPGA device itself. And so, since we're not doing a board layout or changing any of that, the package pin I/O standard will stay the same. The only thing we're going to change is the actual name.

Jordan Christman: So, before it was LED, we just changed it to LED Out. So, we have LED Out from zero to three and we can go ahead and select all those lines and click the uncomment. So, now that we uncomment, we can see the set property and the get ports. The key words have been highlighted. And we'll go ahead and click Save.

Jordan Christman: So, at this point, we've got our LED Out has been mapped to the actual LED outputs. Our Button In now needs to be mapped. So, we'll click, do a copy, go to our XDC. And we have Button In from three to zero. So, just like we do with the LEDs, we want to replace the BTN with the the I/O we have specified in our entity. So, paste, we change it to Button In. And do a paste again, and we'll do that for all four of these here, so paste, paste. And then, once again, uncomment. You can click the uncomment line or you can just backspace the hashtag, it's what generates a comment. And here's the one that has the hashtag, it just ignores everything after that. And we go ahead and click Save.

Jordan Christman: So, if you would look through the rest here, you can see we've got the RGB LEDs, the switches, the input clock, all the different Pmod headers, I got JA, JB, JC, and JD. And then, USB, UR interface, the chip kit digital I/O. So, all of the I/O that are available on that board, we can access them through here. They have all of the different specific I/O pins that tie to the interface, so for the Ethernet, the QSPI Flash, power measurements, so on and so forth.

Jordan Christman: So, if we go back to our design, we now have LED Out, a Button In, so we just need to tie our Enable. So, if we right click and copy, we need to pick what do we want our Enable to be tied to. So, we know we want through one of the slide switches. And if you look, it tells you on the schematic, it's Switch 0, which the name here is Switch 0. So, there's Switch 0, 1, 2, and 3. And Switch 0 is the one that's farthest on the right on the Arty A7 Development Board. So, we're just going to pick that and cover the entire and hit paste.

Jordan Christman: Now, a key thing to note here and I want to point out, our Enable was a standard logic. So, our Enable is a standard logic data type. Our Button In and LED Out are standard logic vectors. So, since our Enable is a standard logic, it's just a bit of one. If we look at our XDC file, we'll see that we don't have a bracket to say zero because there's just one, so you don't need to do that.

Jordan Christman: However, for example, the LED Out and Button In, which are standard logic vectors, they have four elements. So, in order to access each of the elements, you put the brackets with the number, so from zero to three, you put the bracket in there to tie to that specific bit of the standard logic vector. So, we'll go ahead and uncomment our Enable. And so, now at this point, our design is ready to generate a programing file.

Jordan Christman: We have the VHDL design completed in here. We have all of our inputs and outputs on our port defined in our XDC file. Now, our generic does not need to be defined in our XDC file because it's not an in or an output and it's not tied to any specific pin on the actual FPGA. So, that is everything you need to do in order to map or place the I/O for your FPGA in Vivado.

Peter Dalmaris: Thanks, Jordan. That was really good. I really enjoyed it. I've got a much clearer understanding of FPGAs. But as you were talking, a few questions popped up in my head and I wrote it down. So, if you don't mind, we've got ten minutes to go through them.

Jordan Christman: Yeah, absolutely.

Peter Dalmaris: All right. I always have questions about these things. So, one thing that I understand now is that FPGA programing is really hardware programing. The idea is that you use software tools that integrate development environment that you showed us to program the FPGA array or the array that is inside the FPGA chip.

Peter Dalmaris: And that's essentially like I imagined it, but some kind of rewiring is taking place and the functional components that we have designed in the IDE. And now realized in the chip itself so that a bunch of gates now becomes the I2C module. And then, that bunch becomes some kind of parallel video processing engine. And then, this bunch of gates becomes a counter. Is it kind of what is happening?

Jordan Christman: Yeah. That's exactly what's happening. -- tool you're just using VHDL, Verilog, or some hardware descriptive language to basically tell it how do I want these gates to form. And then, it generates a programing file, if you will, a bitstream file that gets loaded onto the array and that hardware starts taking effect.

Peter Dalmaris: So, you have the hardware. Now, do you need an additional layer of programing on top of it, like some kind of firmware, for example? Or can you build it so that as soon as you apply power, the FPGA now being programed just starts to work and the counters will work, for example?

Jordan Christman: That's a good question. And that's another very good point -- because that's another common thing. When you power on the FPGA, you configure it. Now, you remove power and you power it back on. Some of them are different. But for the most part, as soon as you do that, it will lose that configuration. So, what they require is a separate chip on the board, a memory chip. And what you do is the FPGA, they have certain pins that tell it what does it want to boot from.

Jordan Christman: So, when you're using the development boards, you'll tell I want to boot from JTAG. So, when it powers up, it looks for something coming over JTAG or a programing interface that you will then program it. You can also look for something over just a QSPI Flash chip. So, when you go to manufacturing, you would take your programing file and load it onto the external flash chip. Then, you would tell FPGA to look for the configuration on the flash chips when you power up. So, there will be a little delay and they tell you in the datasheet there, but it might be a four or five millisecond or ten millisecond delay when you first power up, and then it takes configuration, and then your hardware takes effect.

Peter Dalmaris: Wow. Okay. I did not realize it. I thought that it would be whatever configuration you gave to those gates in your programing that would persist. But it works more like RAM, so it loses power, it forgets the program, then you've got to reload it when you boot it next.

Jordan Christman: Yes. And all of them are different, but I would say probably 95 percent of them, you have to do that. I know the MAX10 series, they have that flash. They do the same thing, but that flash is located on the actual FPGA die itself. And the thing you're just programing the flash on there. But yes, that's --

Peter Dalmaris: Saves you a step and saves you from having to provide the external hardware to load the program from.

Jordan Christman: That's correct.

Peter Dalmaris: Right. Yeah. You did say that this is relatively new technology so these things are being worked out, I guess. But I can see the positive of that as well. One of my questions was whether it's possible to reprogram an FPGA so that you can reuse it. But from what you've said, I think the answer is obviously yes, you can reprogram it.

Jordan Christman: Yes. And that's another reason a lot of times they'll put a processor on the board with the FPGA. Sometimes the application, what they'll do is they'll have the processor read the FPGA configuration off the external flash chip that it might be using anyway, it'll pull that and that processor will actually program the FPGA. So, they interface there. The FPGA usually have several interfaces for programing, and you can hook a memory chip directly up, or you can go through your computer via JTAG, or you can have an external processor which implements a JTAG emulation to program it.

Peter Dalmaris: Yeah. So, that's why you said that apart from the fact that FPGA is really good in a few things and really bad in other things that's why they are a very good complement to a microcontroller or a microprocessor. And the additional benefit that you get when you combine these two things together is that you can kind of simplify your hardware by using the processor or the microcontroller to do the initial programing once off at boot time. And from that moment onwards, you've got the microcontroller/microprocessor, CPU plus, the FPGA, which is specialized for a specific task or specific tasks like video processing.

Jordan Christman: Yeah. That's exactly it. That's the reason why you usually have both. Just for that fact of FPGAs, they're good at what they do. But if you start to try to apply them to broader things, they start to have struggles with certain things.

Peter Dalmaris: I'll ask you about applications a bit later. But I've got a couple of other questions first, like at some point in one of your slides, you mentioned something called the IP catalog out of the process. I think it's a component of the IDE that you use with FPGAs.

Peter Dalmaris: So, in my mind, the IP catalog is a little bit like a library in the Arduino IDE or even the language itself. It contains definitions for things that you want your FPGA to do. Like, for example, if you want to implement an RS-232 port, then you go to the IP catalog, you grab that component, and you drop it onto your design or onto your IDE. Is that how it works? Is that what the IP catalog is?

Jordan Christman: Yeah. That's exactly right. That's a very good reference to it. It's exactly like a library in the Arduino. You include the header file to say, "Hey, I want to include this library." Add that, and then you just provide the function call to it. Effectively it's the same thing. It's to test the design that you dropped into your design.

Jordan Christman: For example, you have an RS-232 communication that you've previously worked out in previous projects and you want to reuse it on this one. You just drag and drop it in, provide the connections, and then it's already been simulated, tested, and verified. So, yeah, that's exactly it.

Peter Dalmaris: So, I guess, like with the Arduino and the programing that we are more familiar with, you can borrow other people's components through something like the IP catalog and these are tested components. You can trust them. But can you also go to, like, the gate level yourself and go berserk there and start, you know, implementing some brand new totally never seen before functionality on an FPGA outside what's available in the IP catalog?

Jordan Christman: Oh, yeah. Absolutely. You can create your own, basically, components in the IP, so you'll have your IP catalog. Or when you download the tool, they'll give you default ones that come with it. Just some standard like timers, communications, UART, and stuff like that. And if you want to create your own code, just my crazy IP, you can do that. And then, you create the component, add it to your library, and then you can drop it in. They call it -- the same concept.

Peter Dalmaris: Repository. Are those things available in places like GitHub or so people's websites or you can say, "Hey, I made this. I can share it."

Jordan Christman: Yeah.

Peter Dalmaris: So, same principle then.

Jordan Christman: Yeah. Same principle. If you check out Digilant, where they have those development boards, they have a GitHub page with their projects and you can download some of their IP and start to use it. And that's where you come into, you know, previously tested. Yeah, you can pull that stuff down that somebody else's said, "Hey, I built this and I ran it on this board. Here you go." You can pull it down and go with.

Peter Dalmaris: A couple of other things, so you've got an FPGA chip, it's got a number of gates that are available to utilize in your design. It could be, I think, they're going to the millions, right?

Jordan Christman: Yeah. Yeah.

Peter Dalmaris: If I wanted to implement something like, let's say, a blinking LED. So, every Arduino person knows about that, its applicability. How many gates with a blinking LED take up that just blinks the every half-a-second on and off constantly? That's it. Would you get an idea of, like, how intensive it is in terms of gate utilization?

Jordan Christman: Utilization would be - I'm trying to think. I don't know the number of gates exactly.

Peter Dalmaris: Just ballpark. I want to know, like, my 50 million gates, how far would they take me in terms of what can I implement it? Like, if I can only do an RS-232 port in 50 million, then probably not going to be very useful. But I guess it's certainly not the case, but just a ballpark.

Jordan Christman: Yeah. So, I would say, if you're in the blinking LED, you're probably a handful of gates. Just like a handful, I think. Usually it will give you that utilization. Yeah, you're just a handful, maybe four or five if that. For example, even if you talk and say, I want to blink all 16 LEDs on my board off and on, you're going to be less than one percent utilized. It's small.

Peter Dalmaris: There you go. Is 50 million like a typical number of gates in today's FPGAs, like modern generation?

Jordan Christman: So, there's actually quite a wide range. You can go on the lower end, where the lower end might have like, say, 2,000 gates. But your high end will have 50 million or more gates. And typically your high end ones are what you'll see used in, like, image processing, or possibly a cell phone tower, or something like that where it has to be -- in these processed, or a network processing center might use something with a 50 million gates. The 2,000 gates might be more in the realm of stuff that we would possibly use.

Jordan Christman: Or depending upon, like if you're wanting to do, let's say, an RS-232 communication, several timers, and several LEDs you want to control, and reading several temperatures, or interfacing digitally with some temperature sensors, something of that nature, you know, a couple 100 or 500 or, like, 2,000 gates is probably the world around you want to be in. You do have quite a wide range available.

Jordan Christman: Now, with the lower end devices, I typically find it harder to find development boards that have them on there. A lot of times development boards have a lot larger devices just because they want to count for if you want to do this or you want to do that, you just don't really ever have to worry about -- space.

Peter Dalmaris: Yeah. Because in the board set you showed us, I think the actual FPGA was soldered onto the board. You can't change it later. So, you might as well go for a larger one so you can play more with it.

Jordan Christman: Yeah. Absolutely. And that's one thing, too, once you verify your design on a larger one, you can look at what is your resource. Like, I'm only using 10,000 gates, but this is a 50,000 gate device. I can get by with the 20,000 or less and not have to worry the risk to make changes.

Peter Dalmaris: Is a memory on board? So, if you are running an application that needs to remember, like sensor data, for example, or button press history, is there some kind of memory like RAM on board?

Jordan Christman: Yeah. A lot of them, they'll have on board RAM that comes for free because it's just on the actual die itself, the FPGA die, so you can use that. Or you can also create your memory if you want. You design memory and you write to it and read from it. You can create your memory. You know, say, "Okay. I've got my application. I want to store this here in it's memory." Or you make a register and store your value there. So, yeah, you definitely create the memory or you can use what they have on the board there as well.

Peter Dalmaris: It's so flexible, like, make your own memory. If you want, like, a kilobyte or thinking about it, as long as you got enough gates, you can make it.

Jordan Christman: Well, yeah. And that's the other thing, too, when you work with them, once you get involved and then kind of more advanced applications, you can get to where you can start implementing your own processors on there. And they have in the toolsets themselves with a free included, you can drag and drop in the IP catalog. But they'll have a soft core processor that you can figure and tell kind of what you want to have, and you'll specify how much memory, and they'll kind of tell you a rough estimate of how much resources you're going to use. You know, more memory is going to use more resources, more gates per se, but it's just right there so you just create it and you can do that.

Peter Dalmaris: The FPGA I'm talking about, is it a tool that, say, integrated circuit design is used to prototype functionalities before they commit to building a huge batch of those chips? It's like a prototyping tool.

Jordan Christman: Yeah. They actually do for ASIC prototyping. For that specifically, because I think when they create the ASIC chips, they'll use a hardware descriptive language, and we'll use that as a prototyping. Absolutely. Because then they put that circuit and see how it will respond and how it handles all of those types of things to make sure digitally it's functioning correctly,

Peter Dalmaris: Digitally. And in terms of speed and performance, it'd be kind of closer. It's not really optimized, I guess, but it's not running a program that is executed in a CPU. So, I guess performance-wise would be much closer to the actual hardware.

Jordan Christman: And that's where the fabrics of them can run various speeds. But, like, if you go with a high end processor and a high end FPGA, typically, your high end processor can probably run at a faster clock speed. But with the FPGA is that you can do them in parallel. You know, I can do ten at once. But it depends on the application too. Some algorithms you can't do them in parallel because one step is required before the other one. And that's where kind of CPUs does some things just naturally are better. It happens sequentially. But something you can do in parallel, this is okay. That makes more sense.

Peter Dalmaris: Yeah. Amazing. So versatile. I've got another question. I'm just almost finished with my list here. Sorry it's pretty long.

Jordan Christman: No, it's okay.

Peter Dalmaris: So, in one of your slides, you showed us prototyping boards that had headers for Arduino Shields. So, I wanted to ask you about maybe some examples of FPGAs that we use either alongside in Arduino or to implement some kind of project that normally you'd use in Arduino. Like, it could be just plugging on an Arduino Shield and then programing the FPGA to use the components of that shield. But could you give us one or two examples of Arduino projects in the FPGA world that you are aware of?

Jordan Christman: Yeah. So, I know they have various examples of them out there. If I think of ones that I'm familiar with, I know one case in point would be they use on the Arduino the NeoPixels is what they call them, they're like RGB LEDs or an LED matrix on there. They'll use an Arduino to do that. And the FPGA sometimes can do pretty well with that because they can do things in parallel so they can kind of handle that sort of without eating up a bunch of your, say, processing time.

Jordan Christman: Because every time on the Arduino, you have to -- or a process you loop through and have to update that where the FPGA can kind of handle that, and you can also do a different task simultaneously. So, if I want to update my matrix, I can do that the exact same time I'm getting information from a SPI communicator, wherever, you know, the exact same time. Where, in a processor like an Arduino, you have to do one, then do the other. You can't do both at the exact same time.

Peter Dalmaris: Yeah. So, that's where parallelism comes in. With an FPGA, you can control each RGB LED on the NeoPixel array or strip. I think they are actually addressed. And you can do that one-on-one. We can switch all of the LEDs at the same time. There's an application that works on an FPGA much better than it would on the Arduino because it's more of a sequential device. I'll check that out to see what we'll do with this particular development boards [inaudible]. Great.

Peter Dalmaris: Okay. The last question - the last three questions, actually. So, what are the three or four key learnings from your presentation that the viewers should take home with them to remember? Like, the most important points of your presentation?

Jordan Christman: Yes. The most important points, I would say, one is understanding that when you're working with an FPGA, you're describing hardware. That's definitely number one point. Number two, when you're working with FPGAs or a hardware descriptive language, things don't execute sequentially. It doesn't happen line by line. Those are two big things I know for myself.

Jordan Christman: When I first started working with them, that was the biggest hurdle for me. It became a, "Well, if I'm specifying this AND gate at the top of my VHDL file, wouldn't line 47 execute before line 50?" And it's like, "No. It doesn't matter. You're just telling it." An AND gate is an AND gate whether you specify it here or there, it doesn't matter. So, those are two key things.

Jordan Christman: And a third one is FPGAs excel at parallelism. But that doesn't mean they're always the right solution for the project. And that's kind of the other key thing, too, I think some people get caught up on I don't want to use an FPGA or I want to use an FPGA. And it's sometimes you got to look at the application, some applications that make sense, some applications that don't.

Jordan Christman: And that was kind of when I went through that table to show that it depends on where the application's performance is optimized. You care about performance, don't care about power and cost, or do you care about power cost, or there's tradeoffs to them, obviously. So, those are probably the key things to takeaway.

Peter Dalmaris: Yeah. Thanks. What you said, your second point, is very interesting because it happens often. You switch to a new technology and you really have to reprogram your brain to be able to use it because it's so different to what you are used to.

Jordan Christman: Yes.

Peter Dalmaris: -- I see. Okay. Now, for those of us that would like to learn more about FPGAs - and I'm one of those people - can you recommend a few resources? It could be reading resources or tools that you would recommend for us to be the first FPGA tool. What's the first step for us?

Jordan Christman: So, I would say as far as for tools, one, I would pick out a development board, and I recommend either going to Digilant or Terasic, or anywhere you find one. Pick a development tool and then download the required IDE to work with it, whether it be Vivado, Quartus, or the two I'd recommend, they're the most common. And at that point, if you go to either Terasic or Digilant, they have example projects on there. They also have tutorials that kind of show you here's a start for everything to say come in here and work with projects, and to just kind of playing with them.

Jordan Christman: I mean, effectively starting out with a project where you just want to blink an LED, that's the first step. Once you can do that and you say, "Okay. I can build on that, and how can I integrate this slides, which is how can I integrate push buttons or more advanced peripherals?" Kind of take it one step at a time.

Peter Dalmaris: Just do it.

Jordan Christman: Yeah. Just do it.

Peter Dalmaris: And I think you are an instructor, so you have video courses on FPGAs, we can link them below the video for anybody that wants to check them out. But they're very good. I know they're very good.

Jordan Christman: Yeah. Absolutely. And in there, I go through all kinds of different projects in there, where we start with some that are very basic, you know, just blinking LEDs or pushing buttons. Then, we get to some that are more advanced of how to implement your own UART controller, you can do that. Or if you want to interface with the temperature sensor, you can do that. Or if you want to put your own software processor on there, we go there. So, it's kind of a wide gamut of you can start small and really grow as much as you want. Definitely check out some of those, we kind of cover the whole suite of them and all kinds of different boards as well.

Peter Dalmaris: Definitely. Yeah. We'll include information about this. Speaking of you now, if people want to get in touch with you, what's the best way for them to do it?

Jordan Christman: Various ways. My email, which would be provided, you can send me a message there, and connect with me on LinkedIn and send me a message there. Those are two ways to connect with me. And, also, I'm an instructor on Udemy, if you're a student in one of my coursed there, you can send me messages through that as well. So, those are probably three of the best ways to contact me with any questions or if you have any inquiries.

Peter Dalmaris: Plenty of ways these days to get in touch with anyone.

Jordan Christman: Yes. We live in a connective world.

Peter Dalmaris: We'll have all this information just below the video in this page. Well, Jordan, it's been a pleasure. I really enjoyed this session. I've got a much clearer understanding on FPGA, so I thank you for being my guest.

Jordan Christman: Yeah. Thank you for having me. I really appreciate it as well.

Get life time access to all Maker Mind-Meld masterclasses

Watch each masterclass from the comfort of your own home and learn about their tools, techniques, and thinking processes so that you can become the best maker you can be, at your own pace.


Get audio downloads of all 22 session, the Maker Mind Meld "Playbook" session notes.

We publish fresh content each week. Read how-to's on Arduino, ESP32, KiCad, Node-RED, drones and more. Listen to interviews. Learn about new tech with our comprehensive reviews. Get discount offers for our courses and books. Interact with our community. One email per week, no spam; unsubscribe at any time

Image
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}