> Thanks for taking the time to write that up.
My pleasure, it was a wonderful ride. I hope this info is useful in some way.
> Did you compare with the Tengen code, ala 'rosetta' style?
Yes I did. The Tengen code isn't a 1-1 translation, it does some things
in a different order, and it doesn't do most of the work at all.
It certainly helped though, esp. the timing info.
> Otherwise I don't understand how you are gleaning information on opcodes.
You take a frequent opcode, see in what patterns it is used, and go
from there. Lots of trial and error.
> And stuff like "there is a four entry stack for the PC; it’s not in RAM, it is
> separate". As I mentioned, I could see that when I traced out the
> circuit, but I don't understand how you can see that just from the ROM
> dump and with no knowledge of which cpu is used.
A big part of the work was finding and reading as much documentation
on this chip as possible. None is there that I could find, but some family
members have a bit of info hidden in various patents. Also, some newer
family members have actual datasheets available.
I think the actual chip is a Sharp SM4 (or some very old SM5).
Gleaning the PC stack from the best die photographs i could find
(
https://netfiles.uiuc.edu/mantey/www/D4 ... erview.jpg ) was easy. It is not so easy to find registers on there etc., and I cannot read
out the insn decoder PLA on that resolution/quality ;-)
> Basically, it is important for my learning process to know what
> assumptions went into creating this ... where intuition and guesses are
> separated from derivations. This is important to me. I would like to
> understand the process better, so I can understand the current state of
> knowledge better.
Find me on IRC, it is hard to explain in a forum. You can write it up if you
want to, it's not like I want to keep it a secret or something, I just don't
know where to start.
> > > How is it not Harvard?
> > It can read data from insn rom.
> > Not really; the table lookup insns use a different bank of ROM anyway.
> Since I've traced out the PC and stack myself, I don't see how a lookup
> physically is possible (unless there are complicated multi-cycle
> instructions involving the stack). It looks to me like you can only have
> data from the ROM in the sense that an "immediate" address mode
> opcode contains data in the opcode itself.
It indeed does a push to stack, then it fetches a byte (from a special bank, offset X and A), to X and A, and finally it pops PC again. That is how it is
described for different SM5 anyway.
> Scanning your opcode list, I don't see any table lookup instructions.
Yes, I have only insns that are _used_ in there, I have no way of figuring
out the rest without a much better die photograph, or some ancient docs
showing up magically. There might not _be_ a table insn on this even, I
thought there was though.
> So it still looks like Harvard architecture to me. If I'm missing
> something material here, please let me know. (If you feel I'm misusing
> terminology again, I guess it can only help to clear that up as well.)
Many opcodes have immediate operands in the opcode; that isn't "pure
Harvard". But almost nothing is, heh. It is pretty silly to want to divide
all CPU designs into these two groups; some CPUs are *very* much not like
either Harvard or Von Neumann arch!
I agree now that the CIC CPU is quite like Harvard though.
> While this line of questions may seem silly, since I approached this
> rev-engineering mostly from bottom->up from the IC circuitry itself, it is
> important to me to reconcile this information with what I have learning
> from studying the circuitry myself.
Yeah, it is great to hear (and see) how other people approach the problem,
in my experience everyone has a very different way of working.
> > "that third ROM is 768 bytes, which I don’t handle in my little conversion
> > script, so you’ll need to remove the extra columns (they are empty
> > anyway)"
> Actually, there is one byte in there that is not empty.
It's a "t 0" at offset 7f, you have that in every bank. Doesn't do anything
useful, probably an artifact of the assembler?
> I wonder if this corresponds with your 'mystery' opcode in some way.
Not as far as I can see, sorry :-(
I think the mystery 5e sets some internal flag or I/O something, btw.
Segher