Self Made CPU
- 11 Devlogs
- 15 Total hours
Building a CPU in Digital Logic Sim, planning to use the knowledge in making my own CPU from transistors!
Building a CPU in Digital Logic Sim, planning to use the knowledge in making my own CPU from transistors!
This was a migration from macondo to stardance, the journals from the past can be seen on the github page. My goal with this project is to first design in the online, then transfer it to a PCB, then maybe if I have time make a programming language to code my own CPU.
Currently, I’m only simulating it through digital logic sim
Surprisingly the mattbatwings redstone computer playlist (minecraft) is super helpful and is kinda guiding me on what to do. Ofc there are differences from minecraft to logic gates, but I’ve been able to adapt accordingly
I’ve made the register files, ALU, program counter, and control rom
First I copy pasted everything from macondo to a journal.md file so that I can have my hours here too.
Next, I brainstormed on how to fix the problem of the clock incrementing multiple times per tick, but as I was fixing it I realized that it wasn’t a problem at all. With some more tinkering, I realized that there was a “race” between clocking the components and the program counter, which I fixed by making an inverted timer which would clock the components right after the program counter incremented.
Afterwards, I realized everything was super messy and it was hard to figure out what wires went where, so I just restarted and put everything back together again.
After that, I implemented jumping (with thankfully no problems at all which is awesome) and made some edits to my really basic compiler (comments and more commands)
Finally, I started on branching, but it doesn’t work because of mystery reasons. My next goal is to fix that part.
I made the flags from the ALU and the branching.
Honestly, I also don’t remember much so sorry again.
What I do remember that I couldn’t really tell if it was working or not, since the clock is still really broken.
I also remember that I had to shift around the rivals a bunch because of my messy wiring.
I made the flags from the ALU and the branching.
Honestly, I also don’t remember much so sorry again.
What I do remember that I couldn’t really tell if it was working or not, since the clock is still really broken.
I also remember that I had to shift around the rivals a bunch because of my messy wiring.
https://lapse.hackclub.com/timelapse/wyl1HNTy6TsB
I basically made this by just having an 8 bit mux where the two inputs is itself and the new input.
I don’t really remember much so sorry for the dry journal 😢
https://lapse.hackclub.com/timelapse/wyl1HNTy6TsB
I basically made this by just having an 8 bit mux where the two inputs is itself and the new input.
I don’t really remember much so sorry for the dry journal 😢
https://lapse.hackclub.com/timelapse/Um0NA_AAu0c- (i accidentally left it on but I corrected my hours to be correct)
Following my google sheet I just wired up the control ROM, continue using the the column and grid structure. I used an AND gate, connected to both of the inputs for tri-state buffer for all 16 instructions so all I had to do was to connect it to the correct bus at the bottom. I chose to make a DISABLE and just NOT that signal to make it easier and I don’t have to connect as much.
https://lapse.hackclub.com/timelapse/Um0NA_AAu0c- (i accidentally left it on but I corrected my hours to be correct)
Following my google sheet I just wired up the control ROM, continue using the the column and grid structure. I used an AND gate, connected to both of the inputs for tri-state buffer for all 16 instructions so all I had to do was to connect it to the correct bus at the bottom. I chose to make a DISABLE and just NOT that signal to make it easier and I don’t have to connect as much.
After watching Sebastian Lague’s video about RAM, it made me realize I could easily make 16 registers. I did this by making a 4 bit address which translates into a row and column, which inputs into every 8 bit latch where they both need to be on to be enabled.
Something that made me stuck was trying to connect all of the outputs into one bus, which kept flashing. After doing some research, I realized that using a tri-state buffer was actually useful, turning off an output instead of using an enable. I found that simulating that was a good idea, since in real life 0 goes to ground, which would affect bus signals, compared to just disconnected, which wouldn’t.
After this discovery, I had to restart my register because having the write signal also control the read signal was also not my intent. I did this by adding a 4 bit column and row (similar to before) structure and also made the 8-bit enable to have tri-state buffers instead of a bunch of AND gates, outputting “disconnected” instead of “0”.
After watching Sebastian Lague’s video about RAM, it made me realize I could easily make 16 registers. I did this by making a 4 bit address which translates into a row and column, which inputs into every 8 bit latch where they both need to be on to be enabled.
Something that made me stuck was trying to connect all of the outputs into one bus, which kept flashing. After doing some research, I realized that using a tri-state buffer was actually useful, turning off an output instead of using an enable. I found that simulating that was a good idea, since in real life 0 goes to ground, which would affect bus signals, compared to just disconnected, which wouldn’t.
After this discovery, I had to restart my register because having the write signal also control the read signal was also not my intent. I did this by adding a 4 bit column and row (similar to before) structure and also made the 8-bit enable to have tri-state buffers instead of a bunch of AND gates, outputting “disconnected” instead of “0”.
I did a bunch of progress but didn’t really document it since I kinda put it off until later.
https://lapse.hackclub.com/timelapse/nYJCGsTGZe1D
I made all of the logic gates using only NAND after doing a lot of trial and error. I chose this simulator because it was the first thing I saw
(This was on the airplane so this was not recorded, but I didn’t include it in the time just to be safe) Following the mattbatwings video playlist, (downloaded the ALU video) https://www.youtube.com/watch?v=osFa7nwHHz4&list=PL5LiOvrbVo8nPTtdXAdSmDWzu85zzdgRT I made the ALU, but it took me a while to figure out that my Cin was on the lowest bit instead of the highest bit, then I inputted the bits in reverse order, but I eventually figured out the adder part.
A pretty common thing I’d do was connect the wrong wires, flip it, or anything like that because of messy wiring. When I discovered you could click and like control how the wires flow, everything was a lot cleaner.
https://lapse.hackclub.com/timelapse/lNILn3eZ_3sw This part has some parts working on adder
It took me some trial and error trying to figure out how to make a latch myself, but I eventually gave up and just looked it up.
From there I made a basic memory register
http://lapse.hackclub.com/timelapse/Np7U85oJ2MKF Here I finished up the memory register and made it output based off the addresses you gave in. I also started working on the memory
The whole process was pretty straightfoward and didn’t really have that many struggles, other than messing up the bits on the google sheet
I did a bunch of progress but didn’t really document it since I kinda put it off until later.
https://lapse.hackclub.com/timelapse/nYJCGsTGZe1D
I made all of the logic gates using only NAND after doing a lot of trial and error. I chose this simulator because it was the first thing I saw
(This was on the airplane so this was not recorded, but I didn’t include it in the time just to be safe) Following the mattbatwings video playlist, (downloaded the ALU video) https://www.youtube.com/watch?v=osFa7nwHHz4&list=PL5LiOvrbVo8nPTtdXAdSmDWzu85zzdgRT I made the ALU, but it took me a while to figure out that my Cin was on the lowest bit instead of the highest bit, then I inputted the bits in reverse order, but I eventually figured out the adder part.
A pretty common thing I’d do was connect the wrong wires, flip it, or anything like that because of messy wiring. When I discovered you could click and like control how the wires flow, everything was a lot cleaner.
https://lapse.hackclub.com/timelapse/lNILn3eZ_3sw This part has some parts working on adder
It took me some trial and error trying to figure out how to make a latch myself, but I eventually gave up and just looked it up.
From there I made a basic memory register
http://lapse.hackclub.com/timelapse/Np7U85oJ2MKF Here I finished up the memory register and made it output based off the addresses you gave in. I also started working on the memory
The whole process was pretty straightfoward and didn’t really have that many struggles, other than messing up the bits on the google sheet