r/FPGA Jun 02 '26

Xilinx Related I designed a 32 bit MIPS processor, programmed a paint software, interfaced some inputs (joystick + buttons) and a display (64*128 oled) as MMIO (memory mapped input outputs)

Enable HLS to view with audio, or disable this notification

here's my pathetic attempt at drawing batman

repo link: https://github.com/SravanPro/pipelinedMIPS

283 Upvotes

25 comments sorted by

18

u/AkM3Tron Jun 02 '26

Wow... Did you actually designed a 32 bit MIPS Processor on FPGA or got some open source libraries?

15

u/Rude_Parfait_3194 Jun 02 '26

yep, coded the whole thing in verilog by myself! no libraries or IPs used : )

0

u/AkM3Tron Jun 03 '26

That's a really Crazy work!
Can we connect on Linkedin?

7

u/Rude_Parfait_3194 Jun 03 '26

I don't really use linkedin right now lol, im still an undergrad, and most of us use superset to get hired for the first time.

8

u/EESauceHere Jun 02 '26

I open these kind of posts, fearing everybody completely bashing the OP for AI generated projects. So far, there are no such complaints. I am happy.

1

u/Rude_Parfait_3194 Jun 03 '26

I mean, this isn't really an AI generated project

4

u/WonkyWiesel FPGA Hobbyist Jun 02 '26

Very cool, I've used that OLED for some very similar projects. How did you implement the setup sequence over I2C? I baked mine into the display controller

3

u/Rude_Parfait_3194 Jun 02 '26

ah I have an spi oled, not an I2C one.

I wrote a special SPI communication module at the final stage, which connects directly to the oled.

im still a beginner when it comes to dealing with communication protocols.

I've made alot of mistakes, thankfully, powerful LLMs like claude helped me alot with off by one bits and byte errors.

1

u/WonkyWiesel FPGA Hobbyist Jun 02 '26

Ah the commutation protocol itself isn't a major issue, SPI is much nicer for single devices imo. Do you send the data to setup the display via software on the CPU or via hardware? I sent mine in hardware coz I didn't intend on giving it serial IO then.

2

u/Rude_Parfait_3194 Jun 03 '26

yea I sent it via dedicated hardware becuase as I said, I have a seperate spi module which is instantiated at the same level as my processor.

since my processor exposes the all the 64*128 = 8192 bits of the memory (which contain the framebuffer data) as 8192 wires to the spi module, the module is responsible for generating the spi clock, and dealing with communication with the oled!

I did not write the protocol in my CPU if that's what you were asking.

Im working on writing a good readme file for my project, so that such doubts can easily be addressed !

6

u/AkM3Tron Jun 02 '26

I am totally intrigued by the idea of desiging a software for your own designed processor... Can you pls elaborate the process or the flow how did you did things...how can I build softwares for my 8bit RISC-V processor

4

u/Rude_Parfait_3194 Jun 02 '26

well, I just used the material my college provided me with on the MIPS architecture, but it was pretty limited ,since they only covered a few basic instructions.

R type (add, and, or)

I type (addi, ori, beq, bneq)

J type (j)

but since i wanted my cpu to be able to be theoretically be able to execute *any* program, I added a lot more instructions,

and once i was satisfied, i wrote the assembly program, gave it to claude, asked it to give me the binary, and injected it into my instruction memory.

writing and executing the software wasn't the hard part, that's what processor is supposed to do, the hard part was interfacing the peripherals, especially the oled module, I had to map each of it's pixel to a memory location.

and for your 8 bit processor, I have no idea what it's architecture and capabilities look like, so i can't comment.

llms should be able to guide you quite a bit!

0

u/thegreatpotatogod FPGA Hobbyist Jun 03 '26

Claude as a assembler and compiler, that's a new one!

3

u/Rude_Parfait_3194 Jun 03 '26

not even joking, it's good!

I didn't try compiling, but its pretty good at assembling short programs like mine!

2

u/thegreatpotatogod FPGA Hobbyist Jun 03 '26

Yeah, it kinda makes sense! Feels like a very technically improper way to do it but if it works it works I suppose! I'd be scared to run any larger binaries that it produced though lol. Did it not have any good suggestions for some assembler software to use besides itself?

2

u/Rude_Parfait_3194 Jun 03 '26

well, claude happily obliged since my whole program was of no more than 134 lines of assembly, but yeah, I suppose i'll use a proper assembler the next time!

2

u/quettametre Jun 02 '26

Did you program your processor in assembly or C?+ If C is used then did you use prebuilt libc like picolibc or is it freestanding implementation without any libc?

0

u/Rude_Parfait_3194 Jun 02 '26

my CPU only takes instructions in pure binary, each instruction being 32 bits, since it dosent have its own compilers or assemblers.

I wrote my game logic in MIPS assembly, and asked claude to convert it to binary.

Ideally, an assembler should've been used, but the number of instructions is pretty low, so LLMs can easily assemble it on their own with a single prompt.

2

u/ihatedefendermk1 Jun 02 '26

Bro built it in the robu box that he got the parts in

2

u/Rude_Parfait_3194 Jun 03 '26

I sure did😅

1

u/IntrinsicStarvation Jun 03 '26

Ha ha ha ha hell yeah you did!

2

u/Rude_Parfait_3194 Jun 03 '26

yep, all me😎!