close-circle
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
close
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
  • 4 × 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

  • 74181 with Right Shift?

    Andre Baptista12/05/2017 at 14:41 0 comments

    When programming my first games for the Led Matrix of this computer in Assembly, I quickly realized how useful it would be the Shift instructions, for example to move left and right a character.

    In case of Left Shift, no problem at all, the 74181 ALU has the instruction A PLUS A (check here), which is the same as multiply by 2, or Left Shift one bit.

    Unfortunally the Right Shift instruction is missing in this IC, so I had to implement it with a 74HCT244 (eight tri-state buffer), redirecting bits, such as bit 7 to bit 6, bit 6 to bit 5, and so on... It's a little "ugly" design, as it's the only one instruction computed outside of ALU, but I haven't choice (any idea?)...

    We are very close to delivery the "production" version of the Logisim circuit, the 1.0.0 version. The "done" criteria was, since the very beginning, the ability to run simple games. I'm working in a Tetris game and already have a very crude version of an Arkanoid (or Pong).

    Thanks for reading.

  • Assembler / PCBs (?)

    Andre Baptista11/30/2017 at 19:38 0 comments

    Updating project status...

    Gave up making the compiler, at least for now. Reasons:

    a) It turned out far hard than it seems previously;

    b) Seems for me, now, an overkill. It's not that hard to program right in Assembly (have been watching many videos from WR Kits programming the Z80 in Assembly, it could be fun!), since you have a decent editor and an Assembler to take care of "ugly" things like memory addresses and let the programmer to worry only with the program logic.

    Picture of the assembler:

    That is half the story of last two weeks, the other half is:

    Thanks to this question I put on Electronics Stack Exchange, I'm seriousy considering make the computer right to PCBs, skipping the possible headaches of the breadboards...

    For designing the PCBs I'm thinking of EasyEDA, and for the manufacturing, AllPCB.com.

    Any ideas?

    Thanks for reading.

  • Update.

    Andre Baptista11/16/2017 at 13:46 0 comments

    After a month and a half, I returned to the ICs and wires, making the rest of registers logic and the register A.

    Realized I was mistakenly connecting some ICs, as control inputs are active low (most TTLs are) and I have to put a bunch of 7004 (inverters) to make things work.

    Now we have register A built and tested.

    Almost all of my 14 breadboards were used (some for testing boards) so I ordered 6 more.

    As a side note, I noted that the register was losing it's state when I turned off the desk light (!!!). One decoupling capacitor between Vcc and ground lines close to the IC seems to have corrected this issue. I'm afraid of what kinds of interference I will face when running this CPU above 1 MHz...

    Some pictures to make this log entry more beautiful:

    Thanks for reading.

  • Now we have to code a compiler...

    Andre Baptista10/24/2017 at 18:40 0 comments

    Last 2 weeks were very hard to the project... Almost no progress both in Logisim circuit design and breadboards.

    I've hit a wall: it became almost impossible to code test programs directly in assembly (with no tool but the Excel to convert to machine code), so I started to develop a simple compiler for a very simplified version of C#. But it (as always) revealed far more dificult than appeared, and the estimated 2 or 3 hours of coding quickly became 10 and far from finish.

    Hope to finish this in two weeks at most to return to the main project.

    Estimate of completeness so far:
    Logisim circuit design: 90%
    Real circuit in breadboards: 20%
    Compiler: 10%

  • Update project status

    Andre Baptista10/03/2017 at 20:09 0 comments

    Last two weeks saw some progress although not the expected.

    In the Logisim realm, finally implemented the RET_ADDR register, which, unsurprisingly, stores the return address to be used in the CALL isntructions.

    In the breadboards realm, I managed to build the IR (Instruction register), and a (small) part of the registers control logic.

    In the "future steps" realm I studied and I am very optimistic about VGA output (maybe 256 x 240 pixels, 256 colors/pixel) and interfacing a regular PS/2 keyboard for input.

    That's all people. See you next time.

    Instruction register (IR) with 3 chips (each 8 bits) to hold a 24 bit instruction.

    IR completed.

    Registers logic very far from completed, with those ugly stickrs to help me remember what each wire is for.

  • A little step for a man.

    Andre Baptista09/18/2017 at 16:32 0 comments

    This sunday I finally could make a progress in the hardware part of the project.

    This is the ALU module working, the board below is for test the ALU isolated.

    Now showing the sum of 201 (11001001) and 41 (00101001) which is 242 (11110010):


    Some next modules will need code to be writen to EEPROMs, I will use an arduino to accomplish that.

    Thanks to follow and see you soon.

  • v.0.15.2

    Andre Baptista09/11/2017 at 12:04 0 comments

    Added a 8x8 LED matrix to the circuit in Logisim, already showing simple animations. I'm not sure if this part should be implemented in real hardware, or skip to a VGA output...

    The problem is that the LED matrix haven't any kind of memory, so I'm using a handful of registers to store actual display state. It will be a lot of IC's in real world, doesn't look much like an elegant solution. Maybe I could map screen memory in the RAM and use a fast clock to always refresh the display. We'll see.

    Some changes in OUT instruction were needed, all test programs were reassembled (painful and boring task), but all working fine right now.

    Next step is to implement an input device (keyboard or joystick) in Logisim, to make the first draft of a game, maybe a Tetris clone.

    PS. Now I have all parts necessary to make the CPU in breadboards, maybe next weekend will see big progress.

    Thanks for reading.

  • Weekend update

    Andre Baptista09/05/2017 at 02:42 0 comments

    v.0.14.0 Big changes.

    - Reorganized instructions. As Opcodes changed, all test programs must be reassembled (not finished yet).

    - Implemented some new ALU instructions such as XNOR, INC and DEC. Add new ALU instructions is pretty simple, just add new lines to Microcode ROM.

    -The main change: now there are two registers called H and  L, which will be used to addressing in Direct By Register instructions, containing the High and Low parts of address. These two fix registers replace the previous idea of use any pair of registers [RR3]. Also added one controlled buffer (called Regs Bridge) to separate the outputs of the registers into R1 (A, B, H and L) and R2 (C, D, E and F). This overcome the old limitation that the ALU operations had to use always A register as first input. Now it's much more flexible, R1 for first input (and output also) and R2 for second input.

    New control lines were added to the circuit, and Microcode had to be rewritten.

    Maybe I've forgotten something. Hope I didn't...

    Very busy (and fun) weekend.

    Edit: forgot to mention: all this work only in virtual world (Logisim). Real hardware is stuck as the extras 12 breadboards I've bought still didn't arrive...

  • Clock, Phases, and PC working

    Andre Baptista08/28/2017 at 20:00 0 comments

    Finally, as most of pieces arrive, I could dive into the breadboards and wires and ICs all weekend.

    Now we have the Clock, Reset, 4 Phases (Fetch 1 to 3, Execute) and 12-bit PC (Program Counter) fully operational.

    Lessons learned the hard way:

    -The clock generator 555 IC has very weak output. It barely can feed two TTL inputs. If I put a single 3mm round led (with a huge 4,7K resistor) to see the clock ticks, it makes all the circuit to behave erratically. That is why all projects out there uses an buffer/inverter right after the 555 output to feed all the circuit.

    -Baby steps, allways. The old and good XP (eXtreme Programming) mantra is especially true when dealing with (moody) hardware. For each single piece added, turn on the circuit and see if everything still runs fine.

    -TTL outputs are not suited to drive leds directly, but as i'm using big resistors (4,7k as mentioned above), the current is very small (between 0,3 and 0,8 mA, depending on the TTL output, which can vary bettween 5 and 2.7 V). Surprisingly the leds show a useful bright even with such tiny current, so I can use them without bother with transistors to drive the leds.

    I never felt so happy to see a bunch of leds blinking :)

    Unfortunally the 6 breadboards I ordered a long ago still didn't arrive. I will buy them on local market anyway.

  • Update after long time, real hardware.

    Andre Baptista08/06/2017 at 18:10 0 comments

    Hello, first log entry in a long time... Trying to keep the project up while solving personal issues.

    Finally I have something "real" to show:

    I'm yet to receive many parts (thanks to the brazillian mail), but I could make the clock, and the 74HCT4017 to make the 4 cycles steps (Fetch 1 to 3, the red leds, and Execute, the yellow one).

    It's a very small step, but I need to break the inertia.

    Working with real hardware has it's peculiarities, It's very important to follow one of the XP principles, baby steps...

    Between the lessons learned, never, NEVER keep inputs floting, the circuit behavior becomes imprevisible.

    Thank you for reading.

View all 22 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

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