This is Hardware Black Magic, Building Devices with FPGAs. My name is Rodney McGee. I'm just the first speaker. Everybody up here should be at least at some point interacting with you. This is a three-hour talk, kind of a long talk for DEF CON, but we try to have enough demos and stuff to keep it interesting. Our research group is called C-Vorg. We're from the University of Delaware. It's in Newark, not Newark. That's New Jersey. So our interests actually are in custom hardware, high-speed interconnects, basically designing custom chips. We do a little reverse engineering, a little hardware red teaming, security, and a couple members of a group that works with us do network security. Actually, at C-Vorg, we try to learn things outside of our discipline. We find that it gives us a lot of inspiration and that really puts you ahead of other people who are just learning by the book. I mean, believe me, we have a lot of books, but you have to kind of put things together in a way that really gives you insight and to do something novel. And we're all about hardware. Even if it's about software, we still always come back to hardware. Traditionally, a lot of DEF CON has been focused on hardware, but if you've heard of it, you've been to the con the last couple of years. You notice there's been more hardware and a lot of emphasis on learning hardware every year. One of the things we like to say is, you know, fundamentally, no matter how good your software is, you cannot do a secure implementation on fundamentally unknown or insecure hardware. You can't make any assumptions, no matter how many levels of distraction you have. If your hardware is flawed, there will be some vulnerability introduced there. And the reason why I said here, fight to understand how your hardware works, is because a lot of you are probably big open source guys, and you understand the dangers and the pitfalls of closed source software. But a lot of us easily accept, almost as a cost of doing business, closed source hardware. Using hardware that you basically understand nothing about, have no data sheets for, maybe you don't even know its function. And that's something that is not completely unavoidable like closed source software, but I think we can make it the kind of strives in hardware that we've made in the open source community over the last years and really introduce a whole new level of understanding for hardware for the masses. So what we're going to be talking about today, specifically to kind of get there, is FPGAs. You know, I'm sure a lot of you have heard of FPGAs. A lot of you have put firmware on things, maybe edited firmware, done something custom, make something do something that it wasn't meant to do. HDL, Hardware Descriptive Language, basically lets you design the hardware that you want, not the hardware that you have. FPGAs are flexible in that way. So we're actually going to be covering a lot of different things. I'll be covering basic FPGA and digital technology. We're actually going to be having contests throughout the thing for giveaways. We got some FPGA demo boards. We got some Intel swag. And we actually have a netbook that we got from Intel to give away. And that will actually be the last talk there. We're going to go through the Xilinx software for designing FPGAs. We're going to show demos for that. We're going to show GHDL, which is actually an open source way that you can learn how to code hardware descriptor language. Then we're going to talk about the EDK, which is the next level up in far of it's a little bit more extract. You can actually write C code that runs on an FPGA. And then we're going to talk about, Furcon's going to talk about running Linux on an FPGA. And we're also going to talk about hardware from Altera, or actually software from Altera and some hardware demo board that they sent us. And at the very end we'll announce who won the netbook. So let's start out with what is an FPGA. So an FPGA is a, obviously it's a semiconductor, it's a chip, but specifically it's a field programmable gate array that contains logic blocks that can be reconfigured. This basically allows an FPGA to be any kind of device you can imagine, obviously within the constraints of the actual FPGA itself. There is speed limits, there is complexity limits, and the more you spend on an FPGA, the more you'll basically get out of it. FPGA design covers, modern FPGA design, this is kind of new, actually covers hardware and software design. So that's why I started talking about the EDK. You can actually write C code that runs on a microprocessor that you actually instantiated on the chip. And so if you're not familiar with FPGAs, you may not know that there are a lot of different things. If you have Verizon Fios, every one of your set-top boxes has an Altera FPGA, even in the HD boxes. Lots of networking equipment uses FPGAs, and the reason why they do that is for flexibility. A lot of times you'll have a card that'll plug into the front, and on the back plane, they'll actually have FPGAs that basically allow it to be a totally different networking standard. Also boring things, even like printers, printers have FPGAs. Another talk going on right now is the GNU radio talk. Pretty much every software-defined radio, or most really good ones, have a FPGA on them, and lots of analog digital converters. Digital to analog, actually. And even like large integrated systems like an F22, you might think, well, they have the budget to design their own chips. They don't have to use Phil Gramel chips. But actually, the flexibility that FPGAs give you, they'll even use them on projects that you have a large budget for, so you can find them there. And one of the other uses for FPGAs is hardware accelerator cards. ShmooCon is actually a hacker conference out in DC, and a couple years ago a guy gave a talk on cracking WEP and WPA keys with FPGAs. And you can see the speed up there between, this is just running on a PC, there's two different processors. There's a PS3, which has actually like six, what they call SPUs, for doing parallel processing. And there's actually a fairly middle-of-the-road, kind of low-end FPGA, and that's how many keys it's able to get through. And the same story with WPA. There's actually two different models of complexity of FPGAs. They're just basically about the same size, but they have more parallel units in them that you can take advantage of. So FPGAs can basically help you a lot, in that kind of sense. So what are your choices for digital system development? Well, you can get a high-end processor. They're really easy to write code for. I mean, there's endless languages and endless environments that you can code for processors. The newest and the best ones are expensive. The performance, when I say okay, what I mean is normally on a processor you're not utilizing the whole thing. Even if you're utilizing all the cores in your modern processor, there's a lot of units that are sitting there unused, and they can be fairly power-hungry when you're actually using them. Of course, they've come a long way with sleeping for laptops, being able to get a lot more hours out of your usage. And then there's something kind of new, actually, that's coming up in the next couple of years, is specialized parallel hardware. Of course, OpenGL has been around forever, but that was very specific usage. That allowed you to do massively parallel video systems. So, you know, basically playing games, doing 2D, 3D rendering. But something new, kind of, is NVIDIA came out with CUDA, and it got standardized around OpenCL. And what that allows you to do is basically bring the power of the parallel processor of a video card into the desktop world, so that you can basically take advantage of the hundreds of different parallel processing units on a video card to basically do operations that are not very single-threaded. And if you know that next to the processor, these things can be, like, pretty hefty power, power-hungry monsters, too, actually. But what you're somewhat restricted is the structure. They're still fundamentally designed for doing video card stuff. So if your parallel problem can be fit into that kind of problem, then they're great. But if not, then you're going to run into some flexibility problems. So that's actually kind of exciting. And for a lot of people, that's going to bring a lot of parallel performance to computers over the next couple years. And actually, the next option here is an ASIC, which, that's basically a custom chip. So big companies who do high volume, they design their own chips that do exactly what they want them to do. They're very high performance. They're basically the best performance you get. The entire chip is optimized for doing one specific thing or a few specific things very well. They're expensive to manufacture unless you're making millions of them. So in that sense, they're kind of out of the reach of the individual. And then there's FPGAs. So once you buy them, you program them. They're obviously easier to design. They're high performance if your problem can be parallelized, that is. And for doing the same job, they're lower power than a processor. So in embedded design, an FPGA pretty much can do all of this area, all of its, and you can even do it within the FPGA design tools. You can substitute out parts that you want there. But fundamentally, the only layer you're not messing with is basically making the PCB board that you actually put them on. And, of course, you can do that too, but that's up to you. And so FPGAs is kind of very vertical in that sense where you can do a lot all the way from the bottom to the top. So when you design FPGAs, you start out with what you want to do. You can either actually enter a schematic. You can actually have the series of digital logic gates that you actually want to make. You take them, and you can actually put them in a schematic, or you can write HDL source code. And then you have a series of tools, basically. These tools are kind of like they have analogs in the real world. That's basically like logic analyzers and things like that that basically make you to be able to debug your very complicated designs. And the way you test them, is you use test benches. And this is a lot like... Actually, a lot of you who've learned coding over the last couple years, this is like a big thing they do now, test-oriented programming. And there's basically two big languages in HDL. There's VHDL and Verilog. So let's start out with something fairly simple. If you've never seen VHDL before, I'm going to try to walk you through it. This is basically kind of in C, kind of the libraries you're using. There's only a couple standard libraries that come with HDL. They basically do some simple things, like you can do adding and handle certain data types. This here you can think of as like the .h file. This kind of says like what basically inputs and outputs you have out of a digital entity. And you can see here that we have an A, B, C, D that are both inputs. They are single bit, which is why they're standard logic. You have S there, which is actually a vector. You can think of that as like an array. Pretty much the same thing. It's actually only two bits, but you can see those two bits right there. And this is the output. So this is a four to one mux. So basically you put your signals coming in here, and then you select them with these S bits, and then you get out what's on Z. Pretty simple. And this is actually the code for the HDL. So this is what they call architecture in VHDL. And so basically you can see the cases here. If it's 00 on the select bits, you'll get A. If it's 01, you'll get B. You could either say 11 or others here. This is kind of like whether you have an else or just a series of ifs. And the most important thing here is this code is not, if there was more code here, it would be more clear, but this code is not executed sequentially. This is not like C. This actually happens in parallel on all of them at the same time. So this line up here, process, is actually pretty important. Even if you don't have it here, it's kind of implied. Process actually says when any of these things change, this code, so to speak, should re-execute. Or in other words, the output should change. So this is actually how you control when a new value comes in. You could also have a clock. This is actually asynchronous logic, which means it has no clock. This is the other language called Verilog. Very similar idea, same implementation. Here's the basically structure of what's inputs, what's outputs, what's the variable. Over here, you have the same implementation. This might be a little confusing, but what this actually says is base two, what this is and that, and whether those match and whether you get A, B, C, D. Same idea, though. And look, there's actually the equivalent line to process. You have that in Verilog right there. So after you write your code, you actually synthesize it. And what that actually means is when it takes it and it actually puts it into a series of gates that actually implement what you are trying to design. And then you take those pieces, those logical blocks that you've developed, and then you connect them together into pieces that function together. And so that's actually called the netlist. The next thing you do is implement your design. So now that you've actually kind of compiled it, if you will, you actually have to say, well, this is going on a specific FPGA. This FPGA has this resources available to you. And how do I map that design onto these resources? For example, some FPGAs have digital adders on them. Some of them have a limited number of them. But an adder can also be made up of a series of more basic gates. So this is going to take your design and actually put it onto a real FPGA. This is actually compiling it, you know, for a specific architecture. It would kind of be the same idea if you're taking these C analysts of things. And the place and route is pretty important. That actually is how you connect the different logical pieces on your board to other pieces. And one more important thing is eventually you're going to be outside of the FPGA, and then you need to know your IO standards of what you're interfacing with. Actually, that's something you need to consider before you even select an FPGA is, does this have the number of IO pins I need to be able to do what I want to do? And most of the time, you cannot mix different IO standards on what they call a bank, which is a grouping of IO pins. And so you need to kind of plan out before you select an FPGA which one that you're actually going to go with and make sure it does and has the number of output pins you need. And actually, what I wanted to say here is that each step where it actually is getting closer to the real implementation, you're actually getting more real world numbers in here. For example, after mapping, you'll have what they call a clock to state propagation delay of 1.2 nanoseconds. Well, what does that mean? Well, that means after you change the inputs, when do the outputs come out to the place where you expect them to be? And then as you get farther to the actual real design, this is actually going to increase. So this thing has so many gates in it, and how long does it take to get from the input side to the output side? Well then, how long does it take to get from where it's outputted to the next component that it's going to go to to get maybe to the other side of the FPGA? And of course, you're talking nanoseconds here, about numbers that matter for high speed. Then once you get your design ready, you're actually going to have to program your FPGA. There's a lot of ways to program an FPGA. There's JTAG, USB, you can program it with Flash, you can have other kinds of programmable memory. You can have an FPGA program on boot. Some FPGAs, you can actually reprogram parts of them while they're running in some FPGAs if you look for those features. So you can dynamically adjust what actual digital circuits you're actually implementing in those modes, basically, without actually affecting the other side of the FPGA. And the rest of the talk is actually going to be, we're going to go through different softwares, hands-on demos. It's basically the same idea, but it's going to be on different implementations or different companies do things, call things different things. We're going to go through writing some simple VHDL, writing some C code for, well, not so much writing a C code, but you would use the EDK. And as a part of that, you actually see how to do high-speed interconnects between functional units. And I also want to say that you can get one of these demo boards for less than $100, and you can spend a lot more on them also, just pretty much like anything. And we actually have a demo board over there that actually has a touch interface and a 5 megapixel camera, which is actually pretty cool. And like I said, we have some stuff that we'll be giving away, too. So, I think that's it for me. Now we're actually going to go to the Xilinx ISC. A contest, okay. So we're going to switch here. There'll be a lot of switching. Hello, everyone. I am Corey Lang. I'm an undergraduate at the University of Delaware. And I'm going to be the one who's giving away stuff today. So, can you see me? That's right. Yay, me. Okay. Let me get this thing up here. See it, maybe. Something. Did anyone read that really quick? Okay. So, how the contest is going to work. We're going to put a question up on the screen. You're going to have about five minutes of a claim password that you're going to have to come up so we don't have, you know, five people named Spartacus coming up trying to claim the same thing. And your answer on a contest form. People, my lovely cohorts, all wearing Seaborg t-shirts will be handing out slips and collecting them when you're done. And we will draw the winning slip from the correct answers. So it's kind of a lottery, but you have to get the question right to be entered. The winner will be announced and you'll get your prize at the start of the next contest session. And, disclaimer, we reserve right to be judge, jury, executioner in all contest matters and decisions. Also, you can take this time. We'll be having four of these throughout the talk since it's a three hour talk. Stretch your legs, get up, move around. But don't go anywhere because there's a lot of cool stuff. So, up for grabs on this first contest we have a Spartan 3e FPGA demo board. And some Intel swag, some travel mugs, and t-shirts. So, some of the Seaborg people will be around handing out entry slips. And the question for the first contest is, what is the approximate visible bandwidth of the human eye? So you guys have about ten minutes, five, ten minutes to answer questions and we'll let you know when the contest is closed. Okay. Just raise your hand if you want a contest slip. We'll be walking all around. And we'll have a lot of people walking around. While we're waiting, do any of you have any questions about the first question? Yeah, if anyone has any questions, stand up. Stand up, because we already have hands up. Unless you want to raise both hands for a question, I don't know. That would be a little hard to... For this? Units. Give it in Hertz. Give it in some kind of frequency. Preferably Hertz. Or some, you know, scientific prefix with Hertz. Nanometers is not okay. That's a wavelength. Oh, we're not. No, right, right, right. Well, the presentation should already be up, right? It's already on. Yeah, you're moving yourself. Why don't you guys get ready for... Do all of you have the question memorized? Can we change the picture? All right. Cool. There it is. Sorry. Let's give it a minute. It is. There are some people over there. You don't have to do that, I think. It is a clone. There are people on the... Josh. Josh. Well, now... Well, don't they... It just gets to... Okay. Six. Four minutes. Oh, one more minute. One more minute. Huh? Yeah, that way we can... Because the award will take an extra minute. Well, one time. Okay. So how do we collect them? Did you tell them how to collect them? I was already collecting them. Tell them to just start... Tell them to start passing them just so people can see them for sure. Okay. Yeah. What was our meeting time? About half an hour, yeah? About half an hour, yeah? He's collecting his scans right now. Of course. We're fine. You can tell them. You might tell them that they can do it. I mean, explain. Let's see. Turn it over. But not whenever they want to, right? If you got an answer, keep your hands up and we'll get to you. I think we're gonna start the next one now. All right. Cool. Hi, everybody. My name's Tyrell, and Ryan's gonna be giving a demo. So we're gonna be talking about the Xilinx IC a little bit. So... So a basic overview of the IC is it's the program that takes your VHDL, your Verilog, your schematics, and it will turn it into... It'll give you the tools needed to turn it into something that your FPGA will understand. It'll turn it into a bit file. So the Webpack is completely free. You can download it at this link. I believe our slides are gonna be up on our website. So here's some... basic information on the Spartan 3 board we're gonna be demoing. It's... It's got the XE3S500E Spartan FPGA. 232 user I.O. pins. There's all kinds of memory with the PROM, DDR, SDRAM, NOR flash and SERO flash. And then some other key things. It has a BGA display port, Ethernet, RS-232, and then some LED switches, push buttons. Here's a... Here's a quick picture showing you where these things are, so when we give the demo we're actually gonna be showing the board up on the screen so you can kind of see what's actually up on there. So here's the design flow for DesignLink software. Basically, to begin with, you plan and budget out your resources. Make sure you have enough of lookup tables, flip flops, serial ports, Ethernet. Make sure you have everything you need to actually implement what you're trying to do. And then, I'm sure a lot of you guys are programmers, so it's just basically writing the code. Then you'll synthesize it to create the netlist, which Rodney talked about a little bit, and I'll talk about it a little bit more. And then you do the functional simulation, and implement timing simulation, make the bit file, and configure FPGA. So here's what the IEC looks like. It has all the tools you need to perform all the steps I just showed in the design flow, which we'll talk about more in the next couple slides. It's pretty compact, and everything's right there for you. Makes it simple. So to begin with, you just take your source type, which can be schematic, state diagram, VHDL, Verilog. You've got tons of options, which you can read on the side over there. Then you have to have a test bench. The test bench is just basically a lot of people will test their code just putting random inputs in, making sure it comes back out the way they want it. So that's pretty much what the test bench is for all of this. So, like I said, you have to make a netlist file, which Xilinx has their own tool. They also have support for a lot of third party tools, which can be nice at times. And so this is the netlist file. Basically what this is, is over here, where you see SW 0-3 and LED 7-0. These are the logical names, so kind of like the variable names that you use in your code. And these locations here are the actual spots on the board, or the traces where it'll hook up to. So when you see the board later, we'll show you L13 is right under one of the switches. So this netlist file, when you process it, it gives it, it allows the FPGA to know whenever we talk about switch 0, that signal will go to L13. And Ronnie talked about the IO standards. You have to list those. For all the ones we're using, we'll be using LVTTL. And then these are some other options, which are specific to whatever piece of hardware you're using. So for the implementation, you are going to be most likely using a lot of different pieces of hardware, which means there could be multiple netlist files. So to begin with the translating, you'll take all these all these netlists and put them together. This is because they're all going to be using the same board, same hardware set, so it makes sense to put them all together so you can see how they interact. Then the mapping is you'll take those logical, from the previous slide, you'll take the logical, the SW0 or the LED7, and you'll actually map them to the trace on the board. And then you'll actually place them around and make sure the connections are good on the chip and you'll get some timing data and some reports from that. So for the configuration, you need to make a file that the FPGA understands, which in this case is a bit file. So you'll put it, you'll make a bit file, you'll download it to the board, which you can download it right to the PROM, and it'll boot off that. It'll boot off that and you can leave it there and turn it on and off and everything in the program will be there to run right off that for you. So this is a little about the simulation. The added test bench is basically you add a test bench with your input and you make sure your output's coming out like I said before. The behavioral simulation is where you will test just the logic. You'll make sure your units, or your logical units are actually making sense. So if you have, if you say if SW1 is high, then LED1 should be on. If SW1 and SW2 are high, LED3 should be on. You just have to make sure that works out how you expected it. The timing simulation is a little more tricky since we're working with hardware, not software. As Roddy mentioned before, hardware is kind of working in parallel. When your signal gets sent there, it's going to work. Then it's not going to wait until the previous step. Like in software, you do this, then you do A, then you do B, then you do C. So the timing simulation is, you may think you have everything working great, but then as soon as you put it through the timing, everything breaks up so you have to make sure you get all the timing right and everything is going when you expect it to be going. This is just a little bit about the design data. The nice thing is they'll give you reports in here. So over here is a list of all the reports, some options, and up here gives you a general overview of the project, the name, the target device, and that kind of things. Here is device utilization, which I'll talk about in the next slide. Down here are just some constraints you can set and some more reports. So the design utilization or device utilization can be nice because it'll show you what you've already used in your design. So here you're using four flip-flops of the available 27,000. 27,000, so you're only using 1%. So it's nice when you're making a design to make sure you're not using up all your resources. And if you need to go back and change your design and you see you're using up 99% of a resource, you can take that into consideration when you redesign to try to either redesign it and optimize it or redesign it another way so you can add stuff without using all your resources. So now Ryan's gonna give a demo of all this with some switches and LEDs and then a nice VGA to show you that the VGA actually works. I also wanted to add that if you guys have any questions at all during this, this is kind of a long talk, so feel free to ask them even during the demo sessions if you have just a quick question about something we said or just wanted to know something more. Okay, so I'm actually gonna walk you guys through a very simple hardware design with the Xilinx ISE. So I'm gonna go ahead and start that out now. . Okay, so we're gonna basically create a design that just has some simple gates and uses switches and LEDs. And one of the most important things when you're designing this is to take into consideration what pins are connected where, like he was talking about the netlist. So, for example, in our case, we're using a demo kit board, not a custom design board. So they have all that stuff already mapped out for you, which is kind of nice. So we can just go here and say, okay, I wanna use the switches, the slide switches, and the UCF location constraints. And it actually will give you right the nets that you need. And you can just select those and copy and paste them into your files. So we'll be going back to that later. We're gonna start a new project. And we'll just call it Simple Def Con. And it looks like this is all set okay. Spartan 3E. That is all actually written on the board. Whatever demo board you have, you can just kind of take a look at it. Take a look at the FPGA in the center, and it has all this timing information and stuff like that. And we're gonna create a new source file. And we're just gonna call it Simple LED. And that will be a VHDL module. And we'll add that to the project. And this is where you tell it basically what is coming in this module and out of this module. And in our case, we're gonna have switches that are gonna be inputs. And they're gonna be a bus. And this is the most significant bit. We'll say three down to zero. So there's basically a vector of four inputs that are switches. And we can address them as like SW0, SW1. And our LEDs are gonna be our output. So we say direction out. And a bus. There's eight of those. So we'll say seven down to zero. It's asking me if it exists. It doesn't exist. Do I want to create it? No existing sources. I'll create a project. Okay. And the next most important thing is to create the netlist file, the constraints file. So we say new source. And pick implementation constraints file. And I'm just gonna call it constraints. And it's gonna pop up here. And I'm gonna say they have like a built-in constraint editor, but it's easier to just do this in text. Since Sidelinks already gives them to you. So you can say edit constraints. And we can just copy this right from here. The switches. And paste it right in there. Since we called them the same thing. It's really important that your ports in your VHDL file have the same names as the nets in your constraints file. Because it uses those to map the two together. So it knows that they're the same thing. So then we're gonna add the LEDs to that too. So we have discrete LEDs. UCF location constraints. And then we're just gonna select all these. And we'll copy. And paste them. So now we have our constraints file. These are the only things that we're gonna interact with on the board at this point. And now we can go ahead and write our VHDL file. It already kind of created an outline for us. And it added in the libraries that we're gonna need automatically. If you had any like custom libraries that other people write online. Like you can go look up VHDL code online. And there's a lot of other libraries you can add them in there. And we're just gonna write very simple VHDL code. Not even gonna put a process in here. Because it's kind of implied. We're just gonna directly map hardware. So basically what we're gonna say now is LED 0. We're addressing LED 0. We're saying that's gonna be mapped directly to. And then we can do whatever we want here. So I can say switch 0. And I can actually give it a hardware gate. So I can say switch 0 and switch 1. Let's find out. Is that better? Okay. So you can put in any kind of gate. You're basically telling it exactly what this is direct hardware mapping. So LED 1 is gonna be connected to a gate of switch 0 or switch 1. LED 3 will say switch 0 exclusive or. Switch 1. Switch 1. 4. Let's make this 2. 3. Switch 1. And these last four I'm just gonna directly map. So we'll just say LED 4 is the same as switch 0. LED 5 is switch 1. Is it case sensitive? No. It's not really case sensitive. I'm just trying to make them look the same. I'm not sure about Verilog but VHDL is insensitive. Yeah. . . . . . . . . . . . . . . . . . . . . . . . . . . VGA controllers it can take a little bit longer to synthesize and place and route your design. It's already done with synthesis. It's moved on to the implement design phase. And there's actually subcategories in this so you can kind of take a look. It's done with translating. It's moved on to mapping. . What's the bottleneck in this process? Is it the speed of the FPGA or the processor? The processor, actually, yeah. The faster you have a computer, the better this process will go. Synthesis currently is mostly a single-threaded operation on the IS, at least the Xilinx software, and I believe so with Altera also. A Pentium, not so much anymore, but a year ago, Pentium 4 might have done better than a slower Core 2 because it didn't take advantage of the second one, but now I think the i7 would kick its ass. So now basically it's telling me Xilinx has this thing called Impact Project Manager, which is basically a project to help you program through whatever means you have available. Here we're going to... We're going to do it through JTAG. It's like a USB to JTAG configuration, so it's going to scan and look for a download cable, and it finds the three devices that are on the Spartan 3 FPGA, so it knows there's a 3500 SE PROM chip on there and a CPLD, and you can see the FPGA is the first one, so we're going to say, okay, program with this bit file we just created, and we're just going to bypass the other two because we don't want to program them right now. We don't have any configuration. We're going to say, okay, that's okay. Now I'm going to click on this, the FPGA, and just click program, and it just programmed the FPGA, so now I'm going to actually switch this over so you can take a look at it, the video input. Those other three devices, those are the ones that you can use to have your FPGA program on startup. The first thing on the chip on the left is the one where you can just program it instantaneously, you know, while it's powered on. Okay, so this is our, this is our demo board here. It's a demo board here. I'm just going to flicker on these switches so you can kind of see the reaction of the LEDs, basically what we just wrote in VHDL. So these are the, so the two switches on the left are, switch three and switch four, and they were directly mapped, only the two LEDs, so you can see them turning on and off. And the first two are switch one and switch zero, which, or switch zero and one, which we had all of the gates hooked up to. So you can kind of see the LEDs react to the different gate configurations that we had. Earlier you talked about test benching it. Would you have done that in software prior to uploading? Yeah, you can actually write your test bench before you write the code. Right, so what you would want to do, if you wanted to do simulation, that's where the test bench would come into play. You need a test bench to look, to do a simulation, otherwise you don't have any input, so you're not going to see any output in simulation. You don't actually have to create a test bench if you just want to put it into hardware and check to see if it works. But when you start to get into more complex systems, it almost becomes essential to create some kind of test bench so you can test individual modules of your system without having the whole thing, hooked up in together. Other than, is it not working, would you damage the device? Usually not. He asked, can you damage the device if it's not working correctly or will it just not work? Most of the time, you really won't damage too many devices, but you could be connected to a component that takes a much lower voltage level and if you're pumping, you know, you have a constraint wrong, and you're pumping like three and a half volts into something that you know isn't supposed to take three and a half volts you can potentially mess something out but yeah I mean if you're just dealing with the FPGA it's pretty hard to write code that destroys it you can make it warmer you do certain things but I've never seen I mean if you saw our talk last year we actually did a hardware Trojan basically making the processor hotter and colder based on certain operations we were doing so you can definitely do things like that but most of the time you get into trouble with interfacing things outside of the FPGA with your FPGA and you're not taking all the proper IO considerations okay so I'm going to show you one other really useful thing with the Xilinx ISC I pulled some code off the internet a couple days ago just some like VHDL example VGA example code that just uses a VGA port and a 50 megahertz clock so I'm just going to do that real quick I'm going to implement that I'm going to basically pull in the code that I got off the internet and put it into ISE and make it work with the Spartan 3e board and this was actually just written for the the pins on a VGA connector all you need is a VGA connector and a 50 megahertz clock and an FPGA so you you could do this on any board that has those three things not just the Spartan 3e so we're going to go through the same process and I'm going to add in that source file here and put it here it's called squares dot VHD and it's going to copy it to this project yep there's Linux and used to be Solaris yes if there's Linux version actually the EDK runs better under Linux because it when you install the EDK under Windows and installs on sigwin the Spartan through 149 and if any of you are still in school or educators you can get discounts from Xilinx so giving away these boards actually so you can win it for free right now so obviously the first the most important thing to do is to create a constraints file first and we have to have a constraints file that includes all of these inputs and outputs that are there in this VHDL module that was that I we got off the internet so I'm going to create another constraints file you said there's a Linux version because I have to go out on the x86 and the x7 I'm pretty sure it's it's a binary so it whether it runs on x86 only the Linux version so we're going to go back to the Spartan 3 again user guide and we're going to go to just the VGA DisplayPort and pull down those constraints now the interesting thing here is that these are named differently because this is just code that's off the internet so I'm going to dump this the Spartan 3 constraints in here but you can see that or not see because it's like gray or something but it says VGA red VGA green whereas in our VHDL module it's called red out green out so basically if I compile this right now it would not know that those are the same signal that we're talking about and it wouldn't map them to the the FPGA so I have to make sure that those are named the same so basically I have to say this is red out here that we're talking about so I'm going to copy and paste right out into there and green out into the next one yeah those are specific he asked what slew and drive are those those kind of fields are basically very specific tweaks to IO standards so the slew would affect like how the the rise in the fall from a zero to a one transition would look like what's the units or drive current so last thing we have to add in here is the clock the Spartan 3 has 50 megahertz oscillator on it the FPGA can pretty much take anything I think there's a certain there's like a it maxes out at some point in megahertz what clock signal you can you can drive in into it but you can you can pretty much drive any clocks or you want so anything like 13 to 25 megahertz if you want and the interesting thing about this is where we're feeding in a 50 megahertz clock because that's what the Spartan 3 has but the VGA standard actually uses a 25 megahertz clock so this is clock 50 megahertz so I'm just going to make this the same so I'm going to save that constraints file but you'll notice in this in this VHDL file we have a signal here it's it's that we created it's kind of like a variable called clock 25 and then we have this process here so this kind of runs in parallel with the other and with any other processes that are going on and this process takes the 50 megahertz clock and turns it into 25 megahertz clock basically that that this VGA process needs in order to you know operate it the the speed that the projector can take in so we're done here because this is a pre-made model module and I'm just going to configure this a while but if you take a look here this is what BHGL is really good at it's really good at taking things that needs specific timing where timing is crucial and and you can kind of write in a very easy to understand language so like if the fifty megahertz clock 50 megahertz clock event happens and the fifty megahertz clock is at a lot a lot signal one so basically if if we see a rising edge then do this and likewise you can see below you just say if this signal is at logic zero now do this so that's where BHTL comes in and really handy that you can't really guarantee timing with a microprocessor when you have want to do several things at once because you've got kind of this multi threading and you're never guaranteed to get specific timing down and the cool thing about these processes there there's no scheduler they're always on the CPU they're always ready to trigger there's no starvation you basically have the entire resources of the board ready to trigger at any moment based on your design so in that sense it blows away a single threaded CPU for timing that real world real-time programming is a joke compared to writing HDL so I'm going to program the the FPGA again real quick and I'll actually plug this signal in so you can see what it what it outputs so that's this this code that I downloaded off the internet this is what it outputs on the VGA port so it's basically just a bunch of squares it's like a test signal but you can see I mean that's that's you know probably a page and a half of code to put that out on your VGA port so it's you can see how useful the ISE can be yeah for example using this VGA imagine what you can do you can basically write a game code for example and run it from your just Spartan 3 board like this is a basic style of programming that you can do and you can play it on any other board and play it without having any other like peripherals or other things yeah we actually do that in our senior design course all the students wrote their video game I mean most of them are varying degrees more comp more complicated than pong you know less complicated than Mario but that's that's the kind of stuff you can do with these boards it's in the fall the senior year just one so this is this is the end of the demo for the ISE and I believe we have contest winners and another contest so Corey's gonna come back up okay so we went through and found out the who got questions right and wrong and we separated out the right answers and we're going to draw some right answers I'm going to have two of my colleagues Steve and Mike come up here and help us out the right answer is approximately 400 terahertz the human eye has about a 400 terahertz bandwidth it's quite impressive but we accepted anything that was kind of close to that or at least within the band up to think about that is a 90 terahertz yeah but we we had to reject things like 60 Hertz and bits per second and nanometers so just because google says that it's 10 million bits per second doesn't mean it was what we're looking for google isn't always right but Wikipedia is so these guys are going to draw the answers and call out names and then you'll come up to me and give me your password and we'll give you some prizes all right who's ready come on guys wake up all right you ready let's get a little anticipation first person is this is for the Spartan three board we're gonna get that one knocked out right now Tom this is why we have the password all right come on do we have the is Tom here raise your hand if you're Tom no close I mean this is a highly brute forcible password here we're gonna draw another one but uh this wouldn't make it past Jack the Ripper sorry let's hope for a better cheese burrito cheese burritos here all right he wins the Spartan three let's give him a round of applause all right Cory will authenticate him all right what's uh what do we have next core all right we're giving away some mugs all right ready sighting here we go these are official from Intel the winner is Votman all right come on up we need another one all right let's give him a round of applause see this is great you guys come out early get to learn about FPGAs take some cool prizes home that's a win-win all right next guy Matt a Matt a going once going twice Chris. Alright, alright, we need, what? Looks like a two? Alright, alright, maybe. Cry two? I'm sorry. Alright, let's see, we got two Intel t-shirts. Dave King? Dave King. Alright, coming on up. Alright, round of applause. Last but not least, ooh, that was a good one. Joel Voss? Joel, are you here? Alright. Alright, we got three more contests coming up. Plenty of demos. We're trying to make the three hours go by a little smoother, but please, for your passwords, let's make them a little bit stronger. Hello does not count as a good password. Alright, thank you. Okay, that's one contest down, but fear not, because we got another one coming right up now. So, we're giving away more prizes. We got another FPGA board, we got some Intel bobbleheads, ooh, and some more t-shirts. So, the question for number two, and same rules apply. Guys, look around for, raise your hand if you need a slip, and give them to the C board. You don't even know what the question is yet. What are you raising your hands for? It might be, anyone raising their hands gives me ten dollars right now. Actually, this is not really a question, but you see some VHDL code right up here. What does it do? And keep it simple. I don't want paragraphs of text. Although, if you make me laugh, I might consider putting it in the drawing. Yeah, one word should be sufficient. One word should do it. While people are passing things out, does anyone have any questions for Tyrell, or Ryan over here about anything? Anything ISE related? Just kind of stand up and shout it out. There he is. Funny. Okay, well actually, VHDL, probably most of the market uses Verilog actually. But we learned in VHDL, Verilog's pretty similar. The reason you use VHDL is if you do anything for the government, they require it, generally speaking. And Verilog, some people say it's easier to learn the syntax. They find it easier, but it's pretty much the same. If you don't have a slip and don't feel like waiting for one, and you just have scrap paper, feel free to just write it down with name, password. I know the software that you actually pay for has very, very vast libraries of pre-created hardware. I mean, is this software kind of new mode? Yeah, it has some IP, what they call IP, intellectual property with it. Some stuff you can actually use non-commercially for free. Some stuff you can buy, like M-EG-4 encoders, or you could find it online. Actually, a good source for libraries is OpenCore. It's opencores.org, I believe. They have tons of HDL code that you can just download and load up on your favorite FPGA. When is incremental synthesis going to work well? When NP-complete problems get easy, I guess. I don't know. What's your recommended best way for someone just getting into the hardware? I mean, I don't know if you've ever done a lot of software in your life. I don't know if you've ever done a lot of software. Any particular test for it that you recommend before? He asked how to get started with this kind of stuff, if mainly you've done software. I mean, if you've done parallel coding, you'll suddenly realize that a lot of the problems are very similar. If you wrote single-predate programs, you might start beating your head against the wall, because you need to have control over when things happen. So. Writing VHDL, it's completely parallelized. You need to have signals for when things happen. You need to have locks if you're having multiple things access the same resource. So these boards are fine to get started. I would recommend having a project that you want to do. I've seen YouTube videos of people programming FPGA so it plays Guitar Hero automatically. If you want to get started without any hardware, we're going to be talking about GHDL soon. But I think the really way to get interested is to say, I have this little thing that I want to do that I think I can actually pretty much draw out how it should work. The way you actually really complex stuff, a lot of computer science guys know it, because it's finite state machines. You need to have good state machines. You should not have lots of nested if statements. You should have basically a state variable that kind of keeps you where you are in the current operation. Anything big like an AES core is going to use something like that. A lot of the old rules with a lot of the kind of behind the scenes stuff and writing C kind of comes out to play when you're writing very complicated systems. As for actually purchasing hardware, the two major manufacturers of FPGAs are Xilinx and Altera. One of our sponsors, Digilent. Digilent actually makes a variety of various FPGA boards of various complexities and whatnot that you could get. So I think we're finishing up with questions or? Yeah, actually, we just installed it. We don't like how it, well, for the version we have it, it requires a network license. But if you get download the free version, it doesn't. It makes a lot of improvements. I haven't had a lot of sit down time with it to see what breaks from the other version. But overall, it looks like a nice, solid incremental build. Right now, we're sticking with 10 for a while. But we're still on 11 on some machines. You said there are software simulators that don't have any hardware? Yeah, we'll cover that, actually. Is that next? Yeah. So that's, where is it? Yeah. So we'll get to that. Does anyone need to see the thing up there anymore? Can we move on? I want to check you. Can you feel? All right. It's . All right. Cory's working his way back up here. It's actually his talk. And Steve is back there. Thank you. Bye. Bye. Bye. Bye. Bye. Okay, so I'm actually going to not talk about something contest-related this time, which I'm sorry about, but we'll get back to it. GHDL is a GNU VHDL simulator. If you don't have the money to shell out for a board, but you want to start playing around with VHDL, it's a great way to get started. It uses the GCC compiler technology. It's a command line interface. There's the URL for it if you want to download it, completely free. The current version, I believe, is .26 or .27. We use .25. Don't ask me why, we just do. The beauty of this is, as it was explained, VHDL, DoD approved language, GHDL, coded in Ada, another DoD language, so you're going to be doing a lot of compiling. Sorry about that, but there's a lot of binary packages out there, so just a heads up. So why use VHDL? Obviously it's free. It's easy to download and use. If you have Linux, people have tried to compile it for Cygwin, and it just fails miserably. I don't know why. But there is a Windows version of it. I couldn't get it working, but you guys might do better than I did. And there's no FPGA required, so it's literally free. You don't need to shell out any money whatsoever. I'm also going to talk a little about the MIPS architecture, which probably most people know about. It's a simple 32-bit RISC architecture. It's used all over the place to teach basics of computer architecture. A common simulator is called SPIM. It's primarily used in embedded systems, TiVo, Cisco routers, and a lot of game consoles. PlayStation, PlayStation 2, PlayStation Portable, N64, you know. So it's a fairly commonly used architecture. And for one of the courses at University of Delaware, we actually designed a computer. And coded in VHDL a 32-bit MIPS multi-cycle CPU using a finite state machine controller, five-stage data path. We didn't program the full ISA, but about six instructions. If you want to add more, obviously, it's just a matter of coding more. Test benches are a big thing in GHDL. Because you don't use an FPGA in order to see if your code works, you need to write a test bench for it. Give it inputs. And try and program. See if it gives you the right outputs. So it will basically, a test bench will create an instance of the code you want to test. Create a running clock. And then run it against input and assert correct output. And hopefully what you assert is right. So GHDL, like I said, is a command line program. There are a bunch of flags up there. You don't need to memorize them because there's the manual page for it. But you know, you have to analyze your code. You have to create your executable. Of your test bench. You have to run your executable. That last little function down there is for a program called GTKWave, which we'll talk about, Steve's going to talk about later. So this is, you know, the series that you have to run in order to run something. You compile. You analyze your, if you want to make a shift register, you write your shift register program. And then you write your test bench for it. You analyze both of them. Create your executable of your test bench. And run the test bench. And hopefully it doesn't say error. Which, more often than not, it will say error, especially when you're just getting started. GTKWave is very similar to the ISC waveform simulator. But again, it's open source. It uses GTK. Who'd a thunk? It can view, you can view any of the signals in any of the code that you're running. And you can view it as binary, hex, integers, anything that's useful for you. For the vectors. You can also see for signals, it just gives you a waveform. So we're going to give you a quick demonstration. Of a MIPS microprocessor that we wrote, a multi-cycle 32-bit like we talked about earlier. Steve's going to run through it and just show you some code and show you it running, hopefully. And then show you GTKWave. All right. So a couple things. Now I've heard some people, they've talked to me before and they've said, well, I don't know VHDL. And that's really the, you know. It's a long block from getting me playing with that stuff. And I don't want to go out and spend the initial money to get the FPGA. Well, I didn't either until I found this. It's very easy. And as you're going to see as we walk you through our little virtual machine that it's really not as hard as it may seem. So here we have our CPU that, as he said, was done by a team of three. We were undergrads. We had no knowledge about the processor and how to make it, how to code VHDL. So let's see if we can zoom in. Control-Alt. Can we make it bigger? Let's go full screen. Let's full screen it. Does that help at all? No. No, no, no. It's exactly the same size. Great. Yeah. Let's try this. Tip up. Let's see. And. Okay. Hopefully. Better? Better. Better. I know it's not perfect. We'll post this code up if you want. You want to do that? Sure. Why not? We'll put the code up on the website so if you want to pull it down later and take a look. I'll go over the basic flow. So basically as, basically there's a bunch of VHDL files. Each time you make an entity, kind of like how you might make an object in coding, you'll make it its own VHDL file and you'll make it its own entity. So, for instance, when we wanted to register, we would make the reg.vhdl file. Now you can make these things generic and all that fun stuff. All those details that are wonderfully documented online. But what we're going to look at right now is the part that brings it all together, the super CPU as we called it. Do we? All right. Disclaimer. I did not make this VM, so he can't yell at me. Emacs, VI, I know, I don't want to start the war, so. Emacs. Nano. Nano I know comes default on Gen 2, so when all else fails, I go drop down the nano. You know, pico for those who want to go even older. So like they've gone over, you know, you've got your library, your includes, build the CPU, bring it all together. As you can see in here, we've got stuff like this. Like the ALU, all the stuff that we coded individually, right? But none of this really makes sense to us, at least from analyzing it, because all this is done is actually glued it together. Imagine you have a circuit, all this is done is connected the wires. So now what we have is, as Corey was pointing out, the test bench, okay? Now the test bench has a certain format. I'll be honest, I never memorized it. We were given a test bench and I just kept editing it. So it makes sense eventually, but it's not something I've memorized. However, what you do is basically this. You've got a black box at this point. You've got all the connectors to the outside. What you do is you start hooking up inputs to them. For instance, here we might set the signal for the reset to one, the clock to one, and the done to zero. Right? So these are the initial states we'll set it to. Then after this, we start beginning a process. Let's see. It's a little bit down further. There it is. Right here. Where we actually start driving input into our black box, all right? And we start hoping that output comes out. If you were to want to actually test the functionality, let's look at the register. Okay. What's got a test bench? Do we have any test benches? No. Oh. Well. All right. Sorry about that. We'll go back to this one. If you wanted to actually test the functionality of something, you can do things just like in C. You can assert the states and stuff like that and have it print out wonderfulness like this isn't right. Usually you'll find out it's due to things like timing. So it gives a nice, wonderful output telling you at what millisecond or what exact clock cycle it failed. And that's basically it. It's just like getting the output from a C compiler. You get a bunch of stuff and you got to hope you understand it. So what we have over here is what's known as GTK wave. Let's full screen this. All right. Now GTK wave takes a special output file that's generated by GHDL. Think of it more as the sort of like it took snapshots along the way of what was happening at every instance. And it records that in a file. And then this allows you to visualize it. So here we have different inputs from our CPU actually inside it. Remember before I said the test bench can't test the internals. It'll test the externals. GTK wave allows you to view the internals, view every signal inside of it. We were so excited when we found out we could see inside our CPU and didn't have to keep guessing based on it was just not working. So over here on the left, you'll get a wonderful list. We're going to ignore that. Moving right along. It'll give you all your signals broken down from every component. For instance, the memory. You can look at the clock cycle that's going into the memory to find out there's one point that we somehow inverted the clock going into our memory. Wasn't fun. Over here, you can then drag these signals that'll show up down here from the components over here. And it'll give you in terms of the time unit. Here we've got our clock going. We've got some data. Data output. We've got different stuff. I think we had a component. Is this the super CPU? Yeah. Okay. So we've got some operations occurring. And as you can see here, you can see them in hex. We can blow this up and view them in binary. We could look at them in any type of format you want. So if you've got ASCII characters going through, you can look at that. Now you'll notice here at the top you see PS for picoseconds. This is simulation. We called it the super CPU because we could set whatever time. We wanted. And our processor ran at it. So do not take this literally and translate it into hardware because it will fail. As Rodney was pointing out, there's a stage in the actual ISE step that'll show you where that simulation goes into reality and takes into those effects. No matter how much you want, you will not design a 500 gigahertz CPU with your FPGA. You can do it on this, though. It's fun. Although our processor was 2 gigahertz, somehow we were able to simulate 500 gigahertz. The beauty of simulation. So within here, you'll see that we have 32-bit. Right here it says 31 to 0. That means we have 32 bits wide, and we can decode all those lines. We can even expand them and look at the individual lines if we wanted to. You can look at any of the clock intervals and do wonderful things like that, search, set markers. All the stuff you might do if you were doing, say, a... A GDB trace through your source code. So you can think of it that way. Again, it's available across all the platforms. We've run it on OSX. We've run it on Linux. We've run it on Windows. So it's easy to get into. Not so much GHDL running on all those, but GTK wave. And kind of a forewarning, there's two outputs that you can create off GHDL. One will say that it's the GTK wave format. One that says it's the Verilog format. Avoid the Verilog one. It's not fully compatible, and you'll only get to see some of your things. So when you go back and look at the slides, Corey gave the proper argument for that. So that's it. And I think that about wraps it up. So I'm going to... Now that you guys sat through our lovely little discussion about that, I'm going to set this back to the right screen size, hopefully. Cross the finger. Yeah. Yeah. Oh, that's nice. And yup, you guessed it. It's contest time again. So we're going to announce our winners. Again, we're giving away another FPGA board. We're giving away some bobbleheads and some t-shirts. So we're going to do the same thing we did last time. And hopefully Bob or Chris or whoever shows up this time. Okay. So we saw some pretty interesting answers this time. Some people thought that the code was a port scanner for some reason. I'd love to see someone implement that on FPGA. I'm sure it's been done. But no, it wasn't. It was actually a MUX, and quite a few people got it right this time. So it should be interesting who gets the Spartan this time. So for the Spartan 3E... Using true random numbers? Pseudo-random. Yep. I'm sorry. Pseudo-random. Okay. Michael Bringle. Hey, hey. All right. Congratulations. All right. Apparently we have some Intel bobbleheads. This should be good. We'll show off these guys. Ooh. That's some nice swag. Have to run over with that. Mike Johnson. Oh. Gave us... All right. All right. All right. Congratulations. All right. And the other bobblehead. AGL. There it is. Congratulations. All right. Feeling lucky. Yeah, yeah. Feeling lucky. All right. Oh. Okay. For the T-shirt. Jesse. Jesse. Is there a few Jesses? All right. I'm going to check the password. Sorry, other Jesse. It's okay. Maybe I'll pick yours next. Okay. And for the last T-shirt. Kai of the Sky. I think I pronounced it right. Kai of the Sky. Yeah. Oh, whoa. Right here in the front. Oh. Oh. Oh. Oh. Oh. Oh. Oh. Uh-oh. He's forgot the password. Doesn't have the password. Well, does anybody else have Kai of the Sky in this room that would contest this winner? I don't see another one, so. Bagel Monster. That's a strong one. All right. Well, thank you. And we got two more contests coming up. There you go. Thank you. So, by now, I think you guys got the general idea. This time, we're going to give away another, yeah, another board and some T-shirts. And after this, we're but one contest away from giving away the netbook, so I hope people stay around for that. The third question this time around, what is the largest on-chip memory? Actually, we haven't done that part yet. We haven't done this yet, apparently. So. I don't know. We don't know what we want to do. We'll just do the talk, and then. We'll do the talk and have the question after that. So if anyone just read that and they're starting to think, just, just. No. Keep an ear out. No. No. Okay. Keep an ear out. It has something to do with memory. So. I don't know. Are you doing it right here? No. I'm doing it here. No. I'm doing it here. No. No. Okay. Okay. So, I'm Dr. K. Actually, I teach the, some of the VHDL courses at University of Delaware, and all the guys here have taken these courses. We have, just to share with you, we have three courses in this. The first course, they come in and just learn the language, VHDL language, and run GHDL. Second course, they come in and they run a lot of Xilinx programs, build a small video game, do EDK stuff. The third course, we actually build, they design and build their PCB, send it to FAB, it comes back, they solder on the FPGA, the DDR RAM, and then they actually build their own box. It could be a game, it could be a wireless LAN or something like that. So it's a lot of fun. So I'm going to give you a background on EDK. EDK is very powerful stuff. It's kind of the next level. You know, we're starting to see so complex systems now, you know, with all kinds of functions, and when you're building these things, you don't want to start from scratch, right? You want to sort of bring in a lot of components, a lot of, it's called IP, intellectual property on, and that's what the EDK allows you to do. So the embedded development kit is a piece of software from Xilinx, and that enables you to develop embedded systems. It includes all the tools, documentation, and IP components that you need to build pretty reasonable systems. And it enables you to integrate both hardware, which is your design, hardware design, with the software. And I'll show you how to do that. Now unfortunately, EDK is not free. It is $495 to buy. And you can buy it from these two designs. These two distributors. And there is a 30-day evaluation that you can get from Xilinx. And there's also a link at the bottom for manuals and application notes if you're interested to learn more about EDK. All right. So this is going to be a little bit of repeat of what Rodney did in the very beginning. So if you want to build an embedded system, something that has a fixed function, not a general purpose computer, you have a number of choices today. You can, you know. Take a microcontroller. And the DEF CON badge is a good example, right? If you were here last year, the badge had a microcontroller. And now this year, the DEF CON badge has a DSP. So that's another way to do it. If you have a very large volume and you have a very low-cost target per unit, then you might actually consider building your own ASIC. You know, basically a custom integrated circuit. Costs a lot of money. There's a lot of, you know. I don't know. A lot of upfront cost. But this is the way to get parts at 10 cents a part or something like that. And then the fourth way, which I'm going to be talking about here with you, is using FPGAs using the EDK. All right. And hopefully I can illustrate to you why you would want to consider an FPGA for an embedded system. So the steps that you need to take when you're designing embedded systems in an FPGA are the following. You first develop your hardware design. Okay. Your hardware design is, okay. Am I going to use a CPU? What type of CPU I'm going to have? Is it going to have an instruction cache, data cache? Then am I going to use memory? Is it going to be DDR RAM, SDR, is it going to be flash? What IP components do I need? Do I need an Ethernet controller? Do I need a PCI interface? Once you've done with your hardware design, the next step would be to generate the drivers and libraries. So it's, in essence, you've built a custom computer for yourself. And now whoever is going to write the software will need the library files. And we'll need the include files. And you need to generate that. That's what we'll show you how to do. Once that's generated, you can actually hand this thing over to somebody who knows very little about FPGAs, is more at an application software level. And they can develop the code that implements your application. So what I'm showing here is a typical embedded system. This is for the boards that we have right now. And what you can see there is that the, at the heart of it all. Is a Micro Blaze processor. It's a 32-bit processor. And then you would select, this is a soft processor. You would select it. You would configure it with the options you like. And it would be compiled and thrown onto the FPGA. And then with that processor, you would select whatever IP you need. So whatever your embedded system needs, you would pick the components that you need and add them to your design. And the Micro Blaze is one of two processors. That Xilinx provides for this particular board that we're giving away today. That's the only option. But their more powerful Vertex devices can do a PowerPC type of processor. So the Micro Blaze is a 32-bit processor. It's soft configurable. There's lots of options. You can configure it to be a three stage or a five stage. You can have instruction data cache. You can have a floating point unit if you wish. You can also have virtual memory. You have 32-bit general purpose registers, 32 of them. And you have two different instruction types. And this shows you some assembly language code for them. Now I said that one of the keys to embedded system development is these IP cores. Because you've got to get your system built really fast. And it's got to follow all these standards. And the fastest way to do it is rather than writing your own code, pull in these components that are pre-made. And so Xilinx has created a wide variety of IP cores. And you will see in the demo, you can just pull them and drop them into your design. You can also go to opensource.org and get the source code for these cores. The stuff you get from Xilinx, about half of it is free and you can use it on a royalty free basis. And I believe the other half is actually either from Xilinx or from other vendors, third party vendors. You can try it. If you like it. I've never gone to that level, but I believe you'll have to pay royalties for usage. Now one thing I want to say is this whole design is based on memory mapped IO. In other words, when you write code for your microprocessor, the memory space, the 32-bit address space, is basically going to be partitioned. And you're going to have, you know, your main memory is going to be in there. And then your peripherals will actually be mapped into the address space, okay? So, when you read and write in your code to the memory locations, you might be actually writing to RAM or you might be talking to your peripherals. You may be, you know, sending stuff over the Ethernet controller. And the thing I want to make you aware of is that there's different latencies and penalties. You know, from the code point of view, it's the same C or assembly language instruction that does the write. But if you're writing to a DDR RAM, your latency might be five clock cycles, but I know that if you're writing to a USB. If you're writing to a UART or a USB device that is sitting on a bus, then the latency is going to be at least 50 clock cycles. And if the bus is busy with other transactions, it might take longer. So you might wonder, well, why should I use FPGAs to build embedded systems, right? So the main thing, in my opinion, is that it allows you to trade off between hardware and software, right? I mean, let's say you write some function on a CPU and you run it and you find it's not fast enough, right? It's not fast enough for your application. So then what you have is you have this thing called fast simplex links. And fast simplex links is basically if you have something, it doesn't work fast enough, you go off to the side and you write a piece of VHDL code using what Ryan just showed you, VHDL ISC. And that accelerates that. That by 1,000, maybe 100,000 times. And then you use a fast simplex link to actually put it inside the processor pipeline. And so then you basically execute, you can dispatch work for your custom functions from the processor and the latency penalty is only a few clock cycles, okay? So you can literally trade off hardware and software. And you can sort of move that. That's a boundary. And that's what the power of EDK is. And those functions are actually implemented in hardware, the ones that you want to accelerate. And you can have multiple accelerators in your design. The FSL bus is implemented using a FIFO. So you basically write inside of your processor. As soon as you get instructions to the FSL, they go into a FIFO and they come out on the FIFO on the other end. So if your accelerator is... Has a latency of one clock cycle. You will get that result on the next clock cycle. It's really fast. So for example, for our project where the students build a video game, they design their own graphics card, right? They design their graphics accelerator that drives the VGA. That graphic accelerator runs on the FSL bus. And you can imagine if you did it on a PLB bus where you have 50 clock cycle latency, the video game would be very stuttery. So now I want to talk about the tools. So there are actually three tools that are in the play when you do embedded development. The tool over here is basically what Ryan showed you. That's the standard ISE stuff. What we have on the left here is basically an SDK. It's a software development environment. You're just writing C code. And in the middle here is the embedded design system. So how does it work? Well, you start out here. You're the computer architect. And you say, what do I need? I'm going to need two products. I'm going to need two processors. I'm going to need an I-O controller, an Ethernet port, Wi-Fi controller. So you specify that, what you want. And then that creates a system netlist. And then that netlist is actually hundreds of thousands of lines of VHDL code, yeah? It's crazy. It's just a lot of code. Then that's dropped into ISE, and ISE runs compile. So compile of hardware for EDK can take a very long time because you are compiling large pieces of code. Then that produces the bit file, okay? And you can actually take that bit file and you can download it on an FPGA. And many students do that. And then they find out that it does nothing. Why is that? The software is not there, right? So when you throw that onto the FPGA, your processor is probably executing a no-op loop. And it's just going to sit there doing nothing. So what we need is we have our embedded system, it's ready to go, but we haven't written the software. So the next step you do is you create a board support package. This is done for you automatically. And this is a bunch of libraries, header files that the software needs so you can write your C code for your hardware, okay? Then you go into this SDK environment, which basically has nothing to do with FPGAs, and you write your code, all right? And that produces a link file. And the final step is this application called Data2Mem, which takes your hardware image, takes your software image, brings them together into one unified bit file, and then that gets downloaded onto the FPGA and then you're up and running, okay? Then you download that and you've got your iPod or a video game or whatever it is that you're building. So to summarize, the flow consists of these steps. First you develop the hardware, decide what pieces you want. Next step is to develop the embedded software, okay? And then you operate in hardware, okay? Yes? Is there, like, a flash bank inside the FPGA that all the code is stored on the ? You could do it that way. Or you could have it hard-coded right into the CPU. You can actually have a file system where you load programs. Then you start to get an operating system land. So you very... I have a question. I guess... How many... How much space does it take to actually take off gates within the other CPU? Okay. Yes. Yeah. Well, can you repeat the question, please? So you're writing code that's micro-placed or what? You know, where inside the FPGA does it go? Does it take off microcells? Okay. Let me repeat for the rest of the audience your question. The question is, you're writing code. Where does that code go? Okay. There are lots of options. The FPGA itself has an onboard memory. As you will see, the device we have on this board has 32 kilobytes of onboard memory. It's incredibly fast because it's onboard. Now, so you can put your program there. But if your program is pretty big, on our particular board, we have a 64-megabyte DDR RAM chip. So you can have it loaded there. We also have parallel flash. You can put your program there. We have serial flash. You can put your program there. The FPGA supports many different options. When the students design their board in a class, they choose. You know, they put some people put SD card and they put the code there. The EDK supports that. And you specify where you want your code to go. And it kind of automatically manages all that, which is really nice. You know all that memory mapped I.O.? It's done for you. Yeah. And you'll see that in the demo. Other questions? That's actually one of the biggest things that the EDK does for you is hide that complexity and manage all that mapping. And from the C point of view, you're just writing to memory. I have a question. When I was writing a program, an embedded GUI program, would I do the GUI from the software side or from the VHDL side? The question is, if I was writing an embedded system that has a GUI, would I do the GUI on the software side or would I do the GUI on the VHDL or hardware side? I think the answer to that, in my opinion, would be that, you know, if you want to do accelerated GUI functions like putting up windows, you could actually write some cool VHDL to really do that fast. And then on the software side, you would call those hardware functions. Does VHDL support a GUI framework? Can somebody else answer? The question was, does VHDL support a GUI framework? In VHDL, I mean, you're writing in hardware, so you're kind of creating your own driver and assembly. It doesn't make a lot of sense for VGA or whatever you're outputting to. So, I mean, whatever functionality you wanted to include, you write, you know? The other thing I would probably say about this is, and also kind of an aside, I think the reason why this software still costs money is because it's fairly, well, it's been around for a while, but it just started to come into its own. And the Linux kernel actually, a couple major revisions ago, just added the micro blaze processor as one of its supported architectures. So a lot of these questions are kind of open because you can run Linux on the FPGA. So if you got Linux and you got your VGA controller, you don't need to write a GUI framework. If you, you know, theoretically, could you write your own? I think that you're quickly, you, I think where this is going is there's going to be a lot of Linux and there's going to be a lot of reusing of code because you don't want to reinvent the wheel. You don't want to code an entire operating system. The idea is that you can do the hardware parts that you want to do that are very specific to your application and then reuse a bunch of code that's already been written by other people. That's good code. So I think that we haven't done GUI programs yet on ours. We're kind of in the Commodore 64 era, if you will, with our development of this stuff, but I think that it's quickly going to, it's going to vary over the next couple of years on the complexity of this. Okay. So let's do a demo. So here's my board. It's all hooked up to the PC. I've got the power cable. I have a serial port that I'm going to, one of the peripherals I'm going to show you that I'm going to instantiate is a serial port. So that's my serial port cable here. The other peripheral I'm using, there's a USB port here, and it's used for programming the FPGA. That's how we send the bit file. And I'll show you also, we'll run a hardware debugger and actually step through the processor step-by-step through instructions. And the debugging is done over the USB port. So I'm going to set that down and launch the SDK for you, the EDK. So yeah, I'll try to increase the font size. So the EDK, I'm going to use a wizard, you know, to sort of speed things up. And I'm going to give it a directory. Is it, it is really small, huh? Can I see it on the back? Oh, hold on. Yeah, we'll change that. It really, ah, that's annoying. Here we go. Yes. Yes. Okay. Out now. All right. So I'm going to create a new design for this particular board. So I'm going to create, say, create a new design. And this board is made by Xilinx. And they make a number of different boards. I know that this is this board. And I know that it's revision D. So I'm going to select that. All right. So the wizard actually knows that this board is, got this FPGA Spartan 3. And it knows all the various parts on it. So now it's basically offering me to configure peripherals on this board for my design. So the first thing I'm going to do is I'm going to configure a processor. I'm going to use the Micro Blaze. And I can choose a different speed. I'm going to run it at 50 megahertz. As I said, in order to have real-time debugging capability, as we write software, we need to include the on-chip hardware debug module. And I said earlier that the maximum on-chip memory we can use is 32 kilobytes. I'm just going to go with 16 here. And if our program is larger than that, you'll see there's an option later to use other memory. We're not going to use a cache. We're not going to use a floating point unit. And, in fact, Micro Blaze has about two dozen other options that you can drill down later on. The wizard is kind of for simple use. You know, it doesn't expose all those. This is the peripherals. Basically, what peripherals on your board do you want to use in your embedded design? I'm just going to use one peripheral, and that is the RS-232 port. That's the cable I showed you. And so I'm going to uncheck the LEDs. I'm not going to use them. Buttons. And when I uncheck that, that means there's actually not going to be hardware generated on the FPGA to interface with those components. So you can see that DDRS DRAM, I'm not going to use that. And that will actually save a lot of FPGA. On the other hand, if your program is very large, you would want that probably. There is an Ethernet interface. I'm not going to use it, so I'm going to uncheck that. All right. So at this point, I have my, I'm sort of at the end of this. And what it's telling me here is that my standard I.O. will go to the RS-232 port. And so to see it, we'll actually run TerraTerm and see it in the TerraTerm window. And then my boot memory, that was a question earlier. Where is your code coming, executing from the FPGA? That's basically where you say, okay, my code will run from ILMB controller, which is the local memory on the FPGA. Here I'm going to pick an application. It's actually going to make me an application, self-test application. So it's going to have, okay. And this screen here is telling me where do you want your instructions, data, stack, and heap. So again, you can put all these in different types of memories in your device. Okay. Here's your memory map. You have the UART. This is your serial port. This is the base address for the serial port. This is the hardware debugger, and it has a different base address. Here's your local memory, all 32 kilobytes of local memory. This, by the way, is your, one of them is your instruction memory, and the other one is your data. And they basically share the same space. And now I hit generate. And once I hit generate, it'll come back. And here's my architecture, basically. So let's look at this. This is kind of my, you know, main screen into the EDK. What you see here, I can draw a block diagram. And you'll see this is my design. It kind of looks like an iPod. But this is my processor. And this is my memory. And so this is one view. This is kind of a graphical view. I can also go here, and I can see the system view. So you can see it's probably small font. But these, all of these things are your components. And remember I told you about the IP components. If I click here on the IP catalog, you can see it's, again, I apologize for the small font. But there is lots of different components. So you can go here and look at PCI. Here's a PCI arbiter. And if I want to include that in my design, all I have to do is drag it here and drop it into my hardware design. And it appears. Now, I don't think I want to do that in my case right now. So I'm going to delete it. . Yeah, 495, you get, yeah, you get everything. And if I click here on some of these things. Where is that? You will see that the ones that have a green star are free. And you can use them to your heart's content. But there is some paid stuff somewhere here. Okay. So you can see like this, right, with a dollar sign and a lock. You can use that. But I think if you start selling it, you need to pay. All right. So let's move on here. So you've built your hardware. Right? These are the components. You can add components. You can go into your processor. You can right click. And you can configure your processor. You know, so as I said, there are tons of options for a microbrace. You have a barrel shifter. You know, just configure whatever you like. You can, once you're happy with this, you can change your address space. What you would do is you would go to the hardware and you would generate netlist. Okay. And what that would do is it would go and grab the VHDL or Verilog for all these different components. And stuff that you pay for probably is going to be encrypted, Verilog or VHDL, because they typically don't want to show the source code. And it's going to create this one netlist, which is, I don't know, 100,000 lines. And it's going to run a compile. And so it's a very long compile. You can see this arrow here spinning. So what I'm going to do is I'm actually going to interrupt this process. And I'm going to load something that, the same thing that's already been compiled so we can just move on quickly. Okay. So here is a design. And it's the same design but except that I've already compiled it. Alright. So it's been compiled. And what I normally would do after generating the netlist, I would generate the bitstream. Okay. And again, nothing to do because it's already been done. Now if I, I can send that to this board and nothing would happen because my software isn't done yet. My software is under here, under the applications tab. Okay. So I have a default project. And here is my source code here. Oops. So here's my source code. Alright. Okay. So what I would do is I'd go under software. And I would generate all, build all user applications. Alright. And again, that's already been compiled. So it's telling me that, you know, everything is cool. The, remember this thing I mentioned. That you combine your software image with your hardware image. That's the update bitstream part. And then once that's done, you download the bitstream onto the FPGA. And as it's downloading, I'm going to quickly switch to this TerraTerm window. And what we'll hopefully see is actually our program. So there it is. If I reset the board, it just brings this message. And that's basically this test application. And just to show you that it is really our test application. Let's go in there. And let's do something like print hello world. So let's, it's okay for now. Alright. So let's just go like this. And we'll say hello world. Alright. We're going to save that. And we're going to generate the application. Okay. And then we're going to update the bitstream. And then we're going to download the bitstream. And I'm going to go back to this. Okay. And you should see a bunch of hello worlds come up. And maybe reset it. Oh. Oh, it's there. There it is. Right? It didn't come up. Try it. Oh, it didn't. Okay. What? Oh. Okay. Did you save it? Yeah, maybe. No, I did. But one thing you want to notice is that when you change the software, it doesn't have to recompile all the hardware. So if you need to change one line, the hardware is the part that takes like 30 minutes to compile depending on the complexity. And so if you change a couple lines in the C, it doesn't, it only takes as long as it does to compile however long your complicated your C is, which usually isn't that complicated. Is it still misbehaving? Okay. Oh, it's not. Okay. Well, we'll move on. Sorry about that. Alright. So what I want to show you next is basically you don't have to program your C from this platform. What you can do is you can launch a software development kit, which is SDK, and at that point, you can hand this design over to somebody who is just doing C programming. And at the SDK level, they'll just be writing C programs that will run on the FPGA. And hopefully, we'll get that hello world working there. Alright. So we're going to create a new application project here, and I'm going to say test program. Alright. And let's try the hello world again here. Print. Hello world. Okay. And when I save it, it should automatically generate a link file. And now I'm going to run it on the device. Alright. So I'm going to run the debugger. Remember when we configured the hardware, we made a hardware debugger? So we're actually going to step through this program in C on the hardware. So I'm going to debug on hardware. And if you notice, there was actually an option to debug it on the simulator. So if you don't have the board, you can actually run an instruction simulator in software to do this. So this is my program. Let me bring the terra term here, and let's clear the screen. Yeah. Clear the buffer, and then this little icon here is to run the program. So if I hit it here, and I go back to the terra term, there's my hello world. Okay. So this is an SDK. It's probably something familiar to you if you write a lot of C++ or SQL. And you can basically write your software on for the embedded system from the SDK. So that concludes this part of the talk. All right. Thank you. Contest time. Okay. Now we're going to do this. This contest. I promise. So are we doing contest three and four in parallel? No. Okay. I don't even want to think about that. I'm not a parallel programmer. I haven't taken that course yet. So I don't even want to think that way. So yeah. We're going to do the... That's not even running. Okay. That's not even helpful. So like I said before, we're going to give away another Spartan board and some more T-shirts. So the question, if you were paying attention last time, what is the largest on-chip memory size that can be used on the Spartan 3 e-board? So same rules apply as before. Answer questions and we'll get back. We're actually going to have Furkan demonstrate his Linux on FPGA. And right after that, before we do the Altera demo, we'll have our netbook question up. So best of luck to everyone on that. Anybody have any questions? And if anyone has any questions for Dr. K about any of the EDK stuff you just saw, feel free to stand up, shout it out. I have a question. Sure. So OpenCourt is free. I can run web apps on your Linux on all of my devices? That's great. Yeah. Do I have to have EDK to use MicroBlades or any corner I get on OpenCourt? And what's the hard way to do it, let's say . Is there a hard way? So the question was that OpenCourt is free and I can imply from that, I can jump from that, that you could probably get a processor source code for a processor. And you can roll your own EDK. So save $500. Yeah. The answer is yes. You can save money and roll your own. What the EDK does is it integrates all these things together and it gives you all these IP peripherals. They all plug in. The bus is compatible. So it's a convenience. Actually, going along with what Dr. K just said, in preparing for this presentation, I went online and actually found the VHDL source code for OpenCourt. You can go for an HC11 Motorola microprocessor online for free. So you don't really have to look that hard in order to find these things. Apparently, Nintendo is online, too, if you want an FPGA Nintendo. NES, Steve? I only saw the original one. Yeah. NES. There you go. Who doesn't want an NES on an FPGA? That's what I thought. By the way, the answer to this contest question was in the talk twice. Does anyone else need the question up there? Otherwise, we're going to switch over to another. Okay. I hear no shouts. Oh, you're actually on here. Okay. Oh, wait. We can do this. We can do this. We can do this. It's where you're here. Okay. I was going to bring Steve down. You're going to do the game demo? Yeah. And then talk about Linux. And then stop. And then I'll do the contest. Okay. And then you can do- Okay. You get on? Sound good? Yeah. Cool. Okay. So, we're going to do the game, then stop. You know what? Cool. Okay. We're going to stop. Do you have a question for it? Yeah. Do you want to do it over there or do it over here? I wonder what happened to this. It's okay. It's okay. Yeah, it is the same board, yep. Why don't you start with the slides over there and give it over here so we can start. But, Ron, you mess with that one and do the other slides. Why don't you try and get that working while he does the slides? Okay. I'm just going to test it. Okay. Okay. Whatever you want to do. No, we can't go over here. Okay. Whatever you say. Keep it going. Okay. Okay. Okay. Okay. Okay. Okay. Okay. We talk about this game demo that everybody talks about, like, game, game, game, and you're wondering what this might be. It's up on the screen. It's just running on this small board here . I don't know, have you ever played Roadrunner, I believe was its name. Just like cars coming down and then the red car is yours and then you're just trying to escape from the cars. Basically, like that. this stuff here yeah so you know you're trying to escape the cars and after some time it's gonna get like the speed is gonna increase so like you know and then so yeah you can do this kind of stuff like you know with an FPGA using a VGA cable basically what it does is like just you write like the VGA code in VHDL and then you pass you pass some arguments from C code you like keep track of speed and the button movements and stuff in C and then you pass the code to VHDL and then you know yeah pretty nice game over there there's a problem here hi everybody again my name is Furkan I'm one of the C work members here I'm a graduate student at the University of Delaware I would like to talk about Linux on Spartan three so first of all what we need to run Linux on this board of course we need an FPGA board in this case we use Xilinx Spartan 3 than three, five hundred, and the software is ZionX ISE EDK, you can download from zionx.com. And for Linux that we run, there are some others, some Linux distributions that you can use. One of them is like Petal Linux, which is one of the good ones, and then it's free also, and mostly it's like GPL. So there are some other solutions like BlueCat or like MontaVista maybe. So you can download the Petal Linux from petalogix.com. The version 0.4 is out, I think, the latest version. And for the, like the machine, you just, you can run it on Linux, as someone asked, is ISE and EDK compatible? Can we run it on Linux? Yeah, we can, you can install it on Linux and then you can run it. So in this particular case, I use HLinux and Pardos. So what are the steps to just, you know, keep you updated? So the step one is like to prepare the workaround. First of all, we would need to install ZionX ISE EDK software, and then install the ZionX USB cable. Installing the ZionX USB cable is, in Linux, is a little bit like hard. You need to do some hacks, maybe, on like Windows version. ZionX gives support, like official support to Red Hat Enterprise, I think. I mean, if you are using like CentOS and Red Hat Enterprise, maybe you would be fine. But if you are using another, like distribution... You would need to do some, like, hacks about USB thing. So you can, well, it just doesn't seem right, but, okay. You can find some information on my blog over there. You can see the slides on, from our website. And also, to download the image to the board, you would need a TFTP server up and running. This is not a necessary step. But... It's a lot faster than downloading it on a serial line. So, I mean, you can use, like, NFS share or stuff. And also, you need a terminal to see this stuff, which, in Linux, you have, I think, Kermit and Minicom solutions. For that, you can go ahead and download them. Also, the baud rate for this particular patch. I think, it's like, $50. I think it's like $150. I think there's a lot of stuff in there. But this is pretty simple. So, you can just download it to your PC or whatever, but, you know, basically, if you want to use it for things that are not, like, in Linux, you can download it. But, again, if you want to use it for something that is, like, for your computer or something like that, you have to go ahead and download it. So, that's a little bit of a follow-up. It's not that much of a challenge. I think it's a little bit of a challenge to use. like fixed baud rate to as like 11 5200 yeah so the second step is to prepare the software after like downloading the code extract it to your home directory and then open up a terminal and then go to your home directory change directory to petal linux um version zero four i believe the latest one is uh rc4 and then after that there is a settings file inside this uh directory you need to source it in order to uh like run the commands uh inside the program there are just two versions of it one is for bash and the other is for c shell so if you are using like z shell or another shell whatever you need to change to bash i mean it's good to change the bash so let's see some demos hopefully i'll not have to change the bash so i'm just gonna go ahead and check this out and i'll show you what i've done so so having VGA issues well we're trying to figure out these problems we're actually going to give out the next set of prizes so I'm pretty sure a lot of people got this one right as dr. K did say it at least two times the answer is 32 kilobytes that's the maximum amount of memory so Steve's gonna draw some names all right just to clarify kilobytes not kilobits and capital B so uh and real quick I was alerted that to the fact that the real Leroy Jenkins is in the audience so I wanted to just say hi to him and you know wave it out but now we're gonna do the drawing all right and you want to give us a help Nadia yeah all right Corey Johnson all right yeah we're pulling on one here I guess so Tara Z all right round of applause let's shake them up a little bit more Mikey okay applause thank you Patrick Patrick Patrick applause ready one more we have one more right all right give me a picture Jas Jas Jas going up all right let's give a round of applause all right and while we're waiting for Corey to come up and give us the last question the Chuck up here just want to ask everyone to please give a round of applause to Dr. Kiamlev up here not only did he get funding to bring us all out here and everything he got you all the prizes that were given away today so let's give him a round of applause thanks thanks a lot actually the students made me do it but still we can thank him all right and Corey's going to come up and give us the question and we're going to try to do that okay guys this is the question I know you've been waiting for and you've been patient I know three hours is a long time so how about a round of applause for yourselves just cause I've sat through lectures and I know how it can be so applause for yourselves just cause I've sat through lectures and I know how it can be so up new from that okay so like I said this is the one we've been waiting for we're going to give a way the ace her inspired notebook or net book six tumblers and a couple T-shirts I know the other ones don't really seem all that throwing but trust me they are they are so we're going to give you probably about ten minutes this to figure this one out this is obviously going to awata a little trickier and you know however you want to try and figure it out you can try and figure it out so the question is not being shamelessly plugging or anything how many 128-bit registers are in each core of the Intel core i7 processor so again if you need some slips I we might be running low so if you have just scrap paper you know raise your hand and good luck does anyone need the question still up there of course if anyone wants to try and bribe the contest manager we'll verbally repeat it we're going to get this VGA thing working sure so once again the question is how many 128-bit registers are in each core of the Intel processor and how many 128-bit hearts are in each column of the Intel� of the Intel Core i7 processor and this is either for a netbook or a lovely tumbler I've been told to inform you that the netbook comes with a beautiful Intel carrying case so sweeten the deal a little bit it's like a mug kind of but without a handle ha ha and major props to anyone who chanced going on the DEF CON Network to get this answer hopefully the netbook will help you know reimburse you for getting whatever computer you use completely owned another to repeat the question again it's how many 128 bit registers are in each core of the Intel Core 7 processor? i7 processor. So, we'll let you keep working on this, and I believe Furcon has a demo for you. So, if you'll direct your attention up front, we have a Linux on an FPGA. Sorry about that. That was like VGA problems, and hopefully it's like solved. Now, let's see a demo. Can the phone be seen back from the back? Is it okay? The phone? Yeah, I think so. So, this is let's go to so this is the code that we downloaded from PetaLogix. As you can see, there are like three different stacks, hardware, software, and tools. The hardware part is for a that you have seen from Dr. K's presentation. The software side is the Linux side, where you can go ahead and compile the kernel. And so, I'm using a ZShell, so I'm going to change it to Bash and source settings.sh. Now, the XPG is running for 14 seconds. have all the peta Linux like executables over there in my path so now I will go to software and then compile the kernel thing so in vendor products settings there are two options here like there is one with petalini peta logics on it and the second one is like Xilinx the petalini peta logic is basically like the some power PC or micro blaze that you can do by yourself and we are going to show you how to do that in just a few minutes so let's go ahead and we're going to do the demo we are going to do the demo for our Spartan 3 500 so we have a lot of different kinds of Spartan boards or ml-401 board here and I choose the EDIX Xilinx Spartan 3 500 and then in kernel settings we have two different stacks one is two point for the O stack and A stack for the…" on the two point things, the new stack. And we are going to come back here later to examine the customization settings. Now we are just going to create the first project. So after we do that, we are going to go to hardware side. And then, as you can see in reference designs, Petalunix made all these cool designs for us. So there is our platform here. Originally like EDK. And so we are going to start a new EDK project. EDK from Linux, if you want to run from command line, it's XPS. And we are going to do that, but we are not going to use a GUI. So it's no window with a no window option. And then our project is system dot XMP. So we are now in XPS shell. So we are not going to do anything here. because all the things are done for us we just save the file and then start compiling it so I compiled like like I think recently because it's going to take like some time as you can remember from that case presentation so I pre compiled it so it says like nothing to be done for bits you first go ahead and compile the bits and for the bit files and then you go ahead and compile the libraries and also this is also pre done and then you go ahead and program the FS boot and in order to like run a code there is a FS boot which is I think first stage boot so you put that code inside the BRAM inside FPGA which Dr. K taught like so you put that code and then this is the first boot loader and after this boot loader like boots up you run you download the code to like a flash or other place micro boot so it boots the second boot loader which you can go ahead and then start your program boot up your kernel so... we are going to make it to initiate in BRAM and then so everything is done here basically these steps are gonna take like five or six hours so it's gonna take three or five minutes anyway. 10 minutes, depending on your processor speed. And then, excuse me, no question. So now, between the hardware and software projects, Petalunix came up with a nice script that you can run, and then after that, all the settings that you have done with this hardware side are going to be transferred to the software side, and then be written in the configuration file. And then you can go ahead and compile your kernel, depending on those settings. So the command is like, Petalunix copy, autoconfig. So now it's doing that. Yep, we are done. Now the autoconfig file success will update it. And then we are basically done here. We are going to go to our software side and compile our kernel. Now our vendor settings are the same. So there are like four different things here. Default all settings, customized kernel settings, customized vendor user settings. All of them are the same. Update default vendor settings. Let's go ahead and customize kernel settings and the vendor user settings. And hopefully, most of you are familiar with this part of the thing. Basic kernel compilation. So this is generally the basic kernel compilation stuff. Like networking. Bluetooth device, or SCIC device, or whatever. I mean, you can choose what to compile. And then, file systems. There are different file systems here. We are going to choose our file system as to be like, ROM read only. So I'm not going to change any settings here. And then the second step here is about... Okay. So the first step is mostly the first step is already done, I think. Because you don't need to worry about that step. But the second step is important here. Because you choose what program you want to use on your FPGA. So the first system settings are like network address here. Here you can define your Ethernet MAC address. And then you can choose to obtain IP address like dynamic, or you can choose to give a static IP address. And you define the server IP address. Also to communicate with your board. Basically after you download your code, or basically after you download the micro boot, if you remember I said, I mentioned about TFTP server, you can get the kernel image from TFTP via these IP addresses. So just make sure that you know the IP addresses. And you set them up. Correctly. And default host name, we are going to choose our default host name to be like DEFCON demo. And default root password is going to be DEFCON. So root file system types, different root file system types, you can choose from there. Like copy file image to TFTP boot. If you are familiar with TFTP server, there is a TFTP boot folder that you can go ahead and pull up the files from there. So this is basically that directory. You define that directory to be whatever you want. And then the core applications here. You choose the core applications. What like the executables do you want to like run on your machine. So there are some cool stuff. You have like libraries, which libraries you want to choose, and file stamp applications like mount, unmount, or like some, if you want to run like Samba, you can choose it. Also network applications. So you might not, you know, ever seen like in this screen like where you pick what applications you want. And the reason why you would pick applications here is because these are actually applications that are going to be built into TFTP. So you can put them into the image that's put on the FPGA. You could stick on an SD card, use a cross compiler, and compile whatever external applications you want. But these are ones that are going to be built in no matter what into the root boot file system. Yeah. Yeah. So, the ACP, some Ethernet tools, HTTP server, FTP server, net cat. Yeah. Open SSL, open VPN. So, you know, pretty much cool stuff here, SSH, Telnet, TFTP. Most of the stuff you can do. So, other applications are like mobile applications like Perl, Python. Yeah. You can write like codes and then compile it. So, and yeah, and three different games, Dungeon, if you ever played. So, yeah, basically we are done here. So we are just going to go ahead and just... Run the process here. Hopefully it's not going to take a lot of time. It takes like four minutes for me. Yeah. We actually want to also... We actually want to start the TFTP server, right? Oh, we can go ahead there. Okay. Let's... Yeah. No. Okay. I'm going to interrupt it here. I think it's going to take some time. Let's go ahead and pre-build here. So, after you... Okay. After you compile the kernel, you'll get some files inside your TFTP boot directory. Some are like kernel images in different formats and some are like microboot things that you want to download. There are some... For example, there is one you would extract here and then you would dash S extract here. Dash S is basically if you want to like... This is generally if you close the... If you power off your board, your code is going to go away and you're not going to be able to run it again if you power on. So, what you want it... You want to... If you want to run it like initially, you can download it. You can download the microboot dash S and then you can run it initially. So, we are going to go ahead and... Into... Into serial port. Before that, we should start our terminal here. Yeah. So, this is the serial port on our FPGA on the button and on top, I'm going to dump the code inside the serial port and you are going to see hopefully... Before that, we should... We should take a look at this. We generated the code, yeah. Now if you remember, we generate the libraries, the bit files and the program, but we didn't dump it to our FPGA. So, we are going to go ahead and then download it to our FPGA. Oh, there you go. So, as you can see here, the first stage bootloader has started. We dumped the code inside FPGA's BRAM, and then it's waiting for a SRAC image to be downloaded. So. So, now we are good to, yeah, we are good to download our microboot. So, as you can see, it's spinning like a dash over there. It's downloading code over serial line. And what we are going to see is microboot loading up. Well, comparing the size of the kernel and microboot, it's going to... If you were to download the kernel, it was going to take, like, a lot of time, so... It's pretty much, yeah. So, it's like 300K versus 2.5 MB. Yeah. So, we are in prompt of microboot are here. We can... This is... We have some commands that we can run, so there are some different kinds of options here that we can use. So, we have the TFTP server running. Yeah. We have the TFTP server running. So, let's go ahead and download it. Yeah. So, let's go ahead and download our image. As you... Yeah. As you can see here, I don't know if you can read over there, but, yeah, there is a register over there, register address over there, like, that you can, like, microboot starts, start, and there is a number over there. So, what we want to do is we want to, like, pass that number and then write our image over that number. So, it's 8D, so we want to use, like, 8E, so TFTP, and 8E, it's not E, yeah. And then our image is image.ub, yeah, it's loading the image. What we did... What we did is we are just... We just downloaded our kernel image that we compiled. It's now on our FPGA, we just wrote it, and now we are going to go ahead and execute that. So, in order to do... Let's, first of all, check, yeah, that's correct. So, we are going to go ahead and execute it with boot M8E. 0, 0, 0, 0, 0, 0. Oh, sorry. Sorry. There you go. Now we are loading up our Linux kernel, at least, at last, yeah. Okay. There we go, we see the DEF CON demo logging over there. We go ahead... Enter the password. What was the password? Password. There you go. Yeah. We are now inside our FPGA box here. So, you know, if we do a processor, just to make sure. CPU family microblades, FPGA are Spartan 3E. And then CPU version, like, 7.10 C. C. So yeah, I hope we can also Telnet into it. Yeah. As you can see, it's running a Telnet server, so you can Telnet into it, or whatnot. All right. So give Farqan a round of a hand for doing this Linux stuff. Well, the question I'm sure is on everyone's mind, will it run Vista? Yep. No. It will not. Yeah. Never. Wow. I mean, that's a real advantage of Linux, is that it can run on pretty much any architecture, as you can see. The real question on all of our mind is, why would you want it to? Yeah. I wouldn't want it to run Vista. All right. So yeah. I guess we're ready for the netbook then. All right. I'll tell you. Yeah. There's one. Oh, one more thing, I guess. One more thing. We promise. Just so we're not totally Xilinx idiots here, you can see that... Yeah. Altair has some software, too. So on the... Yeah. If you can see, there's a cool board here. It's an Altair board. Altair is, by the way, the other company, other FPGA company on the market. So they have different kinds of boards. And this one is Cylon 2. I know the pronunciation. So it has... Yeah. It has a cool touch screen over the... It's running. We want to take a picture. So yeah. It has a touch screen over here, and then a five megapixel camera here, but it has a lot of switches and LEDs over here, four buttons, and back on the board, there's an SD card. Over on the top, there is... There's like microphone in and line out for speakers, and there's also a VGA port on this FPGA. It's pretty cool. And there's also an LCD screen here. You can put up some cool stuff on that. And yeah. Let me show you a cool demo about this board. So camera. Camera. Okay. Do you already have it loaded? Yeah. Let me first pull up here. So this Quartus software is Altera's ISE. You can download it. And there is this NIOS software. It's for embedded applications. Also you can download. It has Linux version, but it's pretty expensive. Write them nasty letters so they make it free like the Windows version. Yeah. That's why I'm running it on VM over a... Yeah. Crappy XP. So I will flop the demo for this board. Yeah. Yeah. Try to start it again. Yeah. Yeah. Yeah. Yeah. So, I didn't have so much time to examine all the stuff on that, so this is a demo from the Altera, thanks to Brian for his support. So, here, as you can see, the interface is pretty much the same as I see. You can see the files over here. I don't know if you can see it from the back, but, yeah. So, yeah, the compilation process is here and the messages are on the button. So, we are going to go ahead and start compilation. It's already, again, pre-confiled. So, full compilation was successful. We are going to go ahead and swap the programmer. It's like impact in Xilinx. Yeah, I will. Let me show something. So, it's downloading the code. Yeah. So, I will. Going to give you guys the camera. Basically, the software demo in here actually does edge detection. So, it takes the picture that it takes in via the camera. And can actually detect, you know, like shapes that are different colors, different brightnesses, and different things like that. So, after we show this demo, we will announce the netbook winner. So, this is touch screen. When I touch the screen, it changes to normal mode. You know, as you can see. And, again, changes. And, like, it swaps the colors. So, yeah. So, basically, that's it. All right. Thanks, Virkan. If you have any questions, let me know. So, this is, I guess, what, well, everyone who chose to wait, this is what you've all been waiting for. And, once again, I'd like to thank everyone for sticking around and hearing our talk. I hope you learned something cool about FPGAs. And, you know, once we're done, feel free to ask questions. And if you see us throughout the rest of the con, ask us questions. And we'll be happy to try and answer them. So, Steve and Mike here are going to pull some names to see who wins. Okay. We'll do the answers as we, like, go over the questions. But before we give the answer to this, I just want to ask, is Rodney De Carataret, Rodney De Carataret, is he here? Okay. I just want to return his business card. And I wouldn't want, you know, him to lose it knowing that it says US Stratcom on it. And Rodney.decaratet at JTFGNO.mil. So, if anybody wanted to e-mail him and let him know how you feel about him leaving his US Stratcom business card around, you can. I'm going to just leave it right there. We had to check the rules. We found out we can't apply that for Spot the Fed. So, yeah. It was worth a shot. Sorry, Rodney. So, for the question, how many 128-bit registers are in each Intel Core i7 NEOHAM processor? It was 16. 16. 16. So, everybody got that right. Good job. Yeah. When they first did the 128 registers, they did eight and then they doubled it. Not in the i7, but in ones before it. But the i7 has 16, too. What kind of name? John? How many Johns we got? One? Oh, just one? Okay. Good. Yeah. We got to thank you, Mark. Do we have this button? Oh. I thought... What was that for? That was for the T-shirt. Sorry. Sorry. We gotta save the best for last. Sorry. We forgot to announce. We're drawing... We're drawing the netbook last. And for those of you who didn't get called, I... I felt just happy though, right? Everybody... All right. All right. We'll play it fair. We'll play it fair. All right. We're going to go back this way. Okay. We're going to go backwards, all right? We should put his name back. Yeah, we'll chuck it back in there, all right? Fair, legit, here's your entry. Going back in there, let's give it a... That was my fault, I'm sorry. I didn't remember to announce it. So, for another shirt... If you win the netbook, you don't get the T-shirt, huh? So don't be excited. Brett Esquivel? I apologize if I can't pronounce that. Brett, come on up. Corey, Corey. Our authentication is lacking in implementation, I apologize. All right, here we go. Mic hit me again. And a punch to the face with Matt T. Matt T, all right, that was for a mug. You can thank Intel. All right. C9H13N. Anyone? Actually, I will give this to you if you can guess their password. Now, I'm telling you, you have a very good shot of this if you think carefully about what a common password might be. Oh, man, delete. He said it. He said it. Their password is password. So, for a netbook, you could have had a netbook and... All right, we got a few more slips. What's this for? This is for what are these, Corey? Yeah, we still got Tumblr. What is a Tumblr, Corey? Travel mug. Travel mug, okay. We're going to try to speed this up. Chris? Chris, I'm going to need a password on this one. Wait, there are two Chris's. I'm seeing two Chris's. We're going to need... All right. Meanwhile, we're going to draw the next one. You already got one, so... Albert Caliland? I apologize. Sorry, Al. All right. All right. Go ahead, Mike. All right. Tim. Tim. Hey, Tim. No, one more. Not netbook? Yeah. Otherwise, it's not going to be fair to John. We're going to shake it up. There's barely any left. What's this for? You have a really good chance. This is for one more Tumblr or travel mug. By the way, there is very few correct answers for this. John. John. You can keep both. You were so close. John is the most unlucky, unlucky guy. Yeah. All right. Last drawing. Shaking it up. Reaching in. That's me. All right. All right. That's me. The other... Jesse. The other Jesse. Oh, yeah. The other Jesse. Yes. All right. Hey. Yeah. There you go. There you go. All right, everyone. Round of applause. Thank you very much for coming out. And I hope you guys have a good DEF CON. Yeah. Yeah. Yeah. Yeah.