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

  • Brazilian presidential run, two more PCBs

    Andre Baptista10/12/2018 at 00:35 0 comments

    Long time since last update. We are very busy trying to deal with this:  https://www.google.com.br/amp/s/amp.economist.com/leaders/2018/09/20/jair-bolsonaro-latin-americas-latest-menace

    Meanwhile, today two packages arrived: 2 PCBs and one octopus board support:

    See you next time.

  • Newborn, two more PCBs ordered

    Andre Baptista08/25/2018 at 15:48 0 comments

    Montly update (there was a time I updated this project 2 or 3 times a week...):

    Thanks to the arrival of my second son, time for project shrunk to almost zero.

    Finally I ordered two more PCBs (expected time to delivery: 4 weeks), lets see the modules status right now:

    • Clock and sequencer: Completed and working fine;
    • Program Counter and Memory: ?
    • Instruction Register: Ordered;
    • Control Store: 90% designed, will be ordered this week;
    • ALU: Ordered;
    • Registers: 20% designed.

    Since a log entry without pictures is useless, lets see the 3D view of the two just ordered modules:

    Thanks for reading.

  • First PCB

    Andre Baptista07/30/2018 at 18:34 0 comments

    Finaly the PCB of the Clock and Sequencer module arrived:

    Apart from small mistakes (e.g. the two potentiometers where placed very close) everything went generally well and I'm very satisfied with the overall quality of the PCBs (https://jlcpcb.com/).

    I hope in the next weeks I could manage to design and order the other modules.

    Thanks for reading.

  • World Cup, vacations and PCBs

    Andre Baptista06/24/2018 at 22:34 2 comments

    After a long time, I'm finally updating the prjoject.

    Despite being on vacation, very small progress due to watching World Cup (another one just in 4 years).

    I was stuck in the indecision between:

    1 - Stick on breadboards, trying to find good ones;

    2 - Use universal PCB boards, like these ones:

    3 - Go right to the definitive PCBs.

    This last one is my choice, and this is the first drawing in EasyEDA (unfinished):

    Thanks for reading.

  • 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 5 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.

View all 38 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