Table of Contents

Week 4

Here we are, entering the fourth week of the semester. Already a considerable amount of groundwork has been done on our simulator. To be sure, I've been very pleased with what I've seen so far.

I've also been pleased with getting the various hiccups worked out. I've been able to meet or speak with almost everyone in some manner this semester and have worked out problems (be it subversion quirks or other questions). So please, keep the questions coming!

And please, don't think you just have to ask me… ask me, but also talk amongst each other… use the mailing list, use #csci on IRC… this is a collaborative effort amongst all of us, and nobody should feel like they're alone. We're each contributing work towards accomplishing various tasks, but we're sharing the codebase, and creating something big.

Registers

With much of the basic components built, we've been getting involved with “circuits” built upon them (half-/full- adders, flip flops, etc.)

There may have been a question pertaining to “circuits”… as in “what is a circuit?”

Consider a circuit as the combination of various components to create new desired functionality. A half adder would be akin to a “circuit” (if we were to plot one out in real life using electronics)… so although we're implementing “classes” of “objects” instead of “wiring” together “components”, we end up achieving similar goals (we just have the convenience to implement differently, selectively ignoring various laws of physics, etc.).

So– the next big thing, and the thing that will open up all sorts of new possibilities for us, is the register.

The register is the basic unit of internal storage on the CPU.

Variables, as we know them, are largely a lie when it comes to the CPU. Everything ultimately goes through a register on the CPU.

What is a register?

Please be sure to do some research on your own regarding registers. Wikipedia likely has some great information and references.

A register, for our purposes, is a fixed size unit of storage, essentially a chained together sequence of flip flops.

In some ways, we can conceptually think of a register as an array… where each element can store one bit.

Most of the registers we will be implementing will typically be 8-bits (there may be some exceptions, depending on the architecture chosen).

So a register class that needs to be build will allow for the loading of data into a register, and various forms of manipulation (as hinted at in my previous message):

As this functionality starts to take place, the shape of the eventual architecture we're implementing will really start to form… what we'll have in the end are various required components for a CPU, and to implement “instructions”, which basically just utilize various components to accomplish tasks (put various items in certain registers, do certain things to others… and take actions based on the current state of things).

So the implementation of registers will be a very important task that will be with us for pretty much the rest of the semester.

CPU architectures

In my 2nd message last week, I hinted towards some architectures that people can implement:

There seems to be one group forming around implementing the 8085, and I think I've heard reference to interest in pursuing the 6502.

If you haven't yet decided on a path, you can choose to either join one of these implementation groups (both will still be using common code of the repository, there will just be some differences to what is used where, and the resulting instruction sets will of course be different), or take on one of the others. We don't have to implement them all… if we only end up with a 8085 and 6502, that is more than fine.

I'd just like to offer the flexibility. There exists considerable opportunity for learning even with these two implementations, as both groups will be learning things that can be shared with the entire class that will help the other to understand something better about their own implementation.

References

This can find its way onto the class wiki page… I stumbled upon the following this afternoon:

The bitsavers project, which is trying to scan old documentation and preserve software from being lost to time. There is stuff there on the 8085, Z80, and 6809. There appears to be something on the MOS 6500, and likely stuff on the 8080. Among lots and lots of other stuff.

I'm staring at the Databook to the Z80 right now, and it has all the circuit layouts, timing diagrams, instruction set info, and all sorts of goodies (many well beyond what we'd need to concern ourselves with in coding, but educational nonetheless).

The 6809 datasheet is similarly good.

Also, for the 6502 (some of you already know about this):

I should say, we should start to collect a list of web resources on the course notes wiki page… any interesting pages you find, be it wikipedia article or something else… slap it on there under the References section.

And everyone be sure to update the TODO list as you work on stuff, complete it, partially work on stuff, find new bugs, whatever… so that everyone can see what tasks are available.