Posts

8-bit CPU: Test module and Python-assembly code

Image
I have ALU block and Memory block, as a next step I wanted to connect both of them to my Arduino test device. It worked, but was very clumsy (3 devices, held together just by wires). I decided to re-build the Test module differently - on breadboard, so I can connect modules together. It is an Arduino Nano , driving a pair of 74HC595 shift registers. To expand further, 3 pins from each shift register drives 74HC138 demultiplexers. Control lines from demultiplexers are for Out and Load lines (7 for each type), the rest are for general purpose (for example - ALU's Subtract). I played around with more tests, implemented ld and st "instructions" (load a register from memory location and store register value in memory) in my Python-assembly. Then I started to think: there are 2 registers, ALU, Flags, memory. I even have some sort of assembly language. What if I try to implement something more interesting, utilizing resources I have?  The "classic" program for BE-SAP...

8-bit CPU: Memory

Image
Time for another important part of the computer - memory. Here I think I have to come up with my own design. Ben's version has only 16 bytes, uses nowadays-exotic 74189 memory chips and there are DIP switches for programming. For the memory I plan to use 62256 SRAM chip. It can store 32 KiB of data, I initially plan to use just 256 bytes, so I'll connect remaining address pins to GND. I'm also not in a mood for any DIP switch based programming, so I'll add an EEPROM instead. There are several ways how computer can utilize such setup: split the address space into program and data memory. This is how Ben's 6502 breadboard computer works. Some additional logic gates are used for chip selection, the main issue however is that it is not very flexible. use Harvard architecture , where program and data memories are completely separate. Reading and fetching instruction are two different operations: former accesses RAM, latter - ROM. This is how AVR microcontrollers (heart ...

8-bit CPU: Wiring and testing the new ALU

Image
Once I had soldered the boards I was eager to test them. At first I "poked around" using jumper wires and boards appeared fine. To be absolutely sure, however, I have to wire them together into a new ALU block and hook it up to my Arduino testing device. Boards are a bit elevated above the breadboards, so it seemed to be a good idea to run wires underneath the PCBs. To save on wiring, I opted for simple, fixed configuration (same as breadboard prototype and Ben's original), instead of my new, dual-output feature. I tested the dual-output some time later, adding jumper wires for missing connections. The concept works fine, but it takes 14 control wires to tame the beast. This will have to wait for proper control logic. The ALU block is not the only piece that is new. My new EEPROM writer features additional pin sockets, giving access to onboard shift register outputs. When no EEPROM needs to be programmed, it can be repurposed to switch control lines. I do not need my ad-h...

8 bit CPU: Soldering the boards

Image
The boards arrived, so did parts. Time to put it all together. I've chosen to make boards using SMD parts, soldering those might sound a little scary. What I remember from previous experience (I've soldered a couple of small boards before), it is easier than one could think before trying. Tool-wise it also does not require anything fancy. Good tweezers, small soldering iron, flux pen. Solder wick could be useful, but I did not need that very often. It helps to have brightly lit workplace. Soldering SOIC chip on the board so that it is connected properly is quick and easy. It takes a bit longer if one wants to align it perfectly . Solder one corner pin, check alignment, re-melt and correct until you're happy, then do one in the opposite corner. Finish with the remaining pins. 0805 resistors and capacitors also are quite easy - solder one pad, check, re-melt. Once happy - solder other one. What I struggled a bit with was LEDs. Again - it is not hard to put them on board and s...

8-bit CPU: design the PCBs

Image
The idea is clear, now the hard part: design the boards. I've been long time CatSoft Eagle user, but since they've been acquired by Autodesk, things have gone downhill. It did not even wanted to start on my machine (I use Linux as my primary OS). Well, so long and thanks for all the fish! KiCAD seems to be popular in the community , let's learn something new. As planned before, I started with ALU module. The schematics part was quite easy, there are no space constraints when drawing that. PCBs on the other hand... After board outline was set and connectors placed, it started to feel quite terrifying. Can I really fit ALL THAT on this small board? Eventually I did... Next I have to route the tracks, a lot of them. Felt a little lazy to do it all by hand and wanted to see what autorouter produces. Turns out, there is no such feature in KiCAD. Everybody appears to to hate autorouters! There was an option to export the board, autoroute it in FreeRouting and then import it ba...

8-bit CPU: Planning PCBs - architectural upgrades and addressing common issues

Image
I built a prototype ALU block and it appears to work fine, where to go now? I should remind that I do not want to build multiple copies of the same circuit. I already wired up the Program Counter board temporarily as B register. I'll need that for the intended purpose later. The logical step is to design a PCBs for parts I've built. I decided to start with ALU, Register and Flags boards. I had some extra ideas for features and improvements, that are not tested on breadboards. The changes are not that complicated so I decided to implement them directly to PCBs. Some of them will allow greater flexibility later on, some should help to prevent come common issues other builders are facing. As for PC, I decided to keep it on breadboard, as only one copy is needed and I'm not really decided if I want to do something different there. Flags I decided to deviate from Ben's design and build Flags register as a separate entity. The main reason is that at some point I plan to build...

8-bit CPU: ALU and Flags

Image
Now that I have a pair of devices that can store a byte, I can proceed to do something more interesting. Build a device that add them together, for example. In other words - let's build an ALU. The design follows same basic idea as Ben's - two 4-bit adders, XOR gates and an output buffer. I'm using HC logic here, so I used 74HC283, 74HC86 and 74HC245 chips. Since I've built only one Register and did not want to build another, I connected my Program Counter board as register B. If I keep the counting function disabled, it serves the purpose just fine. It took a lot of wires, but I'm just getting started, let's build Flags register as well.  There were no surprises with Zero flag - 4 NOR and 3 AND gates does the job - just following the Ben's design. Another latch (74HC173) chip to store it, done. The fun starts with the Carry flag: I wanted to support a carry-in signal for the ALU. It is very useful if one wants to perform the addition or subtraction for wid...