I am not entirely thinking straight right now, but hopefully coherent enough to answer your questions. I'm not sure when I'll wake up and am sure I'll have a headache when I do.
What exactly are bits, and why have you labeled several things (buses, opcodes, etc) with something like "x bits"?
Could you give a brief tutorial (or something) on hexadecimal?
I'll start with hexadecimal (and cover "bit" along with it).
Hexadecimal is base sixteen, with the decimal numbers used for 0 through 9, and...
A=10, B=11, C=12, D=13, E=14, F=15.
Computers do all their math (and most of their other work) in base 2. Each place value in base 2 is a "bit" or binary digit. These bits are transfered/stored in forms that only require two different levels/modes/states/whatever. This small number of states is what makes bit so attractive for computing. When I say something is 4 bits, I mean it uses/stores/transfers/whatever 4 binary-digits.
Without having fonts installed, using subscripts on a computer is not possible. So we denote all hexadecimal number with a "0x" or "'h" prefix, or an "h" suffix. "0x" is most popular (especially in software). The tick notation is used in Verilog HDL (Hardware Description Language) (Verilog is currently the most popular HDL in the U.S., and should not be confused with VHDL which is another language popular in Europe).
The reason we use hexadecimal is that it works really easily when wanting to convert to base 2. Base ten would require various calculations not required in base 16. Note that each place value (often called a "nibble" by Computer Engineers) in base-16 is equivalent to exactly 4 place values in base 2.
There are two "nibbles" in a "byte" (8-bits), get it?
Binary values are often denoted with a "'b" prefix. So 'b0101=0x5=5 (in base 10). In verilog, the constant value actually has the number of bits prefixed to the constant, so you'd see 4'b0101 in the code itself. Sorry, I'm rambling...
The conversion between base 2 and base 16 (other than the normal way) involves simply memorizing 16 translations.
Here is the full translation:
0=0x0='b0000
1=0x1='b0001
2=0x2='b0010
3=0x3='b0011
4=0x4='b0100
5=0x5='b0101
6=0x6='b0110
7=0x7='b0111
8=0x8='b1000
9=0x9='b1001
10=0xA='b1010
11=0xB='b1011
12=0xC='b1100
13=0xD='b1101
14=0xE='b1110
15=0xF='b1111
Now, if you want to interpret hexadecimal number 0xBADCAD into binary you'd simply replace each nibble with its appropriate four bit translation.
In this case:
0xBADCAD='b1011 1010 1101 1100 1010 1101 (spaces used to keep the nibbles visible)
Also, (although conventions differ) in any base, the left most bit/digit/hex-"nibble," is "most significant" (i.e. has the highest place value), while the right most bit/ digit/hex-nibble is "least significant" (i.e. has the least place value).
Going from binary to hexadecimal, we often don't have enough bits for a nibble, so we pad the most significant bits with zeros. So 'b10='b0010=0x2.
I have some questions (turns out the gist just wasn't enough).
-Translating from assembly code to machine code.-
I'm not 100% sure of what's going on there (I thought I did, but I decided to test myself...and I failed). Could you give a step-by-step explanation of the process?
Now to the machine code translation...
I made the machine code really stripped down, so many of the complications in real machines are not here. It was meant for illustration purposes, but I plan to keep using it, so I should make things clear here.
I'll do the subtraction line for illustration.
L1:SUB A B
Note the label L1, in our case is irrelevant for this instruction, it is just a way for the BNZ instruction before the HALT to know where to "branch" to. So we're left with:
"SUB A B" which denotes opcode 0x3, register 0x0 for the first operand, and register 0x1for the second operand. Note that the register codes for the operands are only 2 bits each, so they are padded with zeros in the 6 most significant bits. We get opcode 0x3, operand code 0x00, and operand code 0x01. Put them together, and we get 0x30001.
-Processor cycle thing.-
Why does the looping happen? Why do things become different at cycle 46?
Ah, branching...
So there is the special instruction in our ISA denoted "BNZ" which stands for "branch if not zero." This checks the prescribed register to see if it is not zero. If it is not zero, then it changes the PC to where the label in that instruction specified.
In our case, the label was L1, which was the SUB instruction mentioned earlier, sitting in the third slot of code space (slot 0x2). If the register specified is zero, we move on to the instruction immediately following it in code space.
-Miscellaneous-
What is "clocking" or "clocked"?
Clocks are a means for all the circuits in a processor (and many other digital circuits as well) to synchronize with each other. It is a periodically repeating signal. The most common implementation is signal that switches between a high-voltage level and a low-voltage level and vise-versa at regular intervals. When I say "rising edge" of a clock, I mean the transition from the low-voltage to the high-voltage.
And lastly, I have a suggestion:
Start off posts with definitions of technical terms that you'll be using in the post, and that a layman might not be familiar with.
I'll keep that in mind. I have been doing computing stuff since I was 13, and have worked professionally in some capacity (software engineer, systems engineer, or component engineer) since I was 18, so sometimes I have no perspective on what a layperson would know. Also, many computing terms are hard to define, and many are newly minted. I once used the terms "clauses, and qualifiers" (based on some precedent from other designs) and those words made their way into becoming regular terms used by people working on many chips, and is even going to be in a protocol spec. to be released. nVidia uses the term "warp" to describe something very similar to "thread" in the vernacular of most computer folks, and use the word "thread" for something else funky but similar.
Please, go through the last few posts, and keep asking questions. There is a lot of arbitrariness in computing. Sometimes, you won't understand something till you know the convention (and the convention is easy to assume for someone who uses it regularly).
Hopefully, this made sense to you (or at least will to me in the morning). Please keep asking questions for clarification.
It may seem like I didn't cover much ground, but what I posted is only a few steps away from all the info. needed to design a crude processor like the one described.
So again, please keep asking questions for clarifications.