After falling in love with the original Ben series I wanted to tackle building my own CPU. I'd like to get my kids involved and since they spend 90% of their free time it seems on Youtube I decided to chronicle my journey on a channel. I'm not an expert so this series will be more of a rambling video blog than a tutorial.
Specs I'm shooting for:
3Mhz Clock Speed 8bit ALU with ADD, SUB, AND, OR, XOR 1MB RAM (Bank Switched) 1 (8-bit) Accumulator 2 (8-bit) Index Registers 1 (16-bit) Address Register 1 (16-bit) Program Counter 1 (16-bit) Stack Pointer Compatible with 6502 Assembly ( *Mostly ) GPU that meets or exceeds the NES PPU Chip 320x240 256 Sprites active at once 60hz refresh rate
First time using hackaday so I'm not sure about the ins/outs. I've found dozens of neat projects here over the last 6 months so I figured someone might be interested in what i'm working on too.
I'm doing a youtube series as I build my CPU and GPU. So far I've published 3 Episodes covering the CPU architecture and building the first set of 8 bit data registers along with the decoding circuit.
I like the idea of building each part as a module. It will keep the overall complexity of any given part lower and allows me to make iterative progress. However I'm unsure how to manage the interconnects. My first attempt used double high headers similar to stacking boards on a Raspberry Pi. However the legs bend easy and make poor contact. I'm considering using PCI Express slots but then I have to figure out how to route the edge when I get my board made to properly fit into the socket..
I'm working on the 16 bit registers next. The only UP/DOWN counter I can find is the 74HC191. This chip has two problems.
1. It's only available ( as far as I can tell ) in the 'HC' series, and stringing 4 of them together makes for about 71ns if I did my math right from the datasheet. At 3mhz this should be fine but would kill my dreams of running much faster.
2. It's async preset. This means that I can't both output a value from the register and load a new one in. Which I think I can do on the UP counters with sync preset. At least that's the way its working out in Digital simulator. I'll have to check the hold times of the preset to see if it works in reality.
If anyone knows of a better way to build an UP/DOWN 16 bit register, leave a note in the comments!
OMG, sounds just like my story, YouTube watching kids, etc. My CPU/GPU project [https://hackaday.io/project/180724-project-ember] is aimed at FPGAs, but similar always wanted to do it, just decided to go for it. Would be great to get an update if you're still working on this project!
If you're looking for an up/down counter faster than the 74HC191, you might consider the 74AC193 , 74F193, 74AC191, 74F191, all of which seem to be in stock at Digikey.com , and some of them seem to be in stock at Jameco.com . My understanding is that if you cascade 4 of the 74HC191 (to make a 16-bit stack pointer), the datasheet for suggests feeding /RCO output to the /CTEN input of the next one for (faster) synchronous counting, although it also mentions an alternative feeding /RCO output to CLK input for (slower) ripple counting.
Hi Louis, I suppose your CPU will be microprogrammed. You could use up-counters (HC161) for the SP and do the decrement throught the ALU in one or more extra microcode cycle(s).
But I do not really understand your problem with the HC191 and the HC series. When I read the datasheet, it seems counting is sychronous so all your 4 counters will count at the same time. Max count frequency is 14MHz worst case, 42MHz typical. But the async load might indeed be a problem.
And the HC series seems to me the easiest to use of all logic families, and for more speed you can go to the AC series.
Wow somehow I hadn't seen that one yet in my searching! Very impressive I'm going to have a look through it.
I'm really new to this so take anything I say with a huge grain of salt. I thought it did up/down counting through ripple carry. The way I have it wired right now the first nibble has CE pulled down by a NOR gate from the inc/dec control lines. The RC output from the first nibble feeds the CE of the second and so forth for the third and fourth. I was under the impression that the second nibble couldn't start it's count cycle until the first nibble passed it something on it's CE pin. Thus the total time to count worst case would be the propagation times from CE to RC * 3 + CE to Q. I worked that out to 71ns. I could be totally wrong.
I'm planning my GPU to be entirely AC series because I'm going to run it at 25Mhz but they don't make an UP/DOWN counter in AC.
As for sending the DEC through the ALU that was my first attempt. Yes it's microcoded. No cool RISC for me yet. ( Next one is RISC V ! ) I have only 3 bits set for the stage counter ( due to inputs on the control roms ) so I have a maximum of 8 steps for any instruction. The Jump Subroutine ( JSR ) instruction is already at 8 without going through the ALU. Since JSR absolute is 2 DEC operations that's 10+ steps if using the ALU. Soo for now I'm going to live with the HC191. The Async load I have worked out in the simulator and it only cost me 1 cycle on 1 instruction thus far extra.
OMG, sounds just like my story, YouTube watching kids, etc. My CPU/GPU project [https://hackaday.io/project/180724-project-ember] is aimed at FPGAs, but similar always wanted to do it, just decided to go for it. Would be great to get an update if you're still working on this project!