Close
0%
0%

JACA 1 & 2 Homebrew Computer

JACA - Just Another CPU Again
Homebrew CPU, starting by a simple POC 4-bit CPU on circuit simulator soft. (done), then 8-bit (in progress)

Similar projects worth following
The ultimate goal is to make (physically build) from scratch a complete computer as simple as possible, but powerful enough to run old games such as Tetris, Pong, Arkanoid or Snakes on a LED matrix (probabily 16x16).

Edit: check it out for the latest version of project files on GitHub:

https://github.com/albs-br/jaca

The ultimate goal is to make (physically build) from scratch a complete computer as simple as possible, but powerful enough to run old games such as Tetris, Pong, Arkanoid or Snakes on a LED matrix (probabily 16x16).



In order to do this (and have something working earlier) I decided to make first, as a POC, a very simple 4 bit CPU in a simulation software (Logisim 2.7.1).



This 4 bit CPU has the barely minimum to do some useful computing, in this case I chose a multiplication of two 4 bit numbers.
Hardware specifications:
-4 general registers of 4 bits (A to D)
-RAM memory of 16 words of 8 bits
-initially just 8 instructions, with 3 addressing modes (no instructions of memory access at this point) (*)
-fixed instruction size (8 bits, one cell of memory)



This last point I consider vital for the simplicity of the circuit, since I need only one access to the memory to get all the instruction, making the Fetch fase the simpler I could imagine.



There are only two steps cycles per instruction, Fetch and Execute. Two clock lines are used, one to properly set the inputs of the devices and other to trigger the clocks and commit the changes.



The ISA is heavilly influenced by that of MSX, which I used to program back in the early 90's. That was an 8 bit computer hugelly popular in my country (Brazil), despite almost unknown in the rest of the world.



It uses a Load/Store architecture, meant that all operations are done over the registers, the only instructions to access memory are Load/Store to or from a register. There is is no way to add two numbers in memory directly, for example. As all other design decisions that was for the sake of simplicity.



(*) Later in the project I could squeeze even more the ISA and insert two instructions to make memory access, but this is not necessary to the initial goal (multiply two registers).



Initial research and study on the subject was done late March 2017, I spent maybe two weeks choosing the simulation software (there are lots of options, even web based ones). Circuit design itself started one month ago, and, as of May is, I'd say 80% done. The pace seems very slow, but I could manage to effectively work on the project just 1-3 hours/week...

PS: the name JACA is a (bad) joke with the portuguese name of the jackfruit, common in Brazil.

  • 2 × 74LS181 4 bit ALU
  • 1 × 62256 32k x 8 bit SRAM
  • 5 × AT28C256 Memory ICs / EEPROMsEEPROM 32k X 8 bit
  • 13 × 74ALS874 8 bit register with async CLR and 3-state outputs
  • 10 × 74LS154 4 to 16 demux

View all 8 components

  • Logisim video of computer running test programs

    Andre Baptista05/12/2018 at 23:01 0 comments

    Apart from the extreme frustration because of the bad connections on breadboards, I did something I was postponing for a long time: a small video showing the computer working in Logisim simulator, doing things like write in the LCD display (the ubiquotous Hello World...), playing with leds on the LED 8x8 Matrix, and even assembling (in the Assembler made by me) a simple Tetris clone and running it.

    Enjoy:

    Thanks for reading.

  • Registers A and E working

    Andre Baptista05/03/2018 at 16:48 0 comments

    Small update: now there are two registers working: A and E. Next step: connect the ALU module and perform operations with them.

    Video:

    PS.: probabily due to poor quality breadboards, i'm running into problems of bad connections that are driving me crazy...

    Thanks.

  • Power issues solved

    Andre Baptista04/25/2018 at 18:38 0 comments

    Finally I could take some time to work on the project. I improved the power grid to have the smallest number of  "steps" between the power supply and each IC, and suddenly everithing works just fine, not having the issues I reported in the last log entry anymore. Even some leds looks brighter right now.

    The IC 74ALS874 (8 bit register) seems to be the more sensible to lower voltages. Maybe it's common to the ALS family.

    The E register is almost working (bottom right), hope I could finish it today and make arithmatic operations between the A and E registers soon.

    As a small note: I'm using a cheap USB ampmeter in the power supply (like this one) so I can know the current all the time (picture below). It is useful for debugging too, when you misconnect some wire and short circuit some component, the circuit frequently still works, but it's draining a lot more current. In my case it showed a rise from the normal 200mA to more than 700mA, and I could shut off imediatelly and revise the connections before to fry some IC.

    Thanks for reading.

  • First instruction: loading a value into a register

    Andre Baptista04/16/2018 at 16:13 0 comments

    This weekend I managed to finally make the computer run a instruction from the beggining to the end.

    It's a simple instruction: LD A, 0x20, that means, to load the literal value 0x20 (32 in decimal) into the register A.

    Video:

    At top right is the output of the register A, displaying 0010 0000, the binary value for decimal 32.

    Close to bottom left are four leds, the first three red, the last one yellow. These are the sequencer leds, they show the current state of the machine: Fetch-1, Fetch-2, Fetch-3 and Execute. The fetches are the states in which the 3 bytes of the instruction are get from memory and put on the three Instruction Registers (top left corner). The green leds are the outputs of them (only shows in the last step, Execute).

    But not all are good news: I also ran into two stability problems:

    -The first one: the automatic clock (yellow led at bottom left) was sometimes causing the sequencer to reset, even in manual clock mode. That was solved by adding a 10uF capacitor (decoupling capacitor) to the power line close to him;

    -The second: the register A is not loading the right value all the times, sometimes showing a thrash value. That is driving me crazy. I have no solution for now, but I have one suspect.

    Thanks

  • Voltage issues

    Andre Baptista04/09/2018 at 12:06 0 comments

    Last weekend I faced a (not so) unexpected problem when connecting together all modules: a huge tension drop across the circuit. The IC's fartest from power source are just under 4V! As many of you may know TTLs are guaranted to work only between 4.75 and 5.25V. Surprisingly the behaviour is perfect even at this extreme conditions, which  shows how over dimensioned they are. Even the closest IC is with 4,8V.

    Possible solutions:

    -Use wires direct from power source to each breadboard, not daisy chaining them;

    -Use a regulable power suplly and set it to 5.2V as shown in this fantastic series of the channel WR Kits: Building an 8-bit computer (in portuguese), based on the famous Ben Eater breadboard computer.

    See you next time.

  • Things I learned today

    Andre Baptista04/02/2018 at 17:58 2 comments

    Two ideas I shamelessly stole from the fantastic Gigatron TTL:

    - The MCP100/101 Power On Reset: a very common issue on most projects of this kind is that when you power up the circuit, it starts in a not-so-good state (it's not random, seems to be always the same, but it's not the initial state), so we need a small circuit called Power On Reset, to trigger a short RESET pulse when the system is powered on;

    - Use the HCT family of TTL ICs instead of LS: it uses just 1/5th of the LS energy. I'm already ordering the HCT equivalents of my LS chips (when available, there is no HCT version for 74181 ALU, for example). Today the computer is using more than 200mA, not counting the ALU and registers modules. The Gigatron uses less than 90mA, but doesn't has the plethora of leds my computer has (useful for debug). Most of the leds are restricted by 4.7K resistors, making them drain just 0.7mA per led. This gives enought bright for leds in indoor use (not direct sunlight).

    Thanks, and see you next time.

  • Video of computer (almost) working

    Andre Baptista03/31/2018 at 22:49 0 comments

    Apparently people have a strange interest in homebrew computers in breadboards meaninglessly blinking leds... So I made this small video (no fancy production, sorry). It lacks the register and ALU modules, so it's not doing any useful computing, just increasing Program Counter, getting 3 bytes from memory, putting them into Intruction Register and using the first 6 bits to address the Microcode Rom:

    Besides this I rebuilt the clock module to include a manual clock, so I can debug step by step the computer. It will be very helpful in future.

    Thanks.

  • Slow progress...

    Andre Baptista03/22/2018 at 12:01 0 comments

    Slow project progress last month...

    But at least I managed to finish the EasyEDA documentation of the modules (pictures below).

    The situation so far: I have all the modules (a very crude version of them) finished and working on breadboards. This weekend I will try to put them together and hopefully see the CPU working for the first time outside the Logisim simulator.

    By "working" I mean, capable of run one single instruction: LD A, value. That is, to load an 8 bit value in the A register (the only one avaliable).

    After that, I could expand the modules, by adding registers, adding logic to connect the ALU to registers, logic to control the jumps, etc.

    Thanks for reading.

  • Microcode ROM module (almost) implemented

    Andre Baptista02/17/2018 at 23:35 0 comments

    Last weeks I implemented the microcode ROM in two breadboards:

    It's not very beautiful, as lacks me patience to cut wires the exact length and right colors...

    Besides that I started to document the circuit in an online tool called EasyEDA. This will be important in two ways:

    - Allow to understand the circuit on breadboards (it's a bit different of the Logisim circuit);

    - Make it possible to order the PCBs in the future, for a most professional version of the computer.

    Links for the Easy EDA schematics (I made them public, but not tested yet):

    PC and Memory 

    Instruction Register

    Another improvement: finally connected the PC, memory (very crude version) and IR together. I'm very anxious to see the computer working after almost one year, even a very basic version, so I made some things simpler, and after I will improve.

    Thanks for reading.

  • AT28C256 EEPROM writer

    Andre Baptista01/28/2018 at 22:12 0 comments

    Last week I made a fundamental step to complete the homebrew computer, an EEPROM writer.

    I decidede to put it in a separate project, which makes it easier for someone googling to find it:

    https://hackaday.io/project/43884-eeprom-writer-for-at28c256-using-arduino-mega

    Best regards.

View all 34 project logs

Enjoy this project?

Share

Discussions

Andre Baptista wrote 04/30/2018 at 20:17 point

PS. The 74181 component for Logisim it's not mine, I found out it here: https://74x.weebly.com/blog/library-of-7400-logic-for-logisim.

Also, caution with the versions: the right version of 74181 ALU is the v2, the other ones aren't working correctly. 

  Are you sure? yes | no

Ruud van Falier wrote 05/01/2018 at 07:13 point

I took the correct one then, thanks! :)

  Are you sure? yes | no

Ruud van Falier wrote 05/01/2018 at 07:16 point

Do you know why some datasheets state that "M=L, Cn=L, S=LHHL" will output "A minus B" and some state that it outputs "A minus B minus 1" ?

  Are you sure? yes | no

Andre Baptista wrote 05/02/2018 at 12:25 point

I have no idea. The right output is "A minus B minus 1" as shown in most resources (like the Motorola datasheet). Also I tested in Logisim and its output was  "A minus B minus 1" as expected.

Edit: forget about above. I misread the datasheet ("Active Low Inputs" seems to exist just to make life harder...). Right output is "A minus B". Anyway it's better test by yourself, both in Logisim and with the real IC using breadboards (maybe an Arduino to automatically test all functions with all possible input combinations).

  Are you sure? yes | no

Andre Baptista wrote 04/30/2018 at 19:48 point

You welcome.

This link was very helpful for me: http://www.righto.com/2017/03/inside-vintage-74181-alu-chip-how-it.html

  Are you sure? yes | no

Ruud van Falier wrote 04/30/2018 at 18:32 point

Thanks for sharing all your work. I've picked up your 74181 component and test circuit which helped out a lot in understanding the comparator functions.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates