Step 13: Control Matrix

The control matrix of a computer tells each individual part when to take input and output its value. There are multiple states of each operation in a computer. These states are triggered by a type of counter called a ring counter. A ring counter only has one bit high at a time and cycles through its outputs consecutively. For instance, if a ring counter has 4 outputs it will first have its first output active. At the next clock pulse it will set its second output high (and the first low). The next clock pulse will advance the bit one output higher and so on. These stages are called T states. The computer in this Instructable uses 6 T states for the operation of one command. The first three T states are what is called the fetch cycle in which the current instruction is fetched and placed into the instruction register. The program counter is also incremented by one. The second set of three T states depends on what OP code is fed into the control matrix from the instruction register. The T states are as follows:

T1: The contents of the program counter are transferred into the memory address register. (Address State)
2: The program counter is incremented by one. (Increment State)
T3: The addressed byte in the program memory is transfered into the instruction register. (Memory State)
T4: Dependent on what command is being executed.
T5: Dependent on what command is being executed.
T6: Dependent on what command is being executed.

There are two primary ways to create a control matrix: using discrete logic and using ROM's. The ROM method is the easiest and most efficient. Using discrete logic involves designing a massive logic schematic that will output the correct control words for your computer based on an OP code input. ROM stands for read-only-memory. There are several types of ROM's that you can consider for use in your build. For my computer I originally used EEPROM (electronically erasable programmable ROM) but then shifted to NVRAM (non-volatile random access memory) after the EEPROM chips failed to write. I do not recommend NVRAM as it is meant for random access memory and not permanent storage. EEPROM is the most efficient solution in my opinion.

The control matrix will have three ROM chips each having at least 32 addresses of 8 bit storage (as well as the timing and counting elements). The binary word that is sent out from the control matrix is called the control ROM and contains all of the control bits for every component of your computer. You want to be sure to organize the control bits and know their order. For no operation you want a control word that renders every part of the computer inactive (except the clock of course). The control word for the computer described in this Instructable is 16 bits in length and is stored in two of the control ROM chips. The first three addresses of the control ROM chips hold the control words for the fetch cycle. The rest of the addresses on the chip hold the control words in pairs of three for each OP code. The third ROM chip holds the memory location for the start of the control word sequence for each OP code and is addressed by the OP code itself. For instance, in my computer if you give the control the OP code 0110 it will output binary 21, which is the address of the start of the JMP command. There is an 8-bit counter in between the OP ROM and the control ROM's that counts from 0-2 (first three T states) then on the third T state loads the address outputted by the OP ROM and counts from that position until the T1 state clears the counter again. The ring and binary counter for the control matrix are controlled by an inversion of the clock pulse so that control words are present when the rising clock pulse goes to the elements of the computer. The entire process in order is as follows:

1.) T1 state clears the counter to 0, the control word stored at 0 is sent out
2.) The clock goes high and the address state takes place
3.) The clock goes low and in turn the control counter increments and control word 1 is sent out
4.) The clock goes high and the increment cycle takes place
5.) The clock goes low and the control counter increments to 2, control word 2 is sent out
6.) The clock goes high and the memory state takes place and the OP code arrives at the instruction register, T3 is also active which means on the next low clock pulse the OP control address will be loaded
7.) The clock goes low and loads the counter with the address for the first of the three control words for the given OP code
8.) T4, T5 and T6 execute the OP code
9.) T1 resets the counter, the process continues until a HLT OP is received. The HLT command stops the clock.

<p>Great manual!</p><p>I've made it using Your design, but on an unusual medium: pixels :D Here's the simulator if you wanna see this in motion operating: <a href="https://realhet.wordpress.com/2015/09/02/bitmap-logic-simulator/" rel="nofollow">https://realhet.wordpress.com/2015/09/02/bitmap-lo...</a></p><p>I programmed it to calculate the Fibonacci series, it has an extra 16 byte ROM for the program, the fetch is only 2 cycles and different instructions can break the micro-word sequence earlier as when they finish, so instruction times are ranging from 3 to 5 cycles.</p><p>It was fun to input a program only using switches, like in ancient sci-fi movies. Well, it was fun for the 1st time... After I rather made a ROM.</p>
<p>Good job bro...Nice software</p>
<p>Realhet, that is spectacular! I really like your idea of using simple CA rules to make a logic sim. It is almost like Redstone in Minecraft, but so much more powerful and less latent (and also devoid of a jungle of wires, that must be nice). Congrats on the great project. Do you know of any other users of your program yet? I'll make sure to keep an eye on your site for updates, and I'll share your work with my friends. I'm sure they will really enjoy it.</p>
<p>good jop, i motivated by your project, i am gonna make one sooner . i want to know how much this projects coast you ? is there any additional advice to build one like any mistakes must avoid or things that may save time ?</p>
Sure! Try using shorter breadboard wires, and plan out the layout of your computer beforehand. This will save you a bunch of grief in the future of dealing with EMF related issues and dirty clock signals.
<p>Very well structured into topics. Very well explained and crafted. Awesome job!</p>
<p>your funny</p>
<p>i want to ask about about the uses of this 8 bit computer</p>
<p>Since its 8-bit, you can do anything that requires 16 bytes of memory ( depending on your RAM ). Unless you add some external drive... which would allow you to do so much more. But just with 16 bytes of RAM you can probably do operations like:</p><p>A+B=C, then</p><p>C+B=D,then</p><p>D+A=Z,</p><p>I think.</p><p>But with an external drive of some sort your 8 bit computer will be able to do stuff like this https://www.youtube.com/watch?v=qYvr0b8jqbg ...i think?-e-dah-puzi-1998</p>
<p>16 bytes? How did you get that? Surely an 8-bit address buffer should be able to address 2^8=256 bytes of memory?</p>
<p>Yeah....some people like to have a 4 bit memory address and 4 bit op code...I would personally do an 8 bit op code and memory address.</p>
<p>I mean I guess if you're not addressing much memory then it's Ok, but it would severely limit what you could do with the thing. With 256 bytes, you could even do some kind of really simple pong game.</p>
<p>Yeah....some people like to have a 4 bit memory address and 4 bit op code...I would personally do an 8 bit op code and memory address.</p>
<p>I think someone forgot to cable manage :P</p>
<p>Im guessing your a linus fan. ( By your picture and your comment).</p>
<p>Yes I am definitely a Linus fan :) But, my image is not a parody of Linus's image, rather its a parody of Steve Jobs famous image, so is Linus's. The comment inspiration is more Luke, not Linus. </p>
<p>thanks for all the info and references. <br>your 8 bit computer looks like a pile of wires lol. <br>its cool though. </p>
It is awesome! One question though, I didn't quite understand what your computer is capable of doing. What can it actually do?
<p>Presumably execute simply binary programs. Adding numbers, subtracting numbers, multiplication, division, maybe some more complex things like calculating square roots or powers. Anything that a standard computer can do within the limited memory it has (256 bytes).</p>
Thanks for letting me know.
<p>Are logical operations like AND , OR, NOR, or XOR essential in performing complex operations like square rooting, or a game. I just wanna know if they are needed. If so, which operation is used the most.</p>
<p>Every single kind of computation your computer does relies fundamentally on the operations of AND, OR, NOR, NOT and XOR. Actually, even AND, XOR and NOR can be composed simply of OR and NOT gates.</p>
<p>What ROM ic's did you buy.</p>
<p>Can anyone tell me which RAM IC I should buy?</p>
<p><a href="http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?freeText=74189&langId=-1&storeId=10001&productId=49883&search_type=jamecoall&catalogId=10001&ddkey=http:StoreCatalogDrillDownView" rel="nofollow">http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?freeText=74189&amp;langId=-1&amp;storeId=10001&amp;productId=49883&amp;search_type=jamecoall&amp;catalogId=10001&amp;ddkey=http:StoreCatalogDrillDownView</a>...</p><p>Two of these chips can be your 16x8 RAM</p>
<p>i like your instructable and i'am building it i'am wondering if it's possible to calculate big numbers with this computer or i am limited to 8 bit numbers only?</p><p>in 32 bit computer you can calculate bigger number than 32 bit, i think it's a software thing but anyone can make it clear how it's done ?</p><p>Sorry for my english.</p>
<p>You certainly can, you just have to do the calculations over a series of operations, also storing and loading from RAM. As opposed to having the CPU's ALU do it all for you. Just like how you would have to manually calculate Floating Point operations on old CPUs. Yes it is much slower!</p>
lots of registers and a big ALU would allow bigger number calculations to be done.
<p>how many wires do I need? </p>
just an idea, couldn't you use a decoder for the binary to decimal conversions, instead of using an arduino (using another computer I think is technically cheating)?
<p>haha sonic screwdriver. This is awesome</p>
<p>this is so awesome i am about to cry. congrats</p>
<p>This is amazing will try this hmm.. maybe next year</p>
<p>I love it. Thanks a lot. Nicely explained. Awesome. :D</p>
cool, you've made the Apollo flight computer (not really but still cool :p)
<p>cost to make computer?</p>
<p>Where can i buy those nice leds? :D</p>
<p>I clicked this link, saw the image of the bread boards swathed with a gazillion wires, and literally laughed out loud. Clearly not an easy task, but clearly you've shown it is achievable. Thanks a lot for sharing this! </p>
<p>such skill</p>
<p>Check out my new YouTube Channel for Computers...</p><p><a href="https://www.youtube.com/channel/UCWj5yoeXf12zUWZl8ziNSDA" rel="nofollow">https://www.youtube.com/channel/UCWj5yoeXf12zUWZl8...</a></p><p>Like... </p><p>Share... </p><p>Comment... </p><p>Subscribe...</p><p>Request any computer related tutorials for hardware and software... <br>c.m.c.firerat@gmail.com</p>
<p>Check out my new YouTube Channel for Computers...</p><p><a href="https://www.youtube.com/channel/UCWj5yoeXf12zUWZl8ziNSDA" rel="nofollow">https://www.youtube.com/channel/UCWj5yoeXf12zUWZl8...</a></p><p>Like... </p><p>Share... </p><p>Comment... </p><p>Subscribe...</p><p>Request any computer related tutorials for hardware and software... <br>c.m.c.firerat@gmail.com</p>
<p>This is an amazing project, thank you for sharing!</p><p>Would it make sense to replace the JMP instruction with some kind of conditional jump? Such as &quot;Jump to a certain instruction in memory at the specified address *if* the accumulator is non-zero&quot;? Otherwise I cannot figure out how to program conditionals (such as a program which outputs 0 if the accumulator contains the value 0, and 1 otherwise). In particular, I can't figure out how to program multiplication with your instruction set (which would be easy with a conditional jump). All of the arithmetic tricks that I know for getting a conditional jump out of a non-conditional jump require multiplication, such as encoding &quot;if A then B else C&quot; with A*B+(1-A)*C in the case that A is either 0 (false) or 1 (true).</p><p>Am I missing something obvious? Thanks again!</p>
Incredible instructable!<br>
<p>I think clock can be a simple button at beginning :)</p>
Great project, but I have a question, why always I see 8 bit calculator or 4 bit or such numbers ( 1-2-4-8-16... ), I mean for an 8 bit calculator it can do numbers up to 255, so why not a 7 bit, with limit of 128? I mean the whole bit thing is just summing of multiple full adders, that will work like a chain reaction, or I'm missing something?<br>
<p>a bit is the smallest form of computer memory </p><p>so basically 8 is its maximum storage and processing power which isn't much for a computer but it is all it need's for calculating numbers also why would you limit the ability of a calculator? </p>
<p>This tutorial seems good but its quite brief. I wanted to implement the logic gates with transistors and after some research I got a very nice and detailed tutorial. Study this, <a href="http://innovatelogics.com/blogs/tutorials/14431713-logic-gates" rel="nofollow">Logic Gates with Transistors</a>.</p>
This is awesome !!!
<p>do you have a multisim or any other simulation files of the end result? if so could you please mail it to me at aus284@gmail.com if possible.</p>
<p>What a great idea using the XOR and C-in to preform a subtraction!</p>

About This Instructable


825 favorites


Bio: All of my life I have been interested in learning the way things work. It was always hard for me to use something and just ... More »
More by spel3o: How to Build an 8-Bit Computer Make a Pocket Watch Chain for Your iPod How To Change Your MAC address (Snow Leopard)
Add instructable to: