Close
0%
0%

4-bit CPU (TD4 once again)

I build TD4 CPU and expand it (add RAM, switchable memory banks and rugged I/O)

Similar projects worth following
TD4 is a 4-bit CPU built around 74HC283 full-adder (which I don't have and will replace with "discrete logic" adder) described in Japanese book "CPU no tsukurikata". That's not the first time this CPU is built here on HaD (see https://hackaday.io/project/8442-ttl-based-4-bit-cpu , that's actually how I found this book in first place).

TD4 by itself is very primitive architecture - it can't even add it's registers together! There is only 16 bytes for program code and no RAM. Of course, it's easy to understand, but for something serious (think OS) that's absolutely not enough!

So, the plan:

  • Add RAM
  • Add switchable ROM banks
  • ...
  • Software!

But, there are a few tricky moments.

First and foremost - I want to maintain backward compatibility with existing programs for TD4. It's not very hard, but gives a restriction to work with:

  • I can't change existing opcodes (there are 12 out of 16 now)

This means I can only use 4 additional instructions to implement all the features I want.

Currently, those 4 instruction are distributed like this:

  • LD Imm - load from RAM to register B
  • ST Imm - store to RAM from register B
  • SWM Imm - switch RAM (memory) bank
  • SWI Imm - switch ROM (instruction) bank

RISCy, isn't it?

Also, there is an age-old workaround - it's possible to hook up additional hardware to the I/O bus and control it using IN and OUT instructions. I consider this as a way to add some interedting functionality, like external ALU or even UART (communications!).

Another moment is jumps between ROM banks. I'm still not sure about the implementation details, so I skip this for a while.

  • Finally, an update!

    Fedor Gruzdev10/18/2018 at 09:15 0 comments

    After almost 2 weeks since projects' creation it's time to write a log, isn't it? I've got a few things to post.

    First, now there's a link to Github repo with some code written by my friend with whom we started this. As he is more about software than hardware, he writes "SDK" (if you can call it this).  For now, there are assembler/disassembler and emulator. This is enough to start writing programs (although you can do this using nothing but a sheet of paper but still).

    Second, I finally assembed ROM PCB!

    It's wired point-to-point using enameled wire. I saw this technique here on HaD (by the way, I hihgly reccomend visiting Elm's site, elm-chan.org, there's a lot of great stuff over there (check out the pictures!)). That's a time-consuming process, but the results look very nice (do they?). I've also made it swappable, so it's possible to develop program using this PCB and than make a smaller hard-wired diode-only version (true firmware BTW).

    Next thing to do is to start assembling the main board, and the first part will be, of course, the IC9 replacement, discrete-logic ful adder!

View project log

Enjoy this project?

Share

Discussions

agp.cooper wrote 10/10/2018 at 11:55 point

The TD4 is perhaps my favourate CPU. Look forward to seeing your version.

  Are you sure? yes | no

Dave's Dev Lab wrote 10/09/2018 at 20:01 point

looking forward to seeing some log entries on this! specially the 283 build!

  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