|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
OK, so this is what I have. I'm still debugging it, but it should more
or less work now.
It's an 8-bit processor. All data paths are 8 bits wide. There are three
general-purpose registers, named X, Y and Z. They're all 8 bits wide.
Since the address bus is also 8-bit, the processor is limited to a
piffling 256 bytes of addressible memory (unless you go implement
banking). There are 17 valid opcodes (plus more which may or may not
produce predictable results.)
All instructions are exactly 2 bytes long. The first byte is an opcode,
and the second is a memory address (which may or may not actually be
used for anything). It's merely simpler to design if all instructions
use an identical addressing mode. Similarly, all instructions are
exactly 6 clock cycles long, even if some of them could actually be done
faster.
There are basically 4 instructions:
- Unconditional load.
- Conditional load.
- Save.
- Math-op.
A conditional load does exactly the same thing is an unconditional load
*if* the last math-op produced a result exactly equal to zero. Otherwise
an unconditional load does nothing at all.
Either way, a load copies the contents of the specified memory register
into one of the internal registers. Since the target register can be the
Program Counter, an unconditional load instruction can be used to
perform an unconditional jump (to an absolute address). Similarly, a
conditional load can perform a conditional jump.
A save instruction does the reverse: it copies the contents of the
specified register (including the PC) to the specified memory address.
There are 5 possible math-ops. They all take X and Y as their operands,
and store their result in Z. (They also set or clear the "zero flag"
that the conditional load instruction tests.) The available operations
are bit-wise AND, OR, XOR, binary addition and binary subtraction.
Currently math-ops generate several flags, but it is impossible to
access any of them except the zero flag. In particular, this means that
16-bit addition would be spine-tinglingly difficult to implement in
software. What I probably need to do is utilise some of the unused bits
in the opcode to select what condition the conditional load instruction
tests. (Which means *another* binary decoder in the control matrix...)
As you can see, the CPU itself is quite simple; just a bunch of
registers attached to a single common data bus. The complexity comes
from the maze of control busses eminating from the control matrix. And
when you look inside the control matrix itself... woah. OK, that's
pretty complicated! o_O
Now, if I can just figure out a reasonable way of getting Logisim to
test the damned thing...
Post a reply to this message
Attachments:
Download 'processor.png' (13 KB)
Download 'control matrix.png' (23 KB)
Preview of image 'processor.png'
Preview of image 'control matrix.png'
|
|
| |
| |
|
|
|
|
| |
| |
|
|
and you say you're a retard... o_O
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
nemesis wrote:
> and you say you're a retard... o_O
Well, I _did_ just spend several weeks building a simulated model of a
trivially simple computer when I could just, uh, use a real one...
When you think about the amount of _useful_ stuff I could have done with
that much time and energy, you start to understand why I feel
unfulfilled with my life. :-(
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Orchid XP v8 <voi### [at] devnull> wrote:
> nemesis wrote:
> > and you say you're a retard... o_O
>
> Well, I _did_ just spend several weeks building a simulated model of a
> trivially simple computer when I could just, uh, use a real one...
>
> When you think about the amount of _useful_ stuff I could have done with
> that much time and energy, you start to understand why I feel
> unfulfilled with my life. :-(
is learning not useful?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 10.06.10 22:46, schrieb nemesis:
> Orchid XP v8<voi### [at] devnull> wrote:
>> nemesis wrote:
>>> and you say you're a retard... o_O
>>
>> Well, I _did_ just spend several weeks building a simulated model of a
>> trivially simple computer when I could just, uh, use a real one...
>>
>> When you think about the amount of _useful_ stuff I could have done with
>> that much time and energy, you start to understand why I feel
>> unfulfilled with my life. :-(
>
> is learning not useful?
Learning aside: Hobbies were invented for fun, not for "productive time
management". ;-)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Tim Nikias wrote:
> Learning aside: Hobbies were invented for fun, not for "productive time
> management". ;-)
They were also invented for bragging rights. Only a vanishingly small
portion of the human race can claim to know how computers really work at
the component level.
Regards,
John
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
nemesis wrote:
> is learning not useful?
Depends on your point of view.
On the one hand, knowing stuff always holds the possibility that one day
it'll somehow be useful.
On the other hand, what possible purpose could there be to knowing how
to build an RS Flip-Flop from two NOR latches? I mean, unless I actually
get hired by an IC design firm (which will never, ever happen), it's
useless knowledge. It has no practical use of any kind. Hell, even
learning to use regular expressions is theoretically more useful!
http://xkcd.com/208/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Tim Nikias wrote:
> Learning aside: Hobbies were invented for fun, not for "productive time
> management". ;-)
Sure. But spending weeks wiring together little black blobs in order to
make a few LEDs flash in a pattern with hypothetically means something?
Most people wouldn't regard that as "fun".
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
John VanSickle wrote:
> They were also invented for bragging rights. Only a vanishingly small
> portion of the human race can claim to know how computers really work at
> the component level.
And an even smaller portion of the human race *care* how computers work.
Most people's reaction would be "you poor autistic weirdo, you should
seek professional help".
The only minor consolation is that without losers like me, we wouldn't
*have* computers in the first place...
...still trying to convince myself this makes up for it...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> is learning not useful?
>
> Depends on your point of view.
>
> On the one hand, knowing stuff always holds the possibility that one day
> it'll somehow be useful.
But if you spend your whole life learning, you'll run out of time to do
anything useful with it :-)
> On the other hand, what possible purpose could there be to knowing how to
> build an RS Flip-Flop from two NOR latches?
Those skills will be a useful base to learn more complex things, and also to
use as part of more complex projects.
See how your knowledge of transistors helped you when you were first wiring
up your logic gate? Ermm.. hang on... :-)
Well your skill of wiring up logic gates might one day help with something
else. If you want a real life example then on the LCDs we design here along
one edge of the glass it is pretty much just a huge chain of logic gates
that clock the display data into the DACs for each column of pixels, then
each row is clocked active in turn to connect the output of each DAC to
every pixel in that row. Somebody has to design that, more people need to
understand it in great detail, and even more people need to roughly
understand how it works. I'm sure there are a huge number of jobs where
knowing the details of logic gates it a requirement.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |