0%
0%

Fourbit

Another DIY 4-bit computer

jaromirsukubajaromir.sukuba

Become a Hackaday.io member

Not a member? You should Sign up.

Already have an account? Log in.

Just one more thing

To make the experience fit your profile, pick a username and tell us what interests you.

Pick an awesome username
hackaday.io/
Your profile's URL: hackaday.io/username. Max 25 alphanumeric characters.
Pick a few interests
Projects that share your interests
People that share your interests
Similar projects worth following
7.5k views
View Gallery
Simple 4-bit computer, designed from scratch

Since I was born in mid-eighties, I've never experienced real 74xx build. Few gates here and there was common, but lager designs were practically unneeded - as microcontrollers, CPLDs or FPGAs replaced need for such as work.
But my possession in vintage systems and desire to understand inner working principles of modern devices brought me to design of simple CPU made of simple 74xx devices.

CPU design
CPU is not that complicated circuit, if we keep goals simple - so no hardware multipliers, few registers, no fancy addressing modes. Such as CPU is not particular useful, as even old 8080 outperforms this easily, but performance is not primary goal now.
Basically, CPU does simple things - moving data from/to memory locations and making operations on it. Program flow should be allowed to change and IO latches are needed for real world operation.


Registers
Registers are elementary part of CPU design. They serve as most used and useful memory locations, source or target of most of instructions. We will have a few registers in our design.

register schematics


Heart of register is latch 74HCT574. It latches data from data bus DB on rising clock of WE signal. Passing this data to DB is controlled by OE signal, using bus driver 74HCT245. Theoretically we can use OC signal of 574, but data should be accessible even when output is not brought to DB. That is why two ICs are needed to build single register.
We can have a lot of registers on single bus, with WE and OE signals for each one register.

ALU
Adding ALU is quite simple task, thanks to 74181 developed in late 60's/start of 70's. It is 4-bit wide ALU, capable of performing almost all common logical and arithmetic operations.
Let's put two registers together, add 74181 and serve with single bus driver.

ALU schematics


Nothing special here, but this starts to be quite useful. We have two registers (A and B), controlled by respective OE and WE signals, ALU, with operation controlled by signals on M and S1 to S4 signals (for more details see 74181 datasheet). Because 74181 doesn't have tristate outputs for connecting to DB, bus driver is needed here. So, data in both registers (accessible from DB) can be passed through ALU and put on DB again.
Imagine we want to do this sequence: put data to A, another data to B, perform ALU operation and put into A again. We need to put A data on bus, assert and release AWE, then put B data on bus, assert and release BWE. In the meantime, ALU does its job (it is only combinational logic) and on F1 to F4 outputs is result. We can assert ALUOE to put result on bus. To write it to A register, asserting AWE is needed... but wait. If we assert WE, latched data (ALU result) appears on data lines of A register, ALU changes its output and this is (or may be) transferred to A register.
That's why third register is needed. Let’s call it T - temporary register. After putting ALU content on bus, we write it to T register and then (when ALU output is securely saved) to A register again.

PC
Let's focus now on another important part of CPU, program counter - PC. It's main job is to increment whenever new instruction is needed or set to value when program jump is to be made.

PC schematics


Nothing special again. Two chained 74HCT193 counters, EEPROM memory holding program and instruction register (IR). It holds current instruction byte until it is fully executed.
Preset inputs of counters (A, B, C and D) are connected to BD, in order to allow direct change of PC (program jump). Otherwise PC changes after each single instruction by CLOCK UP signal (pin 5).


Instruction decoder, part one
PC and registers with ALU are muscles of CPU, doing hard work, but it needs a brain - to decide when and how to change control signals. Instruction decoder does this job. Now starts the real fun and messing with 74xx logic.
Before actually building instruction decoder, it is necessary to decide which instructions we are going to decode.


Instructions
For this computer, I decided to use only three instructions:
1, load direct data...

Read more »

View all details

Enjoy this project?

Share

Discussions

Log In/Sign up to comment

Become a Hackaday.io Member

Create an account to leave a comment. Already have an account? Log In.

Eric Evenchick wrote 04/01/2014 at 16:21 point
I like the wide variety of homebrew computers we're seeing around here. Great write up and intro into CPU design.

Are you sure? yes | no

jaromir.sukuba wrote 04/01/2014 at 19:04 point
Thanks. This is not very much "computerish" computer, just a CPU with a tiny bit of memory, able to perform only simple tasks - for demonstration how simple it could be. In fact, I designed, soldered and brought it to life in one weekend.
Homebrew computing is attractive, though computers are very available nowadays. And maybe that is the reason - computers are not new or exciting anymore, it became mass produced and disposable thing. That's why a lot of people feel urge to have a bit of creative brain stretching instead of dull and boring consuming.

Are you sure? yes | no

Eric Evenchick wrote 04/02/2014 at 00:19 point
True, but this is a great look into how computers actually work. Computers are very available today, but nobody can understand how the whole thing works. It's awesome to see something like this which is functional, but also understandable. That's why I like reading homebrew computer schematics at least :)

Are you sure? yes | no

Similar Projects

Project Owner Contributor

TD4 CPU

agpcooperagp.cooper

Project Owner Contributor

Microcode-less TTL CPU

szoftveresSzoftveres

Project Owner Contributor

Kobold K2 - RISC TTL Computer

roelhroelh

Project Owner Contributor

TTL 6510 Computer

stefanStefan

Does this project spark your interest?

to follow this project and never miss any updates

Cancel

AltStyle によって変換されたページ (->オリジナル) /