Sunday, April 10, 2005

The Program Counter Unit

If the ALU is the heart of the CPU, then the PCU is surely the bit that nags you to get off your ass and do things. Wait--no--maybe it's the brain. Yeah, that's probably it.

It's a bit awkward for me to try to abstract out a monolithic PCU block for testing. At least in my design, the PCU is quite closely tied in to the master state machine that controls the entire CPU. What I've ended with up here is therefore not a box labelled "PCU" that you just hook up to your ROM, RAM, ALU, etc. It's a set of pieces:
In this test I'm just displaying the link register's value rather than actually using it, and my opcodes are just:
  • nop
  • branch to immediate value
  • branch-and-link to immediate value
In order to have a complete view of all sorts of different branching instructions, well...I'd have to have done a lot more work. I'll get there, but for today at least I've tested all the basic parts I'll need.

Incidentally, the two small text boxes in the screen shot, which are probably too small to read, contain the following text:

Phases of operation:

   Read Next PC->PC
   Increment PC
   Read PC->ROM
   Process instruction

Opcodes for this test [bits 15-14 only]:

   0x0000: No-op
   0x4000: No-op
   0x8000: branch to addr in bits 13-6
   0xC000: branch-and-link to addr in 13-6

0 Comments:

Post a Comment

<< Home