Maker Pro
Maker Pro

My Video: My Logisim CPU / Computer - Now With Floating Point (FPU) (Fractals, Raytracer, Etc.)

mcsoftware

Oct 13, 2015
26
Joined
Oct 13, 2015
Messages
26
Here's the latest development on my Logisim CPU / Computer. I've added floating point capability to my CPU and created programs to run on it (function plotter, fractal plotter, raytracer, and more).

 

Austin Clark

Aug 29, 2016
16
Joined
Aug 29, 2016
Messages
16
Fantastic work! Keep it up, dude.
Have you made any progress towards getting this built in an FPGA? Were you planning on making a whole computer with this processor eventually?
Also, do you have any tips for someone looking to create their own assembler, as you seem to have done? That was where I was having issues on my own logisim / homebrew computer project, which I'm probably going to return to soon. My processor design experience is decent (for an amateur without any formal schooling) but I don't feel like my programming experience is at the same level.
 

mcsoftware

Oct 13, 2015
26
Joined
Oct 13, 2015
Messages
26
Thanks! Not really too much progress with an FPGA. I did give my CPU files to someone who intended to put it in an FPGA (they have more experience doing that) but I don't know if he'll ever have the time to do it. It did seem to me to be a little disappointing when I looked into it - I think the way to synthesize it to an FPGA would be to put the program you want to run in a ROM with the design and send that to an FPGA. That's very limiting since you would have to do it for every program you wanted to run. My testing showed that if you didn't have a program in ROM, the optimizing stage would prune out practically the whole CPU. Of course, that was before I removed the gated clocks. It might not prune out the components now that they are clocked by the main clock (but then you have that horrid logisim clock tree to deal with (potentially))
Then there's also getting an FPGA or getting the right FPGA (one supported by Logisim as well as having the right capabilities). And, also, as pointed out in this video, I probably won't be able to synthesize the floating point stuff (at least not all of it).
I wasn't planning on making a whole computer. BUT, the guy who was supposed to try putting mine in an FPGA has had good experiences putting designs in an FPGA that had a lot of devices (LCD, keyboard, etc.), so it might end up in a pretty good computer system, who knows.
Concerning the assembler... An assembler is rather simple. The problem I found was in how you handle labels and whether you want to make labels versatile (I did) - what do you do if you reference a label/variable that hasn't been defined yet? The way I handle it is, when you come across a label put it in a table. When you come across a reference to a label check the table to see if it's there. If it is, that's great. If it isn't then search the source code for where the label is defined, then put it in the table, and continue where you left off. Keep in mind that usually the label refers to a memory location within the code, so would have to keep a count of the current memory location when you're doing the search, so you know where the label resides in memory, and then return the memory counter back to where you left off.
For example:
0 | NOOP
1 | LOADI 10
2 | : Lab1 LOADI 20
3 | JUMP Lab2
4 | STROBE
5 | : Lab2 DATAIN
6 | JUMP Lab1

Lab1 would have a value of 2, (and Lab2 would eventually have a value of 5) and when you get to the JUMP Lab2, Lab2 would not be known, so you would scan forward to find Lab2 keeping track of what the memory address would be, so when you find it, you would know it would be 5 (the current count at that point). BTW, once I have to scan forward, at that point I put any found label into the table (so even if I find the label I'm searching for, I keep going to the end), so that I only have to scan forward once. And of course when you're scanning forward, don't output any machine language. Though you could place it in memory and make a note to modify the necessary locations once you know the values, but I don't see much reason to make it that complicated.
I assume your CPU has jumps of some sort, but if it doesn't then labels would only be needed for variables. So you could always declare the variables at the top, and avoid the need to scan forward. I mostly declare variables with an EQU ( EQU i $1000 would mean the variable i resides in the memory location $1000 (hex) (be sure that's out of your program space, though). But I also do: : i DC 12 ( i being a label (variable) residing at that memory location with an initial value of 12) (but make sure the program won't try to run that (unless you want to create some self-writing code).
I hope that all makes sense.

It probably would be easier to code if you make a two-pass assembler. 1st pass resolving all labels, 2nd pass outputting machine language.
Fantastic work! Keep it up, dude.
Have you made any progress towards getting this built in an FPGA? Were you planning on making a whole computer with this processor eventually?
Also, do you have any tips for someone looking to create their own assembler, as you seem to have done? That was where I was having issues on my own logisim / homebrew computer project, which I'm probably going to return to soon. My processor design experience is decent (for an amateur without any formal schooling) but I don't feel like my programming experience is at the same level.
 

Austin Clark

Aug 29, 2016
16
Joined
Aug 29, 2016
Messages
16
Excellent. Thanks for your response. I had originally planned to do a double-pass to resolve labels, per the recommendation by other sources, so it's nice you happened to bring that up. I think I just need to put my nose to the grindstone and actually DO it. I'm pretty confident I could manage, it just won't be very clean and pretty. ;)
 

mcsoftware

Oct 13, 2015
26
Joined
Oct 13, 2015
Messages
26
That's good (recommendations and pretty confident). It probably doesn't have to be elegant. If we were talking about a compiler (like for C, for example) I would say that would be a difficult task and one should try to make it clean, but an assembler is much less difficult.

Excellent. Thanks for your response. I had originally planned to do a double-pass to resolve labels, per the recommendation by other sources, so it's nice you happened to bring that up. I think I just need to put my nose to the grindstone and actually DO it. I'm pretty confident I could manage, it just won't be very clean and pretty. ;)
 
Top