Sunday, May 3, 2020

Around Instructions...

After a (another) Clock and Stepper overhaul, I finally think I've got the implementation down pat. I have over 550 unit tests for the clock and stepper alone, so I think I've got everything covered.

Over the course of the weekend, I worked on 3 things:

  • The concept of Breadboard
  • Getting the framework ready for processing instructions
  • Getting the framework ready for implementing instructions

Breadboard

With all these components imlpemented, I needed a way to instantiate them all and have them readily available for interconnecting them. 

I'm not a electronics buff, but I found out that a device used to connect components together to create a circuit is called a breadboard. I created a Breadboard object in my project that comes pre-loaded with all the parts that make up the bulk of the computer:
  • System Bus and all registers (seen so far)
  • ALU and RAM
  • All necessarry wires to connect everything together properly

Instruction Processing

Instruction Processing basically involves creating the circuit for steps 1 through 3, which involves loading the current instruction (refered to by IAR) from RAM to IR and incrementing IAR. Here we add to the Breadboard:
  • IAR and IR
  • Circuitry decribed on page 110 of the book

Instruction Implementation

Instruction Implementation means setting up all the necessary scaffolding that will enable creating circuits for specific instructions. That includes:
  • RegA and RegB enable and set circuitry
  • The "All Enables" and "All Sets" sides of the Control Unit
  • The circuits to set and enable R0 through R3 (page 117)
  • The Instruction Decoder circuit from page 122

Introducing "Elastic OR"
This setup is difficult to build in steps because all the OR gates for the Enable and Set sides of the Control Unit will have a certain number of wires connected to them, but we have not build those circuits yet...

In a real life situation, you would probably just leave those pind unconnected and they would send 0 to the gate. But in my case, the gates must have wires connected everywhere when they are created.

To accomodate for that, I have come up with something I called an "Elastic OR". An "Elastic OR" is really just a 6-pin OR that come pre-configured as such:


It basically has all "off" wires already attached, so by default it returns 0. When you attach something to an input, it effectively replaces the pre-attached wire with the new one, so the circuit now effectively returns the value of that one new wire. As you keep adding wires, the "Elastic OR" adapts to always return the correct value according to the number of connections.

This construct allows me to setup those OR gates in advance and have them working, even though not all the connections are in place yet.

With all this in place, we are ready to start wiring specific instructions!

No comments:

Post a Comment