Sunday, June 25, 2006

Memory

I've now implemented and tested the 4 memory-access instructions:
  • lba - Load a byte from an immediate 8-bit address

  • sba - Store a byte to an immediate 8-bit address

  • lbr - Load a byte from an address that's the sum of the contents of a register and a 5-bit offset

  • sbr - Store a byte to an address that's the sum of the contents of a register and a 5-bit offset

The offset is currently unsigned, but I can see that it might be more useful as a signed value. I could easily sign-extend it in the memory address unit, but I haven't yet decided whether I should. There remains the question of whether it will ever get used at all, of course. Will programs that fit in 256 instructions actually feel the need for stack-pointer-relative local variables? We shall see.

Sunday, June 11, 2006

Scripting tools

I've not done any more logic design since my last post, but my tools have gotten a great upgrade. My tests are now completely self-verifying, and can be scripted [to a certain extent]. Bcd can now, under scripted control: load a design file, create a simulator, set values in it, run it for some number of cycles, and check the results. Script files can include other script files, so I have one master test that runs each of my opcode tests in sequence without having to reload the design. This is a big time-saver, as loading the CPU design takes about 30 seconds, but creating, running, and cleaning up the simulator takes only about a second.

I've also done most of the markup I mentioned last post, and therefore can set and test values by byte [by word for the ROM] instead of bit-by-bit. The values also show up in the GUI at the top level, so I don't have to drill down 3 levels deep to read out the registers. Here's what the ROM looks like. It's really got 256 words, but if I show only the first 32, it's easier to read. Plus I haven't had any need to show more than the first word so far, but I have high hopes of needing more some day ;'>.