laserhawk64
Senior Member
Hello, all. It's been a while As usual, I have a very odd idea that isn't really in the PICAXE's typical line of work, and I'd like to see if I can hammer the round peg into its square hole...
I'm, er, emulating a four bit CPU with a 20X2.
It has a four bit data bus, an eight bit address bus, and four other lines -- clock, I/M, W/R, and IRQ. (I/M = IO/MEM -- L for memory operations, H for I/O ops; W/R = Write/Read -- L for read ops, H for write ops; IRQ is an active-high input.) I can post the pinout map I came up with if it really matters, but I'll leave it out for now.
A local friend of mine started designing the logic and got far enough to lay out commands and states -- which is just enough for me to figure out how to implement it. I've decided that I want to keep it as simple as possible -- the entire computer around the CPU is an SRAM chip (parallel IO, 32k*8 of which half will be used) and the buffer/latch chips needed to read switches and drive LEDs. (This is a ROMless system.) As such, the "clock" is a single-cycle circuit (each press of a button produces a single clock cycle). As the input switches will be DIPs (I want to keep it physically small, too), this will probably result in an overall system speed of less than 1Hz. Whee...
*ahem*
Here's the issue. I want to use the internal RAM to simulate the internal CPU registers. Those registers are laid out like this --
RegA = 4b
RegB = 4b
RegT = 8b (divided into RegTA and RegTB, 4b each)
Flags = 4b (divided into four 1b sections, labeled C E Z M )
PC = 8b
...and during an interrupt condition...
RegIntA = 4b
RegIntB = 4b
RegIntT = 8b (divided into RegIntTA and RegIntTB, 4b each)
IntFlags = 4b (divided into four 1b sections, labeled IC IE IZ IM )
IntPC = 8b
So, if I can address individual nybbles within the 20X2, I only need 28b (3-1/2 bytes). I can split b0 for RegA+RegB, b1 becomes RegT, Flags becomes the first half of b2, and b3 is the PC. b4 is RegIntA+RegIntB, b5 is RegIntT, the first half of b6 acts as IntFlags, and b7 is IntPC.
However, if I have to use whole bytes, it requires 80b (TEN whole bytes... geez louise!) -- one byte for each register. When I don't really need that much space, it's a little silly to take it up.
So, can I address individual nybbles at once in that 20X2 (and if so, how), or do I have to use whole bytes?
Oh -- don't know if it matters but I'm on Linux now so I'm using LinAXEpad to program the chip.
Thanks guys, I know you folks rock
I'm, er, emulating a four bit CPU with a 20X2.
It has a four bit data bus, an eight bit address bus, and four other lines -- clock, I/M, W/R, and IRQ. (I/M = IO/MEM -- L for memory operations, H for I/O ops; W/R = Write/Read -- L for read ops, H for write ops; IRQ is an active-high input.) I can post the pinout map I came up with if it really matters, but I'll leave it out for now.
A local friend of mine started designing the logic and got far enough to lay out commands and states -- which is just enough for me to figure out how to implement it. I've decided that I want to keep it as simple as possible -- the entire computer around the CPU is an SRAM chip (parallel IO, 32k*8 of which half will be used) and the buffer/latch chips needed to read switches and drive LEDs. (This is a ROMless system.) As such, the "clock" is a single-cycle circuit (each press of a button produces a single clock cycle). As the input switches will be DIPs (I want to keep it physically small, too), this will probably result in an overall system speed of less than 1Hz. Whee...
*ahem*
Here's the issue. I want to use the internal RAM to simulate the internal CPU registers. Those registers are laid out like this --
RegA = 4b
RegB = 4b
RegT = 8b (divided into RegTA and RegTB, 4b each)
Flags = 4b (divided into four 1b sections, labeled C E Z M )
PC = 8b
...and during an interrupt condition...
RegIntA = 4b
RegIntB = 4b
RegIntT = 8b (divided into RegIntTA and RegIntTB, 4b each)
IntFlags = 4b (divided into four 1b sections, labeled IC IE IZ IM )
IntPC = 8b
So, if I can address individual nybbles within the 20X2, I only need 28b (3-1/2 bytes). I can split b0 for RegA+RegB, b1 becomes RegT, Flags becomes the first half of b2, and b3 is the PC. b4 is RegIntA+RegIntB, b5 is RegIntT, the first half of b6 acts as IntFlags, and b7 is IntPC.
However, if I have to use whole bytes, it requires 80b (TEN whole bytes... geez louise!) -- one byte for each register. When I don't really need that much space, it's a little silly to take it up.
So, can I address individual nybbles at once in that 20X2 (and if so, how), or do I have to use whole bytes?
Oh -- don't know if it matters but I'm on Linux now so I'm using LinAXEpad to program the chip.
Thanks guys, I know you folks rock