When I was in grade 9 I watched Ben Eater create a computer from logic chips and my mind exploded. I realized computer architecture was just like LEGOs and that is how I spent my entire high school life doing. I wanted to create a computer better than Ben Eaters. His was an 8bit computer was 16 bytes of RAM and 16 instructions. I needed to do something far better. So I began to design my first computer in grade 10. Since then I created 5 other machines. This project is about my most recent creation. It is a 16 bit machine with many useful instructions. It is similar to Ben Eaters computer except that:
- Instructions can have up to 16 micro states
- If an instruction does not need 16 micro states to execute the micro state counter is reset
- Stack Pointer
- LCD display
- 74181 ALU
- 32KB RAM 4KB ROM
- Up to 128 instructions
- Conditional branching
Understanding the Architecture in Words
Print the instruction set and the block diagram of the architecture, then read this and use that for reference.
This architecture is linear. Once an instruction is finished address in the program counter is used as the location of the next instruction to execute. There is no parallel computing or memory management but that is an area I would like to explore in the future.
A program is just a list of instructions that the computer follows exactly in the order you list them in. It has memory where you place the instruction and variables in. This computer has a RAM memory of about 32000 bytes and ROM memory of 4096 bytes. Something different about this computer is that instruction codes are made of sometimes 1 or 3 bytes but for the most part, most instructions need 2 bytes. The first byte is always an instruction. The address larger than the first byte stores the operand and the number of operands is dependant on the micro code of the computer which is explained later.
The computer distinguishes between RAM and ROM memory through logic gates explained in the memory section. When a computer is fully reset it will think that the first instruction is stored at memory address 0. If we have a program already stored starting from address 0, it will begin to execute.
To understand how a computer like this executes we must look at something called the instruction cycle. The instruction cycle consists of 3 main steps. There is a ring counter counting at a frequency that sets the speed of the CPU. It resets when it counts to 16 or gets a signal saying that an instruction is done executing and does not need the full 16 states to complete. It just keeps track of which of which instruction state is active. State 1 on the counter represents fetch, state 2 represents decode, and 3 -16 all represent execution states. Execution states vary depending on state 1 and 2. To understand why continue reading my friend.
Fetch: the ring counter is reset and pointing at state 1 in the control ROM
Find RAM at address of interest(stored in program counter) where we expect an instruction to be stored for sure. This is basically outputting the contents of the Program Counter onto the bus for the Memory Address Register to read. This explains why the computer begins to read instructions from address 0, because on reset, the program counter becomes 0.
Since the Memory Address Register is pointing directly into RAM while in RUN mode, the contests of RAM at that address(which is basically the first instruction of the program are put on the bus and the Instruction Register is loaded with a this instruction. At this point if you look at the block diagram of the architecture. The output register is connected to a bunch of decoding things. To understand this read the control unit section. Basically fetch and decode are always expected to happen and not placed on the instruction set table. Only The Program Counter is incremented. Why tho?? This can be explained since the program counter...Read more »