Ethan Lab Notebook #159
Replies: 13 comments 14 replies
-
Woo! Excited to see the start of the world's greatest RISC-V processor!! I'll recommend the name Couple of other logistical thoughts:
|
Beta Was this translation helpful? Give feedback.
-
6/2/23This week I added support to fud for passing binary and hex data into Filament designs. I figured this was a good place to start because it would make testing parts of my RISC-V implementation much easier. This sounded pretty simple, but I had to integrate it with the rest of the fud codebase that already existed, which was a little daunting and took some time to get the hang of. After some trial and error I came up with a good solution that fit pretty nicely with the rest of the code. Then, I moved on to starting the RISC-V processor (I like the name frisc but I will spend the next few weeks brainstorming some other cool names). I figured the instruction decoder would be a good place to start. A few weeks ago I played around with implementing this in Filament, so I was a bit familiar and focused on making my code cleaner/easier to read, since my first implementation was neither of those things. I took a bit of a detour and spent some time looking through the Filament compiler code because I was interested in implementing some syntactic sugar like Rachit helped me out with printing the AST, so next week I plan on revisiting this. I think it would be nice and not that difficult to have syntax like Fun first |
Beta Was this translation helpful? Give feedback.
-
6/9/23This week, I finished up the decoder, started/completed the register file and ALU, and wrote tests for each component (#171). Once I was convinced each component was working properly, I connected them together in a top-level module called I wrote quite a bit of Filament code to get this part of the processor working, and it was fun. This part of the design is mostly combinational so I wasn't working much with Filament's type system, but it was interesting to get a feel for the syntax of the language. I think it will be really interesting to eventually use the type system to pipeline this design. Apart from the processor, I also spent time this week learning about Filament's new IR. I implemented some small changes to the IR printer at first (#168). Then, I started working on the monomorphize pass. I haven't made much tangible progress yet, since most of the things I did so far ended up being incorrect, and it took me a bit of time to understand how the IR is structured. I think I have a better understanding of it now, and will continue this next week. |
Beta Was this translation helpful? Give feedback.
-
Awesome stuff! Most of the specific comments are in #171
You can spin it as "updating your stochastic priors" like the machine learning people do ;-) |
Beta Was this translation helpful? Give feedback.
-
6/16/23Much of my time this week was spent trying to find ways for the RISC-V core to interface with memories, which are not yet a part of the Filament language. I thought about this problem for a bit and figured a good approach to start with would be compiling my Filament program to Calyx, then instantiating it in a Calyx program along with whatever memories I wanted to use. I made a harness would read an instruction from memory into the CPU and write the output of the ALU to a separate memory, but ran into some strange bugs. I loaded a simple instruction sequence into the instruction memory: The harness was working, but it wasn't exactly easy to use. The compiler did not emit any Calyx for Filament programs that did not have a With the harness in a pretty good place, I started implementing the rest of the instruction set, which I hope to finish up next week. I think we are pretty close to being able to actually run programs on the processor, which is exciting. I spent most of my time on |
Beta Was this translation helpful? Give feedback.
-
Little mid-week update/to-do list for myself: So I wanted to use memories implemented in Filament (or at least with a Filament signature) because it was a bit troublesome to reason about the timing of the Calyx memories. And there was also no explicit reason I could come up with for why the data memory had to be instantiated outside of the Filament Sort-of-related tangent: I got this error (which I think is thrown by Verilator? unsure though) before when trying to build the circuitry for the program counter logic. I was connecting a Back to what I was saying before: I did this same thing to avoid the combinational loop error and instantiated a Filament memory in the Calyx harness, and then connected it to the To-do list for myself:
|
Beta Was this translation helpful? Give feedback.
-
Yeah, I'll try to write a simpler program that captures what was happening later today |
Beta Was this translation helpful? Give feedback.
-
6/23/23Rest of this week's update (refer to previous post to see the rest). I implemented the load and store instructions for the processor, which ended up taking more time than I thought it would. Getting the logic right for loading/storing bytes and halfwords took a bit of time, and also made me realize I had to rethink how the memories were designed. I was previously using memories that had X blocks of 32-bit data. This meant that a memory address corresponded to whatever word was at that address, but the memory should be byte-addressable. Instead I wrote something up that could be instantiated with X bytes, and each of those can be addressed. This works fine, but it has no concept of alignment (should it? I am not too familiar) and the RISC-V spec says this about alignment:
Similar thing needs to be done for the instruction RAM, but this would make loading programs into it a bit more annoying. Still need to think about this some more. In the meantime, I added a new data format I think this is a start to building up a toolchain-like thing where you can compile a program, load it into the instruction memory, and then run it on the processor, all from the command line. |
Beta Was this translation helpful? Give feedback.
-
6/30/23This week I reached a good point to stop on I understood generally how the IR is structured thanks to previous meetings, but it took a bit of time to get familiar with the technical details of the code, and I mostly figured things out as I went. Also, I am still getting familiar with Rust so it took a bit to figure out exactly how to implement the things I wanted to, but I think I have a good enough handle on it now. |
Beta Was this translation helpful? Give feedback.
-
7/7/23I spent all of this week working on monomorphization. I built up some infrastructure to replace all the params in a given IR data structure with concrete values, which was an ongoing task because they kept popping up in places I didn't know they were. Also, loop unrolling took kind of a while to get correct, because I had to add a lot of new times, invokes, instances, etc as I unrolled them and had to be careful about causing name collisions. There was a lot of information to track and it was not immediately obvious how to do it, like the bindings between invokes and instances that are inside loops and had to be added to the component. But I was able to figure most things out as I went. Right now, I'm working on adding ports and if statements, which (I think?) are the last two things to do, besides bugs that still might pop up here and there. Ports also require a lot of information to be copied over from the original component, so I'll have to be careful about making sure everything is correct. |
Beta Was this translation helpful? Give feedback.
-
7/14/23Again, this week was spent on monomorphization. I met with Rachit to do some pair programming, and we worked on parts of it together. We decided to make a new version of the pass, since the one I had been working on was getting pretty messy. I think working through it gave me a good sense of the things that need to be done, and also some possible shortcomings of the IR (like the Overall, this is taking longer than I thought it would take me, but I guess that makes sense because I had to learn how to work with the IR, as well as learn a lot of Rust, and also implement the pass. I apologize if this has been blocking other people's work, but I feel like I've been learning a lot while working through this, so at least there's that. |
Beta Was this translation helpful? Give feedback.
-
7/28/23I spent most of the week working on more monomorphization things. At the start of the week I figured out there were a lot of bugs with ports and parameters, mainly arising from when we would unroll loops. New parameters would not be generated correctly, so the new ports that were being generated were using parameters that either didn't exist in the new component or were used by other ports. This wasn't too difficult to sort out, it mostly just required keeping track of some more information and being careful about where/when new parameters were generated. Then the more difficult thing to figure out was why loop parameters were not being correctly substituted for concrete values in constructs like invoke events and port livenesses. With help from Rachit, we fixed it by restructuring the code to do the substitution before we check if we've already visited the expression. With monomorphization appearing to mostly work, I inserted it into the rest of the compiler flow and found some more bugs that were exposed by lowering and bundle elimination. I fixed these and then wrote up a PR for it, #216 |
Beta Was this translation helpful? Give feedback.
-
(Repurposing this to just be a general lab notebook) 3/26/24This week I worked on #437, which I ran into when implementing more of BLAS kernels. I was a little rusty on working with the IR so it took a little while longer than I thought, but it's done now. So now I'll go back to implementing some kernels, with a focus on getting some synthesis results for the kernels that are implemented. |
Beta Was this translation helpful? Give feedback.
-
6/1/23
Hi and welcome to those reading! Will be posting updates here about implementing a RISC-V Processor in Filament.
Beta Was this translation helpful? Give feedback.
All reactions