TD4 CPU is a "4bit CPU that runs".
It is very interesting for what can be done with so little.

Similar projects worth following
The TD4 CPU is described by I bought the book and have knocked up a design in EasyEDA. But I can't help myself with making changes. TD4 stands for "とりあえず動作するだけの4bitCPU (Toriaezu Dousa-suru-dakeno 4bitCPU)", or "4-bit CPU that runs".(source:


Here is a schematic from the Internet:


The entire CPU has only 12 TTL chips. Yes it has a switch based ROM! The schematic also shows the 12 OpCodes. It is not perfect, you cannot add the two main registers together and it cannot access any RAM. The author is Iku Watanabe, his book is available from Amazon but it is in Japanese:

I like most of the design but I want to map the full 16 OpCodes and make room for an address register. Yes I want to access some RAM.

Flashing LEDs

Most of the units have lots of LEDs that really add to the special effects when it is running:


One guy even build a relay version:



  • Replaced TD4B PCB

    agp.cooper05/29/2018 at 01:43 3 comments

    Replaced TD4B PCB

    Well not much choice, EasyEDA corrupted the PCB after an upgrade (gone wrong again?).

    Anyway, this version does not have the RAM add attached or the page register:

    The PCB is public so if you want you can get your own version of the PCB (x5) from EasyEDA. 


  • First Power Up

    agp.cooper09/20/2017 at 07:15 0 comments

    First Power Up

    Sorry, it did not work!

    Address 0-3 light up concurrently

    Tracked this down to duplicate labels RA0-3 in the schematic.

    Fixed by cutting tracks (8) and adding wire links (4).

    Jump does not work

    The problem was that the diode ROM low voltage is about 0.9v but the 74LS14 needs less than 0.8v to trip. A 74LS04 would work (trip voltage is about 1.3v) but better to use a 74HC14. I am migrating to HC anyway.

    Read/Write to RAM does not work

    What can I say, I did not check the schematic and it does not work!

    Removed the RAM and support chips.

    Okay, the basic TD4B now works (except for the memory):


    Use different coloured LEDs, it adds to the visual appeal of the CPU.

    I also have to redesign the decoder, !WE is flawed and the next step is to add a Page register.

    Also the AOUT and DOUT registers should be reset on RESET.

    At the moment the the TD4B is programmed to count from 0 to 255 and then stop:


  • TD4B CPU Schematic and Simulating a TTA CPU

    agp.cooper08/08/2017 at 07:12 0 comments

    TD4 CPU Version B 

    Here id the full schematic

    And the PCB:

    Simulating A TTA

    A TTA is a Transport Triggered Architecture (i.e. a single instruction move only CPU). An example is my Weird CPU.

    Why simulate TTA? It is a good test for a CPU, can it simulate another CPU.

    The TTA CPU model:

    • PC Mem[15]
    • JC Mem[14] (n.b. it could be JNC)
    • Hardware sets Mem[14] to "15" to signal not carry.
    • Other memory locations would "hide" the ALU, I/O etc.

    Here is my program:

    In the above I explicitly test the jump address for the not carry flag. There are other hardware/software arrangements. You could read the PC and write it back as PC+2. The carry signal would determine which of Mem[15] or Mem[14] was read.

    Here are the modified OpCode for reference:

    So pretty cool for a 4 bit CPU. The power of this CPU is the automatic adding of immediate data with every OpCode, without it it would be dead.

    Expanding the TD4B

    There are two basic approaches:

    1. Increase the 4 bus to 8 bit but keep the 4 bit OpCode.
    2. Increase the only the PC to 8 bit.

    The second approach is not easy. We need to add a page register. For this we have to remap on of the OpCodes (okay you could multiplex DOUT using AOUT and get 16 registers but that would take an extra instruction each time). We could remap JNC, B to Page, B. The new Page register would set the high nibble of the PC on a jump. There would still only be 16 RAM words to play with. 

    A Few Days Later

    I coded the Page Register:

    By adding three chips I have 256 bytes of program memory. I cannot program it with the CPU directly (they call it Harvard Architecture) so what to do? It needs some thought.


  • PCB Design Done

    agp.cooper08/06/2017 at 09:51 0 comments


    I have designed the PCB:

    And I have written a short demo program (actually all programs are short for the TD4):

    The demo shows the basic OpCode syntax and how data is written to or read from memory. The "... + 0" etc. for all the OpCodes, is the immediate data that is always added to the source data before being written to the destination register. The OpCode structure is much more pleasant to use than TTA. An expanded version (i.e. increased address space) would need to be able to access an ALU (perhaps in the memory address space) to be considered a complete CPU. It remains to be seen how efficient this set of OpCodes would be in an expanded CPU.

    Here are the current OpCodes:


  • Remapping the TD4 OpCodes

    agp.cooper08/03/2017 at 12:19 0 comments

    TD4 OpCodes

    The TD4 opcodes are designed for minimum decoder chip count (2) and therefore only 12 of the 16 possible opcodes have been mapped (at least that is what the text suggests):

    Immediate OpCode Mnemonic   ; Comment  
    DCBA      0011   MOV A, Imm ; MOVE Imm to A register
    DCBA      0111   MOV B, Imm ; MOVE Imm to B register
    0000      0001   MOV A, B   ; MOVE A register to B register
    0000      0100   MOV B, A   ; MOVE B register to A register
    DCBA      0000   ADD A, Imm ; ADD Imm to A register
    DCBA      0101   ADD B, Imm ; ADD Imm to B register
    0000      0010   IN A       ; Copy input port to A register
    0000      0111   IN B       ; Copy input port to B register
    DCBA      1011   OUT Imm    ; Copy Im to output register
    DCBA      1001   OUT B      ; Copy B register to output port
    DCBA      1111   JMP Imm    ; Jump to Imm
    DCBA      1110   JNC Imm    ; Jump to Imm if C flag is not 1

    I found however, author (Iku Watanabe) has actually mapped 14 of the 16 OpCodes!

    You will note that the OpCodes always add the Immediate value to the source register so if an immediate value is not required then it must be set to zero.

    Here is a CPU block diagram of the CPU:

    Remapping The OpCodes

    Let us begin by using format [DST][SRC]. The results in the following mapping:

    DST    SRC    Comment
    A    A      Move A     + Immediate to A
    A    B      Move B     + Immediate to A
    A    IN     Move Input + Immediate to A
    A    Z      Move Zero  + Immediate to A
    B    A      Move A     + Immediate to B
    B    B      Move B     + Immediate to B
    B    IN     Move Input + Immediate to B
    B    Z      Move Zero  + Immediate to B
    OUT  A      Move A     + Immediate to Output
    OUT  B      Move B     + Immediate to Output
    OUT  IN     Move Input + Immediate to Output
    OUT  Z      Move Zero  + Immediate to Output
    PC   A      Move A     + Immediate to PC
    PC   B      Move B     + Immediate to PC
    PC   IN     Move Input + Immediate to PC
    PC   Z      Move Zero  + Immediate to PC

    You should be able to see that for some OpCodes, they only make sense if the Immediate data is zero.


    I have mapped the set of basic OpCodes (as shown above), Iku's OpCodes and two of my own OpCode transformations:

    (If you like, each step across the table adds one chip to the decoder design.)

    My first transformation is to honour Iku's OpCodes but to release the unused OpCodes.

    My final transformation is to add an address output register.

    Now it is not absolutely necessary to take my approach as you can just use the A Register value to directly apply the RAM address, but for a CPU with so few registers an extra register is probably worth the extra two or three chips.

    Here is the Iku decoder:

    And here is mine (version 2):

    Although mine has four chips instead of two, it does release a spare inverter and nand gate which I will need for the RAM databus decoding. That is, in order to access the RAM I need to have a tri-state databus, I will need to swap the Output 74LS161 with a 74LS173 and provide output logic to tri-state the output buffer when a memory input is preformed. Sounds hard but it is just an inverter or two.

    The Clock

    Iku has the PC clock in phase with the other clock signals, for most of my CPU designs I have it out of phase. It works because all outputs are shunted via the adder and delayed, making the clock/data transition reliable. As I have found out, this will also work for the !WE and !CS of RAM that does not have an !OE. It could be tricky in some cases if the buffer has a data hold period greater than the data delay. Something to watch out for. 

    Final Version

    How many times have I said that?

    Anyway, I worked out a simpler way. I can demultiplex the OUT signal using ROM_D4 (Version 3):

    I have also renamed the label to suit access to a 16 bit RAM (74LS189). Yes that was 16 bit (not 16k or 16M). You could use a 74LS138 to do this but I used a 74LS02 (quad NOR gate) as I want to invert the select and create a !WE signals. Here is part of the schematic:

    You should recognise Iku decoder to the bottom right and my demultiplexer to the bottom left. I have also swapped out the 74LS161s for 74LS75s as I need to invert the output for the 74LS189 RAM. As I am using LS TTL the inverting outputs of the 74LS75s work better with LEDs. I have...

    Read more »

View all 5 project logs

Enjoy this project?



Rue Mohr wrote 04/20/2023 at 06:22 point

Yea the clock and reset lines are swapped, a correction on that would be nice.

  Are you sure? yes | no

Rue Mohr wrote 04/20/2023 at 06:23 point

ah sorry I see you have a correction in the version in the logs!

  Are you sure? yes | no

zpekic wrote 06/14/2020 at 04:20 point

Super cool! Sometime back I "built" (well, on a FPGA) something similar using a single 4-bit Am2901 slice. Of course that is cheating, because 1 slice contains the equivalent of up to 10 74XX TTL chips (74181 + 2 7489 + bunch of MUXs)

Here is one of sample programs I wrote for it, but not even sure any more what it does :-)

; //Test program 2

; .org 0 //fill program memory starting at location 0

0000 00 ;loop: Q = INPUT[0] // read value from port 0

0001 5B ; B = Q // store to b to initialize count

0002 54 ;dsp2: A = 0

0003 51 ; A++

0004 51 ; A++

0005 51 ; A++

0006 1E ;disp: OUTPUT[A] = Q // put q to outputs 3, 2, 1

0007 52 ; A--

0008 FD FD; IF(A != 0) GOTO disp

000A 1E ; OUTPUT[A] = Q // put q to output 0

000B 4F ; Q-- // decrement q

000C 5A ; B-- // decrement counter

000D FE F4; IF (B != 0) GOTO dsp2 //repeat until 0 reached

000F F6 F0; GOTO loop

; //end of test program!

  Are you sure? yes | no

agp.cooper wrote 01/05/2018 at 13:31 point

Now that was a good pick up.

I don't remember if I noted it or not. I do recall it looking strange.

The schematic in this area: debounce and current limited is over-kill when using a schimitt trigger.

I am pretty sure the protection diodes would have no problem up to 10uF but I can't back that up at the moment.

Anyway I always rebuld these schematics to fully understand them.


The schematic in the book is correct, the schematic (source: is copy.


  Are you sure? yes | no

Dave's Dev Lab wrote 01/05/2018 at 19:51 point

thanks for the info! 

  Are you sure? yes | no

SpaceCoaster wrote 02/14/2018 at 19:21 point

The schematic you posted from the book is NOT completely correct!

Pin 13 on IC10/7410 should connect to D6 and not D7 as drawn. If you connect it as drawn then LOAD1 is driven by (!D7 or D7) which is always 1. (!D6 or D7) is the right choice. Your version B schematic already does it this way.

Thanks for posting this. I have coded it in Verilog both using chip emulations and then as structural code. I also found the chips required on some old wire wrapped prototypes and I will plop them on a protoboard soon. I think I finally understand how a simple processor works!

  Are you sure? yes | no

agp.cooper wrote 02/15/2018 at 05:12 point

I posted that schematic because the best I could find without drawing my own (at the time). In any case my version was a complete "reboot" along with other changes. The only thing that caught me out was that the diode ROM will not work with TTL, it has to be HC or similar (input low voltage is not low enough for TTL).
It is a pretty neat demonstration CPU. The Japanese have a way with adding lights and noises to make something more impressive than it really is.


  Are you sure? yes | no

Dave's Dev Lab wrote 01/05/2018 at 01:54 point

hey, did you happen to notice on the reference schematic you posted above "from the net" that the reset and clock signals appear to be swapped? is that the "official" schematic from the book?

  Are you sure? yes | no

Dave's Dev Lab wrote 11/26/2017 at 01:53 point

any updates?

  Are you sure? yes | no

agp.cooper wrote 11/27/2017 at 01:20 point

Hi Dave,

Just back from three weeks in Malaysia and Japan.

Have been to Malaysia many times. First time to Japan.

Highly recommend Japan.

If you use Airbnb and JR rail pass it is pretty easy to get around and relative to Australia not expensive.

As Japan is non-english you need to do plenty of research to work out how things work. It is quite different to Australia and the US. That aspect alone was worth the trip.


Well its works (a couple of patches to the board).

I crashed my EasyEDA project so I have to redo the PCB.

Most of the work was about including instructions to expand program address space and to allow self programming. Still some work if I want to finish this aspect.

It is a really good project for "beginning programming" because of the visual feed back and the relatively high code density. It is something you could give a 10 year old to play with.

I need to re-organise the LED layout a little as well, and perhaps add a buzzer and a couple of user switches.

I would really recommend this project (my version or the original version) to anyone as a first CPU project.


I was not going to do the next stage but I will have another look now.

If you interested in a PCB board, I can updated the PCB design.


Regards AlanX

  Are you sure? yes | no

Dave's Dev Lab wrote 11/27/2017 at 01:59 point

Thanks for the update! Yea, i have been looking at doing my own variation of TD4 for some time, but i really wanted the text of the book to help guide the design. i was just curious if you had planned to post more technical information or if it was just a research project... thanks again for the info!

  Are you sure? yes | no

agp.cooper wrote 11/28/2017 at 02:10 point

Hi Dave,

The book (by Iku Watanabe) is easy enough to read even if you have no Japanese.

I checked my logs and I have posted the the original TD4 schematic.

Which is all you really need. Still you can buy his book for karma (as I did).

My work basically swapped 74HC161 chips for other register style chips and remapped some of the instructions to add an additional output port. I stuffed up the memory chip read/write signals but really I was wasting my time with this.

The next step was to add a page register to expand the address space.

I have not worked out how to make it self programmable yet but really that may be pushing the TD4 concept a bit to hard.

I can send you my last schematic if you like, but really you should not have much trouble decoding either the original or my design.

If you are interested I can redo the PCB (that I lost). Most of my designs are publicly  available from the EasyEDA website.


Technical information? The way the CPU works did take a little time to workout.

The key concepts are:

* Every instructions adds the immediate value to the data being read.

* Four readable registers (A, B, Zero and Data In).

* Four writable register (A, B, Data Out and PC), the B version has two data output registers.

Have a look at the table below for an 8 bit counter example (if it displays after I post this reply):


  Are you sure? yes | no

agp.cooper wrote 09/22/2017 at 14:48 point

Hi Dave,

I post what I learn, what worked and what failed. For some people this is very interesting. For others, they just want the answer. The answer of course is subjective.


I bought the book for karma, pretty well everything can be found on the Internet. The book however is a gem. It has style.


It took me a while to understand his CPU (it strengths and limitations) as my CPU design style is quite different. But you have to be impressed with the code density! You can do a lot in 16 bytes.


I have modified the CPU to add a second output (the B Version). The C Version has a Page register for an 8 bit ROM as well. You need this second output if you want to build on the design.  I think in my case the 16 bit RAM was premature, however.

What is interesting with the CPU is that it is Turing complete in that it can emulate other simple CPUs ( for example TTA).

I have had a problem with the latest version of EasyEDA so the PCB is lost. I do intent to rebuild the B version of this CPU. But I have to rearrange the LEDs. Having the Instruction LEDs next to the output LEDs make me nauseous. Also in keeping with the Japanese style I need to use different colour LEDs and even a buzzer when the program ends!

The B Version is a good piece of wall art or something for the kids to play with. The most common program on the Internet seems to be a Ramen (instant noodle) timer.


Version C is the next step up with page memory but I have not really thought the development path.

Regards AlanX

  Are you sure? yes | no

Dave's Dev Lab wrote 09/24/2017 at 04:58 point

Thanks for the feedback AlanX!

i am curious have your run across this paper before?

i google around but didn't find any additional material about this CHUMP design...



  Are you sure? yes | no

agp.cooper wrote 09/24/2017 at 06:36 point

No, but I can see the similarities to the TD4 with the immediate nimble.
I am not a big fan of using PROMs for instructions decoders.
I have only recently given in to microcode (CPU4 and the One Bit CPU).
Basically trade the decoder PROM for 3 or 4 SSI chips and you have a TD4B.
Regards AlanX

  Are you sure? yes | no

Ed S wrote 09/27/2017 at 17:19 point

Interesting find Dave. I see it appears in this list of TTL CPUs curated by Andrew Wasson:

  Are you sure? yes | no

Dave's Dev Lab wrote 09/22/2017 at 04:02 point

I've been looking to order this book for some time, but i was unsure of the value without having an english version. i "liked" and "followed" your project, i am really interested in seeing the results and information! get up with the log posts!!!!

  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