A New Approach to the Software side of Hardware
A revised transcript from our interview with Charles Papon (Creator of SpinalHDL)
Colby: Could you explain, at a higher level, what SpinalHDL is and what it does and how it works?
Charles: We learn in school how to do digital design. Maybe we use logic gates and we draw them, that's the first basic approach. You need to abstract things out. So you could regroup some of those individual gates into components, but still, you end up doing a lot of wiring by hand, and it's really messy if you want to modify a design, because it's graphical. You need to shift around all the wires and rearrange things. It's like when you write a word document, you end up spending more time on the layout than on the content.
And for instance, we learned to use VHDL or verilog as a way to describe digital hardware. And it's great, but when you think about it, those languages are not designed for digital hardware. It's like a paradigm that you can interpret as digital hardware. If you want to use them to describe hardware, we don't really want to use an event driven paradigm, but we have to because they're made like this.
So what I've seen and heard in industries is that, to overcome the shortcomings of verilog, especially in term of elaboration. In VHDL and Verilog for instance, you have for loops, modules, parameters.
Things are a bit better since system verilog, but still, there are quite a few limitations. And in VHDL there is the 2008 and some other versions of VHDL, but the foundation is kind of broken.
So what I've seen in industry is, people for instance, will write some script to generate VHDL or Verilog files to overcome those limitations, they are using a programming language which can model things to generate what they really want as hardware. And we could say it at the first evolutionary step.
And SpinalHDL is a step further where we still use general purpose programming language to do the elaboration of what we want. At least instead of ourselves managing a weak string of Verilog or VHDL code, you want to add into our file, instead of really having to put together the strength to compose our Verilog files in Python or whatever you want to use. Instead of this, we have a software library, which provides an API which allows you to capture the design that you want, like say I want a register of this type and it'll create it for you. SpinalHDL is really about capturing the full graph of the hardware you want, having some automatic checking done on it, like checking if there are some unconventional loops, if there are some latches, some unwanted cross clock domain, checking a lot of things. And at the very end, generating the verilog as a net list. So that's the concept.
Colby: Who are the main users of SpinalHDL, because I see it in a lot of different places, but who are the main users you see? Because I see it being really helpful in schools and everything, when you're doing complex projects, especially when they're teaching verilog, to have something that can streamline the whole process.
Charles: There are two ways to answer that question. One way is, it's really hard to know who is really the main users of SpinalHDL, because it's an open source project, and because it's open source it's hard to keep track of it. You don't have customers.
So I don't have a real main user. I would say, instead, there are some main projects which use Spinal, which is Vex RISC V. And that's the thing which really bootstrapped Spinal. Without RISC V, SpinalHDL would have been much less successful. Many people are using it in FPGAs as well.
Colby: How did SpinalHDL start in the beginning and develop, was it just you in the beginning or did you have a small team of people.
Charles: It was just me for a very long time. I was in university, and I had a project where I had to present Chizel. So I tried a Chizel, it was great because the paradigm was great. At that time, the Chizel implementation was not good. It was Chizel two or something, I don't exactly remember, but at that time, it was really lacking in many places.
Because of this, after a few times I tried to implement my own implementation of the paradigm to understand how it could work how Chizel could be implemented. And because it was working well, I continued my way. And little by little, for at least three years, I was mostly alone.
It was mostly a hobby, pretty much part time. And then for three years I was in a university to get a bit of money on my side. And 60% of my time I was working on SpinalHDL, and in my free time, doing different projects and stuff like that. And for two and a half years now, I've been full time on SpinalHDL and related projects like Vex RISC V.
Colby: That's awesome. And that's something that, for open source tools, especially in this area, like Xschem and Klayout and everything, a lot of the creators aren't doing it full time. It's still a hobby project for them. What made it take off so that you were able to switch completely to full time? Was it mostly the RISC V that made everything explode and get popular?
Charles: There are two ways to see the question, like there is a financial side and the motivational side. So it first started with motivation. I worked for one year in a company where we had to do really big designs in VHDL and it was really tedious. And the thing is, once there are ways to do things better, it really feels painful. So I worked there for one year there and then when I came back it became my full-time occupation.
To make these kinds of things possible, there should be a lot of different things going well in parallel. You have to be motivated, but also, you really need to have quite a bit of financial security. You need freedom, and to have that freedom, you really need to have some money on the side.
I was in that situation, so I was able to do it. And then on the financial side, it came much later mostly because of Vex RISC V. And that opened some funding, some open source foundations provided me a bit of funding to add some features. Some companies gave me some funding to add, for instance, multi cloud support and these kinds of things.
Colby: And speaking on that, you mentioned it with the commercial and support and everything. As an individual developer of this program, was it difficult to wear every hat, and be responsible for support and development and kind of all these different things? And GitHub helps a lot with the pulls and everything and the forums, but was it hard to do everything at once?
Charles: So in some ways I didn't really have to do a lot of commercial support. It really depends on the time of the year for the workload for support. It comes in waves. I don’t why it's always in waves, really heavy waves. And then for a few months, nothing.
The thing is, really often it's little questions, simple things asked by many people. So you can't really charge people for that. And very often people who work in companies don't want to mess up with the bureaucracy above them. If they twist the portfolio maybe one or two hours, but it's so much bureaucracy to get that funding through the management of the company, and they haven't tried because, I know, it's really a pain. So that's the thing, for commercial support, I don't have much, I'm trying to get some funding for projects I wanted to work on, so I didn't have to do a lot of commercial support.
There is a lot of answering question, managing Github issues at the same time. This is a bit depressing because it's not something which pays you a meal. But sometimes there is a wave of students asking questions that the teacher will handle because it's his job to handle his students. And that, sometimes, is a lot of emails to handle. And that's a bit depressing sometimes.
Colby: It's a lot of work to have to manage all of that.
Charles: And that's work, you can do out of the goodness of your heart. But the thing is, to keep the motivation to go forward with the rest of the project, you have to limit that part. Cause it's sucking the energy out of you really fast compared to doing things you want to really want to do. It's a lot of managing your willingness to do things for free, contributing in open source.
You have to protect yourself from doing too much support or else nothing will move forward. It's really a hard situation. I'm really trying to find contributors to handle Github issues and all these kinds of things. And it's starting to come. People are starting to be ready to be helpful, and not only relying on me to map things and it's really coming along.
Colby: It's really cool to see your tool get popular enough to the point where people can help each other. And something I also wanted to ask that I jumped over before SpinalHDL, because it's difficult to learn HDL, all the languages, and verilog and design and everything like that. And usually it's restricted to specialized programs and everything. And on top of that, you also obviously had to do some work with software development and everything like that. What was your background in education and everything throughout school?
Charles: So my background is from the Switzerland system. It's driven by, there's many ways, many different ways, but the way I talk about it is, I was 14 years old, I started an apprenticeship. It's a little bit like the German system where there is really the industry way, where you go into industry at 14 or 15 years old.
You go in apprenticeship for three or four years where it's maybe one and a half days of school per week or something like this and the rest at the company.
Colby: What was the apprenticeship for?
Charles: Electronics, I was soldering, PCB design, these sort of things.
Colby: That's really cool to be able to do something that technical at such a young age.
Charles: Yeah that's that's the thing, there is the more generalist way where you go in a general public school until you are 18, and then you go in your university and this kind of thing. But I really didn't want that to go that way because I wanted to learn a bit more technical, more math things. So I was lucky I had this possibility.
Colby: And then in college, I'm assuming, you started to focus more on the digital design side.
Charles: The thing is I started doing FPGAs at the end of the apprenticeship on my own time for fun. Then I started doing FPGA at the end of the apprenticeship.
So in some sense, everything about digital design, I learned the basics in the apprenticeship and from there, everything else came a bit from my free time at home. And then at university, you call that the bachelor degree? And there, it was a mix of software and electronics, and we did a bit more too.
Colby: And with the education and everything, for SpinalHDL and for teaching people how to use it, one of the things that I really like about SpinalHDL is how good it's documentation is. Because for open source tools there are huge gaps in the documentation for some of the tools, especially the newer ones and less developed ones, and the documentation isn't really that well managed and maintained. Was that one of your main goals? To have a really good and thorough documentation for the tool?
Charles: I would say, the first three years or the first four years of SpinalHDL. My main focus was really the language. It was not as much of a focus, but also to have documentation which was okay, mostly filled with examples. Because I always learned by taking a piece of code and modifying it. I didn't learn things by reading books or reading scripts. I always learned by taking a thing and modifying it to see how it works, to see what happens. But there is also somebody else who helped me with documentation, which helped quite a bit.
Colby: That's a huge help, because for me, at least as an engineer, writing documentation is definitely not my favorite thing to do.
Charles: Yeah the thing is, often we're underwater with all the things, all the priorities. It's a question of having the freedom, having the time.
Colby: And now, for Spinal, how many people do you have working on the project with you or for you?
Charles: There are two things. First, it's really a project that I already started a long time ago on. And then people joined with contributions. Currently, I would say there are maybe four or five really active people on it, which do requests, managing issues, math things, maybe four or five people.
Colby: And I kind of wanted to touch on that part because it's pretty rare to see an open source tool like this develop into something so big. Basically like a company. And for you, getting the funding in the beginning you mentioned, and the financial support. And for a lot of technical founders, dealing with the finance side of things is difficult because they're trained in engineering and science, was working through all the funding and financial parts of the project difficult for you? Or was that just something that you learned on the spot?
Charles: So for the funding side of things I would say it really doesn't pay well at all. If I would go work in industry, I would at least double my pay. So I would say it's more because I'm relaxed, on my side, having a simple way of life without a lot of expenses that I can do it.
And for all the authors which are contributing to it, from my understanding, it's mostly people who work in a company, use SpinalHDL as a tool to do things, and contribute on the side.
Yeah. Personally, over the last two years, I was quite lucky because there was a foundation made to help open source people to do projects by giving them money, like maybe 50K to do a project. And so one of those foundations contacted me and asked me if I had a project that I wanted to do and that they could give me funding.
And the reason why they contacted me is, people that they were already funding were using my things and spoke to them about my things. So I was really lucky. That's the thing. It's a lot of luck, being somewhere at the right time.
Colby: And for open source, you mentioned the foundation and the funding and everything, because the field has grown so much, did you see how much it was growing? And what was your decision to make this an open source tool instead of something that you could go out and make completely closed source?
Charles: So for the last part of the question, I would say maybe it's a cultural thing. At the time when was a kid, I was just downloading music files on websites, those peer to peer things. Growing up in that environment where you can download things like a pirate, and basically where you really feel like you are just a kid, you have no income, you have no access to things where there are are infinite results, technically speaking.
It maybe changed the way of thinking a bit. So for me, there was really no way to develop some code and keep it closed source, locked somewhere. It's not really part of my philosophy. I'm more into sharing things. Like currently, I'm using Linux and I'm happy I can use it. And it's all open source. So it's a way of contributing to the cause.
Colby: And you mentioned, learning a lot of the stuff by yourself, which is really cool, especially with all these open source tools, it gives people access to programs that are usually very expensive and only used by larger companies. When you were figuring everything out and learning everything, is that kind of how you look at SpinalHDL? Because there's a lot of SpinalHDL examples and tutorials and everything like that. Is that something that you continue to do? And I even see some classrooms and universities that have lessons and tutorials and everything. Is that something that’s a goal of yours, to be able to teach as many people as you can how to use it.
Charles: Yeah, my goal was that if somebody wanted to pick it up, they could pick it up with enough resources that if they tried it, he could look around code and modify things to see, at least, how it works. My goal was initially to provide a proper replacement to the VHDL and Verilog, that was really my goal.
I didn't want to have to deal with those languages anymore. It's really frustrating. Especially when you come from a software background, and I have more of a software background than a hardware background.
Colby: Yeah. Because a hardware language is difficult for software engineers.
Charles: Yeah. Initially it really came just as a replacement for VHDL and Verilog. But with time, you could go so much further. And the thing is, the more I was using Spinal, the more I was discovering or realizing new ways to use it with more abstractions, smarter ways to do things over time. The project evolved from being a replacement for VHDL/Verilog, more into exploring even more new ways to define hardware. Because for instance, the thing with SpinalHDL is it’s great because it is a programming language. You can layer abstractions over abstractions. For instance, you can have a state API, or you could have a pipeline, API pipeline, all these kinds of things. And this is really the growing part.
Colby: And also I wanted to touch on Scala, the language. Can you describe that a little bit? How you got into that?
Charles: So Scala, it was one of the first lessons I had to follow in my master degree, I had one semester where I had a lesson of Scala, and it started from there.
Scala is far from being perfect. I would say it's getting older now. The thing is with scala, you can do functional programming and VHDL programming. And the one issue is that, really often, when you look for resources about Scala, you find resources which go into the really functional way of describing Scala instead of the easy to approach way. So it's a bit of an issue. Scala is very scary if you look online but can be used quite easily, if you don't go into too many crazy concepts.
Colby: Yeah because it seems like a really cool language. I also wanted to touch on the development of the open source community and, especially because you have success stories, like SpinalHDL is so popular now and there's so many different tools. Have you seen it, especially in recent years, start to grow very rapidly?
Charles: So yeah, I don’t know how popular SpinalHDL is, but the last growth I have seen was a lot in China. I'm not sure exactly why, but in the software world, for instance, things evolved a lot. In part, because the software engineering field and the number of people working in that field grew a lot really fast.
So there were constantly new people coming in with new ideas and trying new things. And maybe in China, it's the same. Because maybe it's really growing there, the users of VHDL and stuff like this. So new people are getting trained, new people are being open to new things, like SpinalHDL, maybe that's one reason why. It's the right timing.
Colby: You mentioned SpinalHDLs has more of a digital focus. Do you think that you'll ever let analog or make it compatible and be able to do analog designs, because those are two very different areas?
Charles: Yeah. I would say it's out of scope.
Colby: That would take like a whole team of engineers to make a tool like that or make it compatible.
Charles: It's really not my background. So the thing is I will try to avoid going into things that I don't have mastery of. Because it'll not end up good and I will not really use it. So because I'm not using it, it'll not be published enough. Often I'm trying to avoid going into features that I would not really use, because if it's not in use, it's not tested, it's not stable.
Colby: What do you see as the future for SpinalHDL and do you see this as continuing to be your full-time project and job and your main focus?
Charles: SpinalHDL itself, I think now, is mostly stable there. Most additions done are libraries of components, like for instance, CPU and this kind of thing. So currently I would say it is on bug fix mode if there is bugs or little additions. But most of the effort is really done on libraries. And personally the last part was to add, for instance, it was a pipeline in API.
Where you can define a state, how is that connected? And you can define a signal. I want part of the pipeline and then retrieve that pipeline value somewhere else, automatically, these kinds of things. This came, because I was using that in Vex RISC V. It was a lot of fun. Its goal is to get Debian working on it.
And then I don't really have any plans. So we'll see, I'm trying to not have too much, a long term vision to not have a stack overflow.
Colby: And for the RISC V, that seems like enough work as it is to do that. Are you involved with the RISC foundation and directly with them?
Charles: Not really. So RISC V, to be honest, it's probably nice people in it, but the foundation, for me it's really, maybe a bit too corporate. Especially the RISC V summit and these kinds of things where, it's not always true, sometimes it's good, but really often it's too much business, too much corporate, too much RISC giving you the slides. Nothing really technical.
I would say it depends on the people who organize RISC V’s, sometimes it's hosted in a given university and they have a word to say. So yeah, it's a bit sad, it's not enough academics right now, I would say.
Colby: I also wanted to touch on events like those, especially now that everything's in person. Have you, do you try to participate in a lot of the different types of events? Like the Paris conference coming up and the RISC foundation conferences and everything like that.
Charles: I was in the Paris one, which was one month ago, a RISC V spring summit. So yeah, I’ll be in the one in two weeks. After that I have no plan at all, to be honest. If there is something, I may go, but the thing is, mostly, normally all the fees are out of my own pocket. So I'm doing that if I really have something new to talk about, but otherwise it's a bit expensive.
Colby: What are you speaking on at this coming conference?
Charles: So the Vex RISC V, I have been designing since October, so I will try to focus on the SpinalHDL side of the project. For instance, there is a pipeline API, there is a plugin system to compose the CPU with plugins. Often if you have a big design, like a CPU and you do this in Verilog or VHDL, you would have a really big top level, which connects everybody with everybody. Which is really fast, really messy. And if you want to change something in there.
And so for instance, in the next RISC V has a system of plugins, where for instance, each plugin can ask the pool of plugin services, if they have a given service, for instance, one service could provide a jump interface from the program content plugin, this kind of, it's really a modular approach. And the CPU is defined with plugins. So there is no top level. The top level itself is maybe five lines of code used to put in place the framework and everything else is modular. So you can come and for instance, define a new execution unit. So you instantiate a plugin to do that. And you can add your custom solution into the execution unit by adding plugins. It's quite modular. So yeah, we'll talk about this mostly.
Colby: That's pretty much all I had for today, but I really appreciate you meeting again.